script_commands.txt 319 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003
  1. //===== rAthena Documentation ================================
  2. //= rAthena Script Commands
  3. //===== By: ==================================================
  4. //= rAthena Dev Team
  5. //===== Last Updated: ========================================
  6. //= 20150610
  7. //===== Description: =========================================
  8. //= A reference manual for the rAthena scripting language.
  9. //= Commands are sorted depending on their functionality.
  10. //============================================================
  11. This document is a reference manual for all the scripting commands and functions
  12. available in rAthena. It is not a simple tutorial. When people tell you to
  13. "Read The F***ing Manual", they mean this.
  14. The information was mostly acquired through looking up how things actually work
  15. in the source code of the server, which was written by many people over time,
  16. and lots of them don't speak English and never left any notes - or are otherwise
  17. not available for comments. As such, anything written in here might not be
  18. correct, it is only correct to the best of our knowledge, which is limited.
  19. This is not a place to teach you basic programming. This document will not teach
  20. you basic programming by itself. It's more of a reference for those who have at
  21. least a vague idea of what they want to do and want to know what tools they have
  22. available to do it. We've tried to keep it as simple as feasible, but if you
  23. don't understand it, getting a clear book on programming in general will help
  24. better than yelling around the forum for help.
  25. A little learning never caused anyone's head to explode.
  26. Structure
  27. ---------
  28. The commands and functions are listed in no particular order:
  29. *Name of the command and how to call it.
  30. Descriptive text
  31. Small example if possible. Will usually be incomplete, it's there just to
  32. give you an idea of how it works in practice.
  33. To find a specific command, use Ctrl+F, (or whatever keys call up a search
  34. function in whatever you're reading this with) put an * followed by the command
  35. name, and it should find the command description for you.
  36. If you find anything omitted, please respond. :)
  37. Syntax
  38. ------
  39. Throughout this document, wherever a command wants an argument, it is given in
  40. <angle brackets>. This doesn't mean you should type the angle brackets. :) If an
  41. argument of a command is optional, it is given in {curly brackets}. You've
  42. doubtlessly seen this convention somewhere, if you didn't, get used to it,
  43. that's how big boys do it. If a command can optionally take an unspecified
  44. number of arguments, you'll see a list like this:
  45. command <argument>{,<argument>...<argument>}
  46. This still means they will want to be separated by commas.
  47. Where a command wants a string, it will be given in "quotes", if it's a number,
  48. it will be given without them. Normally, you can put an expression, like a bunch
  49. of functions or operators returning a value, in (round brackets) instead of most
  50. numbers. Round brackets will not always be required, but they're often a good
  51. idea.
  52. Wherever you refer to a map name, it's always 'map name' or 'map name.gat'
  53. (although the .gat suffix is deprecated).
  54. Script loading structure
  55. ------------------------
  56. Scripts are loaded by the map server as referenced in the 'conf/map_athena.conf'
  57. configuration file, but in the default configuration, it doesn't load any script
  58. files itself. Instead, it loads the file 'npc/scripts_main.conf' which itself
  59. contains references to other files. The actual scripts are loaded from txt
  60. files, which are linked up like this:
  61. npc: <path to a filename>
  62. Any line like this, invoked, ultimately, by 'map_athena.conf' will load up the
  63. script contained in this file, which will make the script available. No file
  64. will get loaded twice, to prevent possible errors.
  65. Another configuration file option of relevance is:
  66. delnpc: <path to a filename>
  67. This will unload a specified script filename from memory, which, while
  68. seemingly useless, may sometimes be required.
  69. Whenever '//' is encountered in a line upon reading, everything beyond this on
  70. that line is considered to be a comment and is ignored. This works wherever you
  71. place it.
  72. // This line will be ignored when processing the script.
  73. Block comments can also be used, where you can place /* and */ between any text you
  74. wish rAthena to ignore.
  75. Example:
  76. /* This text,
  77. * no matter which new line you start
  78. * is ignored, until the following
  79. * symbol is encountered: */
  80. The asterisks (*) in front of each line is a personal preference, and is not required.
  81. Upon loading all the files, the server will execute all the top-level commands
  82. in them. No variables exist yet at this point, no commands can be called other
  83. than those given in this section. These commands set up the basic server script
  84. structure - create NPC objects, spawn monster objects, set map flags, etc. No
  85. code is actually executed at this point except them. The top-level commands the
  86. scripting are pretty confusing, since they aren't structured like you would
  87. expect commands, command name first, but rather, normally start with a map name.
  88. What's more confusing about the top-level commands is that most of them use a
  89. tab symbol to divide their arguments.
  90. To prevent problems and confusion, the tab symbols are written as '%TAB%'
  91. throughout this document, even though this makes the text a bit less readable.
  92. Using an invisible symbol to denote arguments is one of the bad things about
  93. this language, but we're stuck with it for now. :)
  94. Here is a list of valid top-level commands:
  95. ** Set a map flag:
  96. <map name>%TAB%mapflag%TAB%<flag>
  97. This will, upon loading, set a specified map flag on a map you like. These are
  98. normally in files inside 'npc/mapflag' and are loaded first, so by the time the
  99. server's up, all the maps have the flags they should have. Map flags determine
  100. the behavior of the map in various situations. For more details, see 'setmapflag'
  101. and 'doc/mapflags.txt'.
  102. ** Create a permanent monster spawn:
  103. <map name>,<x>,<y>,<xs>,<ys>%TAB%monster%TAB%<monster name>%TAB%<mob id>,<amount>,<delay1>,<delay2>,<event>{,<mob size>,<mob ai>}
  104. Map name is the name of the map the monsters will spawn on. x,y are the
  105. coordinates where the mob should spawn. If xs and ys are non-zero, they
  106. specify the 'radius' of a spawn-rectangle area centered at x,y.
  107. Putting zeros instead of these coordinates will spawn the monsters randomly.
  108. Note this is only the initial spawn zone, as mobs random-walk, they are free
  109. to move away from their specified spawn region.
  110. Monster name is the name the monsters will have on screen, and has no relation
  111. whatsoever to their names anywhere else. It's the mob id that counts, which
  112. identifies monster record in 'mob_db.txt' database of monsters. If the mob name
  113. is given as "--ja--", the 'japanese name' field from the monster database is
  114. used, (which, in rAthena, actually contains an English name) if it's "--en--",
  115. it's the 'english name' from the monster database (which contains an uppercase
  116. name used to summon the monster with a GM command).
  117. Amount is the amount of monsters that will be spawned when this command is
  118. executed, it is affected by spawn rates in 'battle_athena.conf'.
  119. Delay1 and delay2 control monster respawn delays - the first one is the fixed
  120. base respawn time, and the second is random variance on top of the base time.
  121. Both values are given in milliseconds (1000 = 1 second).
  122. Note that the server also enforces a minimum respawn delay of 5 seconds.
  123. You can specify a custom level to use for the mob different from the one of
  124. the database by adjoining the level after the name with a comma. eg:
  125. "Poring,50" for a name will spawn a monster with name Poring and level 50.
  126. Event is a script event to be executed when the mob is killed. The event must
  127. be in the form "NPCName::OnEventName" to execute, and the event name label
  128. should start with "On". As with all events, if the NPC is an on-touch NPC, the
  129. player who triggers the script must be within 'trigger' range for the event to
  130. work.
  131. There are two optional fields for monster size and AI. Size can be 0 (medium),
  132. 1 (small), or 2 (big). AI can be 0 (default), 1 (attack/friendly), 2 (sphere),
  133. 3 (flora), or 4 (zanzou).
  134. Alternately, a monster spawned using 'boss_monster' instead of 'monster' is able
  135. to be detected on the map with the SC_BOSSMAPINFO status (used by Convex Mirror).
  136. ** NPC names
  137. /!\ WARNING: this applies to warps, NPCs, duplicates and shops /!\
  138. NPC names are kinda special and are formatted this way:
  139. <Display name>{::<Unique name>}
  140. All NPCs need to have a unique name that is used for identification purposes.
  141. When you have to identify a NPC by its name, you should use <Unique name>.
  142. If <Unique name> is not provided, use <Display name> instead.
  143. The client has a special feature when displaying names:
  144. if the display name contains a '#' character, it hides that part of the name.
  145. ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter'
  146. <Display name> must be at most 24 characters in length.
  147. <Unique name> must be at most 24 characters in length.
  148. ** Define a warp point
  149. <from mapname>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to mapname>,<toX>,<toY>
  150. This will define a warp NPC that will warp a player between maps, and while most
  151. arguments of that are obvious, some deserve special mention.
  152. SpanX and SpanY will make the warp sensitive to a character who didn't step
  153. directly on it, but walked into a zone which is centered on the warp from
  154. coordinates and is SpanX in each direction across the X axis and SpanY in each
  155. direction across the Y axis.
  156. Warp NPC objects also have a name, because you can use it to refer to them later
  157. with 'enablenpc'/'disablenpc'
  158. Facing of a warp object is irrelevant, it is not used in the code and all
  159. current scripts have a zero in there.
  160. ** Define an NPC object.
  161. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
  162. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
  163. This will place an NPC object on a specified map at the specified location, and
  164. is a top-level command you will use the most in your custom scripting. The NPCs
  165. are triggered by clicking on them, and/or by walking in their trigger area, if
  166. defined, see that below.
  167. Facing is a direction the NPC sprite will face in. Not all NPC sprites have
  168. different images depending on the direction you look from, so for some facing
  169. will be meaningless. Facings are counted counterclockwise in increments of 45
  170. degrees, where 0 means facing towards the top of the map. (So to turn the sprite
  171. towards the bottom of the map, you use facing 4, and to make it look southeast
  172. it's facing 5.)
  173. Sprite id is the sprite number used to display this particular NPC. For a full
  174. list of sprite id numbers see http://kalen.s79.xrea.com/npc/npce.shtml You may
  175. also use a monster's ID number instead to display a monster sprite for this NPC.
  176. It is possible to use a job sprite as well, but you must first define it as a
  177. monster sprite in 'mob_avail.txt', a full description on how to do this is not
  178. in the scope of this manual.
  179. A '-1' sprite id will make the NPC invisible (and unclickable).
  180. A '111' sprite id will make an NPC which does not have a sprite, but is still
  181. clickable, which is useful if you want to make a clickable object of the 3D
  182. terrain.
  183. TriggerX and triggerY, if given, will define an area, centered on NPC and
  184. spanning triggerX cells in every direction across X and triggerY in every
  185. direction across Y. Walking into that area will trigger the NPC. If no
  186. 'OnTouch:' special label is present in the NPC code, the execution will start
  187. from the beginning of the script, otherwise, it will start from the 'OnTouch:'
  188. label. Monsters can also trigger the NPC, though the label 'OnTouchNPC:' is
  189. used in this case.
  190. The code part is the script code that will execute whenever the NPC is
  191. triggered. It may contain commands and function calls, descriptions of which
  192. compose most of this document. It has to be in curly brackets, unlike elsewhere
  193. where we use curly brackets, these do NOT signify an optional parameter.
  194. ** Define a 'floating' NPC object.
  195. -%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>}
  196. This will define an NPC object not triggerable by normal means. This would
  197. normally mean it's pointless since it can't do anything, but there are
  198. exceptions, mostly related to running scripts at specified time, which is what
  199. these floating NPC objects are for. More on that below.
  200. ** Define a shop/cashshop/itemshop/pointshop NPC.
  201. -%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  202. <map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  203. -%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  204. <map name>,<x>,<y>,<facing>%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  205. -%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  206. <map name>,<x>,<y>,<facing>%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  207. -%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  208. <map name>,<x>,<y>,<facing>%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  209. <map name>,<x>,<y>,<facing>%TAB%marketshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>:<quantity>{,<itemid>:<price>:<quantity>...}
  210. This will define a shop NPC, which, when triggered (which can only be done by
  211. clicking) will cause a shop window to come up. No code whatsoever runs in shop
  212. NPCs and you can't change the prices otherwise than by editing the script
  213. itself. (No variables even exist at this point of scripting, so don't even
  214. bother trying to use them.)
  215. The item id is the number of item in the 'item_db.txt' database. If Price is set
  216. to -1, the 'buy price' given in the item database will be used. Otherwise, the
  217. price you gave will be used for this item, which is how you create differing
  218. prices for items in different shops.
  219. Since trunk r12264 you can alternatively use "cashshop" in place of "shop"
  220. to use the Cash Shop interface, allowing you to buy items with special points
  221. (Currently stored as account variables in global_reg #CASHPOINTS and #KAFRAPOINTS.)
  222. This type of shop will not allow you to sell items at it, you may only
  223. purchase items here. The layout used to define sale items still count, and
  224. "<price>" refers to how many points will be spent purchasing the them.
  225. Since trunk rX you can alternatively use "itemshop" or "pointshop" in place
  226. of "shop" to use the Shop interface, allowing you to buy items with a specific
  227. item or special points from a variable. 'pointshop' only supported variable types
  228. are permanent character variables, temporary character variables, permanent
  229. local account variables, or permanent global account variables. These variables
  230. must be of integer type, not string. 'discount' flag is an option, makes the price
  231. at that shop is affected by discount skill.
  232. ** Define an warp/shop/cashshop/itemshop/pointshop/NPC duplicate.
  233. warp: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
  234. shop/cashshop/itemshop/pointshop/npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  235. shop/cashshop/itemshop/pointshop/npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  236. npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  237. npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  238. This will duplicate an warp/shop/cashshop/itemshop/pointshop/NPC referred to by 'label'.
  239. Warp duplicates inherit the target location.
  240. Shop/cashshop/itemshop/pointshop duplicates inherit the item list.
  241. NPC duplicates inherit the script code.
  242. The rest (name, location, facing, sprite ID, span/trigger area)
  243. is obtained from the definition of the duplicate (not inherited).
  244. ** Define a function object
  245. function%TAB%script%TAB%<function name>%TAB%{<code>}
  246. This will define a function object, callable with the 'callfunc' command (see
  247. below). This object will load on every map server separately, so you can get at
  248. it from anywhere. It's not possible to call the code in this object by
  249. anything other than the 'callfunc' script command.
  250. The code part is the script code that will execute whenever the function is
  251. called with 'callfunc'. It has to be in curly brackets, unlike elsewhere where
  252. we use curly brackets, these do NOT signify an optional parameter.
  253. Once an object is defined which has a 'code' field to its definition, it
  254. contains script commands which can actually be triggered and executed.
  255. ~ RID? GID? ~
  256. What a RID is and why do you need to know
  257. -----------------------------------------
  258. Most scripting commands and functions will want to request data about a
  259. character, store variables referenced to that character, send stuff to the
  260. client connected to that specific character. Whenever a script is invoked by a
  261. character, it is passed a so-called RID - this is the account ID number of a
  262. character that caused the code to execute by clicking on it, walking into its
  263. OnTouch zone, or otherwise.
  264. If you are only writing common NPCs, you don't need to bother with it. However,
  265. if you use functions, if you use timers, if you use clock-based script
  266. activation, you need to be aware of all cases when a script execution can be
  267. triggered without a RID attached. This will make a lot of commands and functions
  268. unusable, since they want data from a specific character, want to send stuff to
  269. a specific client, want to store variables specific to that character, and they
  270. would not know what character to work on if there's no RID.
  271. Unless you use 'attachrid' to explicitly attach a character to the script first.
  272. Whenever we say 'invoking character', we mean 'the character who's RID is
  273. attached to the running script. The script function "playerattached" can be
  274. used to check which is the currently attached player to the script (it will
  275. return 0 if the there is no player attached or the attached player no longer
  276. is logged on to the map-server).
  277. But what about GID?
  278. -------------------
  279. GID stands for the Game ID of something, this can either be the GID obtained
  280. through mobspawn (mob control commands) or the account ID of a character.
  281. Another way would be to right click on a mob, NPC or char as GM sprited char
  282. to view the GID.
  283. See also 'getpetinfo', 'getmercinfo', 'gethominfo', and 'geteleminfo'.
  284. This is mostly used for the new version of skill and the mob control commands
  285. implemented.
  286. Item and pet scripts
  287. --------------------
  288. Each item in the item database has three special fields - Script , OnEquip_Script
  289. and OnUnequip_Script. The first is script code run every time a character equips the item,
  290. with the RID of the equipping character. Every time they unequip an item, all
  291. temporary bonuses given by the script commands are cleared, and all the scripts
  292. are executed once again to rebuild them. This also happens in several other
  293. situations (like upon login) but the full list is currently unknown.
  294. OnEquip_Script is a piece of script code run whenever the item is used by a character
  295. by double-clicking on it. OnUnequip_Script runs whenever the
  296. equipment is unequip by a character
  297. Not all script commands work properly in the item scripts. Where commands and
  298. functions are known to be meant specifically for use in item scripts, they are
  299. described as such.
  300. Every pet in the pet database has a PetScript field, which determines pet
  301. behavior. It is invoked wherever a pet of the specified type is spawned.
  302. (hatched from an egg, or loaded from the char server when a character who had
  303. that pet following them connects) This may occur in some other situations as
  304. well. Don't expect anything other than commands definitely marked as usable in
  305. pet scripts to work in there reliably.
  306. Numbers
  307. -------
  308. Beside the common decimal numbers, which are nothing special whatsoever (though
  309. do not expect to use fractions, since ALL numbers are integer in this language),
  310. the script engine also handles hexadecimal numbers, which are otherwise
  311. identical. Writing a number like '0x<hex digits>' will make it recognized as a
  312. hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try
  313. to 'mes 0x10' it will print '16'.
  314. Number values can't exceed the limits of an integer variable: Any number
  315. greater than INT_MAX (2147483647) or smaller than INT_MIN (-2147483648) will
  316. be capped to those values and will cause a warning to be reported.
  317. Variables
  318. ---------
  319. The meat of every programming language is variables - places where you store
  320. data.
  321. In the rAthena scripting language, variable names are not case sensitive.
  322. Variables are divided into and uniquely identified by the combination of:
  323. prefix - determines the scope and extent (or lifetime) of the variable
  324. name - an identifier consisting of '_' and alphanumeric characters
  325. postfix - determines the type of the variable: integer or string
  326. Scope can be:
  327. global - global to all servers
  328. local - local to the server
  329. account - attached to the account of the character identified by RID
  330. character - attached to the character identified by RID
  331. npc - attached to the NPC
  332. scope - attached to the scope of the instance
  333. Extent can be:
  334. permanent - They still exist when the server resets.
  335. temporary - They cease to exist when the server resets.
  336. Prefix: scope and extent
  337. nothing - A permanent variable attached to the character, the default variable
  338. type. They are stored by char-server in the `char_reg_num` and
  339. `char_reg_str`.
  340. "@" - A temporary variable attached to the character.
  341. SVN versions before 2094 revision and RC5 version will also treat
  342. 'l' as a temporary variable prefix, so beware of having variable
  343. names starting with 'l' if you want full backward compatibility.
  344. "$" - A global permanent variable.
  345. They are stored by map-server in database table `mapreg`.
  346. "$@" - A global temporary variable.
  347. This is important for scripts which are called with no RID
  348. attached, that is, not triggered by a specific character object.
  349. "." - A NPC variable.
  350. They exist in the NPC and disappear when the server restarts or the
  351. NPC is reloaded. Can be accessed from inside the NPC or by calling
  352. 'getvariableofnpc'. Function objects can also have .variables which
  353. are accessible from inside the function, however 'getvariableofnpc'
  354. does NOT work on function objects.
  355. ".@" - A scope variable.
  356. They are unique to the instance and scope. Each instance has its
  357. own scope that ends when the script ends. Calling a function with
  358. callsub/callfunc starts a new scope, returning from the function
  359. ends it. When a scope ends, its variables are converted to values
  360. ('return .@var;' returns a value, not a reference).
  361. "'" - An instance variable.
  362. These are used with the instancing system, and are unique to each
  363. party's instance.
  364. "#" - A permanent local account variable.
  365. They are stored by char-server in the `acc_reg_num` table and
  366. `acc_reg_str`.
  367. "##" - A permanent global account variable stored by the login server.
  368. They are stored in the `global_acc_reg_num` table and
  369. `global_acc_reg_str`.
  370. The only difference you will note from normal # variables is when
  371. you have multiple char-servers connected to the same login server.
  372. The # variables are unique to each char-server, while the ## variables
  373. are shared by all these char-servers.
  374. Postfix: integer or string
  375. nothing - integer variable, can store positive and negative numbers, but only
  376. whole numbers (so don't expect to do any fractional math)
  377. '$' - string variable, can store text
  378. Examples:
  379. name - permanent character integer variable
  380. name$ - permanent character string variable
  381. @name - temporary character integer variable
  382. @name$ - temporary character string variable
  383. $name - permanent global integer variable
  384. $name$ - permanent global string variable
  385. $@name - temporary global integer variable
  386. $@name$ - temporary global string variable
  387. .name - NPC integer variable
  388. .name$ - NPC string variable
  389. .@name - scope integer variable
  390. .@name$ - scope string variable
  391. #name - permanent local account integer variable
  392. #name$ - permanent local account string variable
  393. ##name - permanent global account integer variable
  394. ##name$ - permanent global account string variable
  395. If a variable was never set, it is considered to equal zero for integer
  396. variables or an empty string ("", nothing between the quotes) for string
  397. variables. Once you set it to that, the variable is as good as forgotten
  398. forever, and no trace remains of it even if it was stored with character or
  399. account data.
  400. Some variables are special, that is, they are already defined for you by the
  401. scripting engine. You can see the full list somewhere in 'db/const.txt', which
  402. is a file you should read, since it also allows you to replace lots of numbered
  403. arguments for many commands with easier to read text. The special variables most
  404. commonly used are all permanent character-based variables:
  405. Zeny - Amount of Zeny.
  406. Hp - Current amount of hit points.
  407. MaxHp - Maximum amount of hit points.
  408. Sp - Current spell points.
  409. MaxSp - Maximum amount of spell points.
  410. StatusPoint - Amount of status points remaining.
  411. SkillPoint - Amount of skill points remaining.
  412. BaseLevel - Character's base level.
  413. JobLevel - Character's job level.
  414. BaseExp - Amount of base experience points.
  415. JobExp - Amount of job experience points.
  416. NextBaseExp - Amount of base experience points needed to reach the next level.
  417. NextJobExp - Amount of job experience points needed to reach the next level.
  418. Weight - Amount of weight the character currently carries.
  419. MaxWeight - Maximum weight the character can carry.
  420. Sex - 0 if female, 1 if male.
  421. Class - Character's job.
  422. Upper - 0 if the character is a normal class, 1 if advanced, 2 if baby.
  423. BaseClass - The character's 1-1 'normal' job, regardless of Upper value.
  424. For example, this will return Job_Acolyte for Acolyte, Priest/Monk,
  425. High Priest/Champion, and Arch Bishop/Sura. If the character has not
  426. reached a 1-1 class, it will return Job_Novice.
  427. BaseJob - The character's 'normal' job, regardless of Upper value.
  428. For example, this will return Job_Acolyte for Acolyte,
  429. Baby Acolyte, and High Acolyte.
  430. Karma - The character's karma. Karma system is not fully functional, but
  431. this doesn't mean this doesn't work at all. Not tested.
  432. Manner - The character's manner rating. Becomes negative if the player
  433. utters words forbidden through the use of 'manner.txt' client-side
  434. file.
  435. While these behave as variables, do not always expect to just set them - it is
  436. not certain whether this will work for all of them. Whenever there is a command
  437. or a function to set something, it's usually preferable to use that instead. The
  438. notable exception is Zeny, which you can and often will address directly -
  439. setting it will make the character own this number of Zeny.
  440. If you try to set Zeny to a negative number, the script will be terminated with an error.
  441. Some source-end constants can also be accessed in scripts. This list is located in
  442. 'src/map/script.c' in the 'script_hardcoded_constants' function, which contains
  443. constants such as server defines and status options:
  444. PACKETVER, MAX_LEVEL, MAX_STORAGE, MAX_INVENTORY, MAX_CART, MAX_ZENY, MAX_PARTY,
  445. MAX_GUILD, MAX_GUILDLEVEL, MAX_GUILD_STORAGE, MAX_BG_MEMBERS, MAX_CHAT_USERS,
  446. VIP_SCRIPT, MIN_STORAGE
  447. Option_Nothing, Option_Sight, Option_Hide, Option_Cloak, Option_Falcon, Option_Riding,
  448. Option_Invisible, Option_Orcish, Option_Wedding, Option_Chasewalk, Option_Flying,
  449. Option_Xmas, Option_Transform, Option_Summer, Option_Dragon1, Option_Wug,
  450. Option_Wugrider, Option_Madogear, Option_Dragon2, Option_Dragon3, Option_Dragon4,
  451. Option_Dragon5, Option_Hanbok, Option_Oktoberfest, Option_Dragon, Option_Costume
  452. Assigning variables
  453. --------- ---------
  454. As of rAthena revision 15982, variables can be accessed and assigned values directly
  455. without the use of the built-in 'set' function. This means that variables can be
  456. accessed and modified much like other programming languages.
  457. @x = 100;
  458. @x = @y = 100;
  459. Support for modifying variable values using 'set' is still supported (and required
  460. to exist for this new method to work) so previous scripts will continue to work.
  461. When assigning values, all operator methods are supported which exist in the below
  462. 'Operators' section. For instance:
  463. @x += 100;
  464. @x -= 100;
  465. @x *= 2;
  466. @x /= 2;
  467. @x %= 5;
  468. @x >>= 2;
  469. @x <<= 2;
  470. Will all work. For more information on available operators, see the Operators section
  471. described below. All operators listed there may be placed in-front of the '=' sign
  472. when modifying variables to perform the action as required.
  473. Note:
  474. !! Currently the scripting engine does not support directly copying array variables.
  475. !! In order to copy arrays between variables the use of 'copyarray' function is still
  476. !! required.
  477. Strings
  478. -------
  479. To include symbol '"' in a string you should use prefix '\"'
  480. Arrays
  481. ------
  482. Arrays (in rAthena at least) are essentially a set of variables going under the
  483. same name. You can tell between the specific variables of an array with an
  484. 'array index', a number of a variable in that array:
  485. <variable name>[<array index>]
  486. All variable types can be used as arrays.
  487. Variables stored in this way, inside an array, are also called 'array elements'.
  488. Arrays are specifically useful for storing a set of similar data (like several
  489. item IDs for example) and then looping through it. You can address any array
  490. variable as if it was a normal variable:
  491. set @arrayofnumbers[0],1;
  492. You can also do sneaky things like using a variable (or an expression, or even a
  493. value from an another array) to get at an array value:
  494. set @x,100;
  495. set @arrayofnumbers[@x],10;
  496. This will make @arrayofnumbers[100] equal to 10.
  497. Index numbering always starts with 0 and arrays can hold over 2 billion
  498. variables. As such, the (guaranteed) allowed values for indices are in the
  499. range 0 ~ 2147483647.
  500. And array indexes probably can't be negative. Nobody tested what happens when
  501. you try to get a negatively numbered variable from an array, but it's not going
  502. to be pretty. :)
  503. Arrays can naturally store strings:
  504. @menulines$[0] is the 0th element of the @menulines$ array of strings. Notice
  505. the '$', normally denoting a string variable, before the square brackets that
  506. denotes an array index.
  507. Variable References
  508. -------------------
  509. //##TODO
  510. Operators
  511. ---------
  512. Operators are things you can do to variables and numbers. They are either the
  513. common mathematical operations or conditional operators
  514. + - will add two numbers. If you try to add two strings, the result will be a
  515. string glued together at the +. You can add a number to a string, and the
  516. result will be a string. No other math operators work with strings.
  517. - - will subtract two numbers.
  518. * - will multiply two numbers.
  519. / - will divide two numbers. Note that this is an integer division, i.e.
  520. 7/2 is not equal 3.5, it's equal 3.
  521. % - will give you the remainder of the division. 7%2 is equal to 1.
  522. There are also conditional operators. This has to do with the conditional
  523. command 'if' and they are meant to return either 1 if the condition is satisfied
  524. and 0 if it isn't. (That's what they call 'boolean' variables. 0 means 'False'.
  525. Anything except the zero is 'True' Odd as it is, -1 and -5 and anything below
  526. zero will also be True.)
  527. You can compare numbers to each other and you compare strings to each other, but
  528. you can not compare numbers to strings.
  529. == - Is true if both sides are equal. For strings, it means they are the same.
  530. >= - True if the first value is equal to, or greater than, the second value.
  531. <= - True if the first value is equal to, or less than, the second value
  532. > - True if the first value greater than the second value
  533. < - True if the first value is less than the second value
  534. != - True if the first value IS NOT equal to the second one
  535. Examples:
  536. 1==1 is True.
  537. 1<2 is True while 1>2 is False.
  538. @x>2 is True if @x is equal to 3. But it isn't true if @x is 2.
  539. Only '==' and '!=' have been tested for comparing strings. Since there's no way
  540. to code a seriously complex data structure in this language, trying to sort
  541. strings by alphabet would be pointless anyway.
  542. Comparisons can be stacked in the same condition:
  543. && - Is True if and only if BOTH sides are true.
  544. ('1==1 && 2==2' is true. '2==1 && 1==1' is false.)
  545. || - Is True if either side of this expression is True.
  546. 1==1 && 2==2 is True.
  547. 1==1 && 2==1 is False.
  548. 1==1 || 2==1 is True.
  549. Logical bitwise operators work only on numbers, and they are the following:
  550. << - Left shift.
  551. >> - Right shift.
  552. Left shift moves the binary 1(s) of a number n positions to the left,
  553. which is the same as multiplying by 2, n times.
  554. In the other hand, Right shift moves the binary 1(s) of a number n positions
  555. to the right, which is the same as dividing by 2, n times.
  556. Example:
  557. set b,2;
  558. set a, b << 3;
  559. mes a;
  560. set a, a >> 2;
  561. mes a;
  562. The first mes command would display 16, which is the same as 2 x (2 x 2 x 2) = 16.
  563. The second mes command would display 4, which is the same as 16 / 2 = 8. 8 / 2 = 4.
  564. & - And.
  565. | - Or.
  566. The bitwise operator AND (&) is used to test two values against each other,
  567. and results in setting bits which are active in both arguments. This can
  568. be used for a few things, but in rAthena this operator is usually used to
  569. create bit-masks in scripts.
  570. The bitwise operator OR (|)sets to 1 a binary position if the binary position
  571. of one of the numbers is 1. This way a variable can hold several values we can check,
  572. known as bit-mask. A variable currently can hold up to 32 bit-masks (from position 0
  573. to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks
  574. that a player can have.
  575. A bit-mask basically is (ab)using the variables bits to set various options in
  576. one variable. With the current limit if variables it is possible to store 32
  577. different options in one variable (by using the bits on position 0 to 31).
  578. Example(s):
  579. - Basic example of the & operator, bit example:
  580. 10 & 2 = 2
  581. Why? :
  582. 10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010
  583. 2 = 2^1 (2), so in bits (same size) it would be 0010
  584. The & (AND) operator sets bits which are active (1) in both arguments, so in the
  585. example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit
  586. 0010, which is 2.
  587. - Basic example of creating and using a bit-mask:
  588. set @options,2|4|16; //(note: this is the same as 2+4+16, or 22)
  589. if (@options & 1) mes "Option 1 is activated";
  590. if (@options & 2) mes "Option 2 is activated";
  591. if (@options & 4) mes "Option 3 is activated";
  592. if (@options & 8) mes "Option 4 is activated";
  593. if (@options & 16) mes "Options 5 is activated";
  594. This would return the messages about option 2, 3 and 5 being shown (since we've set
  595. the 2,4 and 16 bit to 1).
  596. ^ - Xor.
  597. The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if both
  598. numbers have the same value in the said position. On the other hand, it
  599. sets to 1 if they have different values in the said binary position.
  600. This is another way of setting and unsetting bits in bit-masks.
  601. Example:
  602. - First let's set the quests that are currently in progress:
  603. set inProgress,1|8|16; // quest 1,8 and 16 are in progress
  604. - After playing for a bit, the player starts another quest:
  605. if( inProgress&2 == 0 ){
  606. // this will set the bit for quest 2 (inProgress has that bit set to 0)
  607. set inProgress,inProgress^2;
  608. mes "Quest 2: find a newbie and be helpful to him for an hour.";
  609. close;
  610. }
  611. - After spending some time reading info on Xor's, the player finally completes quest 1:
  612. if( inProgress&1 && isComplete ){
  613. // this will unset the bit for quest 1 (inProgress has that bit set to 1)
  614. set inProgress,inProgress^1;
  615. mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
  616. close;
  617. }
  618. Unary operators with only with a single number, which follows the operator, and
  619. are following:
  620. - - Negation.
  621. The sign of the number will be reversed. If the number was positive, it will
  622. become negative and vice versa.
  623. Example:
  624. set .@myvar,10;
  625. mes "Negative 10 is "+(-.@myvar);
  626. ! - Logical Not.
  627. Reverses the boolean result of an expression. True will become false and
  628. false will become true.
  629. Example:
  630. if(!callfunc("F_dosomething"))
  631. {
  632. mes "Doing something failed.";
  633. close;
  634. }
  635. ~ - Bitwise Not.
  636. Reverses each bit in a number, also known as one's complement. Cleared bits
  637. are set, and set bits are cleared.
  638. Example:
  639. - Ensure, that quest 2 is disabled, while keeping all other active, if they are.
  640. set inProgress,inProgress&(~2); // same as set inProgress,inProgress&0xfffffffd
  641. Ternary operators take three expressions (numbers, strings or boolean), and are
  642. following:
  643. ?: - Conditional operator
  644. Very useful e.g. to replace
  645. if(Sex) mes "..."; else mes "...";
  646. clauses with simple
  647. mes "Welcome, " + (Sex?"Mr.":"Mrs.") + " " + strcharinfo(0);
  648. or to replace any other simple if-else clauses. It might be worth
  649. mentioning that ?: has low priority and has to be enclosed with
  650. parenthesis in most (if not all) cases.
  651. Labels
  652. ------
  653. Within executable script code, some lines can be labels:
  654. <label name>:
  655. Labels are points of reference in your script, which can be used to route
  656. execution with 'goto', 'menu' and 'jump_zero' commands, invoked with 'doevent'
  657. and 'donpcevent' commands and are otherwise essential. A label's name may not be
  658. longer than 22 characters. (23rd is the ':'.) There is some confusion in the
  659. source about whether it's 22, 23 or 24 all over the place, so keeping labels
  660. under 22 characters could be wise. It may only contain alphanumeric characters
  661. and underscore. In addition to labels you name yourself, there are also some
  662. special labels which the script engine will start execution from if a special
  663. event happens:
  664. OnClock<hour><minute>:
  665. OnMinute<minute>:
  666. OnHour<hour>:
  667. On<weekday><hour><minute>:
  668. OnDay<month><day>:
  669. This will execute when the server clock hits the specified date or time. Hours
  670. and minutes are given in military time. ('0105' will mean 01:05 AM). Weekdays
  671. are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01 to 31.
  672. Remember the zero. :)
  673. OnInit:
  674. OnInterIfInit:
  675. OnInterIfInitOnce:
  676. OnInit will execute every time the scripts loading is complete, including when
  677. they are reloaded with @reloadscript command. OnInterIfInit will execute when
  678. the map server connects to a char server, OnInterIfInitOnce will only execute
  679. once and will not execute if the map server reconnects to the char server later.
  680. OnAgitStart:
  681. OnAgitEnd:
  682. OnAgitInit:
  683. OnAgitStart2:
  684. OnAgitEnd2:
  685. OnAgitInit2:
  686. OnAgitStart will run whenever the server shifts into WoE mode, whether it is
  687. done with @agitstart GM command or with 'AgitStart' script command. OnAgitEnd
  688. will do likewise for the end of WoE.
  689. OnAgitInit will run when data for all castles and all guilds that hold a castle
  690. is received by map-server from the char-server after initial connect.
  691. No RID will be attached while any of the above mentioned labels are triggered, so
  692. no character or account-based variables will be accessible, until you attach a
  693. RID with 'attachrid' (see below).
  694. The above also applies to, the last three labels, the only difference is that
  695. these labels are used exclusively for WoE SE, and are called independently.
  696. OnInstanceInit:
  697. This label will be executed when an instance is created and initialized through
  698. the 'instance_create' command. It will run again if @reloadscript is used while
  699. an instance is in progress.
  700. OnTouch:
  701. This label will be executed if a trigger area is defined for the NPC object it's
  702. in. If it isn't present, the execution will start from the beginning of the NPC
  703. code. The RID of the triggering character object will be attached.
  704. OnTouch_:
  705. Similar to OnTouch, but will only run one instance. Another character is
  706. chosen once the triggering character leaves the area.
  707. OnTouchNPC:
  708. Similar to OnTouch, but will only trigger for monsters. For this case, by using
  709. 'getattachedrid' will returns GID (ID that returned when use 'monster').
  710. OnPCLoginEvent:
  711. OnPCLogoutEvent:
  712. OnPCBaseLvUpEvent:
  713. OnPCJobLvUpEvent:
  714. It's pretty obvious when these four special labels will be invoked.
  715. OnPCDieEvent:
  716. This special label triggers when a player dies. The variable 'killerrid' is
  717. set to the ID of the killer.
  718. OnPCKillEvent:
  719. This special label triggers when a player kills another player. The variable
  720. 'killedrid' is set to the ID of the player killed.
  721. OnNPCKillEvent:
  722. This special label triggers when a player kills a monster. The variable
  723. 'killedrid' is set to the Class (mob ID) of the monster killed.
  724. OnPCLoadMapEvent:
  725. This special label triggers when a player steps in a map marked with the
  726. 'loadevent' mapflag and attaches its RID. The fact that this label requires a
  727. mapflag for it to work is because, otherwise, it'd be server-wide and trigger
  728. every time a player would change maps. Imagine the server load with 1,000 players
  729. (oh the pain...)
  730. OnPCStatCalcEvent:
  731. This special label triggers when a player's stats are recalculated, such as when
  732. changing stats, equipment, or maps, as well as when logging in, leveling up, and
  733. mounting a job mount. This can be used to grant additional item bonuses to certain
  734. player groups, for instance.
  735. OnWhisperGlobal:
  736. This special label triggers when a player whispers the NPC, and will run with the
  737. player's RID attached. It can accept up to ten parameters, which will be stored
  738. into separate temporary character string variables @whispervar0$ to @whispervar9$.
  739. See 'doc/whisper_sys.txt' for further documentation.
  740. Only the special labels which are not associated with any script command are
  741. listed here. There are other kinds of labels which may be triggered in a similar
  742. manner, but they are described with their associated commands.
  743. On<label name>:
  744. These special labels are used with Mob scripts mostly, and script commands
  745. that requires you to point/link a command to a mob or another NPC, giving a label
  746. name to start from. The label name can be any of your liking, but must be
  747. started with "On".
  748. Example:
  749. monster "prontera",123,42,"Poringz0rd",2341,23,"Master::OnThisMobDeath";
  750. amatsu,13,152,4 script Master 767,{
  751. mes "Hi there";
  752. close;
  753. OnThisMobDeath:
  754. announce "Hey, "+strcharinfo(0)+" just killed a Poringz0rd!",bc_blue|bc_all;
  755. end;
  756. }
  757. Each time you kill one, that announce will appear in blue to everyone.
  758. "Global" labels
  759. There's a catch with labels and doevent. If you call a label (using doevent)
  760. and called label is in NPC that has trigger area, that label must end with
  761. "Global" to work globally (i.e. if RID is outside of the trigger area, which
  762. usually happens since otherwise there would be no point calling the label with
  763. doevent, because OnTouch would do the job). For further reference look for
  764. npc_event in npc.c.
  765. Scripting commands and functions
  766. --------------------------------
  767. The commands and functions are listed here in no particular order. There's a
  768. difference between commands and functions - commands leave no 'return value'
  769. which might be used in a conditional statement, as a command argument, or stored
  770. in a variable. Calling commands as if they were functions will sometimes work,
  771. but is not advised, as this can lead to some hard to track errors. Calling
  772. functions as if they were commands will mess up the stack, so 'return' command
  773. will not return correctly after this happens in a particular script.
  774. All commands must end with a ';'. Actually, you may expect to have multiple
  775. commands on one line if you properly terminate them with a ';', but it's better
  776. if you don't, since it is not certain just whether the scripting engine will
  777. behave nicely if you do.
  778. -------------------------
  779. From here on, we will have the commands sorted as follow:
  780. 1.- Basic commands.
  781. 2.- Information-retrieving commands.
  782. 3.- Checking commands.
  783. 4.- Player-related commands.
  784. 5.- Mob / NPC -related commands.
  785. 6.- Other commands.
  786. 7.- Instance commands.
  787. 8.- Quest Log commands.
  788. 9.- Battleground commands.
  789. 10.- Pet commands.
  790. 10.1.- The Pet AI commands.
  791. 11.- Homunculus commands.
  792. 12.- Mercenary commands.
  793. 13.- Party commands.
  794. =====================
  795. |1.- Basic commands.|
  796. =====================
  797. ---------------------------------------
  798. *mes "<string>"{,"<string>"{,...}};
  799. This command will display a box on the screen for the invoking character, if no
  800. such box is displayed already, and will print the string specified into that
  801. box. There is normally no 'close' or 'next' button on this box, unless you
  802. create one with 'close' or 'next', and while it's open the player can't do much
  803. else, so it's important to create a button later. If the string is empty, it
  804. will show up as an empty line.
  805. mes "Text that will appear in the box";
  806. Colors
  807. ------
  808. Inside the string you may put color codes, which will alter the color of the
  809. text printed after them. The color codes are all '^<R><G><B>' and contain three
  810. hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is
  811. bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.
  812. ^FF00FF is a pure magenta, but it's also a color that is considered transparent
  813. whenever the client is drawing windows on screen, so printing text in that color
  814. will have kind of a weird effect. Once you've set a text's color to something,
  815. you have to set it back to black unless you want all the rest of the text be in
  816. that color:
  817. mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";
  818. Notice that the text coloring is handled purely by the client. If you use non-
  819. English characters, the color codes might get screwed if they stick to letters
  820. with no intervening space. Separating them with spaces from the letters on
  821. either side solves the problem.
  822. Multiple Lines
  823. --------------
  824. To display multiple lines of message while only using a single 'mes' command,
  825. use the script command in the following format:
  826. mes "Line 1", "Line 2", "Line 3";
  827. This will display 3 different lines while only consuming a single line in
  828. the relevant script file.
  829. Navigation
  830. ----------
  831. For clients dated 2011-10-10aRagexe onwards, you can generate navigation links
  832. using HTML-like labels:
  833. <NAVI>Display Name<INFO>mapname,x,y,0,000,flag</INFO></NAVI>
  834. The "flag" parameter can be:
  835. 0: Do not open Navigation Window (default).
  836. 1: Open Navigation Window.
  837. The example below will make the [Tool Shop] text clickable and begin navigation
  838. to alberta (98,154) when clicked.
  839. mes "Have you checked out the <NAVI>[Tool Shop]<INFO>alberta,98,154,0,000,0</INFO></NAVI>?";
  840. URLs
  841. ----
  842. Similarly, you can create links to websites that launch in a new window:
  843. <URL>Display Name<INFO>http://www.example.com/</INFO></URL>";
  844. ---------------------------------------
  845. *next;
  846. This command will display a 'next' button in the message window for the
  847. invoking character. Clicking on it will cause the window to clear and display
  848. a new one. Used to segment NPC-talking, next is often used in combination with
  849. 'mes' and 'close'.
  850. If no window is currently on screen, one will be created, but once the invoking
  851. character clicks on it, a warning is thrown on the server console and the script
  852. will terminate.
  853. mes "[Woman]";
  854. mes "This would appear on the page";
  855. next;
  856. // This is needed since it is a new page and the top will now be blank
  857. mes "[Woman]";
  858. mes "This would appear on the 2nd page";
  859. ---------------------------------------
  860. *close;
  861. This command will create a 'close' button in the message window for the invoking
  862. character. If no window is currently on screen, the script execution will end. This is one
  863. of the ways to end a speech from an NPC. Once the button is clicked, the NPC
  864. script execution will end, and the message box will disappear.
  865. mes "[Woman]";
  866. mes "I am finished talking to you. Click the close button.";
  867. close;
  868. mes "This command will not run at all, since the script has ended.";
  869. ---------------------------------------
  870. *close2;
  871. This command will create a 'close' button in the message window for the invoking
  872. character. WARNING: If no window is currently on screen, the script execution will halt
  873. indefinitely! See 'close'. There is one important difference, though - even though
  874. the message box will have closed, the script execution will not stop, and commands after
  875. 'close2' will still run, meaning an 'end' has to be used to stop the script, unless you
  876. make it stop in some other manner.
  877. mes "[Woman]";
  878. mes "I will warp you now.";
  879. close2;
  880. warp "place",50,50;
  881. end;
  882. Don't expect things to run smoothly if you don't make your scripts 'end'.
  883. ---------------------------------------
  884. *end;
  885. This command will stop the execution for this particular script. The two
  886. versions are perfectly equivalent. It is the normal way to end a script which
  887. does not use 'mes'.
  888. if (BaseLevel<=10) goto L_Lvl10;
  889. if (BaseLevel<=20) goto L_Lvl20;
  890. if (BaseLevel<=30) goto L_Lvl30;
  891. if (BaseLevel<=40) goto L_Lvl40;
  892. if (BaseLevel<=50) goto L_Lvl50;
  893. if (BaseLevel<=60) goto L_Lvl60;
  894. if (BaseLevel<=70) goto L_Lvl70;
  895. L_Lvl10:
  896. npctalk "Look at that you are still a n00b";
  897. end;
  898. L_Lvl20:
  899. npctalk "Look at that you are getting better, but still a n00b";
  900. end;
  901. L_Lvl30:
  902. npctalk "Look at that you are getting there, you are almost 2nd profession now right???";
  903. end;
  904. L_Lvl40:
  905. npctalk "Look at that you are almost 2nd profession";
  906. end;
  907. Without the use of 'end' it would travel through the labels until the end of the
  908. script. If you were lvl 10 or less, you would see all the speech lines, the use
  909. of 'end' stops this, and ends the script.
  910. ---------------------------------------
  911. *set <variable>,<expression>{,<char_id>};
  912. *set(<variable>,<expression>{,<char id>})
  913. This command will set a variable to the value that the expression results in.
  914. Variables may either be set through this command or directly, much like any
  915. other programming language (refer to the "Assigning variables" section).
  916. This is the most basic script command and is used a lot whenever you try to do
  917. anything more advanced than just printing text into a message box.
  918. set @x,100;
  919. will make @x equal 100.
  920. set @x,1+5/8+9;
  921. will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are
  922. integer in this language) and make @x equal it.
  923. Returns the variable reference (since trunk r12870).
  924. ---------------------------------------
  925. *setd "<variable name>",<value>{,<char_id>};
  926. Works almost identically as set, except the variable name is identified as a string
  927. and can thus be constructed dynamically.
  928. This command is equivalent to:
  929. set getd("variable name"),<value>;
  930. Examples:
  931. setd ".@var$", "Poporing";
  932. mes .@var$; // Displays "Poporing".
  933. setd ".@" + .@var$ + "123$", "Poporing is cool";
  934. mes .@Poporing123$; // Displays "Poporing is cool".
  935. NOTE:
  936. 'char_id' only works for non-server variables.
  937. Player with Character ID 'char_id' must be online.
  938. ---------------------------------------
  939. *getd("<variable name>")
  940. Returns a reference to a variable, the name can be constructed dynamically.
  941. Refer to 'setd' for usage.
  942. This can also be used to set an array dynamically:
  943. setarray getd(".array[0]"), 1, 2, 3, 4, 5;
  944. Examples:
  945. set getd("$varRefence"), 1;
  946. set @i, getd("$" + "pikachu");
  947. ---------------------------------------
  948. *getvariableofnpc(<variable>,"<npc name>")
  949. Returns a reference to a NPC variable (. prefix) from the target NPC.
  950. This can only be used to get . variables.
  951. Examples:
  952. //This will return the value of .var, note that this can't be used, since the value isn't caught.
  953. getvariableofnpc(.var,"TargetNPC");
  954. //This will set the .v variable to the value of the TargetNPC's .var variable.
  955. set .v, getvariableofnpc(.var,"TargetNPC");
  956. //This will set the .var variable of TargetNPC to 1.
  957. set getvariableofnpc(.var,"TargetNPC"), 1;
  958. Note: even though function objects can have .variables,
  959. getvariableofnpc will not work on them.
  960. ---------------------------------------
  961. *getvar <variable>,<char_id>;
  962. Get variable value from the specified player. Only player/account variables
  963. are allowed to be used (temporary character variable "@", permanent
  964. character "", permanent local account "#", and permanent global account "##").
  965. ---------------------------------------
  966. *goto <label>;
  967. This command will make the script jump to a label, usually used in conjunction
  968. with other command, such as "if", but often used on its own.
  969. ...
  970. goto Label;
  971. mes "This will not be seen";
  972. Label:
  973. mes "This will be seen";
  974. Note by FlavioJS: goto's are "evil" and should be avoided if possible (ò_ó)
  975. ---------------------------------------
  976. *menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...};
  977. This command will create a selectable menu for the invoking character. Only one
  978. menu can be on screen at the same time.
  979. Depending on what the player picks from the menu, the script execution will
  980. continue from the corresponding label. (it's string-label pairs, not label-
  981. string)
  982. Options can be grouped together, separated by the character ':'.
  983. menu "A:B",L_Wrong,"C",L_Right;
  984. It also sets a special temporary character variable @menu, which contains the
  985. number of option the player picked. (Numbering of options starts at 1.)
  986. This number is consistent with empty options and grouped options.
  987. menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
  988. L_Wrong:
  989. // If they click "A" or "B" they will end up here
  990. // @menu == 1 if "A"
  991. // @menu == 2 will never happen because the option is empty
  992. // @menu == 3 if "B"
  993. L_Impossible:
  994. // Empty options are not displayed and therefore can't be selected
  995. // this label will never be reached from the menu command
  996. L_Right:
  997. // If they click "C" they will end up here
  998. // @menu == 5
  999. If a label is '-', the script execution will continue right after the menu
  1000. command if that option is selected, this can be used to save you time, and
  1001. optimize big scripts.
  1002. menu "A::B:",-,"C",L_Right;
  1003. // If they click "A" or "B" they will end up here
  1004. // @menu == 1 if "A"
  1005. // @menu == 3 if "B"
  1006. L_Right:
  1007. // If they click "C" they will end up here
  1008. // @menu == 5
  1009. Both these examples will perform the exact same task.
  1010. If you give an empty string as a menu item, the item will not display. This
  1011. can effectively be used to script dynamic menus by using empty string for
  1012. entries that should be unavailable at that time.
  1013. You can do it by using arrays, but watch carefully - this trick isn't high
  1014. wizardry, but minor magic at least. You can't expect to easily duplicate it
  1015. until you understand how it works.
  1016. Create a temporary array of strings to contain your menu items, and populate it
  1017. with the strings that should go into the menu at this execution, making sure not
  1018. to leave any gaps. Normally, you do it with a loop and an extra counter, like
  1019. this:
  1020. setarray @possiblemenuitems$[0],<list of potential menu items>;
  1021. @j = 0; // That's the menu lines counter.
  1022. // We loop through the list of possible menu items.
  1023. // @i is our loop counter.
  1024. for( @i = 0; @i < getarraysize(@possiblemenuitems$); @i++ )
  1025. {
  1026. // That 'condition' is whatever condition that determines whether
  1027. // a menu item number @i actually goes into the menu or not.
  1028. if (<condition>)
  1029. {
  1030. // We record the option into the list of options actually available.
  1031. @menulist$[@j] = @possiblemenuitems$[@i];
  1032. // We just copied the string, we do need its number for later
  1033. // though, so we record it as well.
  1034. @menureference[@j] = @i;
  1035. // Since we've just added a menu item into the list, we increment
  1036. // the menu lines counter.
  1037. @j++;
  1038. }
  1039. // We go on to the next possible menu item.
  1040. }
  1041. This will create you an array @menulist$ which contains the text of all items
  1042. that should actually go into the menu based on your condition, and an array
  1043. @menureference, which contains their numbers in the list of possible menu items.
  1044. (Remember, arrays start with 0.) There's less of them than the possible menu
  1045. items you've defined, but the menu command can handle the empty lines - only if
  1046. they are last in the list, and if it's made this way, they are. Now comes a
  1047. dirty trick:
  1048. // X is whatever the most menu items you expect to handle.
  1049. menu @menulist$[0],-,@menulist$[1],-,....@menulist$[<X>],-;
  1050. This calls up a menu of all your items. Since you didn't copy some of the
  1051. possible menu items into the list, its end is empty and so no menu items will
  1052. show up past the end. But this menu call doesn't jump anywhere, it just
  1053. continues execution right after the menu command. (And it's a good thing it
  1054. doesn't, cause you can only explicitly define labels to jump to, and how do you
  1055. know which ones to define if you don't know beforehand which options will end up
  1056. where in your menu?)
  1057. But how do you figure out which option the user picked? Enter the @menu.
  1058. @menu contains the number of option that the user selected from the list,
  1059. starting with 1 for the first option. You know now which option the user picked
  1060. and which number in your real list of possible menu items it translated to:
  1061. mes "You selected "+@possiblemenuitems$[@menureference[@menu-1]]+"!";
  1062. @menu is the number of option the user picked.
  1063. @menu-1 is the array index for the list of actually used menu items that we
  1064. made.
  1065. @menureference[@menu-1] is the number of the item in the array of possible menu
  1066. items that we've saved just for this purpose.
  1067. And @possiblemenuitems$[@menureference[@menu-1]] is the string that we used to
  1068. display the menu line the user picked. (Yes, it's a handful, but it works.)
  1069. You can set up a bunch of 'if (@menureference[@menu-1]==X) goto Y' statements to
  1070. route your execution based on the line selected and still generate a different
  1071. menu every time, which is handy when you want to, for example, make users select
  1072. items in any specific order before proceeding, or make a randomly shuffled menu.
  1073. Kafra code bundled with the standard distribution uses a similar array-based
  1074. menu technique for teleport lists, but it's much simpler and doesn't use @menu,
  1075. probably since that wasn't documented anywhere.
  1076. See also 'select', which is probably better in this particular case. Instead of
  1077. menu, you could use 'select' like this:
  1078. @dummy = select(@menulist$[0],@menulist$[1],....@menulist$[<X>]);
  1079. For the purposes of the technique described above these two statements are
  1080. perfectly equivalent.
  1081. ---------------------------------------
  1082. *select("<option>"{,"<option>",...})
  1083. *prompt("<option>"{,"<option>",...})
  1084. This function is a handy replacement for 'menu' for some specific cases where
  1085. you don't want a complex label structure - like, for example, asking simple yes-
  1086. no questions. It will return the number of menu option picked, starting with 1.
  1087. Like 'menu', it will also set the variable @menu to contain the option the user
  1088. picked.
  1089. if (select("Yes:No")==1) mes "You said yes, I know.";
  1090. And like 'menu', the selected option is consistent with grouped options
  1091. and empty options.
  1092. 'prompt' works almost the same as select, except that when a character clicks
  1093. the Cancel button, this function will return 255 instead.
  1094. ---------------------------------------
  1095. *input(<variable>{,<min>{,<max>}})
  1096. This command will make an input box pop up on the client connected to the
  1097. invoking character, to allow entering of a number or a string. This has many
  1098. uses, one example would be a guessing game, also making use of the 'rand'
  1099. function:
  1100. mes "[Woman]";
  1101. mes "Try and guess the number I am thinking of.";
  1102. mes "The number will be between 1 and 10.";
  1103. next;
  1104. .@number = rand(1,10);
  1105. input .@guess;
  1106. if (.@guess == .@number) {
  1107. mes "[Woman]";
  1108. mes "Well done, that was the number I was thinking of!";
  1109. close;
  1110. } else {
  1111. mes "[Woman]";
  1112. mes "Sorry, that wasn't the number I was thinking of.";
  1113. close;
  1114. }
  1115. If you give the input command a string variable to put the input in, it will
  1116. allow the player to enter text. Otherwise, only numbers will be allowed.
  1117. mes "[Woman]";
  1118. mes "Please say HELLO";
  1119. next;
  1120. input .@var$;
  1121. if (.@var$ == "HELLO") {
  1122. mes "[Woman]";
  1123. mes "Well done, you typed it correctly.";
  1124. close;
  1125. } else {
  1126. mes "[Woman]";
  1127. mes "Sorry, you got it wrong.";
  1128. close;
  1129. }
  1130. Normally you may not input a negative number with this command.
  1131. This is done to prevent exploits in badly written scripts, which would
  1132. let people, for example, put negative amounts of Zeny into a bank script and
  1133. receive free Zeny as a result.
  1134. Since trunk r12192 the command has two optional arguments and a return value.
  1135. The default value of 'min' and 'max' can be set with 'input_min_value' and
  1136. 'input_max_value' in script_athena.conf.
  1137. For numeric inputs the value is capped to the range [min,max]. Returns 1 if
  1138. the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
  1139. For string inputs it returns 1 if the string was longer than 'max', -1 is
  1140. shorter than 'min' and 0 otherwise.
  1141. ---------------------------------------
  1142. *callfunc "<function>"{,<argument>,...<argument>};
  1143. *callfunc("<function>"{,<argument>,...<argument>})
  1144. This command lets you call up a function NPC. A function NPC can be called from
  1145. any script on any map server. Using the 'return' command it will come back to
  1146. the place that called it.
  1147. place,50,50,6%TAB%script%TAB%Woman%TAB%115,{
  1148. mes "[Woman]"
  1149. mes "Let's see if you win...";
  1150. callfunc "funcNPC";
  1151. mes "Well done, you have won!";
  1152. close;
  1153. }
  1154. function%TAB%script%TAB%funcNPC%TAB%{
  1155. .@win = rand(2);
  1156. if (.@win == 0) return;
  1157. mes "Sorry, you lost.";
  1158. close;
  1159. }
  1160. You can pass arguments to your function - values telling it what exactly to do -
  1161. which will be available there with getarg() (see 'getarg')
  1162. Notice that returning is not mandatory, you can end execution right there.
  1163. If you want to return a real value from inside your function NPC, it is better
  1164. to write it in the function form, which will also work and will make the script
  1165. generally cleaner:
  1166. place,50,50,6%TAB%script%TAB%Man%TAB%115,{
  1167. mes "[Man]"
  1168. mes "Gimme a number!";
  1169. next;
  1170. input @number;
  1171. if (callfunc("OddFunc",@number)) mes "It's Odd!";
  1172. close;
  1173. }
  1174. function%TAB%script%TAB%OddFunc%TAB%{
  1175. if (getarg(0)%2==0) return 0;// it's even
  1176. return 1;// it's odd
  1177. }
  1178. Alternately, as of rAthena revision 15979 and 15981, user-defined functions
  1179. may be called directly without the use of the 'callfunc' script command.
  1180. function<tab>script<tab>SayHello<tab>{
  1181. mes "Hello " + getarg(0);
  1182. return 0;
  1183. }
  1184. place,50,50,6<tab>script<tab>Man<tab>115,{
  1185. mes "[Man]";
  1186. SayHello strcharinfo(0);
  1187. close;
  1188. }
  1189. Note:
  1190. !! A user-defined function must be declared /before/ a script attempts to
  1191. !! call it. That is to say, any functions should be placed above scripts or NPCs
  1192. !! (or loaded in a separate file first) before attempting to call them directly.
  1193. ---------------------------------------
  1194. *callsub <label>{,<argument>,...<argument>};
  1195. *callsub(<label>{,<argument>,...<argument>})
  1196. This command will go to a specified label within the current script (do NOT use
  1197. quotes around it) coming in as if it were a 'callfunc' call, and pass it
  1198. arguments given, if any, which can be recovered there with 'getarg'. When done
  1199. there, you should use the 'return' command to go back to the point from where
  1200. this label was called. This is used when there is a specific thing the script
  1201. will do over and over, this lets you use the same bit of code as many times as
  1202. you like, to save space and time, without creating extra NPC objects which are
  1203. needed with 'callfunc'. A label is not callable in this manner from another
  1204. script.
  1205. Example 1: callsub for checking (if checks pass, return to script)
  1206. callsub S_CheckFull, "guild_vs2",50;
  1207. switch( rand(4) ) {
  1208. case 0: warp "guild_vs2",9,50; end;
  1209. case 1: warp "guild_vs2",49,90; end;
  1210. case 2: warp "guild_vs2",90,50; end;
  1211. case 3: warp "guild_vs2",49,9; end;
  1212. }
  1213. ...
  1214. S_CheckFull:
  1215. if (getmapusers(getarg(0)) >= getarg(1)) {
  1216. mes "I'm sorry, this arena is full. Please try again later.";
  1217. close;
  1218. }
  1219. return;
  1220. Example 2: callsub used repeatedly, with different arguments
  1221. // notice how the Zeny check/delete is reused, instead of copy-pasting for every warp
  1222. switch(select("Abyss Lake:Amatsu Dungeon:Anthell:Ayothaya Dungeon:Beacon Island, Pharos") {
  1223. case 1: callsub S_DunWarp,"hu_fild05",192,207;
  1224. case 2: callsub S_DunWarp,"ama_in02",119,181;
  1225. case 3: callsub S_DunWarp,"moc_fild20",164,145;
  1226. case 4: callsub S_DunWarp,"ayo_fild02",279,150;
  1227. case 5: callsub S_DunWarp,"cmd_fild07",132,125;
  1228. // etc
  1229. }
  1230. ...
  1231. S_DunWarp:
  1232. // getarg(0) = "map name"
  1233. // getarg(1) = x
  1234. // getarg(2) = y
  1235. if (Zeny >= 100) {
  1236. Zeny -= 100;
  1237. warp getarg(0),getarg(1),getarg(2);
  1238. } else {
  1239. mes "Dungeon warp costs 100 Zeny.";
  1240. }
  1241. close;
  1242. ---------------------------------------
  1243. *getarg(<index>{,<default_value>})
  1244. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1245. call you can specify variables that will make that call different from another
  1246. one. This function will return an argument the function or subroutine was
  1247. called with, and is the normal way to get them.
  1248. This is another thing that can let you use the same code more than once.
  1249. Argument numbering starts with 0, i.e. the first argument you gave is number 0.
  1250. If no such argument was given, a zero is returned.
  1251. place,50,50,6%TAB%script%TAB%Woman1%TAB%115,{
  1252. mes "[Woman]";
  1253. mes "Let's see if you win...";
  1254. callfunc "funcNPC",2;
  1255. mes "Well done, you have won!";
  1256. close;
  1257. }
  1258. place,52,50,6%TAB%script%TAB%Woman2%TAB%115,{
  1259. mes "[Woman]";
  1260. mes "Let's see if you win...";
  1261. callfunc "funcNPC",5;
  1262. mes "Well done, you have won!";
  1263. close;
  1264. }
  1265. function%TAB%script%TAB%funcNPC%TAB%{
  1266. .@win = rand(getarg(0));
  1267. if (.@win == 0) return;
  1268. mes "Sorry, you lost.";
  1269. close;
  1270. |
  1271. "woman1" NPC object calls the funcNPC. The argument it gives in this call is
  1272. stated as 2, so when the random number is generated by the 'rand' function, it
  1273. can only be 0 or 1. Whereas "woman2" gives 5 as the argument number 0 when
  1274. calling the function, so the random number could be 0, 1, 2, 3 or 4, this makes
  1275. "woman2" less likely to say the player won.
  1276. You can pass multiple arguments in a function call:
  1277. callfunc "funcNPC",5,4,3;
  1278. getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3.
  1279. 'getarg' has an optional argument since trunk r10773 and stable r10958.
  1280. If the target argument exists, it is returned.
  1281. Otherwise, if <default_value> is present it is returned instead,
  1282. if not the script terminates immediately.
  1283. In the previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1.
  1284. ---------------------------------------
  1285. *getargcount()
  1286. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1287. call you can specify arguments. This function will return the number of arguments
  1288. provided.
  1289. Example:
  1290. callfunc "funcNPC",5,4,3;
  1291. ...
  1292. function%TAB%script%TAB%funcNPC%TAB%{
  1293. .@count = getargcount(); // 3
  1294. ...
  1295. }
  1296. ---------------------------------------
  1297. *return {<value>};
  1298. This command causes the script execution to leave previously called function
  1299. with callfunc or script with callsub and return to the location, where the call
  1300. originated from. Optionally a return value can be supplied, when the call was
  1301. done using the function form.
  1302. Using this command outside of functions or scripts referenced by callsub will
  1303. result in error and termination of the script.
  1304. callfunc "<your function>";// when nothing is returned
  1305. set <variable>,callfunc("<your function>");// when a value is being returned
  1306. ---------------------------------------
  1307. *function <function name>;
  1308. *<function name>{(<argument>,...<argument>)};
  1309. *function <function name> {
  1310. <code>
  1311. }
  1312. This works like callfunc, and is used for cleaner and faster scripting. The function
  1313. must be defined and used within a script, and works like a label with arguments.
  1314. Note that the name may only contain alphanumeric characters and underscore.
  1315. Usage:
  1316. 1. Declare the function.
  1317. function <function name>;
  1318. 2. Call the function anywhere within the script.
  1319. It can also return a value when used with parentheses.
  1320. <function name>;
  1321. 3. Define the function within the script.
  1322. <function name> {<code>}
  1323. Example:
  1324. prontera,154,189,4 script Item Seller 767,{
  1325. /* Function declaration */
  1326. function SF_Selling;
  1327. if (Zeny > 50) {
  1328. mes "Welcome!";
  1329. /* Function call */
  1330. SF_Selling;
  1331. }
  1332. else mes "You need 50z, sorry!";
  1333. close;
  1334. /* Function definition */
  1335. function SF_Selling {
  1336. mes "Would you like to buy a phracon for 50z?";
  1337. next;
  1338. if(select("Yes","No, thanks") == 1) {
  1339. Zeny -= Zeny;
  1340. getitem 1010,1;
  1341. mes "Thank you!";
  1342. }
  1343. return;
  1344. }
  1345. }
  1346. Example with parameters and return value:
  1347. prontera,150,150,0 script TestNPC 123,{
  1348. /* Function declaration */
  1349. function MyAdd;
  1350. mes "Enter two numbers.";
  1351. next;
  1352. input .@a;
  1353. input .@b;
  1354. /* Function call */
  1355. mes .@a+" + "+.@b+" = "+MyAdd(.@a,.@b);
  1356. close;
  1357. /* Function definition */
  1358. function MyAdd {
  1359. return getarg(0)+getarg(1);
  1360. }
  1361. }
  1362. ---------------------------------------
  1363. *is_function("<function name>")
  1364. This command checks whether a function exists.
  1365. It returns 1 if function is found, or 0 if it isn't.
  1366. Example:
  1367. function script try {
  1368. dothat;
  1369. }
  1370. - script test -1,{
  1371. .@try = is_function("try"); // 1
  1372. .@not = is_function("not"); // 0
  1373. }
  1374. ---------------------------------------
  1375. *if (<condition>) <statement>;
  1376. This is the basic conditional statement command, and just about the only one
  1377. available in this scripting language.
  1378. The condition can be any expression. All expressions resulting in a non-zero
  1379. value will be considered True, including negative values. All expressions
  1380. resulting in a zero are false.
  1381. If the expression results in True, the statement will be executed. If it isn't
  1382. true, nothing happens and we move on to the next line of the script.
  1383. if (1) mes "This will always print.";
  1384. if (0) mes "And this will never print.";
  1385. if (5) mes "This will also always print.";
  1386. if (-1) mes "Funny as it is, this will also print just fine.";
  1387. For more information on conditional operators see the operators section above.
  1388. Anything that is returned by a function can be used in a condition check without
  1389. bothering to store it in a specific variable:
  1390. if (strcharinfo(0)=="Daniel Jackson") mes "It is true, you are Daniel!";
  1391. More examples of using the 'if' command in the real world:
  1392. Example 1:
  1393. .@answer = 1;
  1394. input .@input;
  1395. if (.@input == .@answer)
  1396. close;
  1397. mes "Sorry, your answer is incorrect.";
  1398. close;
  1399. Example 2:
  1400. .@answer = 1;
  1401. input .@input;
  1402. if (.@input != .@answer)
  1403. mes "Sorry, your answer is incorrect.";
  1404. close;
  1405. Notice that examples 1 and 2 have the same effect.
  1406. Example 3:
  1407. @count++;
  1408. mes "[Forgetful Man]";
  1409. if (@count == 1) mes "This is the first time you have talked to me.";
  1410. if (@count == 2) mes "This is the second time you have talked to me.";
  1411. if (@count == 3) mes "This is the third time you have talked to me.";
  1412. if (@count == 4) {
  1413. mes "This is the fourth time you have talked to me.";
  1414. mes "I think I am getting amnesia, I have forgotten about you...";
  1415. @count = 0;
  1416. }
  1417. close;
  1418. Example 4:
  1419. mes "[Quest Person]";
  1420. if (countitem(512) < 1) { // 512 is the item ID for Apple, found in item_db
  1421. mes "Can you please bring me an apple?";
  1422. close;
  1423. }
  1424. mes "Oh, you brought an Apple!";
  1425. mes "I didn't want it, I just wanted to see one.";
  1426. close;
  1427. Example 5:
  1428. mes "[Person Checker]";
  1429. if ($@name$ == "") { // global variable not yet set
  1430. mes "Please tell me someones name";
  1431. next;
  1432. input $@name$;
  1433. $@name2$ = strcharinfo(0);
  1434. mes "[Person Checker]";
  1435. mes "Thank you.";
  1436. close;
  1437. }
  1438. if ($@name$ == strcharinfo(0)) { // player name matches $@name$
  1439. mes "You are the person that " +$@name2$+ " just mentioned.";
  1440. mes "Nice to meet you!";
  1441. // reset the global variables
  1442. $@name$ = "";
  1443. $@name2$ = "";
  1444. close;
  1445. }
  1446. mes "You are not the person that " +$name2$+ " mentioned.";
  1447. close;
  1448. See 'strcharinfo' for an explanation of what this function does.
  1449. Example 6: Using complex conditions.
  1450. mes "[Multiple Checks]";
  1451. if ( (@queststarted == 1) && (countitem(512) >= 5) ) {
  1452. mes "Well done, you have started the quest and brought me 5 Apples.";
  1453. @queststarted = 0;
  1454. delitem 512,5;
  1455. close;
  1456. }
  1457. mes "Please bring me 5 apples.";
  1458. @queststarted = 1;
  1459. close;
  1460. The script engine also supports nested 'if' statements:
  1461. if (<condition>)
  1462. dothis;
  1463. else
  1464. dothat;
  1465. If the condition isn't met, it'll do the action following the 'else'.
  1466. We can also group several actions depending on a condition:
  1467. if (<condition>) {
  1468. dothis1;
  1469. dothis2;
  1470. } else {
  1471. dothat1;
  1472. dothat2;
  1473. dothat3;
  1474. }
  1475. Remember that if you plan to do several actions upon the condition being false, and
  1476. you forget to use the curly braces (the { } ), the second action will be executed regardless
  1477. the output of the condition, unless of course, you stop the execution of the script if the
  1478. condition is true (that is, in the first grouping using a return; , and end; or a close; )
  1479. Also, you can have multiple conditions nested or chained, and don't worry about limits as to
  1480. how many nested if you can have, there is no spoon ;)
  1481. if (<condition 1>)
  1482. dothis;
  1483. else if (<condition 2>) {
  1484. dothat;
  1485. end;
  1486. } else
  1487. dothis;
  1488. ---------------------------------------
  1489. *jump_zero (<condition>),<label>;
  1490. This command works kinda like an 'if'+'goto' combination in one go. (See 'if').
  1491. If the condition is false (equal to zero) this command will immediately jump to
  1492. the specified label like in 'goto'. While 'if' is more generally useful, for
  1493. some cases this could be an optimization.
  1494. The main reason for this command is that other control statements, like
  1495. 'switch', 'for' or 'while', are disassembled into simple expressions together
  1496. with this command when a script is parsed.
  1497. ---------------------------------------
  1498. *switch (expression);
  1499. The switch statement is similar to a series of if statements on the same expression.
  1500. In many occasions, you may want to compare the same variable (or expression)
  1501. with many different values, and execute a different piece of code depending
  1502. on which value it equals to. This is exactly what the switch statement is for.
  1503. It is important to understand how the switch statement is executed in order
  1504. to avoid mistakes. The switch statement executes line by line (actually, statement by statement).
  1505. In the beginning, no code is executed. Only when a case statement is found
  1506. with a value that matches the value of the switch expression the case statement(s)
  1507. will to executed. The parser continues to execute the statements until the end
  1508. of the switch block, or the first time it sees a break statement. If you don't
  1509. write a break statement at the end of a case's statement list, the parser will
  1510. go on executing the statements of the following case (fall-through).
  1511. Example 1:
  1512. switch(select("Yes:No")) {
  1513. case 1:
  1514. mes "You said yes!";
  1515. break;
  1516. case 2:
  1517. mes "Aww, why?";
  1518. break;
  1519. }
  1520. close;
  1521. The example above would work like a menu and would go to the first case if
  1522. the user selects option, otherwise, would go to the second one.
  1523. Example 2:
  1524. switch(getgroupid()) {
  1525. case 1:
  1526. mes "Wow, you're super!";
  1527. break;
  1528. case 2:
  1529. mes "A helping hand!";
  1530. break;
  1531. case 3:
  1532. mes "10001010010011";
  1533. break;
  1534. case 4:
  1535. mes "Yes, milord?";
  1536. break;
  1537. default:
  1538. mes "Hello there!";
  1539. break;
  1540. }
  1541. The example above would print a message depending on the player's groupid.
  1542. If there is no statement declared for the corresponding groupid, the script
  1543. would use the 'default' statement that applies to rest of possible values,
  1544. similar to 'else' in the if-else statement.
  1545. ---------------------------------------
  1546. *while (<condition>) <statement>;
  1547. This is probably the simplest and most frequently used loop structure. The 'while'
  1548. statement can be interpreted as "while <condition> is true, perform <statement>".
  1549. It is a pretest loop, meaning the conditional expression is tested before any of the
  1550. statements in the body of the loop are performed. If the condition evaluates to
  1551. false, the statement(s) in the body of the loop is/are never executed. If the
  1552. condition evaluates to true, the statement(s) are executed, then control transfers
  1553. back to the conditional expression, which is reevaluated and the cycle continues.
  1554. Multiple statements can be grouped with { }, curly braces, just like with the 'if' statement.
  1555. Example 1:
  1556. while (switch(select("Yes:No") == 2 ))
  1557. mes "You picked no.";
  1558. close;
  1559. Example 2: multiple statements
  1560. while (switch(select("Yes:No") == 2 )) {
  1561. mes "Why did you pick no?";
  1562. mes "You should pick yes instead!";
  1563. }
  1564. close;
  1565. Example 3: counter-controlled loop
  1566. .@i = 1;
  1567. while (.@i <= 5) {
  1568. mes "This line will print 5 times.";
  1569. .@i += 1;
  1570. }
  1571. close;
  1572. Example 4: sentinel-controlled loop
  1573. mes "Input 0 to stop";
  1574. input .@num;
  1575. while (.@num != 0) {
  1576. mes "You entered " + .@num;
  1577. input .@num;
  1578. }
  1579. close;
  1580. ---------------------------------------
  1581. *for (<variable initialization>; <condition>; <variable update>) <statement>;
  1582. Another pretest looping structure is the 'for' statement. It is considered a
  1583. specialized form of the 'while' statement, and is usually associated with counter-
  1584. controlled loops. Here are the steps of the 'for' statement: the initialize
  1585. statement is executed first and only once. The condition test is performed.
  1586. When the condition evaluates to false, the rest of the for statement is skipped.
  1587. When the condition evaluates to true, the body of the loop is executed, then the
  1588. update statement is executed (this usually involves incrementing a variable).
  1589. Then the condition is reevaluated and the cycle continues.
  1590. Example 1:
  1591. for( .@i = 1; .@i <= 5; .@i++ )
  1592. mes "This line will print 5 times.";
  1593. Example 2:
  1594. mes "This will print the numbers 1 - 5.";
  1595. for( .@i = 1; .@i <= 5; .@i++ )
  1596. mes "Number: " + .@i;
  1597. ---------------------------------------
  1598. *do { <statement>; } while (<condition>);
  1599. The 'do...while' is the only post-test loop structure available in this script
  1600. language. With a post-test, the statements are executed once before the condition
  1601. is tested. When the condition is true, the statement(s) are repeated. When the
  1602. condition is false, control is transferred to the statement following the
  1603. 'do...while' loop expression.
  1604. Example 1: sentinel-controlled loop
  1605. mes "This menu will keep appearing until you pick Cancel";
  1606. do {
  1607. .@menu = select("One:Two:Three:Cancel");
  1608. } while (.@menu != 4);
  1609. Example 2: counter-controlled loop
  1610. mes "This will countdown from 10 to 1.";
  1611. .@i = 10;
  1612. do {
  1613. mes .@i;
  1614. .@i -= 1;
  1615. } while (.@i > 0);
  1616. ---------------------------------------
  1617. *freeloop({<toggle>})
  1618. Toggling this to enabled (1) allows the script instance to bypass the infinite loop
  1619. protection, allowing your script to loop as much as it may need. Disabling (0) will
  1620. warn you if an infinite loop is detected.
  1621. The command will return the state of freeloop for the attached script, even if no
  1622. argument is provided.
  1623. Example:
  1624. freeloop(1); // enable script to loop freely
  1625. // be careful with what you do here
  1626. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1627. dothis;
  1628. // will sleep the script for 1ms when detect an infinity loop to
  1629. // let rAthena do what it needs to do (socket, timer, process, etc.)
  1630. }
  1631. freeloop(0); // disable freeloop
  1632. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1633. dothis;
  1634. // throw an infinity loop error
  1635. }
  1636. ---------------------------------------
  1637. *setarray <array name>[<first value>],<value>{,<value>...<value>};
  1638. This command will allow you to quickly fill up an array in one go. Check the
  1639. Kafra scripts in the distribution to see this used a lot.
  1640. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1641. First value is the index of the first element of the array to alter. For
  1642. example:
  1643. setarray @array[0],200,200,200;
  1644. setarray @array[1],300,150;
  1645. will produce:
  1646. @array[0]=200
  1647. @array[1]=300
  1648. @array[2]=150
  1649. ---------------------------------------
  1650. *cleararray <array name>[<first value to alter>],<value>,<number of values to set>;
  1651. This command will change many array values at the same time to the same value.
  1652. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1653. // This will make all 6 values 0
  1654. cleararray @array[0],0,6;
  1655. // This will make array element 0 change to 245
  1656. cleararray @array[0],245,1;
  1657. // This will make elements 1 and 2 change to 345
  1658. cleararray @array[1],345,2;
  1659. See 'setarray'.
  1660. ---------------------------------------
  1661. *copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>;
  1662. This command lets you quickly shuffle a lot of data between arrays, which is in
  1663. some cases invaluable.
  1664. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1665. // So we have made @array[]
  1666. copyarray @array2[0],@array[2],2;
  1667. // Now, @array2[0] will be equal to @array[2] (300) and
  1668. // @array2[1] will be equal to @array[3].
  1669. So using the examples above:
  1670. @array[0] = 100
  1671. @array[1] = 200
  1672. @array[2] = 300
  1673. @array[3] = 400
  1674. @array[4] = 500
  1675. @array[5] = 600
  1676. New Array:
  1677. @array2[0] = 300
  1678. @array2[1] = 400
  1679. @array2[2] = 0
  1680. @array2[3] = 0
  1681. Notice that @array[4] and @array[5] won't be copied to the second array, and it will return a
  1682. 0.
  1683. ---------------------------------------
  1684. *deletearray <array name>[<first value>],<how much to delete>;
  1685. This command will delete a specified number of array elements totally from an
  1686. array, shifting all the elements beyond this towards the beginning.
  1687. // This will delete array element 0, and move all the other array elements
  1688. // up one place.
  1689. deletearray @array[0],1
  1690. // This would delete array elements numbered 1, 2 and 3, leave element 0 in its
  1691. // place, and move the other elements ups, so there are no gaps.
  1692. deletearray @array[1],3
  1693. ---------------------------------------
  1694. ======================================
  1695. |2.- Information-retrieving commands.|
  1696. ======================================
  1697. ---------------------------------------
  1698. *strcharinfo(<type>{,<char_id>})
  1699. This function will return either the name, party name or guild name for the
  1700. invoking character. Whatever it returns is determined by type.
  1701. 0 - Character's name.
  1702. 1 - The name of the party they're in if any.
  1703. 2 - The name of the guild they're in if any.
  1704. 3 - The name of the map the character is in.
  1705. If a character is not a member of any party or guild, an empty string will be
  1706. returned when requesting that information.
  1707. ---------------------------------------
  1708. *strnpcinfo(<type>)
  1709. This function will return the various parts of the name of the calling NPC.
  1710. Whatever it returns is determined by type.
  1711. 0 - The NPC's display name (visible#hidden)
  1712. 1 - The visible part of the NPC's display name
  1713. 2 - The hidden part of the NPC's display name
  1714. 3 - The NPC's unique name (::name)
  1715. 4 - The name of the map the NPC is in.
  1716. ---------------------------------------
  1717. *getarraysize(<array name>)
  1718. This function returns highest index of the array that is filled.
  1719. Notice that zeros and empty strings at the end of this array are not
  1720. counted towards this number.
  1721. For example:
  1722. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1723. set @arraysize,getarraysize(@array);
  1724. This will make @arraysize == 6. But if you try this:
  1725. setarray @array[0], 100, 200, 300, 400, 500, 600, 0;
  1726. set @arraysize,getarraysize(@array);
  1727. @arraysize will still equal 6, even though you've set 7 values.
  1728. ---------------------------------------
  1729. *getelementofarray(<array name>,<index>)
  1730. This command retrieves the value of the element of given array at given index.
  1731. This is equivalent to using:
  1732. <array name>[<index>]
  1733. The reason for this is, that this short form is internally converted into a call
  1734. to getelementofarray, when the script is loaded.
  1735. Also useful when passing arrays to functions or accessing another npc's arrays:
  1736. getelementofarray(getarg(0),<index>)
  1737. getelementofarray(getvariableofnpc(.var, "testNPC"),<index>)
  1738. ---------------------------------------
  1739. *readparam(<parameter number>{,"<character name>"})
  1740. This function will return the specified stat of the invoking character, or, if a
  1741. character name is specified, of that player. The stat can either be a number or
  1742. parameter name, defined in 'db/const.txt'.
  1743. Some example parameters:
  1744. StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight, MaxWeight,
  1745. JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp, Sp, MaxSp,
  1746. BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk
  1747. All of these also behave as variables, but don't expect to be able to just 'set'
  1748. them - some will not work for various internal reasons.
  1749. Example 1:
  1750. // Returns how many status points you haven't spent yet.
  1751. mes "Unused status points: "+readparam(9);
  1752. Using this particular information as a function call is not required. Typing this
  1753. will return the same result:
  1754. mes "Unused status points: "+StatusPoint;
  1755. Example 2:
  1756. You can also use this command to get stat values.
  1757. if (readparam(bVit) > 77)
  1758. mes "Only people with over 77 Vit are reading this!";
  1759. ---------------------------------------
  1760. *getcharid(<type>{,"<character name>"})
  1761. This function will return a unique ID number of the invoking character, or, if a
  1762. character name is specified, of that player.
  1763. Type is the kind of associated ID number required:
  1764. 0 - Character ID
  1765. 1 - Party ID
  1766. 2 - Guild ID
  1767. 3 - Account ID
  1768. 4 - Battle Ground ID
  1769. For most purposes other than printing it, a number is better to have than a name
  1770. (people do horrifying things to their character names).
  1771. If the character is not in a party or not in a guild, the function will return 0
  1772. if guild or party number is requested. If a name is specified and the character
  1773. is not found, 0 is returned.
  1774. If getcharid(0) returns a zero, the script got called not by a character and
  1775. doesn't have an attached RID. Note that this will cause the map server to
  1776. print "player not attached!" error messages, so it is preferred to use
  1777. "playerattached" to check for the character attached to the script.
  1778. if (getcharid(2) == 0)
  1779. mes "Only members of a guild are allowed here!";
  1780. ---------------------------------------
  1781. *getnpcid(<type>{,"<npc name>"});
  1782. Retrieves IDs of the currently invoked NPC. If a unique npc name is
  1783. given, IDs of that NPC are retrieved instead. Type specifies what ID
  1784. to retrieve and can be one of the following:
  1785. 0 - NPC Game ID
  1786. If an invalid type is given or the NPC does not exist, 0 is returned.
  1787. ---------------------------------------
  1788. *getchildid({<char_id>})
  1789. *getmotherid({<char_id>})
  1790. *getfatherid({<char_id>})
  1791. These functions return the character ID of the attached player's child,
  1792. mother, mother, or father, respectively. It returns 0 if no ID is found.
  1793. if (getmotherid()) mes "Your mother's ID is: "+getmotherid();
  1794. ---------------------------------------
  1795. *ispartneron({<char_id>})
  1796. This function returns 1 if the invoking character's marriage partner is
  1797. currently online and 0 if they are not or if the character has no partner.
  1798. ---------------------------------------
  1799. *getpartnerid({<char_id>})
  1800. This function returns the character ID of the invoking character's marriage
  1801. partner, if any. If the invoking character is not married, it will return 0,
  1802. which is a quick way to see if they are married:
  1803. if (getpartnerid()) mes "I'm not going to be your girlfriend!";
  1804. if (getpartnerid()) mes "You're married already!";
  1805. ---------------------------------------
  1806. *getlook(<type>{,<char_id>})
  1807. This function will return the number for the current character look value
  1808. specified by type. See 'setlook' for valid look types.
  1809. This can be used to make a certain script behave differently for characters
  1810. dressed in black. :)
  1811. ---------------------------------------
  1812. *getsavepoint(<information type>{,<char_id>})
  1813. This function will return information about the invoking character's save point.
  1814. You can use it to let a character swap between several recorded save points.
  1815. Available information types are:
  1816. 0 - Map name (a string)
  1817. 1 - X coordinate
  1818. 2 - Y coordinate
  1819. ---------------------------------------
  1820. *getcharip({"<character name>"|<account id>|<char id>})
  1821. This function will return the IP address of the invoking character, or, if a player
  1822. is specified, of that character. A blank string is returned if no player is attached.
  1823. Examples:
  1824. // Outputs IP address of attached player.
  1825. mes "Your IP: " + getcharip();
  1826. // Outputs IP address of character "Silver".
  1827. mes "Silver's IP: " + getcharip("Silver");
  1828. ---------------------------------------
  1829. *vip_status(<type>,{"<character name>"})
  1830. Returns various information about a player's VIP status.
  1831. Valid types:
  1832. 1 - VIP status. (1 if VIP, 0 if non-VIP)
  1833. 2 - VIP expire date. (timestamp string if VIP, 0 if non-VIP)
  1834. 3 - VIP time remaining. (timestamp string if VIP, 0 if non-VIP)
  1835. NOTE: This command is only available if the VIP System is enabled.
  1836. ---------------------------------------
  1837. *vip_time <time>,{"<character name>"};
  1838. Changes a player's VIP time (in minutes). A positive value will increase time, and a
  1839. negative value will decrease time.
  1840. NOTE: This command is only available if the VIP System is enabled.
  1841. ---------------------------------------
  1842. *addspiritball <count>,<duration>{,<char_id>};
  1843. Adds spirit ball to player for 'duration' in milisecond.
  1844. ---------------------------------------
  1845. *delspiritball <count>{,<char_id>};
  1846. Deletes the spirit ball(s) from player.
  1847. ---------------------------------------
  1848. *countspiritball {<char_id>};
  1849. Counts the spirit ball that player has.
  1850. ---------------------------------------
  1851. *ignoretimeout <flag>{,<char_id>};
  1852. Disables the SECURE_NPCTIMEOUT function on the character invoking the script,
  1853. or by the given character ID/character name.
  1854. Valid flag:
  1855. 0 - Enabled SECURE_NPCTIMEOUT.
  1856. 1 - Disable SECURE_NPCTIMEOUT.
  1857. Note: SECURE_NPCTIMEOUT must be enabled for this to work.
  1858. ---------------------------------------
  1859. \\
  1860. 2,2 Item-related commands
  1861. \\
  1862. ---------------------------------------
  1863. *getequipid(<equipment slot>{,<char_id>})
  1864. This function returns the item ID of the item equipped in the equipment slot
  1865. specified on the invoking character. If nothing is equipped there, it returns -1.
  1866. Valid equipment slots are:
  1867. EQI_HEAD_TOP (1) - Upper Headgear
  1868. EQI_ARMOR (2) - Armor (jackets, robes)
  1869. EQI_HAND_L (3) - Left hand (weapons, shields)
  1870. EQI_HAND_R (4) - Right hand (weapons)
  1871. EQI_GARMENT (5) - Garment (mufflers, hoods, manteaus)
  1872. EQI_SHOES (6) - Footgear (shoes, boots)
  1873. EQI_ACC_L (7) - Accessory 1
  1874. EQI_ACC_R (8) - Accessory 2
  1875. EQI_HEAD_MID (9) - Middle Headgear (masks, glasses)
  1876. EQI_HEAD_LOW (10) - Lower Headgear (beards, some masks)
  1877. EQI_COSTUME_HEAD_LOW (11) - Lower Costume Headgear
  1878. EQI_COSTUME_HEAD_MID (12) - Middle Costume Headgear
  1879. EQI_COSTUME_HEAD_TOP (13) - Upper Costume Headgear
  1880. EQI_COSTUME_GARMENT (14) - Costume Garment
  1881. EQI_AMMO (15) - Arrow/Ammunition
  1882. EQI_SHADOW_ARMOR (16) - Shadow Armor
  1883. EQI_SHADOW_WEAPON (17) - Shadow Weapon
  1884. EQI_SHADOW_SHIELD (18) - Shadow Shield
  1885. EQI_SHADOW_SHOES (19) - Shadow Shoes
  1886. EQI_SHADOW_ACC_R (20) - Shadow Accessory 2
  1887. EQI_SHADOW_ACC_L (21) - Shadow Accessory 1
  1888. Notice that a few items occupy several equipment slots, and if the character is
  1889. wearing such an item, 'getequipid' will return its ID number for either slot.
  1890. Can be used to check if you have something equipped, or if you haven't got
  1891. something equipped:
  1892. if(getequipid(EQI_HEAD_TOP)==2234) goto L_WearingTiara;
  1893. mes "Come back when you have a Tiara on";
  1894. close;
  1895. L_WearingTiara:
  1896. mes "What a lovely Tiara you have on";
  1897. close;
  1898. You can also use it to make sure people don't pass a point before removing an
  1899. item totally from them. Let's say you don't want people to wear Legion Plate
  1900. armor, but also don't want them to equip if after the check, you would do this:
  1901. if ((getequipid(EQI_ARMOR) == 2341) || (getequipid(EQI_ARMOR) == 2342) goto L_EquipedLegionPlate;
  1902. // the || is used as an or argument, there is 2341 and 2342 cause there are
  1903. // two different legion plate armors, one with a slot one without.
  1904. if ((countitem(2341) > 0) || (countitem(2432) > 0) goto L_InventoryLegionPlate;
  1905. mes "I will lets you pass";
  1906. close2;
  1907. warp "place",50,50;
  1908. end;
  1909. L_EquipedLegionPlate:
  1910. mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
  1911. close;
  1912. L_InventoryLegionPlate:
  1913. mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
  1914. close;
  1915. ---------------------------------------
  1916. *getequipuniqueid(<equipment slot>{,<char_id>})
  1917. This function returns the unique ID (as a string) of the item equipped in the equipment slot
  1918. specified on the invoking character. If nothing is equipped there, it returns an empty string.
  1919. See 'getequipid' for a full list of valid equipment slots.
  1920. ---------------------------------------
  1921. *getequipname(<equipment slot>{,<char_id>})
  1922. Returns the jname of the item equipped in the specified equipment slot on the
  1923. invoking character, or an empty string if nothing is equipped in that position.
  1924. Does the same thing as getitemname(getequipid()). Useful for an NPC to state
  1925. what your are wearing, or maybe saving as a string variable.
  1926. See 'getequipid' for a full list of valid equipment slots.
  1927. if( getequipname(EQI_HEAD_TOP) != "" )
  1928. mes "So you are wearing a "+getequipname(EQI_HEAD_TOP)+" on your head";
  1929. else
  1930. mes "You are not wearing any head gear";
  1931. ---------------------------------------
  1932. *getitemname(<item id>)
  1933. Given the database ID number of an item, this function will return the text
  1934. stored in the 'japanese name' field (which, in rAthena, stores an English name
  1935. the players would normally see on screen.)
  1936. ---------------------------------------
  1937. *getbrokenid(<number>{,<char_id>})
  1938. This function will search the invoking character's inventory for any broken
  1939. items, and will return their item ID numbers. Since the character may have
  1940. several broken items, 1 given as an argument will return the first one found, 2
  1941. will return the second one, etc. Will return 0 if no such item is found.
  1942. // Let's see if they have anything broken:
  1943. if (getbrokenid(1)==0) goto Skip;
  1944. // They do, so let's print the name of the first broken item:
  1945. mes "Oh, I see you have a broken "+getitemname(getbrokenid(1))+" here!";
  1946. Skip:
  1947. mes "You don't have anything broken, quit bothering me.";
  1948. ---------------------------------------
  1949. *getequipisequiped(<equipment slot>{,<char_id>})
  1950. This functions will return 1 if there is an equipment placed on the specified
  1951. equipment slot and 0 otherwise. For a list of equipment slots
  1952. see 'getequipid'. Function originally used by the refining NPCs:
  1953. if (getequipisequiped(EQI_HEAD_TOP)) goto L_equipped;
  1954. mes "[Refiner]";
  1955. mes "Do you want me to refine your dumb head?";
  1956. close;
  1957. L_equipped:
  1958. mes "[Refiner]";
  1959. mes "That's a fine hat you are wearing there...";
  1960. close;
  1961. ---------------------------------------
  1962. *getequipisenableref(<equipment slot>{,<char_id>})
  1963. Will return 1 if the item equipped on the invoking character in the specified
  1964. equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
  1965. see 'getequipid'.
  1966. if (getequipisenableref(EQI_HEAD_TOP)) goto L_Refine;
  1967. mes "[Refiner]";
  1968. mes "I can't refine this hat!...";
  1969. close;
  1970. L_Refine:
  1971. mes "[Refiner]";
  1972. mes "Ok I can refine this";
  1973. close;
  1974. ---------------------------------------
  1975. *getequiprefinerycnt(<equipment slot>{,<char_id>})
  1976. Returns the current number of pluses for the item in the specified equipment
  1977. slot. For a list of equipment slots see 'getequipid'.
  1978. Can be used to check if you have reached a maximum refine value, default for
  1979. this is +10:
  1980. if(getequiprefinerycnt(EQI_HEAD_TOP) < 10) goto L_Refine_HeadGear;
  1981. mes "Sorry, it's not possible to refine hats better than +10";
  1982. close;
  1983. L_Refine_HeadGear:
  1984. mes "I will now upgrade your "+getequipname(EQI_HEAD_TOP);
  1985. ---------------------------------------
  1986. *getequipweaponlv(<equipment slot>{,<char_id>})
  1987. This function returns the weapon level for the weapon equipped in the specified
  1988. equipment slot on the invoking character. For a list of equipment slots see
  1989. 'getequipid'.
  1990. Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons have
  1991. a weapon level. You can, however, probably, use this field for other equippable
  1992. custom items as a flag or something.
  1993. If no item is equipped in this slot, or if it doesn't have a weapon level
  1994. according to the database, 0 will be returned.
  1995. Examples:
  1996. // Right hand can only contain a weapon.
  1997. switch (getequipweaponlv(EQI_HAND_R)) {
  1998. case 1: mes "You are holding a lvl 1 weapon."; break;
  1999. case 2: mes "You are holding a lvl 2 weapon."; break;
  2000. case 3: mes "You are holding a lvl 3 weapon."; break;
  2001. case 4: mes "You are holding a lvl 4 weapon."; break;
  2002. case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
  2003. default: mes "Seems you don't have a weapon on."; break;
  2004. }
  2005. // Left hand can hold either a weapon or shield.
  2006. if (getequipid(EQI_HAND_R) == 0) {
  2007. mes "Seems you have nothing equipped here.";
  2008. close;
  2009. }
  2010. switch (getequipweaponlv(EQI_HAND_L)) {
  2011. case 0: mes "You are holding a shield, so it doesn't have a level."; break;
  2012. case 1: mes "You are holding a lvl 1 weapon."; break;
  2013. case 2: mes "You are holding a lvl 2 weapon."; break;
  2014. case 3: mes "You are holding a lvl 3 weapon."; break;
  2015. case 4: mes "You are holding a lvl 4 weapon."; break;
  2016. case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
  2017. }
  2018. ---------------------------------------
  2019. *getequippercentrefinery(<equipment slot>{,<char_id>})
  2020. This function calculates and returns the percent value chance to successfully
  2021. refine the item found in the specified equipment slot of the invoking character
  2022. by +1. There is no actual formula, the success rate for a given weapon level of
  2023. a certain refine level is found in the db/refine_db.txt file. For a list of
  2024. equipment slots see 'getequipid'.
  2025. These values can be displayed for the player to see, or used to calculate the
  2026. random change of a refine succeeding or failing and then going through with it
  2027. (which is what the official NPC refinery scripts use it for)
  2028. // This will find a random number from 0 - 99 and if that is equal to or more
  2029. // than the value recovered by this command it will go to L_Fail
  2030. if (getequippercentrefinery(EQI_HAND_L)<=rand(100)) goto L_Fail;
  2031. ---------------------------------------
  2032. *getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
  2033. This function will count all the items with the specified ID number lying on the
  2034. ground on the specified map within the x1/y1-x2/y2 square on it and return that
  2035. number.
  2036. This is the only function around where a parameter may be either a string or a
  2037. number! If it's a number, it means that only the items with that item ID number
  2038. will be counted. If it is a string, it is assumed to mean the 'english name'
  2039. field from the item database. If you give it an empty string, or something that
  2040. isn't found from the item database, it will count items number '512' (apples).
  2041. ---------------------------------------
  2042. *getequipcardcnt(<equipment slot>)
  2043. This function will return the number of cards that have been compounded onto a
  2044. specific equipped item for the invoking character. See 'getequipid' for a list
  2045. of possible equipment slots.
  2046. ---------------------------------------
  2047. *getinventorylist {<char_id>};
  2048. This command sets a bunch of arrays with a complete list of whatever the
  2049. invoking character has in their inventory, including all the data needed to
  2050. recreate these items perfectly if they are destroyed. Here's what you get:
  2051. @inventorylist_id[] - array of item ids.
  2052. @inventorylist_amount[] - their corresponding item amounts.
  2053. @inventorylist_equip[] - whether the item is equipped or not.
  2054. @inventorylist_refine[] - for how much it is refined.
  2055. @inventorylist_identify[] - whether it is identified.
  2056. @inventorylist_attribute[] - whether it is broken.
  2057. @inventorylist_card1[] - These four arrays contain card data for the items.
  2058. @inventorylist_card2[] These data slots are also used to store names
  2059. @inventorylist_card3[] inscribed on the items, so you can explicitly check
  2060. @inventorylist_card4[] if the character owns an item made by a specific
  2061. craftsman.
  2062. @inventorylist_expire[] - expire time (Unix time stamp). 0 means never expires.
  2063. @inventorylist_bound[] - whether it is bound to the character
  2064. @inventorylist_count - the number of items in these lists.
  2065. This could be handy to save/restore a character's inventory, since no other
  2066. command returns such a complete set of data, and could also be the only way to
  2067. correctly handle an NPC trader for carded and named items who could resell them
  2068. - since NPC objects cannot own items, so they have to store item data in
  2069. variables and recreate the items.
  2070. Notice that the variables this command generates are all temporary, attached to
  2071. the character, and integer.
  2072. Be sure to use @inventorylist_count to go through these arrays, and not
  2073. 'getarraysize', because the arrays are not automatically cleared between runs
  2074. of 'getinventorylist'.
  2075. ---------------------------------------
  2076. *cardscnt()
  2077. This function will return the number of cards inserted into the equipment
  2078. from which the function is called.
  2079. This function is intended for use in item scripts.
  2080. ---------------------------------------
  2081. *getrefine()
  2082. This function will return the refine count of the equipment from which the
  2083. function is called.
  2084. This function is intended for use in item scripts.
  2085. ---------------------------------------
  2086. *getnameditem(<item id>,"<name to inscribe>"|<char id>);
  2087. *getnameditem("<item name>","<name to inscribe>"|<char id>);
  2088. This function is equivalent to using 'getitem', however, it will not just give
  2089. the character an item object, but will also inscribe it with a specified
  2090. character's name. You may not inscribe items with arbitrary strings, only with
  2091. names of characters that actually exist. While this isn't said anywhere
  2092. specifically, apparently, named items may not have cards in them, slots or no -
  2093. these data slots are taken by the character ID who's name is inscribed. Only one
  2094. remains free and it's not quite clear if a card may be there.
  2095. This function will return 1 if an item was successfully created and 0 if it
  2096. wasn't for whatever reason. Like 'getitem', this function will also accept an
  2097. 'english name' from the item database as an item name and will return 0 if no
  2098. such item exists.
  2099. ---------------------------------------
  2100. *getitemslots(<item ID>)
  2101. This function will look up the item with the specified ID number in the database
  2102. and return the number of slots this kind of items has - 0 if they are not
  2103. slotted. It will also be 0 for all non-equippable items, naturally, unless
  2104. someone messed up the item database. It will return -1 if there is no such item.
  2105. Example:
  2106. //.@slots now has the amount of slots of the item with ID 1205.
  2107. .@slots = getitemslots(1205);
  2108. ---------------------------------------
  2109. *getiteminfo(<item ID>,<type>)
  2110. This function will look up the item with the specified ID number in the database
  2111. and return the info set by TYPE argument.
  2112. It will return -1 if there is no such item.
  2113. Valid types are:
  2114. 0 - Buy Price
  2115. 1 - Sell Price
  2116. 2 - Type
  2117. 3 - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
  2118. if = 0, then monsters don't drop it at all (rare or a quest item)
  2119. if = 10000, then this item is sold in NPC shops only
  2120. 4 - Gender
  2121. 5 - Loc
  2122. 6 - Weight
  2123. 7 - ATK
  2124. 8 - DEF
  2125. 9 - Range
  2126. 10 - Slot
  2127. 11 - View
  2128. 12 - eLV
  2129. 13 - wLV
  2130. 14 - SpriteID from 'db/item_avail.txt'
  2131. 15 - eLVMax
  2132. 16 - matk if RENEWAL is defined
  2133. See the sample in 'doc/sample/getiteminfo.txt'.
  2134. ---------------------------------------
  2135. *getequipcardid(<equipment slot>,<card slot>)
  2136. Returns value from equipped item slot in the indicated slot (0, 1, 2, or 3).
  2137. This function returns CARD ID, 255,254,-255 (for card 0, if the item is produced).
  2138. It's useful for when you want to check whether an item contains cards or if it's signed.
  2139. ---------------------------------------
  2140. *mergeitem({,<char_id>});
  2141. Open merge item window to merge available item can be merged.
  2142. Examples
  2143. 1. See the NPC 'npc/re/other/merge_item.txt'.
  2144. 2. Simple usage:
  2145. mes "Let's check if any item can be merged.";
  2146. close2;
  2147. mergeitem;
  2148. end;
  2149. ---------------------------------------
  2150. *mergeitem2({<item_id>{,<char_id>}});
  2151. *mergeitem2({"<item name>"{,<char_id>}});
  2152. Merge all stackable items that separated by GUID flags
  2153. (either by flag 4 item_flag.txt or GUID in item_group).
  2154. If no item ID/name given, all possible items in player's inventory will be merged.
  2155. ---------------------------------------
  2156. //
  2157. 2,1.- End of item-related commands.
  2158. //
  2159. ---------------------------------------
  2160. *getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})
  2161. This function will locate a character object, NPC object or pet's coordinates
  2162. and place their coordinates into the variables specified when calling it. It
  2163. will return 0 if the search was successful, and -1 if the parameters given were
  2164. not variables or the search was not successful.
  2165. Type is the type of object to search for:
  2166. 0 - Character object
  2167. 1 - NPC object
  2168. 2 - Pet object
  2169. 3 - Monster object -- See 'getunitdata' for monster.
  2170. 4 - Homunculus object
  2171. 5 - Mercenary object
  2172. 6 - Elemental object
  2173. While 3 is meant to look for a monster object, no searching will be done if you
  2174. specify type 3, and the function will always return -1.
  2175. The search string is optional. If it is not specified, the location of the
  2176. invoking character will always be returned for types 0 and 2, the location of
  2177. the NPC running this function for type 1.
  2178. If a search string is specified, for types 0 and 1, the character or NPC with
  2179. the specified name will be located. If type is 3, the search will locate the
  2180. current pet of the character who's name is given in the search string, it will
  2181. NOT locate a pet by name.
  2182. Example:
  2183. prontera,164,301,3%TAB%script%TAB%Meh%TAB%730,{
  2184. mes "My name is Meh. I'm here so that Nyah can find me.";
  2185. close;
  2186. }
  2187. prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
  2188. mes "My name is Nyah.";
  2189. mes "I will now search for Meh all across the world!";
  2190. if (getmapxy(@mapname$,@mapx,@mapy,1,"Meh")!=0) {
  2191. mes "I can't seem to find Meh anywhere!";
  2192. close;
  2193. }
  2194. mes "And I found him on map "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !";
  2195. close;
  2196. }
  2197. Notice that NPC objects disabled with 'disablenpc' will still be located.
  2198. ---------------------------------------
  2199. *mapid2name(<map ID>)
  2200. Returns the map name of the given map ID. Returns an empty string if given
  2201. map ID doesn't exist.
  2202. ---------------------------------------
  2203. *getgmlevel({<char_id>})
  2204. This function will return the (GM) level associated with the player group to which
  2205. the invoking character belongs. If this is somehow executed from a console command,
  2206. 99 will be returned, and 0 will be returned if the account has no GM level.
  2207. This allows you to make NPC's only accessible for certain GM levels, or behave
  2208. specially when talked to by GMs.
  2209. if (getgmlevel()) mes "What is your command, your godhood?";
  2210. ---------------------------------------
  2211. *getgroupid({<char_id>})
  2212. This function will return the group id to which the invoking player belongs.
  2213. ---------------------------------------
  2214. *gettimetick(<tick type>)
  2215. This function will return a tick depending on <tick type>:
  2216. 0: The server's tick, a measurement in milliseconds used by the server's timer
  2217. system. This tick is an unsigned int which loops every ~50 days.
  2218. 1: The time, in seconds, since the start of the current day.
  2219. 2: The system time in UNIX epoch time, or the number of seconds elapsed since
  2220. January 1st, 1970. Useful for reliably measuring time intervals.
  2221. ---------------------------------------
  2222. *gettime(<type>)
  2223. This function will return specified information about the current system time.
  2224. 1 - Seconds (of a minute)
  2225. 2 - Minutes (of an hour)
  2226. 3 - Hour (of a day)
  2227. 4 - Week day (0 for Sunday, 6 is Saturday)
  2228. 5 - Day of the month.
  2229. 6 - Number of the month.
  2230. 7 - Year.
  2231. 8 - Day of the year.
  2232. It will only return numbers.
  2233. if (gettime(4)==6) mes "It's a Saturday. I don't work on Saturdays.";
  2234. ---------------------------------------
  2235. *gettimestr(<format string>,<max length>)
  2236. This function will return a string containing time data as specified by the
  2237. format string.
  2238. This uses the C function 'strfmtime', which obeys special format characters. For
  2239. a full description see, for example, the description of 'strfmtime' at
  2240. http://www.delorie.com/gnu/docs/glibc/libc_437.html
  2241. All the format characters given in there should properly work.
  2242. Max length is the maximum length of a time string to generate.
  2243. The example given in rAthena sample scripts works like this:
  2244. mes gettimestr("%Y-%m/%d %H:%M:%S",21);
  2245. This will print a full date and time like 'YYYY-MM/DD HH:MM:SS'.
  2246. ---------------------------------------
  2247. *getusers(<type>)
  2248. This function will return a number of users on a map or the whole server. What
  2249. it returns is specified by Type.
  2250. Type can be one of the following values, which control what will be returned:
  2251. 0 - Count of all characters on the map of the invoking character.
  2252. 1 - Count of all characters in the entire server.
  2253. 8 - Count of all characters on the map of the NPC the script is
  2254. running in.
  2255. ---------------------------------------
  2256. *getmapusers("<map name>")
  2257. This function will return the number of users currently located on the specified
  2258. map.
  2259. This is used officially in PVP scripts to check whether a room is filled to capacity.
  2260. ---------------------------------------
  2261. *getareausers("<map name>",<x1>,<y1>,<x2>,<y2>)
  2262. This function will return the count of connected characters which are located
  2263. within the specified area - an x1/y1-x2/y2 square on the specified map.
  2264. This is useful for maps that are split into many buildings, such as all the
  2265. "*_in" maps, due to all the shops and houses.
  2266. ---------------------------------------
  2267. \\
  2268. 2,2.- Guild-related commands
  2269. \\
  2270. ---------------------------------------
  2271. *getguildname(<guild id>)
  2272. This function returns a guild's name given an ID number. If there is no such
  2273. guild, "null" will be returned.
  2274. Example:
  2275. mes "The guild "+getguildname(10007)+" are all nice people.";
  2276. ---------------------------------------
  2277. *getguildmember <guild id>{,<type>{,<array_variable>}};
  2278. This command will find all members of a specified guild and returns their names
  2279. (or character id or account id depending on the value of "type") into an array
  2280. of temporary global variables.
  2281. Upon executing this,
  2282. $@guildmembername$[] is a global temporary string array which contains all the
  2283. names of these guild members.
  2284. (only set when type is 0 or not specified)
  2285. $@guildmembercid[] is a global temporary number array which contains the
  2286. character id of these guild members.
  2287. (only set when type is 1)
  2288. $@guildmemberaid[] is a global temporary number array which contains the
  2289. account id of these guild members.
  2290. (only set when type is 2)
  2291. $@guildmembercount is the number of guild members that were found.
  2292. The guild members will be found regardless of whether they are online or offline.
  2293. Note that the names come in no particular order.
  2294. Be sure to use $@guildmembercount to go through this array, and not
  2295. 'getarraysize', because it is not cleared between runs of 'getguildmember'.
  2296. If 'array_variable' is set, the result will be stored to that variable instead
  2297. using global variable.
  2298. For usage examples, see 'getpartymember'.
  2299. ---------------------------------------
  2300. *getguildmaster(<guild id>)
  2301. This function return the name of the master of the guild which has the specified
  2302. ID number. If there is no such guild, "null" will be returned.
  2303. Example 1:
  2304. // Prints the guild master of guild 10007, whoever that might be.
  2305. mes getguildmaster(10007)+" runs "+getguildname(10007);
  2306. Example 2:
  2307. // Checks if the character is the guild master of the specified guild.
  2308. .@GID = getcharid(2);
  2309. if (.@GID == 0) {
  2310. mes "Sorry, you are not in a guild.";
  2311. close;
  2312. }
  2313. if (strcharinfo(0) != getguildmaster(.@GID)) {
  2314. mes "Sorry, you don't own the guild you are in.";
  2315. close;
  2316. }
  2317. mes "Welcome, guild master of "+getguildname(.@GID);
  2318. close;
  2319. ---------------------------------------
  2320. *getguildmasterid(<guild id>)
  2321. This function will return the character ID number of the guild master of the
  2322. guild specified by the ID. 0 if the character is not a guild master of any guild.
  2323. ---------------------------------------
  2324. *getcastlename("<map name>")
  2325. This function returns the name of the castle when given the map name for that
  2326. castle. The data is read from 'db/castle_db.txt'.
  2327. ---------------------------------------
  2328. *getcastledata("<map name>",<type of data>)
  2329. *setcastledata "<map name>",<type of data>,<value>;
  2330. This function returns the castle ownership information for the castle referred
  2331. to by its map name. Castle information is stored in `guild_castle` SQL table.
  2332. Types of data correspond to `guild_castle` table columns:
  2333. 1 - `guild_id` - Guild ID.
  2334. 2 - `economy` - Castle Economy score.
  2335. 3 - `defense` - Castle Defense score.
  2336. 4 - `triggerE` - Number of times the economy was invested in today.
  2337. 5 - `triggerD` - Number of times the defense was invested in today.
  2338. 6 - `nextTime` - unused
  2339. 7 - `payTime` - unused
  2340. 8 - `createTime` - unused
  2341. 9 - `visibleC` - Is 1 if a Kafra was hired for this castle, 0 otherwise.
  2342. 10 - `visibleG0` - Is 1 if the 1st guardian is present (Soldier Guardian)
  2343. 11 - `visibleG1` - Is 1 if the 2nd guardian is present (Soldier Guardian)
  2344. 12 - `visibleG2` - Is 1 if the 3rd guardian is present (Soldier Guardian)
  2345. 13 - `visibleG3` - Is 1 if the 4th guardian is present (Archer Guardian)
  2346. 14 - `visibleG4` - Is 1 if the 5th guardian is present (Archer Guardian)
  2347. 15 - `visibleG5` - Is 1 if the 6th guardian is present (Knight Guardian)
  2348. 16 - `visibleG6` - Is 1 if the 7th guardian is present (Knight Guardian)
  2349. 17 - `visibleG7` - Is 1 if the 8th guardian is present (Knight Guardian)
  2350. All types of data have their meaning determined by War of Emperium scripts,
  2351. with exception of:
  2352. - `guild_id` that is always considered ID of the guild that owns the castle,
  2353. - `defense` that is used in Guardians & Emperium HP calculations,
  2354. - `visibleG` that is always considered to hold guardian presence bits.
  2355. The 'setcastledata' command will behave identically, but instead of returning
  2356. values for the specified types of accessible data, it will alter them and cause
  2357. them to be sent to the char-server for storage.
  2358. Changing Guild ID or Castle Defense will trigger additional actions, like
  2359. recalculating guardians' HP.
  2360. ---------------------------------------
  2361. *getgdskilllv(<guild id>,<skill id>)
  2362. *getgdskilllv(<guild id>,"<skill name>")
  2363. This function returns the level of the skill <skill id> of the guild <guild id>.
  2364. If the guild does not have that skill, 0 is returned.
  2365. If the guild does not exist, -1 is returned.
  2366. Refer to 'db/(pre-)re/skill_db.txt' for the full list of skills. (GD_* are guild skills)
  2367. ---------------------------------------
  2368. *requestguildinfo <guild id>{,"<event label>"};
  2369. This command requests the guild data from the char server and merrily continues
  2370. with the execution. Whenever the guild information becomes available (which
  2371. happens instantly if the guild information is already in memory, or later, if it
  2372. isn't and the map server has to wait for the char server to reply) it will run
  2373. the specified event as in a 'doevent' call.
  2374. ---------------------------------------
  2375. *getmapguildusers("<map name>",<guild id>)
  2376. Returns the amount of characters from the specified guild on the given map.
  2377. Example:
  2378. mes "You have "+getMapGuildUsers("prontera",getcharid(2))+" guild members in Prontera.";
  2379. ---------------------------------------
  2380. //
  2381. 2,2.- End of guild-related commands
  2382. //
  2383. ---------------------------------------
  2384. *getskilllv(<skill id>)
  2385. *getskilllv("<skill name>")
  2386. This function returns the level of the specified skill that the invoking
  2387. character has. If they don't have the skill, 0 will be returned. The full list
  2388. of character skills is available in 'db/(pre-)re/skill_db.txt'.
  2389. There are two main uses for this function, it can check whether the character
  2390. has a skill or not, and it can tell you if the level is high enough.
  2391. Example 1:
  2392. if (getskilllv(152)) goto L_HasSkillThrowStone;
  2393. mes "You don't have Throw Stone";
  2394. close;
  2395. L_HasSkillThrowStone:
  2396. mes "You have got the skill Throw Stone";
  2397. close;
  2398. Example 2:
  2399. if (getskilllv(28) >= 5) goto L_HasSkillHeallvl5orMore;
  2400. if (getskilllv(28) == 10) goto L_HasSkillHealMaxed;
  2401. mes "You heal skill is below lvl 5";
  2402. close;
  2403. L_HasSkillHeallvl6orMore:
  2404. mes "Your heal lvl is 5 or more";
  2405. close;
  2406. L_HasSkillHealMaxed:
  2407. mes "Your heal lvl has been maxed";
  2408. close;
  2409. ---------------------------------------
  2410. *getskilllist({<char_id>});
  2411. This command sets a bunch of arrays with a complete list of skills the
  2412. invoking character has. Here's what you get:
  2413. @skilllist_id[] - skill ids.
  2414. @skilllist_lv[] - skill levels.
  2415. @skilllist_flag[] - see 'skill' for the meaning of skill flags.
  2416. @skilllist_count - number of skills in the above arrays.
  2417. While 'getskillv' is probably more useful for most situations, this is the
  2418. easiest way to store all the skills and make the character something else for a
  2419. while. Advanced job for a day? :) This could also be useful to see how many
  2420. skills a character has.
  2421. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2422. ---------------------------------------
  2423. *getmonsterinfo(<mob ID>,<type>)
  2424. This function will look up the monster with the specified ID number in the
  2425. mob database and return the info set by TYPE argument.
  2426. It will return -1 if there is no such monster (or the type value is invalid),
  2427. or "null" if you requested the monster's name.
  2428. Valid types are listed in 'db/const.txt':
  2429. MOB_NAME 0
  2430. MOB_LV 1
  2431. MOB_MAXHP 2
  2432. MOB_BASEEXP 3
  2433. MOB_JOBEXP 4
  2434. MOB_ATK1 5
  2435. MOB_ATK2 6
  2436. MOB_DEF 7
  2437. MOB_MDEF 8
  2438. MOB_STR 9
  2439. MOB_AGI 10
  2440. MOB_VIT 11
  2441. MOB_INT 12
  2442. MOB_DEX 13
  2443. MOB_LUK 14
  2444. MOB_RANGE 15
  2445. MOB_RANGE2 16
  2446. MOB_RANGE3 17
  2447. MOB_SIZE 18
  2448. MOB_RACE 19
  2449. MOB_ELEMENT 20
  2450. MOB_MODE 21
  2451. MOB_MVPEXP 22
  2452. Note: MOB_ELEMENT doesn't return the element level, only the element ID.
  2453. For more details, see the sample in 'doc/sample/getmonsterinfo.txt'.
  2454. ---------------------------------------
  2455. *getmobdrops(<mob id>)
  2456. This command will find all drops of the specified mob and return the item IDs
  2457. and drop percentages into arrays of temporary global variables.
  2458. 'getmobdrops' returns 1 if successful and 0 if the mob ID doesn't exist.
  2459. Upon executing this,
  2460. $@MobDrop_item[] is a global temporary number array which contains the
  2461. item IDs of the monster's drops.
  2462. $@MobDrop_rate[] is a global temporary number array which contains the
  2463. drop percentages of each item. (1 = .01%)
  2464. $@MobDrop_count is the number of item drops found.
  2465. Be sure to use $@MobDrop_count to go through the arrays, and not
  2466. 'getarraysize', because the temporary global arrays are not cleared between
  2467. runs of 'getmobdrops'. If a mob with 7 item drops is looked up, the arrays would
  2468. have 7 elements. But if another mob is looked up and it only has 5 item drops,
  2469. the server will not clear the arrays for you, overwriting the values instead. So
  2470. in addition to returning the 5 item drops, the 6th and 7th elements from the
  2471. last call remain, and you will get 5+2 item drops, of which the last 2 don't
  2472. belong to the new mob. $@MobDrop_count will always contain the correct number
  2473. (5), unlike 'getarraysize()' which would return 7 in this case.
  2474. Example:
  2475. // get a Mob ID from the user
  2476. input .@mob_id;
  2477. if (getmobdrops(.@mob_id)) { // 'getmobdrops' returns 1 on success
  2478. // immediately copy global temporary variables into scope variables,
  2479. // since we don't know when 'getmobdrops' will get called again for
  2480. // another mob, overwriting your global temporary variables
  2481. .@count = $@MobDrop_count;
  2482. copyarray .@item[0],$@MobDrop_item[0],.@count;
  2483. copyarray .@rate[0],$@MobDrop_rate[0],.@count;
  2484. mes getmonsterinfo(.@mob_id,MOB_NAME) + " - " + .@count + " drops found:";
  2485. for( .@i = 0; .@i < .@count; .@i++ ) {
  2486. mes .@item[.@i] + " (" + getitemname(.@item[.@i]) + ") " + .@rate[.@i]/100 + ((.@rate[.@i]%100 < 10) ? ".0":".") + .@rate[.@i]%100 + "%";
  2487. }
  2488. } else {
  2489. mes "Unknown monster ID.";
  2490. }
  2491. close;
  2492. ---------------------------------------
  2493. *skillpointcount({<char_id>})
  2494. Returns the total amount of skill points a character possesses (SkillPoint+SP's used in skills)
  2495. This command can be used to check the currently attached characters total amount of skill points.
  2496. This means the skill points used in skill are counted, and added to SkillPoints (number of skill points not used).
  2497. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2498. Example 1:
  2499. .@skillPoints = skillpointcount();
  2500. mes "You have " + .@skillPoints + " skill points in total!";
  2501. Example 2:
  2502. if (skillpointcount() > 20)
  2503. mes "Wow, you have more then 20 Skill Points in total!";
  2504. ---------------------------------------
  2505. *getscrate(<effect type>,<base rate>{,<GID>})
  2506. This function will return the chance of a status effect affecting the invoking
  2507. character, in percent, modified by the their current defense against said
  2508. status. The 'base rate' is the base chance of the status effect being inflicted,
  2509. in percent.
  2510. if (rand(100) > getscrate(Eff_Blind, 50)) goto BlindHimNow;
  2511. You can see the full list of available effect types you can possibly inflict in
  2512. 'db/const.txt' under 'Eff_'.
  2513. ---------------------------------------
  2514. ========================
  2515. |3.- Checking commands.|
  2516. ========================
  2517. -------------------------
  2518. *playerattached()
  2519. Returns the ID of the player currently attached to the script. It will return
  2520. 0 if no one is attached, or if the attached player no longer exists on the map
  2521. server. It is wise to check for the attached player in script functions that
  2522. deal with timers as there's no guarantee the player will still be logged on
  2523. when the timer triggers. Note that the ID of a player is actually their
  2524. account ID.
  2525. ---------------------------------------
  2526. *getattachedrid();
  2527. Returns RID from running script. Script may not be attached to any RID like
  2528. a floating script or function and will return 0.
  2529. ---------------------------------------
  2530. *isloggedin(<account id>{,<char id>})
  2531. This function returns 1 if the specified account is logged in and 0 if they
  2532. aren't. You can also pass the char id to check for both account and char id.
  2533. ---------------------------------------
  2534. *checkweight(<item id>,<amount>{,<item id>,<amount>,<item id>,<amount>,...});
  2535. *checkweight("<item name>",<amount>{,"<item name>",<amount>,"<item name>",<amount>,...});
  2536. *checkweight2(<id_array>,<amount_array>);
  2537. These functions will compute and return 1 if the total weight of the specified
  2538. number of specific items does not exceed the invoking character's carrying
  2539. capacity, and 0 otherwise. It is important to see if a player can carry the
  2540. items you expect to give them, failing to do that may open your script up to
  2541. abuse or create some very unfair errors.
  2542. The second function will check an array of items and amounts, and also
  2543. returns 1 on success and 0 on failure.
  2544. The functions, in addition to checking to see if the player is capable of
  2545. holding a set amount of items, also ensure the player has room in their
  2546. inventory for the item(s) they will be receiving.
  2547. Like 'getitem', this function will also accept an 'english name' from the
  2548. database as an argument.
  2549. Example 1:
  2550. if (checkweight(512,10)) {
  2551. getitem 512,10;
  2552. } else {
  2553. mes "Sorry, you cannot hold this amount of apples!";
  2554. }
  2555. Example 2:
  2556. setarray .@item[0],512,513,514;
  2557. setarray .@amount[0],10,5,5;
  2558. if (!checkweight(.@item,.@amount)) {
  2559. mes "Sorry, you cannot hold this amount of fruit!";
  2560. }
  2561. ---------------------------------------
  2562. *basicskillcheck()
  2563. This function will return the state of the configuration option
  2564. 'basic_skill_check' in 'battle_athena.conf'. It returns 1 if the option is
  2565. enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which
  2566. it is by default, characters must have a certain number of basic skill levels to
  2567. sit, request a trade, use emotions, etc. Making your script behave differently
  2568. depending on whether the characters must actually have the skill to do all these
  2569. things might in some cases be required.
  2570. ---------------------------------------
  2571. *checkoption(<option number>{,<char_id>})
  2572. *checkoption1(<option number>{,<char_id>})
  2573. *checkoption2(<option number>{,<char_id>})
  2574. *setoption <option number>{,<flag>{,<char_id>}};
  2575. The 'setoption' series of functions check for a so-called option that is set on
  2576. the invoking character. 'Options' are used to store status conditions and a lot
  2577. of other non-permanent character data of the yes-no kind. For most common cases,
  2578. it is better to use 'checkcart','checkfalcon','checkriding' and other similar
  2579. functions, but there are some options which you cannot get at this way. They
  2580. return 1 if the option is set and 0 if the option is not set.
  2581. Option numbers valid for the first (option) version of this command are:
  2582. 0x1 - Sight in effect.
  2583. 0x2 - Hide in effect.
  2584. 0x4 - Cloaking in effect.
  2585. 0x8 - Cart number 1 present.
  2586. 0x10 - Falcon present.
  2587. 0x20 - Peco Peco present.
  2588. 0x40 - GM Perfect Hide in effect.
  2589. 0x80 - Cart number 2 present.
  2590. 0x100 - Cart number 3 present.
  2591. 0x200 - Cart number 4 present.
  2592. 0x400 - Cart number 5 present.
  2593. 0x800 - Orc head present.
  2594. 0x1000 - The character is wearing a wedding sprite.
  2595. 0x2000 - Ruwach is in effect.
  2596. 0x4000 - Chasewalk in effect.
  2597. 0x8000 - Flying or Xmas suit.
  2598. 0x10000 - Sighttrasher.
  2599. 0x100000 - Warg present.
  2600. 0x200000 - The character is riding a warg.
  2601. Option numbers valid for the second version (opt1) of this command are:
  2602. 1 - Petrified.
  2603. 2 - Frozen.
  2604. 3 - Stunned.
  2605. 4 - Sleeping.
  2606. 6 - Petrifying (the state where you can still walk)
  2607. Option numbers valid for the third version (opt2) of this command are:
  2608. 0x1 - Poisoned.
  2609. 0x2 - Cursed.
  2610. 0x4 - Silenced.
  2611. 0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
  2612. 0x10 - Blinded.
  2613. 0x80 - Deadly poisoned.
  2614. Option numbers (except for opt1) are bit-masks - you can add them up to check
  2615. for several states, but the functions will return true if at least one of them
  2616. is in effect.
  2617. 'setoption' will set options on the invoking character. There are no second and
  2618. third versions of this command, so you can only change the values in the first
  2619. list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted),
  2620. the option will be added to what the character currently has; if 0, the option is removed.
  2621. This is definitely not a complete list of available option flag numbers. Ask a
  2622. core developer (or read the source: src/map/status.h) for the full list.
  2623. ---------------------------------------
  2624. *setcart {<type>{,<char_id>}};
  2625. *checkcart({<char_id>});
  2626. If <type> is 0 this command will remove the cart from the character.
  2627. Otherwise it gives the invoking character a cart. The cart given will be
  2628. cart number <type> and will work regardless of whether the character is a
  2629. merchant class or not.
  2630. Note: the character needs to have the skill MC_PUSHCART to gain a cart
  2631. The accompanying function will return 1 if the invoking character has a cart
  2632. (any kind of cart) and 0 if they don't.
  2633. if (checkcart()) mes "But you already have a cart!";
  2634. ---------------------------------------
  2635. *setfalcon {<flag>{,<char_id>}};
  2636. *checkfalcon({<char_id>});
  2637. If <flag> is 0 this command will remove the falcon from the character.
  2638. Otherwise it gives the invoking character a falcon. The falcon will be there
  2639. regardless of whether the character is a hunter or not. It will (probably) not
  2640. have any useful effects for non-hunters though.
  2641. Note: the character needs to have the skill HT_FALCON to gain a falcon
  2642. The accompanying function will return 1 if the invoking character has a falcon
  2643. and 0 if they don't.
  2644. if (checkfalcon()) mes "But you already have a falcon!";
  2645. ---------------------------------------
  2646. *setriding {<flag>{,<char_id>}};
  2647. *checkriding({<char_id>});
  2648. If <flag> is 0 this command will remove the mount from the character.
  2649. Otherwise it gives the invoking character a PecoPeco (if they are a Knight
  2650. series class), a GrandPeco (if they are a Crusader series class), or
  2651. a Gryphon (if they are a Royal Guard). Unlike 'setfalcon' and 'setcart'
  2652. this will not work at all if they aren't of a class which can ride.
  2653. Note: the character needs to have the skill KN_RIDING to gain a mount
  2654. The accompanying function will return 1 if the invoking character is riding a
  2655. bird and 0 if they aren't.
  2656. if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!";
  2657. ---------------------------------------
  2658. *setdragon {<color>{,<char_id>}};
  2659. *checkdragon({<char_id>});
  2660. The 'setdragon' function toggles mounting a dragon for the invoking character.
  2661. It will return 1 if successful, 0 otherwise.
  2662. The available colors are:
  2663. 1 - Green Dragon (default)
  2664. 2 - Brown Dragon
  2665. 3 - Gray Dragon
  2666. 4 - Blue Dragon
  2667. 5 - Red Dragon
  2668. Note: the character must be a Rune Knight and have the skill RK_DRAGONTRAINING to gain a mount
  2669. The accompanying function will return 1 if the invoking character is riding a
  2670. dragon and 0 if they aren't.
  2671. ---------------------------------------
  2672. *setmadogear {<flag>{,<char_id>}};
  2673. *checkmadogear({<char_id>});
  2674. If <flag> is 0 this command will remove the mount from the character.
  2675. Otherwise it gives the invoking character a Mado (if they are a Mechanic).
  2676. The accompanying function will return 1 if the invoking character has a
  2677. Mado and 0 if they don't.
  2678. ---------------------------------------
  2679. *setmounting {<char_id>};
  2680. *ismounting({<char_id>});
  2681. The 'setmounting' function toggles cash mount for the invoking character.
  2682. It will return 1 if successful, 0 otherwise.
  2683. Note: Character must not be mounting a non-cash mount (eg. dragon, peco, wug, etc.)
  2684. The accompanying function will return 1 if the invoking character has a
  2685. cash mount and 0 if they don't.
  2686. ---------------------------------------
  2687. *checkwug({<char_id>});
  2688. This function will return 1 if the invoking character has a
  2689. warg and 0 if they don't.
  2690. ---------------------------------------
  2691. *checkvending({"<Player Name>"})
  2692. Checks if the player is vending or has has a buyingstore. Additionally
  2693. it gives you the information whether the player uses autotrade or not.
  2694. Name is optional, and defaults to the attached player if omitted.
  2695. The returned value is bitmask of.
  2696. 0 = doesn't have a vending or buyingstore (which also means he can't use autotrade)
  2697. 1 = normal vending
  2698. 2 = using @autotrade
  2699. 4 = has a buyingstore
  2700. Examples:
  2701. //This will check Aaron's state
  2702. .@state = checkvending("Aaron");
  2703. if (.@state&1)
  2704. mes "Aaron is currently vending!";
  2705. if (.@state&4)
  2706. mes "Aaron has a buying store!";
  2707. if (.@state&2)
  2708. mes "Aaron is autotrading!";
  2709. ---------------------------------------
  2710. *checkchatting({"<Player Name>"})
  2711. Checks if the player is in a chatroom.
  2712. Name is optional, and defaults to the attached player if omitted.
  2713. Returns 1 if they are in a chat room, 0 if they are not.
  2714. Examples:
  2715. //This will check if the attached player in a chat room or not.
  2716. if (checkchatting())
  2717. mes "You are currently in a chat room!";
  2718. ---------------------------------------
  2719. *checkidle({"<Player Name>"})
  2720. Returns the time, in seconds, that the specified player has been idle.
  2721. Name is optional, and defaults to the attached player if omitted.
  2722. ---------------------------------------
  2723. *agitcheck()
  2724. *agitcheck2()
  2725. These function will let you check whether the server is currently in WoE mode
  2726. (or WoE SE mode if the second function is called) and will return 1 if War of
  2727. Emperium is on and 0 if it isn't.
  2728. ---------------------------------------
  2729. *isnight()
  2730. *isday()
  2731. These functions will return 1 or 0 depending on whether the server is in night
  2732. mode or day mode. 'isnight' returns 1 if it's night and 0 if it isn't, 'isday'
  2733. the other way around. They can be used interchangeably, pick the one you like
  2734. more:
  2735. // These two are equivalent:
  2736. if (isday()) mes "I only prowl in the night.";
  2737. if (isnight()!=1) mes "I only prowl in the night.";
  2738. ---------------------------------------
  2739. *checkre(<type>)
  2740. Checks if a renewal feature is enabled or not in renewal.h, and returns 1 if
  2741. enabled and 0 for disabled.
  2742. The renewal feature to check is determined by type.
  2743. 0 - RENEWAL (game renewal server mode)
  2744. 1 - RENEWAL_CAST (renewal cast time)
  2745. 2 - RENEWAL_DROP (renewal drop rate algorithms)
  2746. 3 - RENEWAL_EXP (renewal exp rate algorithms)
  2747. 4 - RENEWAL_LVDMG (renewal level modifier on damage)
  2748. 5 - RENEWAL_ASPD (renewal ASPD)
  2749. ---------------------------------------
  2750. *is_clientver(<type>,<value>{,<char id>})
  2751. Checks a character's client version against a specified value. If no char id is
  2752. given, the command will run for the invoking character. The function will return
  2753. 1 if the player's version is greater than or equal to the value, and 0 otherwise.
  2754. Available types are:
  2755. 0 - version number (packet_db_ver)
  2756. 1 - client date (YYYYMMDD)
  2757. ---------------------------------------
  2758. \\
  2759. 3,1.- Item-related commands
  2760. \\
  2761. ---------------------------------------
  2762. *isequipped(<id>{,<id>{,<id>{,<id>}}})
  2763. This function will return 1 if the invoking character has all of the item
  2764. IDs given equipped (if card IDs are passed, then it checks if the cards are
  2765. inserted into slots in the equipment they are currently wearing). Theoretically
  2766. there is no limit to the number of items that may be tested for at the same time.
  2767. If even one of the items given is not equipped, 0 will be returned.
  2768. // (Poring,Santa Poring,Poporing,Marin)
  2769. if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
  2770. // (Poring)
  2771. if (isequipped(4001)) mes "A poring card is useful, don't you think?";
  2772. The function was meant for item scripts to support the cards released by Gravity
  2773. in February 2005, but it will work just fine in normal NPC scripts.
  2774. ---------------------------------------
  2775. *isequippedcnt(<card id>{,<card id>{,<card id>{,<card id>}}})
  2776. This function is similar to 'isequipped', but instead of 1 or 0, it will return
  2777. the number of cards in the list given that were found on the invoking character.
  2778. If a given parameter is not a card, the function returns the amount of that
  2779. item equipped on the invoking character.
  2780. if (isequippedcnt(4001,4005,4033,4196) == 4) mes "Finally got all four poring cards?";
  2781. ---------------------------------------
  2782. *checkequipedcard(<card id>)
  2783. This function will return 1 if the card specified by its item ID number is
  2784. inserted into any equipment they have in their inventory, currently equipped or
  2785. not.
  2786. ---------------------------------------
  2787. //
  2788. 3,1.- End of item-related commands
  2789. //
  2790. ---------------------------------------
  2791. ==============================
  2792. |4.- Player-related commands.|
  2793. ==============================
  2794. -------------------------
  2795. *attachrid(<account ID>)
  2796. *detachrid;
  2797. These commands allow the manipulation of the script's currently attached player.
  2798. While 'attachrid' allows attaching of a different player by using its account id
  2799. for the parameter RID, 'detachrid' makes the following commands run as if the
  2800. script was never invoked by a player.
  2801. The command returns 0 if the player cannot be attached (if the account is offline
  2802. or does not exist), and 1 upon success.
  2803. -------------------------
  2804. *addrid(<type>{,<flag>{,<parameters>}});
  2805. This command will attach other RIDs to the current script without detaching the
  2806. invoking RID. It returns 1 if successful and 0 upon failure.
  2807. <type> determines what RIDs are attached:
  2808. 0: All players in the server.
  2809. 1: All players in the map of the invoking player, or the invoking NPC if no player is attached.
  2810. 2: Party members of a specified party ID.
  2811. [ Parameters: <party id> ]
  2812. 3: Guild members of a specified guild ID.
  2813. [ Parameters: <guild id> ]
  2814. 4: All players in a specified area of the map of the invoking player (or NPC).
  2815. [ Parameters: <x0>,<y0>,<x1>,<y1> ]
  2816. Account ID: If type is Account ID, attach the specified account ID.
  2817. <flag> can prevent certain players from being attached:
  2818. 0: Players are always attached. (default)
  2819. 1: Players currently running another script will not be attached.
  2820. ---------------------------------------
  2821. *rid2name(<rid>)
  2822. Converts rid to name. Note: The player/monster/NPC must be online/enabled.
  2823. Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
  2824. Note: rid2name may not produce correct character names since rid = account id.
  2825. It will return the current online character of the account only.
  2826. ---------------------------------------
  2827. *message "<character name>","<message>";
  2828. That command will send a message to the chat window of the character specified
  2829. by name. The text will also appear above the head of that character. It will not
  2830. be seen by anyone else.
  2831. ---------------------------------------
  2832. *dispbottom "<message>"{,<color>{,<char_id>}};
  2833. This command will send the given message with color into the invoking character's chat
  2834. window. The color format is in RGB (0xRRGGBB). The color is
  2835. by default green
  2836. ---------------------------------------
  2837. *showscript "<message>"{,<GID>};
  2838. Makes attached player or GID says a message like shouting a skill name, the message
  2839. will be seen to everyone around but not in chat window.
  2840. ---------------------------------------
  2841. *warp "<map name>",<x>,<y>;
  2842. This command will take the invoking character to the specified map, and if
  2843. wanted, specified coordinates too, but these can be random.
  2844. warp "place",50,55;
  2845. This would take them to X 50 Y 55 on the map called "place". If your X and Y
  2846. coordinates land on an unwalkable map square, it will send the warped character
  2847. to a random place. Same will happen if they are both zero:
  2848. warp "place",0,0;
  2849. Notice that while warping people to coordinates 0,0 will normally get them into
  2850. a random place, it's not certain to always be so. Darned if I know where this is
  2851. actually coded, it might be that this happens because square 0,0 is unwalkable
  2852. on all official maps. If you're using custom maps, beware.
  2853. There are also three special 'map names' you can use.
  2854. "Random" will warp the player randomly on the current map.
  2855. "Save" and "SavePoint" will warp the player back to their save point.
  2856. ---------------------------------------
  2857. *areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
  2858. This command is similar to 'warp', however, it will not refer to the invoking
  2859. character, but instead, all characters within a specified area, defined by the
  2860. x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
  2861. including the activating character, if they are outside the area.
  2862. areawarp "place",10,10,120,120,"place2",150,150;
  2863. Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
  2864. shape, on the map called "place", will be affected, and warped to "place2" X 150
  2865. Y 150
  2866. areawarp "place",10,10,120,120,"place2",0,0;
  2867. By using ,0,0; as the destination coordinates it will take all the characters in
  2868. the affected area to a random set of co-ordinates on "place2".
  2869. areawarp "place",10,10,120,120,"place2",150,150,200,200;
  2870. By using the optional x4 and y4 parameters, the destination coordinates will be a
  2871. random place within the defined x3/y3-x4/y4 square.
  2872. Like 'warp', areawarp will also explicitly warp characters randomly into the
  2873. current map if you give the 'to map name' as "Random".
  2874. See also 'warp'.
  2875. ---------------------------------------
  2876. *warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>"};
  2877. Warps a party to specified map and coordinate given the party ID, which you can get with
  2878. getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
  2879. You can use the following "map names" for special warping behavior:
  2880. Random: All party members are randomly warped in their current map (as if they
  2881. all used a fly wing)
  2882. SavePointAll: All party members are warped to their respective save point.
  2883. SavePoint: All party members are warped to the save point of the currently
  2884. attached player (will fail if there's no player attached).
  2885. Leader: All party members are warped to the leader's position. The leader must
  2886. be online and in the current map-server for this to work.
  2887. If you specify a from_mapname, 'warpparty' will only affect those on that map.
  2888. Example:
  2889. mes "[Party Warper]";
  2890. mes "Here you go!";
  2891. close2;
  2892. .@party_id = getcharid(1);
  2893. warpparty "prontera",150,100,.@party_id;
  2894. close;
  2895. ---------------------------------------
  2896. *warpchar "<map name>",<x>,<y>,<char id>;
  2897. Warps another player to specified map and coordinate given the char id, which you can get with
  2898. getcharid(0,<player_name>). Obviously this is useless if you want to warp the same player that
  2899. is executing this script, unless it's some kind of "chosen" script.
  2900. Example:
  2901. warpchar "prontera",150,100,150001;
  2902. ---------------------------------------
  2903. *warpguild "<map name>",<x>,<y>,<guild_id>;
  2904. Warps a guild to specified map and coordinate given the guild id, which you can get with
  2905. getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>).
  2906. You can use the following "map names" for special warping behavior:
  2907. Random: All guild members are randomly warped in their current map (as if they
  2908. all used a fly wing)
  2909. SavePointAll: All guild members are warped to their respective save point.
  2910. SavePoint: All guild members are warped to the save point of the currently
  2911. attached player (will fail if there's no player attached).
  2912. Example:
  2913. warpguild "prontera",x,y,Guild_ID;
  2914. ---------------------------------------
  2915. *warppartner("<map name>",<x>,<y>);
  2916. This function will find the invoking character's marriage partner, if any, and
  2917. warp them to the map and coordinates given. Go kidnap that spouse. :) It will
  2918. return 1 upon success and 0 if the partner is not online, the character is not
  2919. married, or if there's no invoking character (no RID). 0,0 will, as usual,
  2920. normally translate to random coordinates.
  2921. ---------------------------------------
  2922. *savepoint "<map name>",<x>,<y>{,<char_id>};
  2923. *save "<map name>",<x>,<y>{,<char_id>};
  2924. These commands save where the invoking character will return to upon clicking
  2925. "Return to Save Point", after death and in some other cases. The two versions are
  2926. equivalent. They ignore any and all mapflags, and can make a character respawn where
  2927. no teleportation is otherwise possible.
  2928. savepoint "place",350,75;
  2929. ---------------------------------------
  2930. *heal <hp>,<sp>{,<char_id>};
  2931. This command will heal a set amount of HP and/or SP on the invoking character.
  2932. heal 30000,0; // This will heal 30,000 HP
  2933. heal 0,30000; // This will heal 30,000 SP
  2934. heal 300,300; // This will heal 300 HP and 300 SP
  2935. This command just alters the hit points and spell points of the invoking
  2936. character and produces no other output whatsoever.
  2937. ---------------------------------------
  2938. *itemheal <hp>,<sp>{,<char_id>};
  2939. This command heals relative amounts of HP and/or SP on the invoking character.
  2940. Unlike heal, this command is intended for use in item scripts. It applies
  2941. potion-related bonuses, such as alchemist ranking, cards, and status changes.
  2942. When used inside an NPC script, certain bonuses are omitted.
  2943. The command also applies a SP/VIT-related bonus:
  2944. heal = heal * [(100 + STATUS*2) / 100]
  2945. Example:
  2946. // If the player has 50 vit and no bonuses, this will heal
  2947. // anything from 200 to 300 HP and 5 SP
  2948. itemheal rand(100,150),5;
  2949. ---------------------------------------
  2950. *percentheal <hp>,<sp>{,<char_id>};
  2951. This command will heal the invoking character. It heals the character, but not
  2952. by a set value - it adds percent of their maximum HP/SP.
  2953. percentheal 100,0; // This will heal 100% HP
  2954. percentheal 0,100; // This will heal 100% SP
  2955. percentheal 50,50; // This will heal 50% HP and 50% SP
  2956. So the amount that this will heal will depend on the total amount of HP or SP
  2957. you have maximum. Like 'heal', this will not call up any animations or effects.
  2958. ---------------------------------------
  2959. *recovery <type>{,<option>,<revive_flag>{,<map name>}};
  2960. This command will revive and fully restore the HP/SP of the selected characters.
  2961. It returns 1 upon successful use.
  2962. <type> is the target, and determines the <option> parameter:
  2963. 0: Player -> Character ID number
  2964. 1: Party -> Party ID number
  2965. 2: Guild -> Guild ID number
  2966. 3: Map -> Map name (a string)
  2967. 4: All -> None (takes <revive_flag> as option)
  2968. If no option is specified, the invoking player's character ID, party ID, guild ID,
  2969. or map will be used.
  2970. <revive_flag> determines the action:
  2971. 1: Revive and heal all players (default)
  2972. 2: Heal living players only
  2973. 4: Revive dead players only
  2974. <map name> can optionally be used to define a single map to execute the command on
  2975. for types 1 (party) and 2 (guild).
  2976. Examples:
  2977. // Only revive characters in invoking party on map "morocc"
  2978. recovery 1,getcharid(1),4,"morocc";
  2979. // Fully heal (don't revive) all members of invoking character's guild
  2980. recovery 2,getcharid(2),2;
  2981. // Revive and fully heal everyone in map "prontera"
  2982. recovery 3,"prontera";
  2983. // Only revive all dead characters on server
  2984. recovery 4,4;
  2985. ---------------------------------------
  2986. *jobchange <job number>{,<upper flag>,<char_id>};
  2987. This command will change the job class of the invoking character.
  2988. jobchange 1; // This would change your player into a Swordman
  2989. jobchange 4002; // This would change your player into a Swordman High
  2990. This command does work with numbers, but you can also use job names. The full
  2991. list of job names and the numbers they correspond to can be found in
  2992. 'db/const.txt'.
  2993. // This would change your player into a Swordman
  2994. jobchange Job_Swordman;
  2995. // This would change your player into a Swordman High
  2996. jobchange Job_Swordman_High;
  2997. 'upper flag' can alternatively be used to specify the type of job one changes
  2998. to. For example, jobchange Job_Swordman,1; will change the character to a high
  2999. swordsman. The upper values are:
  3000. -1 (or when omitted): preserves the current job type.
  3001. 0: Normal/standard classes
  3002. 1: High/Advanced classes
  3003. 2: Baby classes
  3004. This command will also set a permanent character-based variable
  3005. 'jobchange_level' which will contain the job level at the time right before
  3006. changing jobs, which can be checked for later in scripts.
  3007. ---------------------------------------
  3008. *jobname(<job number>)
  3009. This command retrieves the name of the given job using the map_msg entries 550->655.
  3010. mes "[Kid]";
  3011. mes "I never thought I'd met a "+jobname(Class)+" here of all places.";
  3012. close;
  3013. ---------------------------------------
  3014. *eaclass({<job number>,<char_id>})
  3015. This commands returns the "eA job-number" corresponding to the given class, and
  3016. uses the invoking player's class if none is given. The eA job-number is also a
  3017. class number system, but it's one that comes with constants which make it easy
  3018. to convert among classes. The command will return -1 if you pass it a job number
  3019. which doesn't have an eA job-number equivalent.
  3020. @eac = eaclass();
  3021. if ((@eac&EAJ_BASEMASK) == EAJ_SWORDMAN)
  3022. mes "Your base job is Swordman.";
  3023. if (@eac&EAJL_UPPER)
  3024. mes "You are a rebirth job.";
  3025. if ((@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN)
  3026. mes "You must be a Swordman, Baby Swordman or High Swordman.";
  3027. For more information on the eA Job System, see the docs/ea_job_system.txt file.
  3028. ---------------------------------------
  3029. *roclass(<job number>{,<gender>})
  3030. Does the opposite of eaclass. That is, given an eA job-number, it returns the
  3031. corresponding RO class number. A gender is required because both Bard and Dancers
  3032. share the same eA job-number (EAJ_BARDDANCER), and uses the invoking player's
  3033. gender if none is given (if no player is attached, male will be used by default).
  3034. The command will return -1 if there is no valid class to represent the specified
  3035. job (for example, if you try to get the baby version of a Taekwon class).
  3036. @eac = eaclass();
  3037. //Check if class is already rebirth
  3038. if (@eac&EAJL_UPPER) {
  3039. mes "You look strong.";
  3040. close;
  3041. }
  3042. @eac = roclass(@eac|EAJL_UPPER);
  3043. //Check if class has a rebirth version
  3044. if (@eac != -1) {
  3045. mes "Bet you can't wait to become a "+jobname(@eac)+"!";
  3046. close;
  3047. }
  3048. ---------------------------------------
  3049. *changebase <job ID number>{,<account ID>};
  3050. This command will change a character's appearance to that of the specified job
  3051. class. Nothing but appearance will change.
  3052. The command will run for the invoking character unless an account ID is given.
  3053. changebase Job_Novice; // Changes player to Novice sprite.
  3054. changebase Class; // Changes player back to default sprite.
  3055. ---------------------------------------
  3056. *classchange <view id>,<type>;
  3057. This command is very ancient, its origins are clouded in mystery.
  3058. It will send a 'display id change' packet to everyone in the immediate area of
  3059. the NPC object, which will supposedly make the NPC look like a different sprite,
  3060. an NPC sprite ID, or a monster ID. This effect is not stored anywhere and will
  3061. not persist (Which is odd, cause it would be relatively easy to make it do so)
  3062. and most importantly, will not work at all since this command was broken with
  3063. the introduction of advanced classes. The code is written with the assumption
  3064. that the lowest sprite IDs are the job sprites and the anything beyond them is
  3065. monster and NPC sprites, but since the advanced classes rolled in, they got the
  3066. ID numbers on the other end of the number pool where monster sprites float.
  3067. As a result it is currently impossible to call this command with a valid view
  3068. id. It will do nothing whatsoever if the view ID is below 4047. Getting it to
  3069. run will actually just crash the client.
  3070. It could be a real gem if it can be gotten to actually do what it's supposed to
  3071. do, but this will only happen in a later SVN revision.
  3072. ---------------------------------------
  3073. *changesex({<char_id>});
  3074. This command will change the gender for the attached character's account. If it
  3075. was male, it will become female, if it was female, it will become male. The
  3076. change will be written to the character server, the player will receive the
  3077. message: "Need disconnection to perform change-sex request..." and the player
  3078. will be immediately kicked to the login screen. When they log back in, they will
  3079. be the opposite sex.
  3080. If there are any Dancer/Gypsy or Bard/Clown characters on the account,
  3081. they will also have their skills reset upon 'changesex'.
  3082. ---------------------------------------
  3083. *changecharsex({<char_id>});
  3084. This command will change the gender of the attached character. If it
  3085. was male, it will become female, if it was female, it will become male. The
  3086. change will be written to the character server, the player will receive the
  3087. message: "Need disconnection to perform change-sex request..." and the player
  3088. will be immediately kicked to the login screen. When they log back in, they will
  3089. be the opposite sex.
  3090. If the character being changed is a Dancer/Gypsy or Bard/Clown class type,
  3091. the character will also have their skills reset upon 'changecharsex'.
  3092. ---------------------------------------
  3093. *getexp <base xp>,<job xp>{,<char_id>};
  3094. This command will give the invoking character a specified number of base and job
  3095. experience points. Can be used as a quest reward. Negative values won't work.
  3096. getexp 10000,5000;
  3097. You can also use the "set" command with the constants defined in 'db/const.txt':
  3098. // These 2 combined has the same effect as the above command
  3099. set BaseExp,BaseExp+10000;
  3100. set JobExp,JobExp+5000;
  3101. You can also reduce the amount of experience points:
  3102. set BaseExp,BaseExp-10000;
  3103. Note that 'getexp' is now subject to the 'quest_exp_rate' config option, which
  3104. adjusts the gained value. If you want to bypass this, use the 'set' method.
  3105. ---------------------------------------
  3106. *setlook <look type>,<look value>{,<char_id>};
  3107. *changelook <look type>,<look value>{,<char_id>};
  3108. 'setlook' will alter the look data for the invoking character. It is used
  3109. mainly for changing the palette used on hair and clothes: you specify which look
  3110. type you want to change, then the palette you want to use. Make sure you specify
  3111. a palette number that exists/is usable by the client you use.
  3112. 'changelook' works the same, but is only client side (it doesn't save the look value).
  3113. // This will change your hair(6), so that it uses palette 8, what ever your
  3114. // palette 8 is, your hair will use that color
  3115. setlook 6,8;
  3116. // This will change your clothes(7), so they are using palette 1, whatever
  3117. // your palette 1 is, your clothes will then use that set of colors.
  3118. setlook 7,1;
  3119. Here are the possible look types:
  3120. 0 - Base sprite
  3121. 1 - Hairstyle
  3122. 2 - Weapon
  3123. 3 - Head bottom
  3124. 4 - Head top
  3125. 5 - Head mid
  3126. 6 - Hair color
  3127. 7 - Clothes color
  3128. 8 - Shield
  3129. 9 - Shoes
  3130. Whatever 'shoes' means is anyone's guess, ask Gravity - the client does nothing
  3131. with this value. It still wants it from the server though, so it is kept, but
  3132. normally doesn't do a thing.
  3133. Only the look data for hairstyle, hair color and clothes color are saved to the
  3134. char server's database and will persist. The rest freely change as the character
  3135. puts on and removes equipment, changes maps, logs in and out and otherwise you
  3136. should not expect to set them. In fact, messing with them is generally
  3137. hazardous, do it at your own risk, it is not tested what will this actually do -
  3138. it won't cause database corruption and probably won't cause a server crash, but
  3139. it's easy to crash the client with just about anything unusual.
  3140. However, it might be an easy way to quickly check for empty view IDs for
  3141. sprites, which is essential for making custom headgear.
  3142. Since a lot of people have different palettes for hair and clothes, it's
  3143. impossible to tell you what all the color numbers are. If you want a serious
  3144. example, there is a Stylist script inside the default rAthena installation that
  3145. you can look at: 'npc/custom/stylist.txt'
  3146. ---------------------------------------
  3147. *pushpc <direction>,<cells>;
  3148. This command will push the currently attached player to given direction by given
  3149. amount of square cells. Direction is the same as used when declaring NPCs, and
  3150. can be specified by using one of the DIR_* constants (db/const.txt).
  3151. The knock-back is not restricted by items or map flags, only obstacles are taken
  3152. into account. If there is not enough space to perform the push (e.g. due to a
  3153. wall), the character is pushed only up to the obstacle.
  3154. // pushes the character 5 cells in 3 o'clock direction from its
  3155. // current position.
  3156. pushpc DIR_EAST, 5;
  3157. ---------------------------------------
  3158. *get_revision()
  3159. This command will return the SVN revision number that the server is currently
  3160. running on.
  3161. if ( get_revision() >= 15000 )
  3162. mes "Welcome to rAthena!";
  3163. ---------------------------------------
  3164. *get_githash()
  3165. This command will return the Git Hash that the server is currently running on.
  3166. mes "Welcome to rAthena! Git Hash: " + get_githash();
  3167. ---------------------------------------
  3168. \\
  3169. 4,1.- Item-related commands
  3170. \\
  3171. ---------------------------------------
  3172. *getitem <item id>,<amount>{,<account ID>};
  3173. *getitem "<item name>",<amount>{,<account ID>};
  3174. This command will give an amount of specified items to the invoking character.
  3175. If an optional account ID is specified, and the target character is currently
  3176. online, items will be created in their inventory instead. If they are not
  3177. online, nothing will happen.
  3178. In the first and most commonly used version of this command, items are
  3179. referred to by their database ID number found inside 'db/(pre-)re/item_db.txt'.
  3180. getitem 502,10 // The person will receive 10 apples
  3181. getitem 617,1 // The person will receive 1 Old Violet Box
  3182. This transaction is logged if the log script generated transactions option is
  3183. enabled.
  3184. You may also create an item by its name in the 'english name' field in the
  3185. item database:
  3186. getitem "RED_POTION",10;
  3187. Which will do what you'd expect. If it can't find that name in the database,
  3188. apples will be created anyway. It is often a VERY GOOD IDEA to use it like this.
  3189. This is used in pretty much all NPC scripts that have to do with items and
  3190. quite a few item scripts. For more examples check just about any official script.
  3191. ---------------------------------------
  3192. *getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3193. *getitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3194. This command will give an amount of specified items to the invoking character.
  3195. If an optional account ID is specified, and the target character is currently
  3196. online, items will be created in their inventory instead. If they are not
  3197. online, nothing will happen. It works essentially the same as 'getitem' but is
  3198. a lot more flexible.
  3199. Those parameters that are different from 'getitem' are:
  3200. identify - Whether you want the item to be identified (1) or not (0).
  3201. refine - For how many pluses will it be refined.
  3202. It will not let you refine an item higher than the max refine.
  3203. attribute - Whether the item is broken (1) or not (0).
  3204. card1,2,3,4 - If you want a card compound to it, place the card ID number into
  3205. the specific card slot.
  3206. Card1-card4 values are also used to store name information for named items, as
  3207. well as the elemental property of weapons and armor. You can create a named item
  3208. in this manner, however, if you just need a named piece of standard equipment,
  3209. it is much easier to the 'getnameditem' function instead.
  3210. You will need to keep these values if you want to destroy and then perfectly
  3211. recreate a named item, for this see 'getinventorylist'.
  3212. If you still want to try creating a named item with this command because
  3213. 'getnameditem' won't do it for you cause it's too limited, you can do it like
  3214. this. Careful, minor magic ahead.
  3215. // First, let's get an ID of a character who's name will be on the item.
  3216. // Only an existing character's name may be there.
  3217. // Let's assume our character is 'Adam' and find his ID.
  3218. @charid = getcharid(0,"Adam");
  3219. // Now we split the character ID number into two portions with a binary
  3220. // shift operation. If you don't understand what this does, just copy it.
  3221. @card3 = @charid & 65535;
  3222. @card4 = @charid >> 16;
  3223. // If you're inscribing non-equipment, @card1 must be 254.
  3224. // Arrows are also not equipment. :)
  3225. @card1 = 254;
  3226. // For named equipment, card2 means the Star Crumbs and elemental
  3227. // crystals used to make this equipment. For everything else, it's 0.
  3228. @card2 = 0;
  3229. // Now, let's give the character who invoked the script some
  3230. // Adam's Apples:
  3231. getitem2 512,1,1,0,0,@card1,@card2,@card3,@card4;
  3232. This wasn't tested with all possible items, so I can't give any promises,
  3233. experiment first before relying on it.
  3234. To create equipment, continue this example it like this:
  3235. // We've already have card3 and card4 loaded with correct
  3236. // values so we'll just set up card1 and card2 with data
  3237. // for an Ice Stiletto.
  3238. // If you're inscribing equipment, @card1 must be 255.
  3239. @card1 = 255;
  3240. // That's the number of star crumbs in a weapon.
  3241. @sc = 2;
  3242. // That's the number of elemental property of the weapon.
  3243. @ele = 1;
  3244. // And that's the wacky formula that makes them into
  3245. // a single number.
  3246. @card2 = @ele+((@sc*5)<<8);
  3247. // That will make us an Adam's +2 VVS Ice Stiletto:
  3248. getitem2 1216,1,1,2,0,@card1,@card2,@card3,@card4;
  3249. Experiment with the number of star crumbs - I'm not certain just how much will
  3250. work most and what it depends on. The valid element numbers are:
  3251. 1 - Ice, 2 - Earth 3 - Fire 4 - Wind.
  3252. You can, apparently, even create duplicates of the same pet egg with this
  3253. command, creating a pet which is the same, but simultaneously exists in two
  3254. eggs, and may hatch from either, although, I'm not sure what kind of a mess will
  3255. this really cause.
  3256. ---------------------------------------
  3257. *getitembound <item id>,<amount>,<bound type>{,<account ID>};
  3258. *getitembound "<item name>",<amount>,<bound type>{,<account ID>};
  3259. This command behaves identically to 'getitem', but the items created will be
  3260. bound to the target character as specified by the bound type. All items created
  3261. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3262. some cases cannot be traded or stored.
  3263. Valid bound types are:
  3264. Bound_Account : Account Bound item
  3265. Bound_Guild : Guild Bound item
  3266. Bound_Party : Party Bound item
  3267. Bound_Char : Character Bound item
  3268. ---------------------------------------
  3269. *getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3270. *getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3271. This command behaves identically to 'getitem2', but the items created will be
  3272. bound to the target character as specified by the bound type. All items created
  3273. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3274. some cases cannot be traded or stored.
  3275. For a list of bound types see 'getitembound'.
  3276. ---------------------------------------
  3277. *getnameditem <item id>,<character name|character ID>;
  3278. *getnameditem "<item name>",<character name|character ID>;
  3279. Create an item signed with the given character's name.
  3280. The command returns 1 when the item is created successfully, or 0 if it fails.
  3281. Failure occurs when:
  3282. - There is no player attached.
  3283. - Item name or ID is not valid.
  3284. - The given character ID/name is offline.
  3285. Example:
  3286. //This will give the currently attached player a Aaron's Apple (if Aaron is online).
  3287. getnameditem "Apple","Aaron";
  3288. //Self-explanatory (I hope).
  3289. if (getnameitem("Apple","Aaron")) {
  3290. mes "You now have a Aaron's Apple!";
  3291. }
  3292. ---------------------------------------
  3293. *rentitem <item id>,<time>{,<account_id>};
  3294. *rentitem "<item name>",<time>{,<account_id>};
  3295. Creates a rental item in the attached character's inventory. The item will expire
  3296. in <time> seconds and be automatically deleted. When receiving a rental item,
  3297. the character will receive a message in their chat window. The character will
  3298. also receive warning messages in their chat window before the item disappears.
  3299. This command can not be used to rent stackable items. Rental items cannot be
  3300. dropped, traded, sold to NPCs, or placed in guild storage. (i.e. trade mask 75)
  3301. Note: 'delitem' in an NPC script can still remove rental items.
  3302. ---------------------------------------
  3303. *rentitem2 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3304. *rentitem2 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3305. Creates a rental item in the attached character's inventory. The item will expire
  3306. in <time> seconds and be automatically deleted. See 'rentitem' for further details.
  3307. See 'getitem2' for an explanation of the expanded parameters.
  3308. ---------------------------------------
  3309. *makeitem <item id>,<amount>,"<map name>",<X>,<Y>;
  3310. *makeitem "<item name>",<amount>,"<map name>",<X>,<Y>;
  3311. This command will create an item on the specified cell of a map.
  3312. As with any dropped items, the items created with this command will disappear after
  3313. a period of time. Using an amount greater than 1 will create a single stack of the
  3314. given amount, not multiple stacks of 1.
  3315. Like 'getitem', it also accepts an 'english name' field from the database and creates
  3316. Apples if the name isn't found.
  3317. If the map name is given as "this", the map the invoking character is on will be used.
  3318. ---------------------------------------
  3319. *makeitem2 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3320. *makeitem2 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3321. This command will create an item on the specified cell of a map. See 'makeitem' for
  3322. further details.
  3323. See 'getitem2' for an explanation of the expanded parameters.
  3324. ---------------------------------------
  3325. *cleanarea "<map name>",<x1>,<y1>,<x2>,<y2>;
  3326. *cleanmap "<map name>";
  3327. These commands will clear all items lying on the ground on the specified map, either
  3328. within the x1/y1-x2/y2 rectangle or across the entire map.
  3329. ---------------------------------------
  3330. *searchitem <array name>,"<item name>";
  3331. This command will fill the given array with the ID of items whose name matches
  3332. the given one. It returns the number of items found. For performance reasons,
  3333. the results array is limited to 10 items.
  3334. mes "What item are you looking for?";
  3335. input .@name$;
  3336. .@qty = searchitem(.@matches[0],.@name$);
  3337. mes "I found " + .@qty + " items:";
  3338. for (.@i = 0; .@i < .@qty; .@i++)
  3339. // Display name (eg: "Apple[0]")
  3340. mes getitemname(.@matches[.@i]) + "[" + getitemslots(.@matches[.@i]) + "]";
  3341. ---------------------------------------
  3342. *delitem <item id>,<amount>{,<account ID>};
  3343. *delitem "<item name>",<amount>{,<account ID>};
  3344. This command will remove a specified amount of items from the invoking/target character.
  3345. Like all the item commands, it uses the item ID found inside 'db/(pre-)re/item_db.txt'.
  3346. delitem 502,10; // The person will lose 10 apples
  3347. delitem 617,1; // The person will lose 1 Old Violet Box
  3348. It is always a good idea to check if the player actually has the items before you delete them.
  3349. If you try to delete more items that the player has, the player will lose the ones he/she has
  3350. and the script will terminate with an error.
  3351. Like 'getitem', this command will also accept an 'english name' field from the
  3352. database. If the name is not found, nothing will be deleted.
  3353. ---------------------------------------
  3354. *cartdelitem <item id>,<amount>{,<account ID>};
  3355. *cartdelitem "<item name>",<amount>{,<account ID>};
  3356. *storagedelitem <item id>,<amount>{,<account ID>};
  3357. *storagedelitem "<item name>",<amount>{,<account ID>};
  3358. This command behaves identically to 'delitem', but deletes items from the player's
  3359. cart or storage. If no cart is mounted, 'cartdelitem' will fail.
  3360. ---------------------------------------
  3361. *delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3362. *delitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3363. This command will remove a specified amount of items from the invoking/target character.
  3364. See 'getitem2' for an explanation of the expanded parameters.
  3365. ---------------------------------------
  3366. *cartdelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3367. *cartdelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3368. *storagedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3369. *storagedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3370. This command behaves identically to 'delitem2', but deletes items from the player's
  3371. cart or storage. If no cart is mounted, 'cartdelitem2' will fail.
  3372. ---------------------------------------
  3373. *countitem(<item id>)
  3374. *countitem("<item name>")
  3375. This function will return the number of items for the specified item ID that the
  3376. invoking character has in the inventory.
  3377. mes "[Item Checker]";
  3378. mes "Hmmm, it seems you have "+countitem(502)+" apples";
  3379. close;
  3380. Like 'getitem', this function will also accept an 'english name' from the
  3381. database as an argument.
  3382. If you want to state the number at the end of a sentence, you can do it by
  3383. adding up strings:
  3384. mes "[Item Checker]";
  3385. mes "Hmmm, the total number of apples you are holding is "+countitem("APPLE");
  3386. close;
  3387. ---------------------------------------
  3388. *cartcountitem(<item id>)
  3389. *cartcountitem("<item name>")
  3390. *storagecountitem(<item id>)
  3391. *storagecountitem("<item name>")
  3392. This command behaves identically to 'countitem', but counts items from the player's
  3393. cart or storage. If no cart is mounted, 'cartcountitem' will return -1.
  3394. ---------------------------------------
  3395. *countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3396. *countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3397. Expanded version of 'countitem' function, used for created/carded/forged items.
  3398. This function will return the number of items for the specified item ID and
  3399. other parameters that the invoking character has in the inventory.
  3400. See 'getitem2' for an explanation of the expanded parameters.
  3401. ---------------------------------------
  3402. *cartcountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3403. *cartcountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3404. *storagecountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3405. *storagecountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3406. This command behaves identically to 'countitem2', but counts items from the player's
  3407. cart or storage. If no cart is mounted, 'cartcountitem2' will return -1.
  3408. ---------------------------------------
  3409. *countbound({<bound type>{,<char_id>}})
  3410. This function will return the number of bounded items in the character's
  3411. inventory, and sets an array @bound_items[] containing all item IDs of the
  3412. counted items. If a bound type is specified, only those items will be counted.
  3413. For a list of bound types see 'getitembound'.
  3414. Example:
  3415. mes "You currently have "+countbound()+" bounded items.";
  3416. next;
  3417. mes "The list of bounded items include:";
  3418. for(.@i = 0; .@i < getarraysize(@bound_items); .@i++)
  3419. mes getitemname(@bound_items[.@i]);
  3420. close;
  3421. ---------------------------------------
  3422. *groupranditem <group id>{,<sub_group>};
  3423. Returns the item_id of a random item picked from the group specified. The
  3424. different groups and their group number are specified in 'db/(pre-)re/item_group_db.txt'.
  3425. When used in conjunction with other functions, you can get a random item. For
  3426. example, for a random pet lure:
  3427. getitem groupranditem(IG_Taming),1;
  3428. 'sub_group' is used to get the available random items of item group from specified random
  3429. group. 0 for 'must' item group, and random item group is 1 until 5 (MAX_ITEMGROUP_RANDGROUP+1).
  3430. More info, see doc/item_group.txt.
  3431. ---------------------------------------
  3432. *getrandgroupitem <group_id>{,<quantity>{,<sub_group>}};
  3433. Similar to the above example, this command allows players to obtain the specified
  3434. quantity of a random item from the group "<group id>". The different groups and
  3435. their group number are specified in db/(pre-)re/item_group_db.txt
  3436. If 'quantity' is not defined or 0, it will uses defined amount from Item Group list.
  3437. If 'sub_group' is not defined the value will be 1 (since random group is 1 ~ 5, and 0 is
  3438. 'must' item group).
  3439. More info, see doc/item_group.txt.
  3440. ---------------------------------------
  3441. *getgroupitem <group_id>{,<char_id>};
  3442. Gives item(s) to the attached player based on item group contents.
  3443. This is not working like 'getrandgroupitem' which only give 1 item for specified
  3444. item group & sub_group.
  3445. More info, see doc/item_group.txt.
  3446. ---------------------------------------
  3447. *enable_items;
  3448. *disable_items;
  3449. These commands toggle the ability to change equipment while interacting with
  3450. an NPC. To avoid possible exploits, the commands affect the particular script
  3451. instance only. Note that if a different script also calls enable_items, it
  3452. will override the last call (so you may want to call this command at the start
  3453. of your script without assuming it is still in effect).
  3454. The default setting, 'item_enabled_npc', is defined in 'conf/battle/items.conf'.
  3455. ---------------------------------------
  3456. *itemskill <skill id>,<skill level>;
  3457. *itemskill "<skill name>",<skill level>;
  3458. This command is meant for item scripts to replicate single-use skills in usable
  3459. items. It will not work properly if there is a visible dialog window or menu.
  3460. If the skill is self or auto-targeting, it will be used immediately; otherwise a
  3461. target cursor is shown.
  3462. // When Anodyne is used, it will cast Endure (8), Level 1, as if the actual
  3463. // skill has been used from skill tree.
  3464. 605,Anodyne,Anodyne,11,2000,0,100,,,,,10477567,2,,,,,{ itemskill 8,1; },{}
  3465. ---------------------------------------
  3466. *consumeitem <item id>{,<char_id>};
  3467. *consumeitem "<item name>"{,<char_id>};
  3468. This command will run the item script of the specified item on the invoking
  3469. character. The character does not need to possess the item, and the item will
  3470. not be deleted. While this command is intended for usable items, it will run
  3471. for any item type.
  3472. This command does not currently work with the 'itemskill' script command.
  3473. ---------------------------------------
  3474. *produce <item level>;
  3475. This command will open a crafting window on the client connected to the invoking
  3476. character. The 'item level' is a number which determines what kind of a crafting
  3477. window will pop-up.
  3478. You can see the full list of such item levels in 'db/produce_db.txt' which determines
  3479. what can actually be produced. The window will not be empty only if the invoking
  3480. character can actually produce the items of that type and has the appropriate raw
  3481. materials in their inventory.
  3482. The success rate to produce the item is the same as the success rate of the skill
  3483. associated with the item level. If there is no skill id, the success rate will be 50%.
  3484. Valid item levels are:
  3485. 1 - Level 1 Weapons
  3486. 2 - Level 2 Weapons
  3487. 3 - Level 3 Weapons
  3488. 21 - Blacksmith's Stones and Metals
  3489. 22 - Alchemist's Potions, Holy Water, Assassin Cross's Deadly Poison
  3490. 23 - Elemental Converters
  3491. ---------------------------------------
  3492. *cooking <dish level>;
  3493. This command will open a produce window on the client connected to the invoking
  3494. character. The 'dish level' is the number which determines what kind of dish
  3495. level you can produce. You can see the full list of dishes that can be produced in
  3496. 'db/produce_db.txt'.
  3497. The window will be shown empty if the invoking character does not have enough of
  3498. the required incredients to cook a dish.
  3499. Valid dish levels are:
  3500. 11 - Level 1 Dish
  3501. 12 - Level 2 Dish
  3502. 13 - Level 3 Dish
  3503. 14 - Level 4 Dish
  3504. 15 - Level 5 Dish
  3505. 16 - Level 6 Dish
  3506. 17 - Level 7 Dish
  3507. 18 - Level 8 Dish
  3508. 19 - Level 9 Dish
  3509. 20 - Level 10 Dish
  3510. Although it's required to set a dish level, it doesn't matter if you set it to 1
  3511. and you want to cook a level 10 dish, as long as you got the required incredients
  3512. to cook the dish the command works.
  3513. ---------------------------------------
  3514. *makerune <% success bonus>{,<char_id>};
  3515. This command will open a rune crafting window on the client connected to the
  3516. invoking character. Since this command is officially used in rune ores, a bonus
  3517. success rate must be specified (which adds to the base formula).
  3518. You can see the full list of runes that can be produced in 'db/produce_db.txt'.
  3519. The window will not be empty only if the invoking character can actually produce
  3520. a rune and has the appropriate raw materials in their inventory.
  3521. ---------------------------------------
  3522. *successremovecards <equipment slot>;
  3523. This command will remove all cards of the cards slots defined by item_db.txt
  3524. from the item found in the specified equipment slot of the invoking character,
  3525. create new card items and give them to the character.
  3526. If any cards were removed in this manner, it will also show a success effect.
  3527. ---------------------------------------
  3528. *failedremovecards <equipment slot>,<type>;
  3529. This command will remove all cards from the item found in the specified
  3530. equipment slot of the invoking character. 'type' determines what happens to the
  3531. item and the cards:
  3532. 0 - will destroy both the item and the cards.
  3533. 1 - will keep the item, but destroy the cards.
  3534. 2 - will keep the cards, but destroy the item.
  3535. Whatever the type is, it will also show a failure effect on screen.
  3536. ---------------------------------------
  3537. *repair <broken item number>{,<char_id>};
  3538. This command repairs a broken piece of equipment, using the same list of broken
  3539. items as available through 'getbrokenid'.
  3540. ---------------------------------------
  3541. *repairall {<char_id>};
  3542. This command repairs all broken equipment in the attached player's inventory.
  3543. A repair effect will be shown if any items are repaired, else the command will
  3544. end silently.
  3545. ---------------------------------------
  3546. *successrefitem <equipment slot>{,<count>{,<char_id>}};
  3547. This command will refine an item in the specified equipment slot of the invoking
  3548. character by +1, or a count if given. For a list of equipment slots see 'getequipid'.
  3549. This command will also display a 'refine success' effect on the character and put
  3550. appropriate messages into their chat window. It will also give the character fame
  3551. points if a weapon reached +10 this way, even though these will only take effect for
  3552. blacksmith who will later forge a weapon.
  3553. ---------------------------------------
  3554. *failedrefitem <equipment slot>{,<char_id>};
  3555. This command will fail to refine an item in the specified equipment slot of the
  3556. invoking character. The item will be destroyed. This will also display a 'refine
  3557. failure' effect on the character and put appropriate messages into their chat
  3558. window.
  3559. ---------------------------------------
  3560. *downrefitem <equipment slot>{,<count>{,<char_id>}};
  3561. This command will downgrade an item in the specified equipment slot of the invoking
  3562. character by -1, or a count if given. For a list of equipment slots see 'getequipid'.
  3563. This command will also display a 'refine failure' effect on the character and put
  3564. appropriate messages into their chat window.
  3565. ---------------------------------------
  3566. *unequip <equipment slot>{,<char_id>};
  3567. This command will unequip whatever is currently equipped in the invoking
  3568. character's specified equipment slot. For a full list of possible equipment
  3569. slots see 'getequipid'.
  3570. If an item occupies several equipment slots, it will get unequipped from all of
  3571. them.
  3572. ---------------------------------------
  3573. *delequip <equipment slot>{,<char_id>};
  3574. This command will destroy whatever is currently equipped in the invoking
  3575. character's specified equipment slot. For a full list of possible equipment
  3576. slots see 'getequipid'.
  3577. This command will return 1 if an item was deleted and 0 otherwise.
  3578. ---------------------------------------
  3579. *breakequip <equipment slot>{,<char_id>};
  3580. This command will break and unequip whatever is currently equipped in the
  3581. invoking character's specified equipment slot. For a full list of possible
  3582. equipment slots see 'getequipid'.
  3583. This command will return 1 if an item was broken and 0 otherwise.
  3584. ---------------------------------------
  3585. *clearitem {<char_id>};
  3586. This command will destroy all items the invoking character has in their
  3587. inventory (including equipped items). It will not affect anything else, like
  3588. storage or cart.
  3589. ---------------------------------------
  3590. *equip <item id>{,<char_id>};
  3591. *autoequip <item id>,<option>;
  3592. These commands are to equip a equipment on the attached character.
  3593. The equip function will equip the item ID given when the player has
  3594. this item in his/her inventory, while the autoequip function will
  3595. equip the given item ID when this is looted. The option parameter of
  3596. the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off.
  3597. Examples:
  3598. //This will equip a 1104 (falchion) on the character if this is in the inventory.
  3599. equip 1104;
  3600. //The invoked character will now automatically equip a falchion when it's looted.
  3601. autoequip 1104,1;
  3602. //The invoked character will no longer automatically equip a falchion.
  3603. autoequip 1104,0;
  3604. ---------------------------------------
  3605. *buyingstore <slots>;
  3606. Invokes buying store preparation window like the skill 'Open Buying Store',
  3607. without the item requirement. Amount of slots is limited by the server to
  3608. a maximum of 5 slots by default.
  3609. Example:
  3610. // Gives the player opportunity to buy 4 different kinds of items.
  3611. buyingstore 4;
  3612. ---------------------------------------
  3613. *searchstores <uses>,<effect>;
  3614. Invokes the store search window, which allows to search for both vending
  3615. and buying stores. Parameter uses indicates, how many searches can be
  3616. started, before the window has to be reopened. Effect value affects,
  3617. what happens, when a result item is double-clicked and can be one of the
  3618. following:
  3619. 0 = Shows the store's position on the mini-map and highlights the
  3620. shop sign with yellow color, when the store is on same map
  3621. as the invoking player.
  3622. 1 = Directly opens the shop, regardless of distance.
  3623. Example:
  3624. // Item Universal_Catalog_Gold (10 uses, effect: open shop)
  3625. searchstores 10,1;
  3626. ---------------------------------------
  3627. *enable_command;
  3628. *disable_command;
  3629. These commands toggle the ability to use atcommand while interacting with an NPC.
  3630. The default setting, 'atcommand_enable_npc', is defined in 'conf/battle/gm.conf'.
  3631. ---------------------------------------
  3632. //
  3633. 4,1.- End of item-related commands
  3634. //
  3635. ---------------------------------------
  3636. *openstorage;
  3637. This will open character's Kafra storage window on the client connected to the
  3638. invoking character. It can be used from any kind of NPC or item script, not just
  3639. limited to Kafra Staff.
  3640. The storage window opens regardless of whether there are open NPC dialogs or
  3641. not, but it is preferred to close the dialog before displaying the storage
  3642. window, to avoid any disruption when both windows overlap.
  3643. mes "Close this window to open your storage.";
  3644. close2;
  3645. openstorage;
  3646. end;
  3647. ---------------------------------------
  3648. *openmail({<char_id>});
  3649. This will open a character's Mail window on the client connected to the
  3650. invoking character.
  3651. mes "Close this window to open your mail inbox.";
  3652. close2;
  3653. openmail;
  3654. end;
  3655. ---------------------------------------
  3656. *openauction({<char_id>});
  3657. This will open the Auction window on the client connected to the invoking character.
  3658. mes "Close this window to open the Auction window.";
  3659. close2;
  3660. openauction;
  3661. end;
  3662. ---------------------------------------
  3663. \\
  3664. 4,2.- Guild-related commands
  3665. \\
  3666. ---------------------------------------
  3667. *guildopenstorage()
  3668. This function works the same as 'openstorage' but will open a guild storage
  3669. window instead for the guild storage of the guild the invoking character belongs
  3670. to. This is a function because it returns a value - 0 if the guild storage was
  3671. opened successfully and 1 if it wasn't. (Notice, it's a ZERO upon success.)
  3672. Since guild storage is only accessible to one character at one time, it may fail
  3673. if another character is accessing the guild storage at the same time.
  3674. This will also fail and return 2 if the character does not belong to any guild.
  3675. ---------------------------------------
  3676. *guildchangegm(<guild id>,<new master's name>)
  3677. This function will change the Guild Master of a guild. The ID is the guild's
  3678. id, and the new guild master's name must be passed.
  3679. Returns 1 on success, 0 otherwise.
  3680. ---------------------------------------
  3681. *guildgetexp <amount>;
  3682. This will give the specified amount of guild experience points to the guild the
  3683. invoking character belongs to. It will silently fail if they do not belong to
  3684. any guild.
  3685. ---------------------------------------
  3686. *guildskill <skill id>,<level>
  3687. *guildskill "<skill name>",<level>
  3688. This command will bump up the specified guild skill by the specified number of
  3689. levels. This refers to the invoking character and will only work if the invoking
  3690. character is a member of a guild AND its guild master, otherwise no failure
  3691. message will be given and no error will occur, but nothing will happen - same
  3692. about the guild skill trying to exceed the possible maximum. The full list of
  3693. guild skills is available in 'db/(pre-)re/skill_db.txt', these are all the GD_ skills at
  3694. the end.
  3695. // This would give your character's guild one level of Approval (GD_APPROVAL ID
  3696. // 10000). Notice that if you try to add two levels of Approval, or add
  3697. // Approval when the guild already has it, it will only have one level of
  3698. // Approval afterwards.
  3699. guildskill 10000,1,0;
  3700. You might want to make a quest for getting a certain guild skill, make it hard
  3701. enough that all the guild needs to help or something. Doing this for the Glory
  3702. of the Guild skill, which allows your guild to use an emblem, is a good idea for
  3703. a fun quest. (Wasting a level point on that is really annoying :D)
  3704. ---------------------------------------
  3705. //
  3706. 4,2 End of guild-related commands.
  3707. //
  3708. ---------------------------------------
  3709. *resetlvl <action type>{,<char_id>};
  3710. This is a character reset command, meant mostly for rebirth script supporting
  3711. Advanced jobs, which will reset the invoking character's stats and level
  3712. depending on the action type given. Valid action types are:
  3713. 1 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp, wipes the
  3714. status effects (only the ones settable by 'setoption'), sets all stats to 1.
  3715. If the new job is 'Novice High', give 100 status points, give First Aid and
  3716. Play Dead skills.
  3717. 2 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp.
  3718. Skills and attribute values are not altered.
  3719. 3 - Base level 1, base exp 0. Nothing else is changed.
  3720. 4 - Job level 1, job exp 0. Nothing else is changed.
  3721. In all cases everything the character has on will be unequipped.
  3722. Even though it doesn't return a value, it is used as a function in the official
  3723. rebirth scripts. Ask AppleGirl why.
  3724. ---------------------------------------
  3725. *resetstatus({<char_id>});
  3726. This is a character reset command, which will reset the stats on the invoking
  3727. character and give back all the stat points used to raise them previously.
  3728. Nothing will happen to any other numbers about the character.
  3729. Used in reset NPC's (duh!)
  3730. ---------------------------------------
  3731. *resetskill({<char_id>});
  3732. This command takes off all the skill points on the invoking character, so they
  3733. only have Basic Skill blanked out (lvl 0) left, and returns the points for them
  3734. to spend again. Nothing else will change but the skills. Quest skills will also
  3735. reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If
  3736. the 'quest_skill_learn' option is set in there, the points in the quest skills
  3737. will also count towards the total.
  3738. Used in reset NPC's (duh!)
  3739. ---------------------------------------
  3740. *sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
  3741. *sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
  3742. *sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
  3743. *sc_end <effect type>{,<GID>};
  3744. These commands will bestow a status effect on a character.
  3745. The <effect type> determines which status is invoked. This can be either a number
  3746. or constant, with the common statuses (mostly negative) found in 'db/const.txt'
  3747. with the 'SC_' prefix. A full list is located in 'src/map/status.h', though
  3748. they are not currently documented.
  3749. The duration of the status is given in <ticks>, or milleseconds.
  3750. Certain status changes take an additional parameter <value 1>, which typically
  3751. modifies player stats by the given number or percentage. This differs for each
  3752. status, and is sometimes zero.
  3753. Optional value <rate> is the chance that the status will be invoked (100 = 1%).
  3754. This is used primarily in item scripts. When used in an NPC script, a flag MUST
  3755. be defined for the rate to work.
  3756. Optional value <flag> is how the status change start will be handled (a bitmask).
  3757. 1: Status change cannot be avoided.
  3758. 2: Tick cannot be reduced by stats (default).
  3759. 4: sc_data loaded, so no value will be altered.
  3760. 8: Rate cannot be reduced.
  3761. If a <GID> is given, the status change will be invoked on the specified character
  3762. instead of the one attached to the script. This can only be defined after setting
  3763. a rate and flag.
  3764. 'sc_start2' and 'sc_start4' allow extra parameters to be passed, and are used only
  3765. for effects that require them. The meaning of the extra values vary depending on the
  3766. effect type. For more infos, read status_change.txt containing a list of all Status Changes
  3767. and theirs val1, val2, val3, and val4 usage in source.
  3768. 'sc_end' will remove a specified status effect. If SC_ALL (-1) is given, it will
  3769. perform a complete removal of all statuses (although permanent ones will re-apply).
  3770. Examples:
  3771. // This will poison the invoking character for 10 minutes at 50% chance.
  3772. sc_start SC_POISON,600000,0,5000;
  3773. // This will bestow the effect of Level 10 Blessing.
  3774. sc_start SC_BLESSING,240000,10;
  3775. // Adjust element resistance by percentage. Sample with Resist_Fire item script:
  3776. // val1: Water resistance
  3777. // val2: Earth resistance
  3778. // val3: Fire resistance
  3779. // val4: Wind resistance
  3780. sc_start4 SC_ARMOR_ELEMENT,1200000,-15,0,20,0;
  3781. // This will end the Freezing status for the invoking character.
  3782. sc_end SC_FREEZE;
  3783. Note: to use SC_NOCHAT you should alter Manner
  3784. set Manner, -5; // Will mute a user for 5 minutes
  3785. set Manner, 0; // Will unmute a user
  3786. set Manner, 5; // Will unmute a user and prevent the next use of 'Manner'
  3787. ---------------------------------------
  3788. *getstatus(<effect type>{,<type>{,<char_id>}})
  3789. Retrieve information about a specific status effect when called. Depending on <type>
  3790. specified the function will return different information.
  3791. Possible <type> values:
  3792. - 0 or undefined: whether the status is active
  3793. - 1: the val1 of the status
  3794. - 2: the val2 of the status
  3795. - 3: the val3 of the status
  3796. - 4: the val4 of the status
  3797. - 5: the amount of time in milliseconds that the status has remaining
  3798. If <type> is not defined or is set to 0, then the script function will either
  3799. return 1 if the status is active, or 0 if the status is not active. If the status
  3800. is not active when any of the <type> fields are provided, this script function
  3801. will always return 0.
  3802. ---------------------------------------
  3803. *skilleffect <skill id>,<number>;
  3804. *skilleffect "<skill name>",<number>;
  3805. This command displays visual and aural effects of given skill on currently
  3806. attached character. The number parameter is for skill whose visual effect
  3807. involves displaying of a number (healing or damaging). Note, that this command
  3808. will not actually use the skill, it is intended for scripts, which simulate
  3809. skill usage by the NPC, such as buffs, by setting appropriate status and
  3810. displaying the skill's effect.
  3811. mes "Be blessed!";
  3812. // Heal of 2000 HP
  3813. heal 2000,0;
  3814. skilleffect 28,2000;
  3815. // Blessing Level 10
  3816. sc_start SC_BLESSING,240000,10;
  3817. skilleffect 34,0;
  3818. // Increase AGI Level 5
  3819. sc_start SC_INCREASEAGI,140000,5;
  3820. skilleffect 29,0;
  3821. This will heal the character with 2000 HP, buff it with Blessing Lv 10 and
  3822. Increase AGI Lv 5, and display appropriate effects.
  3823. ---------------------------------------
  3824. *npcskilleffect <skill id>,<number>,<x>,<y>;
  3825. *npcskilleffect "<skill name>",<number>,<x>,<y>;
  3826. This command behaves identically to 'skilleffect', however, the effect will not
  3827. be centered on the invoking character's sprite, nor on the NPC sprite, if any,
  3828. but will be centered at map coordinates given on the same map as the invoking
  3829. character.
  3830. ---------------------------------------
  3831. *specialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
  3832. This command will display special effect with the given number, centered on the
  3833. specified NPCs coordinates, if any. For a full list of special effect numbers
  3834. known see 'doc/effect_list.txt'. Some effect numbers are known not to work in
  3835. some client releases. (Notably, rain is absent from any client executables
  3836. released after April 2005.)
  3837. <NPC name> parameter will display <effect number> on another NPC. If the NPC
  3838. specified does not exist, the command will do nothing. When specifying an NPC,
  3839. <send_target> must be specified when specifying an <NPC Name>, specifying AREA
  3840. will retain the default behavior of the command.
  3841. // this will make the NPC "John Doe#1"
  3842. // show the effect "EF_HIT1" specified by
  3843. // Jane Doe. I wonder what John did...
  3844. mes "[Jane Doe]";
  3845. mes "Well, I never!";
  3846. specialeffect EF_HIT1,AREA,"John Doe#1";
  3847. close;
  3848. ---------------------------------------
  3849. *specialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
  3850. This command behaves identically to 'specialeffect', but the effect will be
  3851. centered on the invoking character's sprite.
  3852. <Player name> parameter will display <effect number> on another Player than the
  3853. one currently attached to the script. Like with specialeffect, when specifying
  3854. a player, <send_target> must be supplied, specifying AREA will retain the default
  3855. behavior of the command.
  3856. ---------------------------------------
  3857. *statusup <stat>{,<char_id>};
  3858. This command will bump a specified stat of the invoking character up by one
  3859. permanently. Stats are to be given as number, but you can use these constants to
  3860. replace them:
  3861. bStr - Strength
  3862. bVit - Vitality
  3863. bInt - Intelligence
  3864. bAgi - Agility
  3865. bDex - Dexterity
  3866. bLuk - Luck
  3867. ---------------------------------------
  3868. *statusup2 <stat>,<amount>{,<char_id>};
  3869. This command will bump a specified stat of the invoking character up by the
  3870. specified amount permanently. The amount can be negative. See 'statusup'.
  3871. // This will decrease a character's Vit forever.
  3872. statusup bVit,-1;
  3873. ---------------------------------------
  3874. *bonus <bonus type>,<val1>;
  3875. *bonus2 <bonus type>,<val1>,<val2>;
  3876. *bonus3 <bonus type>,<val1>,<val2>,<val3>;
  3877. *bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
  3878. *bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
  3879. These commands are meant to be used in item scripts. They will probably work
  3880. outside item scripts, but the bonus will not persist for long. They, as
  3881. expected, refer only to an invoking character.
  3882. You can find the full list of possible bonuses and which command to use for each
  3883. kind in 'doc/item_bonus.txt'.
  3884. ---------------------------------------
  3885. *autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  3886. *autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  3887. *autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
  3888. *autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
  3889. These commands are meant to be used in item scripts. They will probably work
  3890. outside item scripts, but the bonus will not persist for long. They, as
  3891. expected, refer only to an invoking character.
  3892. What these commands do is 'attach' a script to the player which will get
  3893. executed on attack (or when attacked in the case of autobonus2).
  3894. Rate is the trigger rate of the script (1000 = 100%).
  3895. Duration is the time that the bonus will last for since the script has triggered.
  3896. Skill ID/skill name the skill which will be used as trigger to start the bonus. (autobonus3)
  3897. The optional argument 'flag' is used to classify the type of attack where the script
  3898. can trigger (it shares the same flags as the bAutoSpell bonus script):
  3899. Range criteria:
  3900. BF_SHORT: Trigger on melee attack
  3901. BF_LONG: Trigger on ranged attack
  3902. Default: BF_SHORT+BF_LONG
  3903. Attack type criteria:
  3904. BF_WEAPON: Trigger on weapon skills
  3905. BF_MAGIC: Trigger on magic skills
  3906. BF_MISC: Trigger on misc skills
  3907. Default: BF_WEAPON
  3908. Skill criteria:
  3909. BF_NORMAL: Trigger on normal attacks
  3910. BF_SKILL: Trigger on skills
  3911. default: If the attack type is BF_WEAPON (only) BF_NORMAL is used,
  3912. otherwise BF_SKILL+BF_NORMAL is used.
  3913. The difference between the optional argument 'other script' and the 'bonus script' is that,
  3914. the former one triggers only when attacking(or attacked) and the latter one runs on
  3915. status calculation as well, which makes sure, within the duration, the "bonus" that get
  3916. lost on status calculation is restored. So, 'bonus script' is technically supposed to accept
  3917. "bonus" command only. And we usually use 'other script' to show visual effects.
  3918. In all cases, when the script triggers, the attached player will be the one
  3919. who holds the bonus. There is currently no way of knowing within this script
  3920. who was the other character (the attacker in autobonus2, or the target in
  3921. autobonus and autobonus3).
  3922. //Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
  3923. //using weapon or misc attacks (both melee and ranged skills) and shows a special
  3924. //effect when the bonus is active.
  3925. autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
  3926. ---------------------------------------
  3927. *bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};
  3928. This command will attach a script to a player for a given duration, in seconds.
  3929. After that time, the script will automatically expire. The same bonus cannot be
  3930. stacked. By default, this bonus will be stored on `bonus_script` table when player
  3931. logs out.
  3932. Flags (bitmask):
  3933. 1 : Remove when dead.
  3934. 2 : Removable by Dispell.
  3935. 4 : Removable by Clearance.
  3936. 8 : Remove when player logs out.
  3937. 16 : Removeable by Banishing Buster.
  3938. 32 : Removable by Refresh.
  3939. 64 : Removable by Luxanima.
  3940. 128 : Remove when Madogear is activated or deactivated.
  3941. 256 : Remove when receive damage.
  3942. 512 : Script is permanent, cannot be cleared by bonus_script_clear.
  3943. 1024: Force to replace duplicated script by expanding the duration.
  3944. 2048: Force to add duplicated script. This flag cannot be stacked with 1024,
  3945. if both are defined, 1024 will be checked first and ignore this flag.
  3946. Types:
  3947. This will be used to decide negative or positive buff for 'debuff_on_logout'.
  3948. 0: Ignore the buff type and won't be removed if the flag is not &8 (Default)
  3949. 1: Buff
  3950. 2: Debuff
  3951. Status_icon: See "Status Icon" section in 'db/const.txt'. Default is SI_BLANK (-1).
  3952. Example:
  3953. // Apple gives you +5 Str bonus for 1 minute when it's consumed.
  3954. 512,Apple,Apple,0,15,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "{ bonus bStr,5; }",60; },{},{}
  3955. ---------------------------------------
  3956. *bonus_script_clear {<flag>,{<char_id>}};
  3957. Removes attached bonus_script from player. If no 'char_id' given, it will removes
  3958. from the invoker.
  3959. If 'flag' is 1, means will clears all scripts even it's Permanent effect. By default,
  3960. it just removes non-permanent script.
  3961. ---------------------------------------
  3962. *skill <skill id>,<level>{,<flag>};
  3963. *skill "<skill name>",<level>{,<flag>};
  3964. *addtoskill <skill id>,<level>{,<flag>};
  3965. *addtoskill "<skill name>",<level>{,<flag>};
  3966. These commands will give the invoking character a specified skill. This is also
  3967. used for item scripts.
  3968. Level is obvious. Skill id is the ID number of the skill in question as per
  3969. 'db/(pre-)re/skill_db.txt'. It is not known for certain whether this can be used to give
  3970. a character a monster's skill, but you're welcome to try with the numbers given
  3971. in 'db/(pre-)re/mob_skill_db.txt'.
  3972. Flag is 0 if the skill is given permanently (will get written with the character
  3973. data) or 1 if it is temporary (will be lost eventually, this is meant for card
  3974. item scripts usage.). The flag parameter is optional, and defaults to 1 in
  3975. 'skill' and to 2 in 'addtoskill'.
  3976. Flag 2 means that the level parameter is to be interpreted as a stackable
  3977. additional bonus to the skill level. If the character did not have that skill
  3978. previously, they will now at 0+the level given.
  3979. Flag 3 is the same as flag 1 in that it saves to the database. However, these skills
  3980. are ignored when any action is taken that adjusts the skill tree (reset/job change).
  3981. Flag constants:
  3982. 0 - SKILL_PERM
  3983. 1 - SKILL_TEMP
  3984. 2 - SKILL_TEMPLEVEL
  3985. 3 - SKILL_PERM_GRANT
  3986. // This will permanently give the character Stone Throw (TF_THROWSTONE,152), at
  3987. // level 1.
  3988. skill 152,1,0;
  3989. ---------------------------------------
  3990. *nude {<char_id>};
  3991. This command will unequip anything equipped on the invoking character.
  3992. It is not required to do this when changing jobs since 'jobchange' will unequip
  3993. everything not equippable by the new job class anyway.
  3994. ---------------------------------------
  3995. *sit {"<character name>"};
  3996. *stand {"<character name>"};
  3997. These commands will make a character sit or stand.
  3998. If no character is specified, the command will run for the invoking character.
  3999. ---------------------------------------
  4000. *disguise <Monster ID>{,<char_id>};
  4001. *undisguise {<char_id>};
  4002. This command disguises the current player with a monster sprite.
  4003. The disguise lasts until 'undisguise' is issued or the player logs out.
  4004. Example:
  4005. disguise 1002; // Disguise character as a Poring.
  4006. next;
  4007. undisguise; // Return to normal character sprite.
  4008. ---------------------------------------
  4009. *transform <monster ID>,<duration>,<sc type>{,<val1>,<val2>,<val3>,<val4>};
  4010. *transform "<monster name>",<duration>,<sc type>{,<val1>,<val2>,<val3>,<val4>};
  4011. This command will turn a player into a monster for a given duration and grants an
  4012. SC attribute effect while transformed. Note that players cannot be transformed
  4013. during War of Emperium or if already disguised.
  4014. Can only be removed when you die or the duration ends.
  4015. ---------------------------------------
  4016. \\
  4017. 4,3 Marriage-related commands
  4018. \\
  4019. ---------------------------------------
  4020. *marriage("<spouse name>");
  4021. This function will marry two characters, the invoking character and the one
  4022. referred to by name given, together, setting them up as each other's marriage
  4023. partner. No second function call has to be issued (in current SVN at least) to
  4024. make sure the marriage works both ways. The function returns 1 upon success, or
  4025. 0 if the marriage could not be completed, either because the other character
  4026. wasn't found or because one of the two characters is already married.
  4027. This will do nothing else for the marriage except setting up the spouse ID for
  4028. both of these characters. No rings will be given and no effects will be shown.
  4029. ---------------------------------------
  4030. *wedding;
  4031. This command will call up wedding effects - the music and confetti - centered on
  4032. the invoking character. Example can be found in the wedding script.
  4033. ---------------------------------------
  4034. *divorce({<char_id>})
  4035. This function will "un-marry" the invoking character from whoever they were
  4036. married to. Both will no longer be each other's marriage partner, (at least in
  4037. current SVN, which prevents the cases of multi-spouse problems). It will return
  4038. 1 upon success or 0 if the character was not married at all.
  4039. This function will also destroy both wedding rings and send a message to both
  4040. players, telling them they are now divorced.
  4041. ---------------------------------------
  4042. //
  4043. 4,3.- End of marriage-related commands
  4044. //
  4045. ---------------------------------------
  4046. *pcfollow <id>,<target id>;
  4047. *pcstopfollow <id>;
  4048. Makes a character follow or stop following someone. This command does the same
  4049. as the @follow command. The main difference is that @follow can use character
  4050. names, and this commands needs the account ID for the target.
  4051. Examples:
  4052. // This will make Aaron follow Bullah, when both of these characters are online.
  4053. pcfollow getCharID(3,"Aaron"),getCharID(3,"Bullah");
  4054. // Makes Aaron stop following whoever he is following.
  4055. pcstopfollow getCharID(3,"Aaron");
  4056. ---------------------------------------
  4057. *pcblockmove <id>,<option>;
  4058. *unitblockmove <id>,<option>;
  4059. Prevents the given GID from moving when the option is 1, and enables the ID to
  4060. move again when the option is 0. This command will run for the attached unit
  4061. if the given GID is zero.
  4062. Examples:
  4063. // Prevents the current char from moving away.
  4064. pcblockmove getcharid(3),1;
  4065. // Enables the current char to move again.
  4066. pcblockmove getcharid(3),0;
  4067. ---------------------------------------
  4068. ==================================
  4069. |5.- Mob / NPC -related commands.|
  4070. ==================================
  4071. ---------------------------------------
  4072. *monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4073. *areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4074. This command will spawn a monster on the specified coordinates on the specified
  4075. map. If the script is invoked by a character, a special map name, "this", will
  4076. be recognized to mean the name of the map the invoking character is located at.
  4077. This command works fine in the item scripts.
  4078. The same command arguments mean the same things as described above in the
  4079. beginning of this document when talking about permanent monster spawns. Monsters
  4080. spawned in this manner will not respawn upon being killed.
  4081. Unlike the permanent monster spawns, if the mob id is -1, a random monster will
  4082. be picked from the entire database according to the rules configured in the
  4083. server for dead branches. This will work for all other kinds of non-permanent
  4084. monster spawns.
  4085. The only very special thing about this command is an event label, which is an
  4086. optional parameter. This label is written like '<NPC object name>::<label name>'
  4087. and upon the monster being killed, it will execute the script inside of the
  4088. specified NPC object starting from the label given. The RID of the player
  4089. attached at this execution will be the RID of the killing character.
  4090. <size> can be:
  4091. 0 = medium (default)
  4092. 1 = small
  4093. 2 = big
  4094. <ai> can be:
  4095. 0 = none (default)
  4096. 1 = attack/friendly
  4097. 2 = sphere (Alchemist skill)
  4098. 3 = flora (Alchemist skill)
  4099. 4 = zanzou (Kagerou/Oboro skill)
  4100. 5 = legion (Sera skill)
  4101. 6 = faw (Mechanic skill)
  4102. monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
  4103. The coordinates of 0,0 will spawn the monster on a random place on the map.
  4104. The 'areamonster' command works much like the 'monster' command and is not
  4105. significantly different, but spawns the monsters within a square defined by
  4106. x1/y1-x2/y2.
  4107. Returned value is an array with the game ID of the spawned monster(s) depending
  4108. on the amount spawned. Array is stored in $@mobid[].
  4109. Simple monster killing script:
  4110. <Normal NPC object definition. Let's assume you called him NPCNAME.>
  4111. mes "[Summon Man]";
  4112. mes "Want to start the Poring hunt?";
  4113. next;
  4114. if(select("Yes.:No.") == 2) {
  4115. mes "[Summon Man]";
  4116. mes "Come back later.";
  4117. close;
  4118. }
  4119. // Summon 10 Porings.
  4120. // Using coordinates 0,0 will spawn them in a random location.
  4121. monster "prontera",0,0,"Quest Poring",1002,10,"NPCNAME::OnPoringKilled";
  4122. mes "[Summon Man]";
  4123. mes "Now go and kill all the Porings I summoned.";
  4124. close;
  4125. OnPoringKilled:
  4126. $PoringKilled++;
  4127. if ($PoringKilled >= 10) goto L_AllDead;
  4128. end;
  4129. L_AllDead:
  4130. announce "Summon Man: Well done. All the Porings are dead!",3;
  4131. $PoringKilled = 0;
  4132. end;
  4133. For more good examples see just about any official 2-1 or 2-2 job quest script.
  4134. ---------------------------------------
  4135. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4136. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4137. This command will make all monsters of the specified mob ID in the specified
  4138. area use the specified skill. Map name, x, and y define the center of the area,
  4139. which extending <range> cells in each direction (ex: a range of 3 would create
  4140. a 7x7 square). The skill can be specified by skill ID or name. <cast time> is in
  4141. milliseconds (1000 = 1 second), and the rest should be self-explanatory.
  4142. <target type> can be:
  4143. 0 = self
  4144. 1 = the mob's current target
  4145. 2 = the mob's master
  4146. 3 = random target
  4147. Example:
  4148. // spawn 1 Shining Plant in the 5x5 area centered on (155,188)
  4149. areamonster "prontera",153,186,157,190,"Shining Plant",1083,1;
  4150. // make the plant cast level 10 Cold Bolt on a random target
  4151. areamobuseskill "prontera",155,188,2,1083,"MG_COLDBOLT",10,3000,1,e_gg,3;
  4152. ---------------------------------------
  4153. *killmonster "<map name>","<event label>"{,<type>};
  4154. This command will kill all monsters that were spawned with 'monster' or
  4155. 'addmonster' and have a specified event label attached to them. Commonly used to
  4156. get rid of remaining quest monsters once the quest is complete.
  4157. If the label is given as "All", all monsters which have their respawn times set
  4158. to -1 (like all the monsters summoned with 'monster' or 'areamonster' script
  4159. command, and all monsters summoned with GM commands, but no other ones - that
  4160. is, all non-permanent monsters) on the specified map will be killed regardless
  4161. of the event label value.
  4162. As of r12876 killmonster now supports an optional argument type. Using 1 for type
  4163. will make the command fire "OnMyMobDead" events from any monsters that do die
  4164. as a result of this command.
  4165. ---------------------------------------
  4166. *killmonsterall "<map name>"{,<type>};
  4167. This command will kill all monsters on a specified map name, regardless of how
  4168. they were spawned or what they are. As of r12873, The behavior has changed slightly.
  4169. In light of a label behavior fix for mob spawning commands that will now allow the label to
  4170. trigger when there is no player, killmonsterall has also been modified to support this.
  4171. Using this the normal/old way means labels don't trigger when a player didn't
  4172. attack/kill a monster. This is because it breaks compatibility with older scripts if
  4173. forced to use the new method. However, if you wish to use the new label type with this
  4174. command, simply use 1 for type. Any other number won't be recognized.
  4175. ---------------------------------------
  4176. *strmobinfo(<type>,<monster id>);
  4177. This function will return information about a monster record in the database, as
  4178. per 'db/(pre-)re/mob_db.txt'. Type is the kind of information returned. Valid types are:
  4179. It will return 0 if there is no such monster (or the type value is invalid),
  4180. or an empty string if you requested the monster's name.
  4181. 1 - 'english name' field in the database, a string.
  4182. 2 - 'japanese name' field in the database, a string.
  4183. All other returned values are numbers:
  4184. 3 - Level.
  4185. 4 - Maximum HP.
  4186. 5 - Maximum SP.
  4187. 6 - Experience reward.
  4188. 7 - Job experience reward.
  4189. ---------------------------------------
  4190. *mobcount("<map name>","<event label>")
  4191. This function will count all the monsters on the specified map that have a given
  4192. event label and return the number or 0 if it can't find any. Naturally, only
  4193. monsters spawned with 'monster' and 'areamonster' script commands can have non-empty
  4194. event label.
  4195. If you pass this function an empty string for the event label, it will return
  4196. the total count of monster without event label, including permanently spawning monsters.
  4197. With the dynamic mobs system enabled, where mobs are not kept
  4198. in memory for maps with no actual people playing on them, this will return a 0
  4199. for any such map.
  4200. If the event label is given as "all", all monsters will be counted, regardless of
  4201. having any event label attached.
  4202. If the map name is given as "this", the map the invoking character is on will
  4203. be used. If the map is not found, or the invoker is not a character while the map
  4204. is "this", it will return -1.
  4205. ---------------------------------------
  4206. *clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
  4207. This command creates a monster which is a copy of another player. The first
  4208. four arguments serve the same purpose as in the monster script command, The
  4209. <char id> is the character id of the player to clone (player must be online).
  4210. If <master id> is given, the clone will be a 'slave/minion' of it. Master_id
  4211. must be a character id of another online player.
  4212. The mode can be specified to determine the behavior of the clone. Its
  4213. values are the same as the ones used for the mode field in the mob_db. The
  4214. default mode is aggressive, assists, can move, can attack.
  4215. Flag can be either zero or one currently. If zero, the clone is a normal
  4216. monster that'll target players, if one, it is considered a summoned monster,
  4217. and as such, it'll target other monsters. Defaults to zero.
  4218. The duration specifies how long the clone will live before it is auto-removed.
  4219. Specified in seconds, defaults to no limit (zero).
  4220. Returned value is the monster ID of the spawned clone. If command fails,
  4221. returned value is zero.
  4222. ---------------------------------------
  4223. *summon "monster name",<monster id>{,<Time Out>{,"event label"}};
  4224. This command will summon a monster. (see also 'monster') Unlike monsters spawned
  4225. with other commands, this one will set up the monster to fight to protect the
  4226. invoking character. Monster name and mob id obey the same rules as the one given
  4227. at the beginning of this document for permanent monster spawns with the
  4228. exceptions mentioned when describing 'monster' command.
  4229. The effect for the skill 'Call Homunculus' will be displayed centered on the
  4230. invoking character.
  4231. Timeout is the time in milliseconds the summon lives, and is set default
  4232. to 60000 (1 minute). Note that also the value 0 will set the timer to default,
  4233. and it is not possible to create a spawn that lasts forever.
  4234. If an event label is given, upon the monster being killed, the event label will
  4235. run as if by 'donpcevent'.
  4236. Returned value is the game ID of the spawned monster.
  4237. // Will summon a dead branch-style monster to fight for the character.
  4238. summon "--ja--",-1;
  4239. ---------------------------------------
  4240. *addmonsterdrop <monster id>,<item id>,<rate>;
  4241. *addmonsterdrop "<monster name>",<item id>,<rate>;
  4242. *delmonsterdrop <monster id>,<item id>;
  4243. *delmonsterdrop "<monster name>",<item id>;
  4244. These commands will temporarily add or delete a monster drop, which will be reset
  4245. when the mob database reloads or the server shuts down. They return 1 upon success.
  4246. If the monster already drops the specified item, its drop rate will be updated with
  4247. the given rate (100 = 1%).
  4248. Examples:
  4249. // Makes Owl Baron drop Honey at an 80% rate.
  4250. addmonsterdrop 1295,518,8000;
  4251. // Deletes Executioner's Mitten from Rybio.
  4252. delmonsterdrop 1201,7017;
  4253. ---------------------------------------
  4254. *disablenpc "<NPC object name>";
  4255. *enablenpc "<NPC object name>";
  4256. These two commands will disable and enable, respectively, an NPC object
  4257. specified by name. The disabled NPC will disappear from sight and will no longer
  4258. be triggerable in the normal way. It is not clear whether it will still be
  4259. accessible through 'donpcevent' and other triggering commands, but it probably
  4260. will be. You can disable even warp NPCs if you know their object names, which is
  4261. an easy way to make a map only accessible through walking half the time. Then
  4262. you 'enablenpc' them back.
  4263. You can also use these commands to create the illusion of an NPC switching
  4264. between several locations, which is often better than actually moving the NPC -
  4265. create one NPC object with a visible and a hidden part to their name, make a few
  4266. copies, and then disable all except one.
  4267. ---------------------------------------
  4268. *hideonnpc "<NPC object name>";
  4269. *hideoffnpc "<NPC object name>";
  4270. These commands will make the NPC object specified display as hidden/visible,
  4271. even though not actually disabled per se. Hidden as in thief Hide skill, but
  4272. unfortunately, not detectable by Ruwach or Sight.
  4273. As they are now, these commands are pointless, it is suggested to use
  4274. 'disablenpc'/'enablenpc', because these two commands actually unload the NPC
  4275. sprite location and other accompanying data from memory when it is not used.
  4276. However, you can use these for some quest ideas (such as cloaking NPCs talking
  4277. while hidden then revealing.... you can wonder around =P
  4278. ---------------------------------------
  4279. *doevent "<NPC object name>::<event label>";
  4280. This command will start a new execution thread in a specified NPC object at the
  4281. specified label. The execution of the script running this command will not stop,
  4282. and the event called by the 'doevent' command will not run until the invoking
  4283. script has terminated. No parameters may be passed with a doevent call.
  4284. The script of the NPC object invoked in this manner will run as if it's been
  4285. invoked by the RID that was active in the script that issued a 'doevent'. As
  4286. such, the command will not work if an RID is not attached.
  4287. place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
  4288. mes "This is what you will see when you click me";
  4289. close;
  4290. OnLabel:
  4291. mes "This is what you will see if the doevent is activated";
  4292. close;
  4293. }
  4294. ....
  4295. doevent "NPC::OnLabel";
  4296. ---------------------------------------
  4297. *donpcevent "<NPC object name>::<event label>";
  4298. This command invokes the event label code within an another NPC or NPCs. It
  4299. starts a separate instance of execution, and the invoking NPC will resume
  4300. execution its immediately.
  4301. If the supplied event label has the form "NpcName::OnLabel", then only given
  4302. NPC's event label will be invoked (much like 'goto' into another NPC). If the
  4303. form is "::OnLabel" (NPC name omitted), the event code of all NPCs with given
  4304. label will be invoked, one after another. In both cases the invoked script
  4305. will run without an attached RID, whether or not the invoking script was
  4306. attached to a player. The event label name is required to start with "On".
  4307. This command can be used to make other NPCs act, as if they were responding to
  4308. the invoking NPC's actions, such as using an emotion or talking.
  4309. place,100,100,1%TAB%script%TAB%NPC1%TAB%53,{
  4310. mes "NPC2 copies my actions!";
  4311. close2;
  4312. donpcevent "NPC2::OnEmote";
  4313. OnEmote:
  4314. emotion rand(1,30);
  4315. end;
  4316. }
  4317. place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{
  4318. mes "NPC1 copies my actions!";
  4319. close2;
  4320. donpcevent "NPC1::OnEmote";
  4321. OnEmote:
  4322. emotion rand(1,30);
  4323. end;
  4324. }
  4325. Whichever of the both NPCs is talked to, both will show a random emotion at the
  4326. same time.
  4327. As of r16564, command now returns 1 or 0 on success and failure.
  4328. A debug message also shows on the console when no events are triggered.
  4329. ---------------------------------------
  4330. *cmdothernpc "<npc name>","<command>";
  4331. This is simply "donpcevent <npc name>::OnCommand<command>".
  4332. It is an approximation of official server script language's 'cmdothernpc'.
  4333. ---------------------------------------
  4334. *npctalk "<message>";
  4335. This command will display a message to the surrounding area as if the NPC object
  4336. running it was a player talking - that is, above their head and in the chat
  4337. window. The display name of the NPC will get appended in front of the message to
  4338. complete the effect.
  4339. // This will make everyone in the area see the NPC greet the character
  4340. // who just invoked it.
  4341. npctalk "Hello "+strcharinfo(0)+", how are you?";
  4342. ---------------------------------------
  4343. *setnpcdisplay("<npc name>", "<display name>", <class id>, <size>)
  4344. *setnpcdisplay("<npc name>", "<display name>", <class id>)
  4345. *setnpcdisplay("<npc name>", "<display name>")
  4346. *setnpcdisplay("<npc name>", <class id>)
  4347. Changes the display name and/or display class of the target NPC.
  4348. Returns 0 is successful, 1 if the NPC does not exist.
  4349. Size is 0 = normal 1 = small 2 = big.
  4350. ---------------------------------------
  4351. \\
  4352. 5,1.- Time-related commands
  4353. \\
  4354. ---------------------------------------
  4355. *addtimer <ticks>,"NPC::OnLabel";
  4356. *deltimer "NPC::OnLabel";
  4357. *addtimercount <ticks>,"NPC::OnLabel";
  4358. These commands will create, destroy, and delay a countdown timer - 'addtimer' to
  4359. create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified
  4360. number of ticks. For all three cases, the event label given is the identifier of
  4361. that timer. The timer runs on the character object that is attached to the script,
  4362. and can have multiple instances. When the label is run, it is run as if the player that
  4363. the timer runs on has clicked the NPC.
  4364. When this timer runs out, a new execution thread will start in the specified NPC
  4365. object at the specified label.
  4366. The ticks are given in 1/1000ths of a second.
  4367. One more thing. These timers are stored as part of player data. If the player
  4368. logs out, all of these get immediately deleted, without executing the script.
  4369. If this behavior is undesirable, use some other timer mechanism (like 'sleep').
  4370. Example:
  4371. <NPC Header> {
  4372. dispbottom "Starting a 5 second timer...";
  4373. addtimer 5000, strnpcinfo(3)+"::On5secs";
  4374. end;
  4375. On5secs:
  4376. dispbottom "5 seconds have passed!";
  4377. end;
  4378. }
  4379. ---------------------------------------
  4380. *initnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  4381. { "<NPC name>" | <Attach Flag> };
  4382. *stopnpctimer{ "<NPC name>" {, <Detach Flag>} } |
  4383. { "<NPC name>" | <Detach Flag> };
  4384. *startnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  4385. { "<NPC name>" | <Attach Flag> };
  4386. *setnpctimer <tick>{,"<NPC name>"};
  4387. *getnpctimer(<type of information>{,"<NPC name>"})
  4388. *attachnpctimer {"<character name>"};
  4389. *detachnpctimer {"<NPC name>"};
  4390. This set of commands and functions will create and manage an NPC-based timer.
  4391. The NPC name may be omitted, in which case the calling NPC is used as target.
  4392. Contrary to addtimer/deltimer commands which let you have many different timers
  4393. referencing different labels in the same NPC, each with their own countdown,
  4394. 'initnpctimer' can only have one per NPC object. But it can trigger many labels
  4395. and let you know how many were triggered already and how many still remain.
  4396. This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon
  4397. creating this timer, the execution will not stop, but will happily continue
  4398. onward. The timer will then invoke new execution threads at labels
  4399. "OnTimer<time>:" in the NPC object it is attached to.
  4400. To create the timer, use the 'initnpctimer', which will start it running.
  4401. 'stopnpctimer' will pause the timer, without clearing the current tick, while
  4402. 'startnpctimer' will let the paused timer continue.
  4403. By default timers do not have a RID attached, which lets them continue even
  4404. if the player that started them logs off. To attach a RID to a timer, you can
  4405. either use the optional "attach flag" when using 'initnpctimer/startnpctimer',
  4406. or do it manually by using 'attachnpctimer'. Likewise, the optional flag of
  4407. stopnpctimer lets you detach any RID after stopping the timer, and by using
  4408. 'detachnpctimer' you can detach a RID at any time.
  4409. Normally there is only a single timer per NPC, but as an exception, as long as
  4410. you attach a player to the timer, you can have multiple timers running at once,
  4411. because these will get stored on the players instead of the NPC.
  4412. NOTE: You need to attach the RID before the timer _before_ you start it to
  4413. get a player-attached timer. Otherwise it'll stay a NPC timer (no effect).
  4414. If the player that is attached to the npctimer logs out, the "OnTimerQuit:"
  4415. event label of that NPC will be triggered, so you can do the appropriate
  4416. cleanup (the player is still attached when this event is triggered).
  4417. The 'setnpctimer' command will explicitly set the timer to a given tick.
  4418. 'getnpctimer' provides timer information. Its parameter defines what type:
  4419. 0 - Will return the current tick count of the timer.
  4420. 1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the
  4421. specified NPC waiting for execution.
  4422. 2 - Will return the number of times the timer has triggered and will trigger
  4423. an "OnTimer<tick>:" label in the specified NPC.
  4424. Example 1:
  4425. <NPC Header> {
  4426. // We need to use attachnpctimer because the mes command below needs RID attach
  4427. attachnpctimer;
  4428. initnpctimer;
  4429. npctalk "I cant talk right now, give me 10 seconds";
  4430. end;
  4431. OnTimer5000:
  4432. npctalk "Ok 5 seconds more";
  4433. end;
  4434. OnTimer6000:
  4435. npctalk "4";
  4436. end;
  4437. OnTimer7000:
  4438. npctalk "3";
  4439. end;
  4440. OnTimer8000:
  4441. npctalk "2";
  4442. end;
  4443. OnTimer9000:
  4444. npctalk "1";
  4445. end;
  4446. OnTimer10000:
  4447. stopnpctimer;
  4448. mes "[Man]";
  4449. mes "Ok we can talk now";
  4450. detachnpctimer;
  4451. // and remember attachnpctimer and detachnpctimer can only use while the NPC timer is not running !
  4452. }
  4453. Example 2:
  4454. OnTimer15000:
  4455. npctalk "Another 15 seconds have passed.";
  4456. // You have to use 'initnpctimer' instead of 'setnpctimer 0'.
  4457. // This is equal to 'setnpctimer 0' + 'startnpctimer'.
  4458. // Alternatively, you can also insert another 'OnTimer15001' label so that the timer won't stop. */
  4459. initnpctimer;
  4460. end;
  4461. // This OnInit label will run when the script is loaded, so that the timer
  4462. // is initialized immediately as the server starts. It is dropped back to 0
  4463. // every time the NPC says something, so it will cycle continuously.
  4464. OnInit:
  4465. initnpctimer;
  4466. end;
  4467. Example 3:
  4468. mes "[Man]";
  4469. mes "I have been waiting "+(getnpctimer(0)/1000)+" seconds for you.";
  4470. // We divide the timer returned by 1000 to convert milliseconds to seconds.
  4471. close;
  4472. Example 4:
  4473. mes "[Man]";
  4474. mes "Ok, I will let you have 30 more seconds...";
  4475. close2;
  4476. setnpctimer (getnpctimer(0)-30000);
  4477. // Notice the 'close2'. If there were a 'next' there the timer would be
  4478. // changed only after the player pressed the 'next' button.
  4479. end;
  4480. ---------------------------------------
  4481. *sleep {<milliseconds>};
  4482. *sleep2 {<milliseconds>};
  4483. *awake "<NPC name>";
  4484. These commands are used to control the pause of a NPC.
  4485. sleep and sleep2 will pause the script for the given amount of milliseconds.
  4486. Awake is used to cancel a sleep. When awake is called on a NPC it will run as
  4487. if the sleep timer ran out, and thus making the script continue. Sleep and sleep2
  4488. basically do the same, but the main difference is that sleep will not keep the rid,
  4489. while sleep2 does.
  4490. Examples:
  4491. sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore)
  4492. sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached.
  4493. awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'.
  4494. ---------------------------------------
  4495. *progressbar "<color>",<seconds>;
  4496. This command works almost like sleep2, but displays a progress bar
  4497. above the head of the currently attached character (like cast bar).
  4498. Once the given amount of seconds passes, the script resumes. If the
  4499. character moves while the progress bar progresses, it is aborted and
  4500. the script ends. The color format is in RGB (0xRRGGBB). The color is
  4501. currently ignored by the client and appears always green.
  4502. ---------------------------------------
  4503. //
  4504. 5,1.- End of time-related commands
  4505. //
  4506. ---------------------------------------
  4507. *announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  4508. This command will broadcast a message to all or most players, similar to
  4509. @kami/@kamib GM commands.
  4510. announce "This will be shown to everyone at all in yellow.",0;
  4511. The region the broadcast is heard in (target), source of the broadcast
  4512. and the color the message will come up as is determined by the flags.
  4513. The flag values are coded as constants in 'db/const.txt' to make them easier to use.
  4514. Target flags:
  4515. - bc_all: Broadcast message is sent server-wide (default).
  4516. - bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below).
  4517. - bc_area: Message is sent to players in the vicinity of the source.
  4518. - bc_self: Message is sent only to current player.
  4519. You cannot use more than one target flag.
  4520. Source flags:
  4521. - bc_pc: Broadcast source is the attached player (default).
  4522. - bc_npc: Broadcast source is the NPC, not the player attached to the script
  4523. (useful when a player is not attached or the message should be sent to those
  4524. nearby the NPC).
  4525. You cannot use more than one source flag.
  4526. Special flags:
  4527. - bc_yellow: Broadcast will be displayed in yellow color (default).
  4528. - bc_blue: Broadcast will be displayed in blue color.
  4529. - bc_woe: Indicates that this broadcast is 'WoE Information' that can be disabled client-side.
  4530. Due to the way client handles broadcasts, it is impossible to set both bc_blue and bc_woe.
  4531. The optional parameters allow usage of broadcasts in custom colors, font-weights, sizes etc.
  4532. If any of the optional parameters is used, special flag is ignored.
  4533. Optional parameters may not work well (or at all) depending on a game client used.
  4534. The color parameter is a single number which can be in hexadecimal notation.
  4535. For example:
  4536. announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
  4537. Will display a global announce in green. The color format is in RGB (0xRRGGBB).
  4538. In official scripts only two font-weights (types) are used:
  4539. - normal (FW_NORMAL = 400, default),
  4540. - bold (FW_BOLD = 700).
  4541. Default font size is 12.
  4542. Using this for private messages to players is probably not that good an idea,
  4543. but it can be used instead in NPCs to "preview" an announce.
  4544. // This will be a private message to the player using the NPC that made the
  4545. // announcement
  4546. announce "This is my message just for you",bc_blue|bc_self;
  4547. // This will be shown on everyones screen that is in sight of the NPC.
  4548. announce "This is my message just for you people here",bc_npc|bc_area;
  4549. ---------------------------------------
  4550. *mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  4551. This command will work like 'announce' but will only broadcast to characters
  4552. currently residing on the specified map. The flag and optional parameters
  4553. parameters are the same as in 'announce', but target and source flags are ignored.
  4554. ---------------------------------------
  4555. *areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  4556. This command works like 'announce' but will only broadcast to characters
  4557. residing in the specified x1/y1-x2/y2 rectangle on the map given. The flags and
  4558. optional parameters are the same as in 'announce', but target and source flags are ignored.
  4559. areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0;
  4560. ---------------------------------------
  4561. *callshop "<name>",<option>;
  4562. These are a series of commands used to create dynamic shops.
  4563. The 'callshop' function calls an invisible shop (view -1) as if the player clicked on it.
  4564. The options are:
  4565. 0 = The normal window (buy, sell and cancel)
  4566. 1 = The buy window
  4567. 2 = The sell window
  4568. A shop called with this command will trigger the labels "OnBuyItem" and "OnSellItem"
  4569. (as long as an npcshop* command is executed from that NPC, see note below). These
  4570. labels, if used, will replace how the shop handles the buying and selling of items,
  4571. allowing for the creation of dynamic shops.
  4572. The label "OnBuyItem" sets the following arrays:
  4573. @bought_nameid - item ID bought
  4574. @bought_quantity - amount bought
  4575. The label "OnSellItem" sets the following arrays:
  4576. @sold_nameid - item ID sold
  4577. @sold_quantity - amount sold
  4578. @sold_refine - refine count
  4579. @sold_attribute - if the item is broken (1) or not (0)
  4580. @sold_identify - if the item is identified (1) or not (0)
  4581. @sold_card1 - card slot 1
  4582. @sold_card2 - card slot 2
  4583. @sold_card3 - card slot 3
  4584. @sold_card4 - card slot 4
  4585. Note: These labels will only be triggered if an npcshop* command is executed because these
  4586. commands set a special data on the shop NPC, named master_nd in the source. The above labels
  4587. are triggered in the NPC whose master_nd is given in the shop.
  4588. A full example of a dynamic shop can be found in doc/sample/npc_dynamic_shop.txt.
  4589. ---------------------------------------
  4590. *npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  4591. This command lets you override the contents of an existing NPC shop or cashshop. The
  4592. current sell list will be wiped, and only the items specified with the price
  4593. specified will be for sale.
  4594. The function returns 1 if shop was updated successfully, or 0 if not found.
  4595. NOTES:
  4596. - That you cannot use -1 to specify default selling price!
  4597. - If attached shop type is market shop, need an extra param after price, it's <qty>
  4598. and make sure don't add duplication item!
  4599. ---------------------------------------
  4600. *npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  4601. This command will add more items at the end of the selling list for the
  4602. specified NPC shop or cashshop. If you specify an item already for sell, that item will
  4603. appear twice on the sell list.
  4604. The function returns 1 if shop was updated successfully, or 0 if not found.
  4605. NOTES:
  4606. - That you cannot use -1 to specify default selling price!
  4607. - If attached shop type is market shop, need an extra param after price, it's <qty>
  4608. and make sure don't add duplication item!
  4609. ---------------------------------------
  4610. *npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}};
  4611. This command will remove items from the specified NPC shop or cashshop.
  4612. If the item to remove exists more than once on the shop, all instances will be
  4613. removed.
  4614. Note that the function returns 1 even if no items were removed. The return
  4615. value is only to confirm that the shop was indeed found.
  4616. ---------------------------------------
  4617. *npcshopattach "<name>"{,<flag>};
  4618. This command will attach the current script to the given NPC shop.
  4619. When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem"
  4620. of your script will be executed whenever a player buys/sells from the shop.
  4621. Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[]
  4622. and @sold_quantity[] will be filled up with the items and quantities
  4623. bought/sold.
  4624. The optional parameter specifies whether to attach ("1") or detach ("0") from
  4625. the shop (the default is to attach). Note that detaching will detach any NPC
  4626. attached to the shop, even if it's from another script, while attaching will
  4627. override any other script that may be already attached.
  4628. The function returns 0 if the shop was not found, 1 otherwise.
  4629. NOTES:
  4630. - If attached shop type is market shop, will be default to call the 'buy' window.
  4631. ---------------------------------------
  4632. *npcshopupdate "<name>",<item_id>,<price>{,<stock>}
  4633. Update an entry from shop. If price is 0 means don't change the price, maybe used for
  4634. marketshop to update the stock quantity. Except marketshop type, 'stock' value means
  4635. nothing.
  4636. ---------------------------------------
  4637. *waitingroom "<chatroom name>",<limit>{,"<event label>"{,<trigger>{,<required zeny>{,<min lvl>{,<max lvl>}}}}};
  4638. This command will create a chat room, owned by the NPC object running this
  4639. script and displayed above the NPC sprite.
  4640. The maximum length of a chat room name is 60 letters.
  4641. The limit is the maximum number of people allowed to enter the chat room.
  4642. The attached NPC is included in this count. If the optional event and trigger
  4643. parameters are given, the event label ("<NPC object name>::<label name>")
  4644. will be invoked as if with a 'doevent' upon the number of people in the chat
  4645. room reaching the given triggering amount.
  4646. // The NPC will just show a box above its head that says "Hello World", clicking
  4647. // it will do nothing, since the limit is zero.
  4648. waitingroom "Hello World",0;
  4649. // The NPC will have a box above its head, it will say "Disco - Waiting Room"
  4650. // and will have 8 waiting slots. Clicking this will enter the chat room, where
  4651. // the player will be able to wait until 7 players accumulate. Once this happens,
  4652. // it will cause the NPC "Bouncer" run the label "OnStart".
  4653. waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",7;
  4654. // The NPC will have a box above its head, it will say "Party - Waiting Room"
  4655. // and will have 8 waiting slots. Clicking this will allow a player who has
  4656. // 5000 zeny and lvl 50~99 to enter the chat room, where the player will be
  4657. // able to wait until 7 players accumulate. Once this happens, it will cause
  4658. // the NPC "Bouncer" run the label "OnStart".
  4659. waitingroom "Party - Waiting Room",8,"Bouncer::OnStart",7,5000,50,99;
  4660. Creating a waiting room does not stop the execution of the script and it will
  4661. continue to the next line.
  4662. For more examples see the 2-1 and 2-2 job quest scripts which make extensive use
  4663. of waiting rooms.
  4664. ---------------------------------------
  4665. *delwaitingroom {"<NPC object name"};
  4666. This command will delete a waiting room. If no parameter is given, it will
  4667. delete a waiting room attached to the NPC object running this command, if it is,
  4668. it will delete a waiting room owned by another NPC object. This is the only way
  4669. to get rid of a waiting room, nothing else will cause it to disappear.
  4670. It's not clear what happens to a waiting room if the NPC is disabled with
  4671. 'disablenpc', by the way.
  4672. ---------------------------------------
  4673. *enablewaitingroomevent {"<NPC object name>"};
  4674. *disablewaitingroomevent {"<NPC object name>"};
  4675. *enablearena;
  4676. *disablearena;
  4677. This will enable and disable triggering the waiting room event (see
  4678. 'waitingroom') respectively. Optionally giving an NPC object name will do that
  4679. for a specified NPC object. The chat room will not disappear when triggering is
  4680. disabled and enabled in this manner and players will not be kicked out of it.
  4681. Enabling a chat room event will also cause it to immediately check whether the
  4682. number of users in it exceeded the trigger amount and trigger the event
  4683. accordingly.
  4684. Normally, whenever a waiting room was created to make sure that only one
  4685. character is, for example, trying to pass a job quest trial, and no other
  4686. characters are present in the room to mess up the script.
  4687. The 'enablearena'/'disablearena' commands are just aliases with no parameter.
  4688. These are supposedly left here for compatibility with official server scripts,
  4689. but no rAthena script uses these at the moment.
  4690. ---------------------------------------
  4691. *getwaitingroomstate(<information type>{,"<NPC object name>"})
  4692. This function will return information about the waiting room state for the
  4693. attached waiting room or for a waiting room attached to the specified NPC if
  4694. any.
  4695. The valid information types are:
  4696. 0 - Number of users currently chatting.
  4697. 1 - Maximum number of users allowed.
  4698. 2 - Will return 1 if the waiting room has a trigger set.
  4699. 0 otherwise.
  4700. 3 - Will return 1 if the waiting room is currently disabled.
  4701. 0 otherwise.
  4702. 4 - The Title of the waiting room (string)
  4703. 5 - Password of the waiting room, if any. Pointless, since there is no way to
  4704. set a password on a waiting room right now.
  4705. 16 - Event name of the waiting room (string)
  4706. 32 - Whether or not the waiting room is full.
  4707. 33 - Whether the amount of users in the waiting room is higher than the trigger
  4708. number.
  4709. ---------------------------------------
  4710. *warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
  4711. This command will warp the amount of characters equal to the trigger number of
  4712. the waiting room chat attached to the NPC object running this command to the
  4713. specified map and coordinates, kicking them out of the chat. Those waiting the
  4714. longest will get warped first. It can also do a random warp on the same map
  4715. ("Random" instead of map name) and warp to the save point ("SavePoint").
  4716. The list of characters to warp is taken from the list of the chat room members.
  4717. Those not in the chat room will not be considered even if they are talking to
  4718. the NPC in question. If the number of people is given, exactly this much people
  4719. will be warped.
  4720. This command can also keep track of who just got warped. It does this by setting
  4721. special variables:
  4722. $@warpwaitingpc[] is an array containing the account_id numbers of the
  4723. characters who were just warped.
  4724. $@warpwaitingpcnum contains the number of the character it just warped.
  4725. See also 'getpartymember' for advice on what to do with those variables.
  4726. The obvious way of using this effectively would be to set up a waiting room for
  4727. two characters to be warped onto a random PVP map for a one-on-one duel, for
  4728. example.
  4729. ---------------------------------------
  4730. *waitingroomkick "<NPC object name>" , "<character name>";
  4731. This command kicks the given character from the waiting room attached to the given NPC.
  4732. ---------------------------------------
  4733. *getwaitingroomusers "<NPC object name>";
  4734. This command get all the characters in the waiting room of the given NPC and stores
  4735. their gids in the array .@waitingroom_users[]. Also, stores the the number of characters
  4736. in the variable .@waitingroom_usercount
  4737. ---------------------------------------
  4738. *kickwaitingroomall {"<NPC object name>"};
  4739. This command kicks everybody out of a specified waiting room chat.
  4740. ---------------------------------------
  4741. *setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
  4742. This command sets the 'nosave' flag for the specified map and also gives an
  4743. alternate respawn-upon-relogin point.
  4744. It does not make a map impossible to make a save point on as you would normally
  4745. think, 'savepoint' will still work. It will, however, make the specified map
  4746. kick the reconnecting players off to the alternate map given to the coordinates
  4747. specified.
  4748. ---------------------------------------
  4749. *setmapflag "<map name>",<flag>{,<zone>{,<type>}};
  4750. This command marks a specified map with the given map flag, which will alter the
  4751. behavior of the map. A full list of mapflags is located in 'db/const.txt' with
  4752. the 'mf_' prefix, and documentation can be found in 'doc/mapflags.txt'.
  4753. The map flags alter the behavior of the map regarding teleporting (mf_nomemo,
  4754. mf_noteleport, mf_nowarp, mf_nogo), storing location when disconnected
  4755. (mf_nosave), dead branch usage (mf_nobranch), penalties upon death
  4756. (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty,
  4757. mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use
  4758. skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall),
  4759. current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds,
  4760. mf_fireworks) and whether night will be in effect on this map (mf_nightenabled).
  4761. The optional parameter 'zone' is used to set the zone for restricted mapflags.
  4762. For the 'skill_damage' mapflag, 'zone' functions as 'value' (-100 to 100000) and
  4763. 'type' can be:
  4764. 1: damage against players
  4765. 2: damage against mobs
  4766. 3: damage against bosses
  4767. 4: damage against other
  4768. 5: caster type
  4769. ---------------------------------------
  4770. *removemapflag "<map name>",<flag>{,<zone>};
  4771. This command removes a mapflag from a specified map.
  4772. See 'setmapflag' for a list of mapflags.
  4773. The optional parameter 'zone' is used to remove the zone from restricted mapflags.
  4774. ---------------------------------------
  4775. *getmapflag("<map name>",<flag>{,<type>})
  4776. This command checks the status of a given mapflag and returns the mapflag's state.
  4777. 0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.
  4778. The optional parameter 'type' is used in the 'skill_damage' mapflag:
  4779. 0: if mapflag is set (default)
  4780. 1: damage against players
  4781. 2: damage against mobs
  4782. 3: damage against bosses
  4783. 4: damage against other
  4784. 5: caster type
  4785. ---------------------------------------
  4786. *setbattleflag "<battle flag>",<value>;
  4787. *getbattleflag("<battle flag>")
  4788. Sets or gets the value of the given battle flag.
  4789. Battle flags are the flags found in the battle / *.conf files and is also used in Lupus' variable rates script.
  4790. Examples:
  4791. // Will set the base experience rate to 20x (2000%)
  4792. setBattleFlag "base_exp_rate",2000;
  4793. // Will return the value of the base experience rate (when used after the above example, it would print 2000).
  4794. mes getBattleFlag("base_exp_rate");
  4795. ---------------------------------------
  4796. *warpportal <source x>,<source y>,"<map name>",<target x>,<target y>;
  4797. Creates a warp portal identical to the Acolyte "Warp Portal" skill.
  4798. The source coordinates specify the portal's location on the map of the invoking NPC.
  4799. The target map and coordinates determine the destination of the portal.
  4800. Examples:
  4801. // Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180.
  4802. warpportal 150,150,"prontera",150,180;
  4803. ---------------------------------------
  4804. *mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
  4805. This command will collect all characters located on the From map and warp them
  4806. wholesale to the same point on the To map, or randomly distribute them there if
  4807. the coordinates are zero. "Random" is understood as a special To map name and
  4808. will mean randomly shuffling everyone on the same map.
  4809. Optionally, a type and ID can be specified. Available types are:
  4810. 0 - Everyone
  4811. 1 - Guild
  4812. 2 - Party
  4813. Example:
  4814. // Will warp all members of guild with ID 63 on map prontera to map alberta.
  4815. mapwarp "prontera","alberta",150,150,1,63;
  4816. ---------------------------------------
  4817. \\
  4818. 5,2.- Guild-related commands
  4819. \\
  4820. ---------------------------------------
  4821. *maprespawnguildid "<map name>",<guild id>,<flag>;
  4822. This command goes through the specified map and for each player and monster
  4823. found there does stuff.
  4824. Flag is a bit-mask (add up numbers to get effects you want)
  4825. 1 - warp all guild members to their save points.
  4826. 2 - warp all non-guild members (including guildless players) to their save points.
  4827. 4 - remove all monsters which are not guardian or Emperium.
  4828. Flag 7 will, therefore, mean 'wipe all mobs but guardians and the Emperium and
  4829. kick all characters out', which is what the official scripts do upon castle
  4830. surrender. Upon start of WoE, the scripts do 2 (warp all intruders out).
  4831. For examples, check the WoE scripts in the distribution.
  4832. ---------------------------------------
  4833. *agitstart;
  4834. *agitend;
  4835. *agitstart2;
  4836. *agitend2;
  4837. These four commands will start and end War of Emperium or War of Emperium SE.
  4838. This is a bit more complex than it sounds, since the commands themselves won't
  4839. actually do anything interesting, except causing all 'OnAgitStart:' and
  4840. 'OnAgitEnd:', or 'OnAgitStart2:' and 'OnAgitEnd2:' in the case of latter two
  4841. commands, events to run everywhere, respectively. They are used as simple
  4842. triggers to run a lot of complex scripts all across the server, and they,
  4843. in turn, are triggered by clock with an 'OnClock<time>:' time-triggering label.
  4844. ---------------------------------------
  4845. *gvgon "<map name>";
  4846. *gvgoff "<map name>";
  4847. These commands will turn GVG mode for the specified maps on and off, setting up
  4848. appropriate map flags. In GVG mode, maps behave as if during the time of WoE,
  4849. even though WoE itself may or may not actually be in effect.
  4850. ---------------------------------------
  4851. *flagemblem <guild id>;
  4852. This command only works when run by the NPC objects which have sprite id 722,
  4853. which is a 3D guild flag sprite. If it isn't, the data will change, but nothing
  4854. will be seen by anyone. If it is invoked in that manner, the emblem of the
  4855. specified guild will appear on the flag, though, if any players are watching it
  4856. at this moment, they will not see the emblem change until they move out of sight
  4857. of the flag and return.
  4858. This is commonly used in official guildwar scripts with a function call which
  4859. returns a guild id:
  4860. // This will change the emblem on the flag to that of the guild that owns
  4861. // "guildcastle"
  4862. flagemblem GetCastleData("guildcastle",1);
  4863. ---------------------------------------
  4864. *guardian "<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"{,<guardian index>}};
  4865. This command is roughly equivalent to 'monster', but is meant to be used with
  4866. castle guardian monsters and will only work with them. It will set the guardian
  4867. characteristics up according to the castle's investment values and otherwise
  4868. set the things up that only castle guardians need.
  4869. Since trunk r12524:
  4870. Returns the id of the mob or 0 if an error occurred.
  4871. When 'guardian index' isn't supplied it produces a temporary guardian.
  4872. Temporary guardians are not saved with the castle and can't be accessed by guardianinfo.
  4873. ---------------------------------------
  4874. *guardianinfo("<map name>", <guardian number>, <type>);
  4875. This function will return various info about the specified guardian, or -1
  4876. if it fails for some reason. It is primarily used in the castle manager NPC.
  4877. Map name and guardian number (value between 0 and 7) define the target.
  4878. Type indicates what information to return:
  4879. 0 - visibility (whether the guardian is installed or not)
  4880. 1 - max. hp
  4881. 2 - current hp
  4882. ---------------------------------------
  4883. //
  4884. 5,2.- End of guild-related commands
  4885. //
  4886. ---------------------------------------
  4887. *npcspeed <speed value>;
  4888. *npcwalkto <x>,<y>;
  4889. *npcstop;
  4890. These commands will make the NPC object in question move around the map. As they
  4891. currently are, they are a bit buggy and are not useful for much more than making
  4892. an NPC move randomly around the map.
  4893. 'npcspeed' will set the NPCs walking speed to a specified value. As in the
  4894. @speed GM command, 200 is the slowest possible speed while 0 is the fastest
  4895. possible (instant motion). 100 is the default character walking speed.
  4896. 'npcwalkto' will start the NPC sprite moving towards the specified coordinates
  4897. on the same map it is currently on. The script proceeds immediately after the
  4898. NPC begins moving.
  4899. 'npcstop' will stop the motion.
  4900. While in transit, the NPC will be clickable, but invoking it will cause it to
  4901. stop moving, which will make its coordinates different from what the client
  4902. computed based on the speed and motion coordinates. The effect is rather
  4903. unnerving.
  4904. Only a few NPC sprites have walking animations, and those that do, do not get
  4905. the animation invoked when moving the NPC, due to the problem in the NPC walking
  4906. code, which looks a bit silly. You might have better success by defining a job-
  4907. sprite based sprite id in 'db/mob_avail.txt' with this.
  4908. ---------------------------------------
  4909. *movenpc "<NPC name>",<x>,<y>{,<dir>};
  4910. This command looks like the NPCWalkToxy function,but is a little different.
  4911. While NPCWalkToXY just makes the NPC 'walk' to the coordinates given (which
  4912. sometimes gives problems if the path isn't a straight line without objects),
  4913. this command just moves the NPC. It basically warps out and in on the current
  4914. and given spot. Direction can be used to change the NPC's facing direction.
  4915. Example:
  4916. // This will move Bugga from it's old coordinates to the new coordinates at 100,20 (if those coordinates are legit).
  4917. moveNPC "Bugga",100,20;
  4918. ---------------------------------------
  4919. =====================
  4920. |6.- Other commands.|
  4921. =====================
  4922. ---------------------------------------
  4923. *debugmes "<message>";
  4924. This command will send the message to the server console (map-server window). It
  4925. will not be displayed anywhere else.
  4926. // Displays "NAME has clicked me!" in the map-server window.
  4927. debugmes strcharinfo(0)+" has clicked me!";
  4928. ---------------------------------------
  4929. *logmes "<message>";
  4930. This command will write the message given to the map server NPC log file, as
  4931. specified in 'conf/log_athena.conf'. In the TXT version of the server, the log
  4932. file is 'log/npclog.log' by default. In the SQL version, if SQL logging is
  4933. enabled, the message will go to the 'npclog' table, otherwise, it will go to the
  4934. same log file.
  4935. If logs are not enabled, nothing will happen.
  4936. ---------------------------------------
  4937. *globalmes "<message>"{,"<NPC name>"};
  4938. This command will send a message to the chat window of all currently connected
  4939. characters.
  4940. If NPC name is specified, the message will be sent as if the sender would be
  4941. the NPC with the said name.
  4942. ---------------------------------------
  4943. *rand(<number>{,<number>});
  4944. This function returns a number ...
  4945. (if you specify one) ... randomly positioned between 0 and the number you specify -1.
  4946. (if you specify two) ... randomly positioned between the two numbers you specify.
  4947. rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9
  4948. rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
  4949. rand(2,5) would result in 2,3,4 or 5
  4950. ---------------------------------------
  4951. *viewpoint <action>,<x>,<y>,<point number>,<color>;
  4952. This command will mark places on the mini map in the client connected to the
  4953. invoking character. It uses the normal X and Y coordinates from the main map.
  4954. The colors of the marks are defined using a hexadecimal number, same as the ones
  4955. used to color text in 'mes' output, but are written as hexadecimal numbers in C.
  4956. (They look like 0x<six numbers>.)
  4957. Action is what you want to do with a point, 1 will set it, while 2 will clear
  4958. it. 0 will also set it, but automatically removes the point after 15 seconds.
  4959. Point number is the number of the point - you can have several. If more than
  4960. one point is drawn at the same coordinates, they will cycle, which can be used
  4961. to create flashing marks.
  4962. // This command will show a mark at coordinates X 30 Y 40, is mark number 1,
  4963. // and will be red.
  4964. viewpoint 1,30,40,1,0xFF0000;
  4965. This will create three points:
  4966. viewpoint 1,30,40,1,0xFF0000;
  4967. viewpoint 1,35,45,2,0xFF0000;
  4968. viewpoint 1,40,50,3,0xFF0000;
  4969. And this is how you remove them:
  4970. viewpoint 2,30,40,1,0xFF0000;
  4971. viewpoint 2,35,45,2,0xFF0000;
  4972. viewpoint 2,40,50,3,0xFF0000;
  4973. The client determines what it does with the points entirely, the server keeps no
  4974. memory of where the points are set whatsoever.
  4975. ---------------------------------------
  4976. *cutin "<filename>",<position>;
  4977. This command will display a picture, usually an NPC illustration, also called
  4978. cutin, for the currently attached client. The position parameter determines the
  4979. placement of the illustration and takes following values:
  4980. 0 - bottom left corner
  4981. 1 - bottom middle
  4982. 2 - bottom right corner
  4983. 3 - middle of screen in a movable window with an empty title bar
  4984. 4 - middle of screen without the window header, but still movable
  4985. The picture is read from data\texture\유저인터페이스\illust, from both the GRF archive
  4986. and data folder, and is required to be a bitmap. The file extension .bmp can be
  4987. omitted. Magenta color (#ff00ff) is considered transparent. There is no limit
  4988. placed on the size of the illustrations by the client, although loading of large
  4989. pictures (about 700x700 and larger) causes the client to freeze shortly (lag).
  4990. Typically the size is about 320x480. New illustrations can be added by just
  4991. putting the new file into the location above.
  4992. The client is able to display only one cutin at the same time and each new one
  4993. will cause the old one to disappear. To delete the currently displayed
  4994. illustration without displaying a new one, an empty file name and position 255
  4995. must be used.
  4996. // Displays the Comodo Kafra illustration in lower right corner.
  4997. cutin "kafra_07",2;
  4998. // Typical way to end a script, which displayed an illustration during a
  4999. // dialog with a player.
  5000. mes "See you.";
  5001. close2;
  5002. cutin "",255;
  5003. end;
  5004. ---------------------------------------
  5005. *emotion <emotion number>{,<target>{,"<target name>"}};
  5006. This command makes an object display an emotion sprite above their own as
  5007. if they were doing that emotion. For a full list of emotion numbers,
  5008. see 'db/const.txt' under 'e_'. The not so obvious ones are 'e_what' (a question mark)
  5009. and 'e_gasp' (the exclamation mark).
  5010. The optional target parameter specifies who will get the emotion on top of
  5011. their head. If 0 (the default if omitted), the NPC in current use will show
  5012. the emotion, if 1, the player that is running the script will display it.
  5013. Target name parameter allows to display emotion on top of other NPC/PC without
  5014. event labels. If specified name is not found, command does nothing.
  5015. ---------------------------------------
  5016. *misceffect <effect number>;
  5017. This command, if run from an NPC object that has a sprite, will call up a
  5018. specified effect number, centered on the NPC sprite. If the running code does
  5019. not have an object ID (a 'floating' NPC) or is not running from an NPC object at
  5020. all (an item script) the effect will be centered on the character who's RID got
  5021. attached to the script, if any. For usable item scripts, this command will
  5022. create an effect centered on the player using the item.
  5023. A full list of known effects is found in 'doc/effect_list.txt'. The list of
  5024. those that actually work may differ greatly between client versions.
  5025. ---------------------------------------
  5026. *soundeffect "<effect filename>",<type>;
  5027. *soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
  5028. These two commands will play a sound effect to either the invoking character
  5029. only ('soundeffect') or multiple characters ('soundeffectall'). If the running
  5030. code does not have an object ID (a 'floating' NPC) or is not running from an NPC
  5031. object at all (an item script) the sound will be centered on the character who's
  5032. RID got attached to the script, if any. If it does, it will be centered on that
  5033. object. (an NPC sprite)
  5034. Effect filename is the filename in a GRF. It must have the .wav extension.
  5035. It's not quite certain what the 'type' actually does, it is sent to the client
  5036. directly. It probably determines which directory to play the effect from.
  5037. It's certain that giving 0 for the number will play sound files from '\data\wav\',
  5038. but where the other numbers will read from is unclear.
  5039. The sound files themselves must be in the PCM format, and file names should also
  5040. have a maximum length of 23 characters including the .wav extension:
  5041. soundeffect "1234567890123456789.wav", 0; // this will play the soundeffect
  5042. soundeffect "12345678901234567890.wav", 0; // throw gravity error
  5043. You can add your own effects this way, naturally.
  5044. ---------------------------------------
  5045. *playBGM "<BGM filename>";
  5046. *playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
  5047. These two commands will play a Background Music to either the invoking character
  5048. only ('playBGM') or multiple characters ('playBGMall').
  5049. BGM filename is the filename in /BGM/ folder. It has to be in .mp3 extension.
  5050. It's not required to specify the extension inside the script.
  5051. If coordinates are omitted, BGM will be broadcasted on the entire map. If the map name
  5052. is omitted as well the BGM will be played for the entire server.
  5053. You can add your own BGMs this way, naturally.
  5054. ---------------------------------------
  5055. *pvpon "<map name>";
  5056. *pvpoff "<map name>";
  5057. These commands will turn PVP mode for the specified maps on and off. Beside
  5058. setting the flags referred to in 'setmapflag', 'pvpon' will also create a PVP
  5059. timer and ranking as will @pvpon GM command do.
  5060. ---------------------------------------
  5061. *atcommand "<command>";
  5062. This command will run the given command line exactly as if it was typed in from
  5063. the keyboard by the player connected to the invoking character, and that
  5064. character belonged to an account which had GM level 99.
  5065. // This will ask the invoker for a character name and then use the '@nuke'
  5066. // GM command on them, killing them mercilessly.
  5067. input @player$;
  5068. atcommand "@nuke "+@player$;
  5069. Note that for atcommands bound using 'bindatcmd', this command will execute the
  5070. original atcommand, not the script-bound atcommand.
  5071. ---------------------------------------
  5072. *charcommand "<command>";
  5073. This command will run the given command line exactly as if it was typed in from
  5074. the keyboard from a character that belonged to an account which had GM level 99.
  5075. The commands can also run without an attached rid.
  5076. // This would do the same as above, but now
  5077. // it doesn't need a player attached by default.
  5078. charcommand "#option 0 0 0 Roy";
  5079. ---------------------------------------
  5080. *bindatcmd "<command>","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};
  5081. This command will bind a NPC event label to an atcommand. Upon execution of the
  5082. atcommand, the user will invoke the NPC event label. Each atcommand is only allowed
  5083. one binding. If you rebind, it will override the original binding.
  5084. The following variables are set upon execution:
  5085. .@atcmd_command$ = The name of the @command used.
  5086. .@atcmd_parameters$[] = Array containing the given parameters, starting from an index of 0.
  5087. .@atcmd_numparameters = The number of parameters defined.
  5088. Example:
  5089. When a user types the command "@test", an angel effect will be shown.
  5090. - script atcmd_example -1,{
  5091. OnInit:
  5092. bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
  5093. end;
  5094. OnAtcommand:
  5095. specialeffect2 338;
  5096. end;
  5097. }
  5098. ---------------------------------------
  5099. *unbindatcmd "<command>";
  5100. This command will unbind a NPC event label from an atcommand.
  5101. ---------------------------------------
  5102. *useatcmd "<command>";
  5103. This command will execute a script-bound atcommand for the attached RID. If the
  5104. supplied command is not bound to any script, this command will act like 'atcommand'
  5105. and attempt to execute a source-defined command.
  5106. The three .@atcmd_***** variables will NOT be set when invoking script-bound atcommands
  5107. in this way.
  5108. ---------------------------------------
  5109. \\
  5110. 6,1.- Unit-related commands
  5111. \\
  5112. ---------------------------------------
  5113. *unitwalk <GID>,<x>,<y>{,"<event label>"};
  5114. *unitwalkto <GID>,<Target GID>{,"<event label>"};
  5115. This command will tell a <GID> to walk to a position, defined either as a set of
  5116. coordinates or another object. The command returns a 1 for success and 0 upon failure.
  5117. If coordinates are passed, the <GID> will walk to the given x,y coordinates on the
  5118. unit's current map. While there is no way to move across an entire map with 1 command
  5119. use, this could be used in a loop to move long distances.
  5120. If an object ID is passed, the initial <GID> will walk to the <Target GID> (similar to
  5121. walking to attack). This is based on the distance from <GID> to <Target ID>. This command
  5122. uses a hard walk check, so it will calculate a walk path with obstacles. Sending a bad
  5123. target ID will result in an error.
  5124. An optional Event Label can be passed as well which will execute when the <GID> has reached
  5125. the given coordinates or <Target GID>.
  5126. Examples:
  5127. // Makes player walk to the coordinates (150,150).
  5128. unitwalk getcharid(3),150,150;
  5129. // Performs a conditional check with the command and reports success or failure to the player.
  5130. if(unitwalk(getcharid(3),150,150))
  5131. dispbottom "Walking you there...";
  5132. else
  5133. dispbottom "That's too far away, man.";
  5134. // Makes player walk to another character named "WalkToMe".
  5135. unitwalkto getcharid(3),getcharid(3,"WalkToMe");
  5136. ---------------------------------------
  5137. *unitattack <GID>,<Target ID>{,<action type>};
  5138. *unitattack <GID>,"<Target Name>"{,<action type>};
  5139. This command will make a <GID> attack the specified target. It returns 1 upon
  5140. success and 0 for all failures.
  5141. If <GID> is a player and a non-zero <action type> is given, the unit will perform a
  5142. continuous attack instead of a single attack.
  5143. ---------------------------------------
  5144. *unitkill <GID>;
  5145. This command will kill a <GID>.
  5146. ---------------------------------------
  5147. *unitwarp <GID>,"<map name>",<x>,<y>;
  5148. This command will warp a <GID> to the specified map and coordinates.
  5149. If <GID> is zero, the command runs for the unit that invoked the script. This can be
  5150. used with "OnTouch" to warp monsters:
  5151. OnTouch:
  5152. unitwarp 0,"this",-1,-1;
  5153. ---------------------------------------
  5154. *unitstopattack <GID>;
  5155. This command will make a <GID> stop attacking.
  5156. ---------------------------------------
  5157. *unitstopwalk <GID>;
  5158. This command will make a <GID> stop moving.
  5159. Note: If this is called from OnTouch, then the walktimer attached to the unit is
  5160. removed from OnTouch which causes this command to not stop the unit from walking.
  5161. Suggest to use 'unitblockmove' to forcefully stop the unit with OnTouch.
  5162. ---------------------------------------
  5163. *unittalk <GID>,"<text>";
  5164. This command will make a <GID> say a message.
  5165. ---------------------------------------
  5166. *unitemote <GID>,<emotion number>;
  5167. This command will make a <GID> display an emotion sprite.
  5168. For a full list of emotion numbers, see 'db/const.txt' under 'e_'.
  5169. ---------------------------------------
  5170. *unitskilluseid <GID>,<skill id>,<skill lvl>{,<target id>,<casttime>};
  5171. *unitskilluseid <GID>,"<skill name>",<skill lvl>{,<target id>,<casttime>};
  5172. *unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>{,<casttime>};
  5173. *unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>{,<casttime>};
  5174. This is the replacement of the older commands, these use the same values for
  5175. GID as the other unit* commands (See 'GID').
  5176. Skill ID is the ID of the skill, skill level is the level of the skill.
  5177. Cast time is the amount of seconds to add or remove from the skill. Use a positive value to
  5178. add and negative value to subtract. Using 0 or no value will use the default skill cast time.
  5179. For the position, the x and y are given in the UnitSkillUsePos.
  5180. ---------------------------------------
  5181. *getunittype <GID>;
  5182. Returns the type of object from the given Game ID. Returns -1 if the given <GID> does not
  5183. exist.
  5184. 0 - Monster
  5185. 1 - Homunculus
  5186. 2 - Pet
  5187. 3 - Mercenary
  5188. 4 - Elemental
  5189. 5 - NPC
  5190. ---------------------------------------
  5191. *getunitname <GID>;
  5192. Gets the name of the given unit. Supported types are monster, homunculus, pet, and NPC.
  5193. Mercenary and Elemental don't support custom names.
  5194. Returns "Unknown" if unit is not found.
  5195. ---------------------------------------
  5196. *setunitname <GID>,"<new name>";
  5197. Changes the name of the given unit to the new name given. Supported types are monster,
  5198. homunculus, and pet. To change an NPC's name, see 'setnpcdisplay'. Mercenary and
  5199. Elemental don't support custom names.
  5200. Changing a homunculus or pet name will be permanent.
  5201. ---------------------------------------
  5202. *getunitdata <GID>,<arrayname>;
  5203. *setunitdata <GID>,<parameter>,<new value>;
  5204. This is used to get and set special data related to the unit.
  5205. With getunitdata, the array given will be filled with the current data. In setunitdata
  5206. the indexes in the array would be used to set that data on the unit.
  5207. Note: When adjusting a unit's stat (STR, AGI, etc) the unit's respective statuses are
  5208. recalculated (HIT, FLEE, etc) automatically. Keep in mind that some stats don't
  5209. affect a unit's status and will have to directly be modified.
  5210. Parameters (indexes) for monsters are:
  5211. UMOB_SIZE
  5212. UMOB_LEVEL
  5213. UMOB_HP
  5214. UMOB_MAXHP
  5215. UMOB_MASTERAID
  5216. UMOB_MAPID
  5217. UMOB_X
  5218. UMOB_Y
  5219. UMOB_SPEED
  5220. UMOB_MODE
  5221. UMOB_AI
  5222. UMOB_SCOPTION
  5223. UMOB_SEX
  5224. UMOB_CLASS
  5225. UMOB_HAIRSTYLE
  5226. UMOB_HAIRCOLOR
  5227. UMOB_HEADBOTTOM
  5228. UMOB_HEADMIDDLE
  5229. UMOB_HEADTOP
  5230. UMOB_CLOTHCOLOR
  5231. UMOB_SHIELD
  5232. UMOB_WEAPON
  5233. UMOB_LOOKDIR
  5234. UMOB_STR
  5235. UMOB_AGI
  5236. UMOB_VIT
  5237. UMOB_INT
  5238. UMOB_DEX
  5239. UMOB_LUK
  5240. UMOB_SLAVECPYMSTRMD
  5241. UMOB_DMGIMMUNE
  5242. UMOB_ATKRANGE
  5243. UMOB_ATKMIN
  5244. UMOB_ATKMAX
  5245. UMOB_MATKMIN
  5246. UMOB_MATKMAX
  5247. UMOB_DEF
  5248. UMOB_MDEF
  5249. UMOB_HIT
  5250. UMOB_FLEE
  5251. UMOB_PDODGE
  5252. UMOB_CRIT
  5253. UMOB_RACE
  5254. UMOB_ELETYPE
  5255. UMOB_ELELEVEL
  5256. UMOB_AMOTION
  5257. UMOB_ADELAY
  5258. UMOB_DMOTION
  5259. -----
  5260. Parameter (indexes) for homunculi are:
  5261. UHOM_SIZE
  5262. UHOM_LEVEL
  5263. UHOM_HP
  5264. UHOM_MAXHP
  5265. UHOM_SP
  5266. UHOM_MAXSP
  5267. UHOM_MASTERCID
  5268. UHOM_MAPID
  5269. UHOM_X
  5270. UHOM_Y
  5271. UHOM_HUNGER
  5272. UHOM_INTIMACY
  5273. UHOM_SPEED
  5274. UHOM_LOOKDIR
  5275. UHOM_CANMOVETICK
  5276. UHOM_STR
  5277. UHOM_AGI
  5278. UHOM_VIT
  5279. UHOM_INT
  5280. UHOM_DEX
  5281. UHOM_LUK
  5282. UHOM_DMGIMMUNE
  5283. UHOM_ATKRANGE
  5284. UHOM_ATKMIN
  5285. UHOM_ATKMAX
  5286. UHOM_MATKMIN
  5287. UHOM_MATKMAX
  5288. UHOM_DEF
  5289. UHOM_MDEF
  5290. UHOM_HIT
  5291. UHOM_FLEE
  5292. UHOM_PDODGE
  5293. UHOM_CRIT
  5294. UHOM_RACE
  5295. UHOM_ELETYPE
  5296. UHOM_ELELEVEL
  5297. UHOM_AMOTION
  5298. UHOM_ADELAY
  5299. UHOM_DMOTION
  5300. -----
  5301. Parameter (indexes) for pets are:
  5302. UPET_SIZE
  5303. UPET_LEVEL
  5304. UPET_HP
  5305. UPET_MAXHP
  5306. UPET_MASTERAID
  5307. UPET_MAPID
  5308. UPET_X
  5309. UPET_Y
  5310. UPET_HUNGER
  5311. UPET_INTIMACY
  5312. UPET_SPEED
  5313. UPET_LOOKDIR
  5314. UPET_CANMOVETICK
  5315. UPET_STR
  5316. UPET_AGI
  5317. UPET_VIT
  5318. UPET_INT
  5319. UPET_DEX
  5320. UPET_LUK
  5321. UPET_DMGIMMUNE
  5322. UPET_ATKRANGE
  5323. UPET_ATKMIN
  5324. UPET_ATKMAX
  5325. UPET_MATKMIN
  5326. UPET_MATKMAX
  5327. UPET_DEF
  5328. UPET_MDEF
  5329. UPET_HIT
  5330. UPET_FLEE
  5331. UPET_PDODGE
  5332. UPET_CRIT
  5333. UPET_RACE
  5334. UPET_ELETYPE
  5335. UPET_ELELEVEL
  5336. UPET_AMOTION
  5337. UPET_ADELAY
  5338. UPET_DMOTION
  5339. -----
  5340. Parameter (indexes) for mercenaries are:
  5341. UMER_SIZE
  5342. UMER_HP
  5343. UMER_MAXHP
  5344. UMER_MASTERCID
  5345. UMER_MAPID
  5346. UMER_X
  5347. UMER_Y
  5348. UMER_KILLCOUNT
  5349. UMER_LIFETIME
  5350. UMER_SPEED
  5351. UMER_LOOKDIR
  5352. UMER_CANMOVETICK
  5353. UMER_STR
  5354. UMER_AGI
  5355. UMER_VIT
  5356. UMER_INT
  5357. UMER_DEX
  5358. UMER_LUK
  5359. UMER_DMGIMMUNE
  5360. UMER_ATKRANGE
  5361. UMER_ATKMIN
  5362. UMER_ATKMAX
  5363. UMER_MATKMIN
  5364. UMER_MATKMAX
  5365. UMER_DEF
  5366. UMER_MDEF
  5367. UMER_HIT
  5368. UMER_FLEE
  5369. UMER_PDODGE
  5370. UMER_CRIT
  5371. UMER_RACE
  5372. UMER_ELETYPE
  5373. UMER_ELELEVEL
  5374. UMER_AMOTION
  5375. UMER_ADELAY
  5376. UMER_DMOTION
  5377. -----
  5378. Parameter (indexes) for elementals are:
  5379. UELE_SIZE
  5380. UELE_HP
  5381. UELE_MAXHP
  5382. UELE_SP
  5383. UELE_MAXSP
  5384. UELE_MASTERCID
  5385. UELE_MAPID
  5386. UELE_X
  5387. UELE_Y
  5388. UELE_LIFETIME
  5389. UELE_MODE
  5390. UELE_SPEED
  5391. UELE_LOOKDIR
  5392. UELE_CANMOVETICK
  5393. UELE_STR
  5394. UELE_AGI
  5395. UELE_VIT
  5396. UELE_INT
  5397. UELE_DEX
  5398. UELE_LUK
  5399. UELE_DMGIMMUNE
  5400. UELE_ATKRANGE
  5401. UELE_ATKMIN
  5402. UELE_ATKMAX
  5403. UELE_MATKMIN
  5404. UELE_MATKMAX
  5405. UELE_DEF
  5406. UELE_MDEF
  5407. UELE_HIT
  5408. UELE_FLEE
  5409. UELE_PDODGE
  5410. UELE_CRIT
  5411. UELE_RACE
  5412. UELE_ELETYPE
  5413. UELE_ELELEVEL
  5414. UELE_AMOTION
  5415. UELE_ADELAY
  5416. UELE_DMOTION
  5417. -----
  5418. Parameter (indexes) for NPCs are:
  5419. UNPC_DISPLAY
  5420. UNPC_LEVEL
  5421. UNPC_HP
  5422. UNPC_MAXHP
  5423. UNPC_MAPID
  5424. UNPC_X
  5425. UNPC_Y
  5426. UNPC_LOOKDIR
  5427. UNPC_STR
  5428. UNPC_AGI
  5429. UNPC_VIT
  5430. UNPC_INT
  5431. UNPC_DEX
  5432. UNPC_LUK
  5433. UNPC_PLUSALLSTAT
  5434. UNPC_DMGIMMUNE
  5435. UNPC_ATKRANGE
  5436. UNPC_ATKMIN
  5437. UNPC_ATKMAX
  5438. UNPC_MATKMIN
  5439. UNPC_MATKMAX
  5440. UNPC_DEF
  5441. UNPC_MDEF
  5442. UNPC_HIT
  5443. UNPC_FLEE
  5444. UNPC_PDODGE
  5445. UNPC_CRIT
  5446. UNPC_RACE
  5447. UNPC_ELETYPE
  5448. UNPC_ELELEVEL
  5449. UNPC_AMOTION
  5450. UNPC_ADELAY
  5451. UNPC_DMOTION
  5452. *Notes:
  5453. - *_SIZE: small (0); medium (1); large (2)
  5454. - *_MAPID: this refers to the map_data index (from src/map/map.c), not the mapindex_db index (from src/common/mapindex.c)
  5455. -- For 'setunitdata', map name can also be passed in as a valid value instead of map ID
  5456. - *_SPEED: 20 - 1000
  5457. - *_MODE: see doc/mob_db_mode_list.txt
  5458. - *_LOOKDIR: north (0), northwest (1), west (2), etc
  5459. - *_CANMOVETICK: seconds * 1000 the unit will be unable to move
  5460. - *_DMGIMMUNE: unit will be immune to damage (1), or will receive damage (0)
  5461. - *_HUNGER: 0 - 100
  5462. - *_INTIMACY: 0 - 1000
  5463. - *_LIFETIME: seconds * 1000 the unit will be 'alive' for
  5464. - *_AMOTION: see doc/mob_db.txt
  5465. - *_ADELAY: see doc/mob_db.txt
  5466. - *_DMOTION: see doc/mob_db.txt
  5467. - UMOB_AI: none (0); attack (1); marine sphere (2); flora (3); zanzou (4); legion (5); faw (6)
  5468. - UMOB_SCOPTION: see the 'Variables' section at the top of this document
  5469. - UMOB_SLAVECPYMSTRMD: make the slave copy the master's mode (1), or not (0)
  5470. - UNPC_PLUSALLSTAT: same as 'bAllStats'; increases/decreses all stats by given amount
  5471. Example:
  5472. // Spawn some Porings and save the Game ID.
  5473. // - Keep in mind, when the 'monster' script command is used,
  5474. // - all the spawned monster GID's are stored in an array
  5475. // - called $@mobid[].
  5476. monster "prontera",149,190,"Poring",1002,10;
  5477. .GID = $@mobid[9]; // Store and modify the 10th Poring spawned to make him stronger!
  5478. // Save the strong Poring's mob data in the @por_arr[] variable. (@por_arr[1] being level, @por_arr[13] being class, etc.)
  5479. // With this data we can have the NPC display or manipulate it how we want. This does not have to be ran before 'setunitdata'.
  5480. getunitdata .GID,@por_arr;
  5481. // Set the max HP of the Poring to 1000 (current HP will also get updated to 1000).
  5482. setunitdata .GID,UMOB_MAXHP,1000;
  5483. ---------------------------------------
  5484. *geteleminfo <type>{,<char_id>};
  5485. Get info of elemental of attached player or player by char_id.
  5486. Other info can be obtained by 'getunitdata' command.
  5487. Valid types are:
  5488. 0: Elemental ID
  5489. 1: Elemental Game ID
  5490. ---------------------------------------
  5491. \\
  5492. 6,1.- End of unit-related commands
  5493. \\
  5494. ---------------------------------------
  5495. *npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;
  5496. *npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;
  5497. This command causes the attached NPC object to cast a skill on the attached
  5498. player. The skill will have no cast time or cooldown. The player must be
  5499. within the default skill range or the command will fail silently.
  5500. The "stat point" parameter temporarily sets all NPC stats to the given value,
  5501. and "NPC level" is the temporary level of the NPC (used in some skills).
  5502. Neither value can be greater than the max level defined in config, and will
  5503. not work properly if the NPC has a mob sprite.
  5504. // Casts Level 10 Heal on the attached player, calculated with
  5505. // all stats 99 and base level 60.
  5506. npcskill "AL_HEAL",10,99,60;
  5507. ---------------------------------------
  5508. *day;
  5509. *night;
  5510. These two commands will switch the entire server between day and night mode
  5511. respectively. If your server is set to cycle between day and night by
  5512. configuration, it will eventually return to that cycle.
  5513. Example:
  5514. - script DayNight -1,{
  5515. OnClock0600:
  5516. day;
  5517. end;
  5518. OnInit:
  5519. // setting correct mode upon server start-up
  5520. if(gettime(3)>=6 && gettime(3)<18) end;
  5521. OnClock1800:
  5522. night;
  5523. end;
  5524. }
  5525. This script allows to emulate the day/night cycle as the server does, but also
  5526. allows triggering additional effects upon change, like announces, gifts, etc.
  5527. The day/night cycle set by configuration should be disabled when this script is used.
  5528. ---------------------------------------
  5529. *defpattern <set number>,"<regular expression pattern>","<event label>";
  5530. *activatepset <set number>;
  5531. *deactivatepset <set number>;
  5532. *deletepset <set number>;
  5533. This set of commands is only available if the server is compiled with regular
  5534. expressions library enabled. Default compilation and most binary distributions
  5535. aren't, which is probably bad, since these, while complex to use, are quite
  5536. fascinating.
  5537. They will make the NPC object listen for text spoken publicly by players and
  5538. match it against regular expression patterns, then trigger labels associated
  5539. with these regular expression patterns.
  5540. Patterns are organized into sets, which are referred to by a set number. You can
  5541. have multiple sets patterns, and multiple patterns may be active at once.
  5542. Numbers for pattern sets start at 1.
  5543. 'defpattern' will associate a given regular expression pattern with an event
  5544. label. This event will be triggered whenever something a player says is matched
  5545. by this regular expression pattern, if the pattern is currently active.
  5546. 'activatepset' will make the pattern set specified active. An active pattern
  5547. will enable triggering labels defined with 'defpattern', which will not happen
  5548. by default.
  5549. 'deactivatepset' will deactivate a specified pattern set. Giving -1 as a pattern
  5550. set number in this case will deactivate all pattern sets defined.
  5551. 'deletepset' will delete a pattern set from memory, so you can create a new
  5552. pattern set in its place.
  5553. Using regular expressions is high wizardry. But with this high wizardry comes
  5554. unparalleled power of text manipulation. For an explanation of what a regular
  5555. expression pattern is, see a few web pages:
  5556. http://www.regular-expressions.info/
  5557. http://www.weitz.de/regex-coach/
  5558. For an example of this in use, see doc/sample/npc_test_pcre.txt
  5559. With this you could, for example, automatically punish players for asking for
  5560. Zeny in public places, or alternatively, automatically give them Zeny instead if
  5561. they want it so much.
  5562. ---------------------------------------
  5563. *pow(<number>,<power>)
  5564. Returns the result of the calculation.
  5565. Example:
  5566. .@i = pow(2,3); // .@i will be 8
  5567. ---------------------------------------
  5568. *sqrt(<number>)
  5569. Returns the square-root of a number.
  5570. Example:
  5571. .@i = sqrt(25); // .@i will be 5
  5572. ---------------------------------------
  5573. *distance(<x0>,<y0>,<x1>,<y1>)
  5574. Returns distance between 2 points.
  5575. Example:
  5576. .@i = distance(100,200,101,202);
  5577. ---------------------------------------
  5578. *md5("<string>")
  5579. Returns the md5 checksum of a number or string.
  5580. Example:
  5581. mes md5(12345);
  5582. mes md5("12345"); // Will both display 827ccb0eea8a706c4c34a16891f84e7b
  5583. mes md5("qwerty"); // Will display d8578edf8458ce06fbc5bb76a58c5ca4
  5584. ---------------------------------------
  5585. *query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  5586. *query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  5587. Executes an SQL query. A 'select' query can fill array variables with up to 128 rows of values,
  5588. and will return the number of rows (i.e. array size) or -1 on failure/empty array.
  5589. Note that 'query_sql' runs on the main database while 'query_logsql' runs on the log database.
  5590. Example:
  5591. .@nb = query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
  5592. mes "Hall Of Fame: TOP5";
  5593. mes "1."+.@name$[0]+"("+.@fame[0]+")"; // largest fame value.
  5594. mes "2."+.@name$[1]+"("+.@fame[1]+")";
  5595. mes "3."+.@name$[2]+"("+.@fame[2]+")";
  5596. mes "4."+.@name$[3]+"("+.@fame[3]+")";
  5597. mes "5."+.@name$[4]+"("+.@fame[4]+")";
  5598. ---------------------------------------
  5599. *escape_sql(<value>)
  5600. Converts the value to a string and escapes special characters so that it is safe to
  5601. use in query_sql(). Returns the escaped form of the given value.
  5602. Example:
  5603. .@name$ = "John's Laptop";
  5604. .@esc_str$ = escape_sql(.@name$); // Escaped string: John\'s Laptop
  5605. ---------------------------------------
  5606. *setiteminfo(<item id>,<type>,<value>)
  5607. This function will set some value of an item.
  5608. Returns the new value on success, or -1 on fail (item_id not found or invalid type).
  5609. Valid types are:
  5610. 0 - Buy Price; 1 - Sell Price; 2 - Item Type;
  5611. 3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc..
  5612. if = 0, then monsters don't drop it at all (rare or a quest item)
  5613. if = 10000, then this item is sold in NPC shops only
  5614. 4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
  5615. 10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id
  5616. Example:
  5617. setiteminfo 7049,6,9990; // Stone now weighs 999.0
  5618. ---------------------------------------
  5619. *setitemscript(<item id>,<"{ new item script }">{,<type>});
  5620. Set a new script bonus to the Item. Very useful for game events.
  5621. You can remove an item's itemscript by leaving the itemscript argument empty.
  5622. Returns 1 on success, or 0 on fail (item_id not found or new item script is invalid).
  5623. Type can optionally be used indicates which script to set (default is 0):
  5624. 0 - Script
  5625. 1 - OnEquip_Script
  5626. 2 - OnUnequip_Script
  5627. Example:
  5628. setitemscript 2637,"{ if(isequipped(2236)==0)end; if(getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
  5629. setitemscript 2637,"";
  5630. ---------------------------------------
  5631. *atoi("<string>")
  5632. *axtoi("<string>")
  5633. *strtol("<string>", base)
  5634. These commands are used to convert strings to numbers. 'atoi' will interpret
  5635. given string as a decimal number (base 10), while 'axtoi' interprets strings as
  5636. hexadecimal numbers (base 16). 'strtol' lets the user specify a base (valid range
  5637. is between 2 and 36 inclusive, or the special value0, which means auto-detection).
  5638. The 'atoi' and 'strtol' functions conform to the C functions with the same names,
  5639. and 'axtoi' is the same as strtol, with a base of 16. Results are clamped to signed
  5640. 32 bit int range (INT_MIN ~ INT_MAX).
  5641. Examples:
  5642. .@var = atoi("11"); // Sets .@var to 11
  5643. .@var = axtoi("FF"); // Sets .@var to 255
  5644. mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16)
  5645. .@var = strtol("11", 10); // Sets .@var to 11 (11 base 10)
  5646. .@var = strtol("11", 16); // Sets .@var to 17 (11 base 16)
  5647. .@var = strtol("11", 0); // Sets .@var to 11 (11 base 10, auto-detected)
  5648. .@var = strtol("0x11", 0); // Sets .@var to 17 (11 base 16, auto-detected because of the "0x" prefix)
  5649. .@var = strtol("011", 0); // Sets .@var to 9 (11 base 8, auto-detected because of the "0" prefix)
  5650. .@var = strtol("11", 2); // Sets .@var to 3 (binary 11)
  5651. ---------------------------------------
  5652. *compare("<string>","<substring>")
  5653. This command returns 1 or 0 when the substring is in the main string (1) or not (0).
  5654. This command is not case sensitive.
  5655. Examples:
  5656. //dothis; will be executed ('Bloody Murderer' contains 'Blood').
  5657. if (compare("Bloody Murderer","Blood"))
  5658. dothis;
  5659. //dothat; will not be executed ('Blood butterfly' does not contain 'Bloody').
  5660. if (compare("Blood Butterfly","Bloody"))
  5661. dothat;
  5662. ---------------------------------------
  5663. *strcmp("<string>","<string>")
  5664. This command compares two strings are returns a value:
  5665. 1: string 1 > string 2
  5666. 0: strings are equal
  5667. -1: string 1 < string 2
  5668. ---------------------------------------
  5669. *getstrlen("<string>")
  5670. This function will return the length of the string given as an argument. It is
  5671. useful to check if anything input by the player exceeds name length limits and
  5672. other length limits and asking them to try to input something else.
  5673. ---------------------------------------
  5674. *charisalpha("<string>",<position>)
  5675. This function will return 1 if the character number Position in the given string
  5676. is a letter, 0 if it isn't a letter but a digit or a space.
  5677. The first letter is position 0.
  5678. ---------------------------------------
  5679. *charat(<string>,<index>)
  5680. Returns char at specified index. If index is out of range, returns empty string.
  5681. The first letter of a string is index 0.
  5682. Example:
  5683. charat("This is a string", 10); //returns "s"
  5684. ---------------------------------------
  5685. *setchar(<string>,<char>,<index>)
  5686. Returns the original string with the char at the specified index set to the
  5687. specified char. If index out of range, the original string will be returned.
  5688. Only the 1st char in the <char> parameter will be used.
  5689. Example:
  5690. setchar("Cat", "B", 0); //returns "Bat"
  5691. ---------------------------------------
  5692. *insertchar(<string>,<char>,<index>)
  5693. Returns the original string with the specified char inserted at the specified
  5694. index. If index is out of range, the char will be inserted on the end of the
  5695. string that it is closest. Only the 1st char in the <char> parameter will be used.
  5696. Example:
  5697. insertchar("laughter", "s", 0); //returns "slaughter"
  5698. ---------------------------------------
  5699. *delchar(<string>,<index>)
  5700. Returns the original string with the char at the specified index removed.
  5701. If index is out of range, original string will be returned.
  5702. Example:
  5703. delchar("Diet", 3); //returns "Die"
  5704. ---------------------------------------
  5705. *strtoupper(<string>)
  5706. *strtolower(<string>)
  5707. Returns the specified string in its uppercase/lowercase form.
  5708. All non-alpha characters will be preserved.
  5709. Example:
  5710. strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!"
  5711. ---------------------------------------
  5712. *charisupper(<string>,<index>)
  5713. *charislower(<string>,<index>)
  5714. Returns 1 if character at specified index of specified string is
  5715. uppercase/lowercase. Otherwise, 0. Characters not of the alphabet will return 0.
  5716. Example:
  5717. charisupper("rAthena", 1); //returns 1
  5718. ---------------------------------------
  5719. *substr(<string>,<start_index>,<end_index>)
  5720. Returns the sub-string of the specified string inclusively between the set
  5721. indexes. If indexes are out of range, or the start index is after the end
  5722. index, an empty string will be returned.
  5723. Example:
  5724. substr("foobar", 3, 5); //returns "bar"
  5725. ---------------------------------------
  5726. *explode(<dest_array>,<string>,<delimiter>)
  5727. Breaks a string up into substrings based on the specified delimiter. Substrings
  5728. will be stored within the specified string array. Only the 1st char of the
  5729. delimiter parameter will be used. If an empty string is passed as a delimiter,
  5730. the string will be placed in the array in its original form.
  5731. Example:
  5732. explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
  5733. //.@my_array$ contents will be...
  5734. //.@my_array$[0]: "Explode"
  5735. //.@my_array$[1]: "Test"
  5736. //.@my_array$[2]: "1965"
  5737. //.@my_array$[3]: "red"
  5738. //.@my_array$[4]: "PIE"
  5739. ---------------------------------------
  5740. *implode(<string_array>{,<glue>})
  5741. Combines all substrings within the specified string array into a single string.
  5742. If the glue parameter is specified, it will be inserted inbetween each substring.
  5743. Example:
  5744. setarray .@my_array$[0], "This", "is", "a", "test";
  5745. implode(.@my_array$, " "); //returns "This is a test"
  5746. ---------------------------------------
  5747. *sprintf(<format>[,param[,param[,...]]])
  5748. C style sprintf. The resulting string is returned same as in PHP. All C format
  5749. specifiers are supported except %n. More info: sprintf @ www.cplusplus.com.
  5750. The number of params is only limited by rA's script engine.
  5751. Example:
  5752. .@format$ = "The %s contains %d monkeys";
  5753. dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys"
  5754. dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys"
  5755. ---------------------------------------
  5756. *sscanf(<string>,<format>[,param[,param[,...]]])
  5757. C style sscanf. All C format specifiers are supported.
  5758. More info: sscanf @ www.cplusplus.com. The number of params is only limited
  5759. by rA's script engine.
  5760. Example:
  5761. sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$);
  5762. dispbottom(.@num + " " + .@str$); //prints "42 foobar"
  5763. ---------------------------------------
  5764. *strpos(<haystack>,<needle>{,<offset>})
  5765. PHP style strpos. Finds a substring (needle) within a string (haystack).
  5766. The offset parameter indicates the index of the string to start searching.
  5767. Returns index of substring on successful search, else -1.
  5768. Comparison is case sensitive.
  5769. Example:
  5770. strpos("foobar", "bar", 0); //returns 3
  5771. strpos("foobarfoo", "foo", 0); //returns 0
  5772. strpos("foobarfoo", "foo", 1); //returns 6
  5773. ---------------------------------------
  5774. *replacestr(<input>, <search>, <replace>{, <usecase>{, <count>}})
  5775. Replaces all instances of a search string in the input with the specified
  5776. replacement string. By default is case sensitive unless <usecase> is set
  5777. to 0. If specified it will only replace as many instances as specified
  5778. in the count parameter.
  5779. Example:
  5780. replacestr("testing tester", "test", "dash"); //returns "dashing dasher"
  5781. replacestr("Donkey", "don", "mon", 0); //returns "monkey"
  5782. replacestr("test test test test test", "test", "yay", 0, 3); //returns "yay yay yay test test"
  5783. ---------------------------------------
  5784. *countstr(<input>, <search>{, <usecase>})
  5785. Counts all instances of a search string in the input. By default is case
  5786. sensitive unless <usecase> is set to 0.
  5787. Example:
  5788. countstr("test test test Test", "test"); //returns 3
  5789. countstr("cake Cake", "Cake", 0); //returns 2
  5790. ---------------------------------------
  5791. *preg_match(<regular expression pattern>,<string>{,<offset>})
  5792. Searches a string for a match to the regular expression provided. The
  5793. offset parameter indicates the index of the string to start searching.
  5794. Returns offsets to captured substrings, or 0 if no match is found.
  5795. This command is only available if the server is compiled with the regular
  5796. expressions library enabled.
  5797. ---------------------------------------
  5798. *setfont <font>;
  5799. This command sets the current RO client interface font to one of the
  5800. fonts stored in data\*.eot by using an ID of the font. When the ID
  5801. of the currently used font is used, default interface font is used
  5802. again.
  5803. 0 - Default
  5804. 1 - RixLoveangel
  5805. 2 - RixSquirrel
  5806. 3 - NHCgogo
  5807. 4 - RixDiary
  5808. 5 - RixMiniHeart
  5809. 6 - RixFreshman
  5810. 7 - RixKid
  5811. 8 - RixMagic
  5812. 9 - RixJJangu
  5813. ---------------------------------------
  5814. *showdigit <value>{,<type>};
  5815. Displays given numeric 'value' in large digital clock font on top of
  5816. the screen. The optional parameter 'type' specifies visual aspects
  5817. of the "clock" and can be one of the following values:
  5818. 0 - Displays the value for 5 seconds (default).
  5819. 1 - Incremental counter (1 tick/second).
  5820. 2 - Decremental counter (1 tick/second). Does not stop at zero,
  5821. but overflows.
  5822. 3 - Decremental counter (1 tick/second). Two digits only, stops
  5823. at zero.
  5824. For type 1 and 2 the start value is set by using negative number of
  5825. the one intended to set (ex. -10 starts the counter at 10 seconds).
  5826. Except for type 3 the value is interpreted as seconds and formatted
  5827. as time in days, hours, minutes and seconds. Note, that the official
  5828. script command does not have the optional parameter.
  5829. // displays 23:59:59 for 5 seconds
  5830. showdigit 86399;
  5831. // counter that starts at 60 and runs for 60 seconds
  5832. showdigit 60,3;
  5833. ---------------------------------------
  5834. *setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
  5835. Each map cell has several 'flags' that specify the properties of that cell.
  5836. These include terrain properties (walkability, shootability, presence of water),
  5837. skills (basilica, land protector, ...) and other (NPC nearby, no vending, ...).
  5838. Each of these can be 'on' or 'off'. Together they define a cell's behavior.
  5839. This command lets you alter these flags for all map cells in the specified
  5840. (x1,y1)-(x2,y2) rectangle. The 'flag' can be 0 or 1 (0:clear flag, 1:set flag).
  5841. The 'type' defines which flag to modify. Possible options see 'db/const.txt'.
  5842. Example:
  5843. setcell "arena",0,0,300,300,cell_basilica,1;
  5844. setcell "arena",140,140,160,160,cell_basilica,0;
  5845. setcell "arena",135,135,165,165,cell_walkable,0;
  5846. setcell "arena",140,140,160,160,cell_walkable,1;
  5847. This will add a makeshift ring into the center of the map. The ring will be
  5848. surrounded by a 5-cell wide 'gap' to prevent interference from outside, and
  5849. the rest of the map will be marked as 'basilica', preventing observers from
  5850. casting any offensive skills or fighting among themselves. Note that the wall
  5851. will not be shown nor known client-side, which may cause movement problems.
  5852. Another example:
  5853. OnBarricadeDeploy:
  5854. setcell "schg_cas05",114,51,125,51,cell_walkable,0;
  5855. end;
  5856. OnBarricadeBreak:
  5857. setcell "schg_cas05",114,51,125,51,cell_walkable,1;
  5858. end;
  5859. This could be a part of the WoE:SE script, where attackers are not allowed
  5860. to proceed until all barricades are destroyed. This script would place and
  5861. remove a nonwalkable row of cells after the barricade mobs.
  5862. ---------------------------------------
  5863. *checkcell ("<map name>",<x>,<y>,<type>);
  5864. This command will return 1 or 0, depending on whether the specified cell has
  5865. the 'type' flag set or not. There are various types to check, all mimicking
  5866. the server's cell_chk enumeration. The types can be found in 'db/const.txt'.
  5867. The meaning of the individual types can be confusing, so here's an overview:
  5868. - cell_chkwall/water/cliff
  5869. these check directly for the 'terrain component' of the specified cell
  5870. - cell_chkpass/reach/nopass/noreach
  5871. passable = not wall & not cliff, reachable = passable wrt. no-stacking mod
  5872. - cell_chknpc/basilica/landprotector/novending/nochat
  5873. these check for specific dynamic flags (their name indicates what they do)
  5874. Example:
  5875. mes "Pick a destination map.";
  5876. input .@map$;
  5877. mes "Alright, now give me the coordinates.";
  5878. input .@x;
  5879. input .@y;
  5880. if( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) {
  5881. mes "Can't warp you there, sorry!";
  5882. close;
  5883. } else {
  5884. mes "Ok, get ready...";
  5885. close2;
  5886. warp .@map$, .@x, .@y;
  5887. end;
  5888. }
  5889. ---------------------------------------
  5890. *setwall "<map name>",<x>,<y>,<size>,<dir>,<shootable>,"<name>";
  5891. *delwall "<name>";
  5892. Creates an invisible wall, an array of "setcell" starting from x,y and doing a
  5893. line of the given size in the given direction. The difference with setcell is
  5894. this one update client part too to avoid the glitch problem. Directions are the
  5895. same as NPC sprite facing directions: 0=north, 1=northwest, 2=west, etc.
  5896. ---------------------------------------
  5897. *readbook <book id>,<page>;
  5898. This command will open a book item at the specified page.
  5899. ---------------------------------------
  5900. ========================
  5901. |7.- Instance commands.|
  5902. ========================
  5903. ---------------------------------------
  5904. *instance_create("<instance name>");
  5905. Creates an instance for the party of the attached player. The instance name,
  5906. along with all other instance data, is read from 'db/(pre-)re/instance_db.txt'.
  5907. Upon success, the command generates a unique instance ID, duplicates all listed
  5908. maps and NPCs, sets the alive time, and triggers the "OnInstanceInit" label in
  5909. all NPCs inside the instance.
  5910. The command returns the instance ID upon success, and these values upon failure:
  5911. -1: Invalid type.
  5912. -2: Party not found.
  5913. -3: Instance already exists.
  5914. -4: No free instances (MAX_INSTANCE exceeded).
  5915. ---------------------------------------
  5916. *instance_destroy {<instance id>};
  5917. Destroys instance with the ID <instance id>. If no ID is specified, the instance
  5918. the script is attached to is used. If the script is not attached to an instance,
  5919. the instance of the currently attached player's party is used. If that fails,
  5920. the script will come to a halt.
  5921. ---------------------------------------
  5922. *instance_enter("<instance name>"{,<x>,<y>,<char_id>});
  5923. Warps player to the specified instance after the script terminates. The map and
  5924. coordinates are located in 'db/(pre-)re/instance_db.txt'.
  5925. The command returns 0 upon success, and these values upon failure:
  5926. 1: Party not found.
  5927. 2: Party does not have an instance.
  5928. 3: Other errors (invalid instance name, instance doesn't match with party).
  5929. Put -1 for x and y if want to warp player with default entrance coordinates.
  5930. ---------------------------------------
  5931. *instance_npcname("<npc name>"{,<instance id>})
  5932. Returns the unique name of the instanced script. If no ID is specified,
  5933. the instance the script is attached to is used. If the script is not attached to
  5934. an instance, the instance of the currently attached player's party is used. If
  5935. that fails, the script will come to a halt.
  5936. ---------------------------------------
  5937. *instance_mapname("<map name>"{,<instance id>})
  5938. Returns the unique name of the instanced map. If no instance ID is specified,
  5939. the instance the script is attached to is used. If the script is not attached to
  5940. an instance, the instance of the currently attached player's party is used. If
  5941. that fails, the command returns an empty string instead.
  5942. ---------------------------------------
  5943. *instance_id()
  5944. Returns the unique instance id of the attached script. If the script is not
  5945. attached to an instance, the instance of the currently attached player's party is
  5946. used. If that fails, the function will return 0.
  5947. ---------------------------------------
  5948. *instance_warpall "<map name>",<x>,<y>{,<instance id>};
  5949. Warps all players in the instance <instance id> to <map name> at given
  5950. coordinates. If no ID is specified, the instance the script is attached to
  5951. is used. If the script is not attached to an instance, the instance of the
  5952. currently attached player's party is used. If that fails, the script will
  5953. come to a halt.
  5954. ---------------------------------------
  5955. *instance_announce <instance id>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  5956. Broadcasts a message to all players in the instance <instance id> currently
  5957. residing on an instance map. If -1 is specified for <instance id>, the instance
  5958. the script is attached to is used. If the script is not attached to an instance,
  5959. the instance of the currently attached player's party is used.
  5960. For details on the other parameters, see 'announce'.
  5961. ---------------------------------------
  5962. *instance_check_party(<party id>{,<amount>{,<min>{,<max>}}})
  5963. This function checks if a party meets certain requirements, returning 1 if all
  5964. conditions are met and 0 otherwise. It will only check online characters.
  5965. amount - number of online party members (default is 1).
  5966. min - minimum level of all characters in the party (default is 1).
  5967. max - maximum level of all characters in the party (default is max level in conf).
  5968. Example:
  5969. if (instance_check_party(getcharid(1),2,2,149)) {
  5970. mes "Your party meets the Memorial Dungeon requirements.",
  5971. mes "All online members are between levels 1-150 and at least two are online.";
  5972. close;
  5973. } else {
  5974. mes "Sorry, your party does not meet requirements.";
  5975. close;
  5976. }
  5977. ---------------------------------------
  5978. =========================
  5979. |8.- Quest Log commands.|
  5980. =========================
  5981. ---------------------------------------
  5982. *questinfo <Quest ID>,<Icon>{,<Map Mark Color>{,<Job Class>}};
  5983. This is esentially a combination of checkquest and showevent. Use this only
  5984. in an OnInit label. For the Quest ID, specify the quest ID that you want
  5985. checked if it has been started yet.
  5986. For Icon, use one of the following:
  5987. No Icon : QTYPE_NONE
  5988. ! Quest Icon : QTYPE_QUEST
  5989. ? Quest Icon : QTYPE_QUEST2
  5990. ! Job Icon : QTYPE_JOB
  5991. ? Job Icon : QTYPE_JOB2
  5992. ! Event Icon : QTYPE_EVENT
  5993. ? Event Icon : QTYPE_EVENT2
  5994. Warg : QTYPE_WARG
  5995. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410)
  5996. Map Mark Color, when used, creates a mark in the user's mini map on the position of the NPC,
  5997. the available color values are:
  5998. 0 - No Marker
  5999. 1 - Yellow Marker
  6000. 2 - Green Marker
  6001. 3 - Purple Marker
  6002. When a user shows up on a map, each NPC is checked for questinfo that has been set.
  6003. If questinfo is present, it will check if the quest has been started, if it has not, the bubble will appear.
  6004. Optionally, you can also specify a Job Class if the quest bubble should only appear for a certain class.
  6005. Example
  6006. izlude,100,100,4 script Test 844,{
  6007. mes "[Test]";
  6008. mes "Hello World.";
  6009. close;
  6010. OnInit:
  6011. questinfo 1001, QTYPE_QUEST, 0, Job_Novice;
  6012. end;
  6013. }
  6014. ---------------------------------------
  6015. *setquestinfo_level <quest_id>,<min_level>,<max_level>;
  6016. Add level range criteria for quest info with quest id 'quest_id'.
  6017. This command must be used after 'questinfo'.
  6018. ---------------------------------------
  6019. *setquestinfo_req <quest_id>,<req_quest_id>,<state>{,<req_quest_id>,<state>,...};
  6020. Add 'req_quest_id' as requirement for quest info with quest id 'quest_id'.
  6021. Value os 'state' are:
  6022. 0: Player doesn't started 'req_quest_id'.
  6023. 1: Player has 'req_quest_id' (state is either "inactive" or "active").
  6024. 2: Player has 'req_quest_id' completed
  6025. This command must be used after 'questinfo'.
  6026. ---------------------------------------
  6027. *setquestinfo_job <quest_id>,<job_id>{,<job_id>...};
  6028. Add job criteria for quest info with quest id 'quest_id'.
  6029. The job criteria may more than one job_id.
  6030. This command must be used after 'questinfo'.
  6031. ---------------------------------------
  6032. *setquest <ID>{,<char_id>};
  6033. Place quest of <ID> in the users quest log, the state of which is "active".
  6034. If *questinfo is set, and the same ID is specified here, the icon will be cleared when the quest is set.
  6035. ---------------------------------------
  6036. *completequest <ID>{,<char_id>};
  6037. Change the state for the given quest <ID> to "complete" and remove from the users quest log.
  6038. ---------------------------------------
  6039. *erasequest <ID>{,<char_id>};
  6040. Remove the quest of the given <ID> from the user's quest log.
  6041. ---------------------------------------
  6042. *changequest <ID>,<ID2>{,<char_id>};
  6043. Remove quest of the given <ID> from the user's quest log.
  6044. Add quest of the <ID2> to the the quest log, and the state is "active".
  6045. ---------------------------------------
  6046. *checkquest(<ID>{,PLAYTIME|HUNTING{,<char_id>}})
  6047. If no additional argument supplied, return the state of the quest:
  6048. -1 = Quest not started (not in quest log)
  6049. 0 = Quest has been given, but the state is "inactive"
  6050. 1 = Quest has been given, and the state is "active"
  6051. 2 = Quest completed
  6052. If parameter "PLAYTIME" is supplied:
  6053. -1 = Quest not started (not in quest log)
  6054. 0 = the time limit has not yet been reached
  6055. 1 = the time limit has not been reached but the quest is marked as complete
  6056. 2 = the time limit has been reached
  6057. If parameter "HUNTING" is supplied:
  6058. -1 = Quest not started (not in quest log)
  6059. 0 = you haven't killed all of the target monsters and the time limit has not been reached.
  6060. 1 = you haven't killed all of the target monsters but the time limit has been reached.
  6061. 2 = you've killed all of the target monsters
  6062. ---------------------------------------
  6063. *isbegin_quest(<ID>{,<char_id>})
  6064. Return the state of the quest:
  6065. 0 = Quest not started (not in quest log)
  6066. 1 = Quest has been given (state is either "inactive" or "active")
  6067. 2 = Quest completed
  6068. ---------------------------------------
  6069. *showevent <icon>{,<mark color>{,<char_id>}}
  6070. Show an emotion on top of a NPC, and optionally,
  6071. a colored mark in the mini-map like "viewpoint".
  6072. This is used to indicate that a NPC has a quest or an event to
  6073. a certain player.
  6074. Available Icons:
  6075. Remove Icon : QTYPE_NONE
  6076. ! Quest Icon : QTYPE_QUEST
  6077. ? Quest Icon : QTYPE_QUEST2
  6078. ! Job Icon : QTYPE_JOB
  6079. ? Job Icon : QTYPE_JOB2
  6080. ! Event Icon : QTYPE_EVENT
  6081. ? Event Icon : QTYPE_EVENT2
  6082. Warg : QTYPE_WARG
  6083. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410)
  6084. Mark Color:
  6085. 0 - No Mark
  6086. 1 - Yellow Mark
  6087. 2 - Green Mark
  6088. 3 - Purple Mark
  6089. ---------------------------------------
  6090. ============================
  6091. |9.- Battleground commands.|
  6092. ============================
  6093. ---------------------------------------
  6094. *waitingroom2bg_single(<battle group>,"<map name>",<x>,<y>,"<npc name>");
  6095. Adds the first waiting player from the chat room of the given NPC to an
  6096. existing battleground group and warps it to the specified coordinates on
  6097. the given map.
  6098. ---------------------------------------
  6099. *waitingroom2bg("<map name>",<x>,<y>,"<On Quit Event>","<On Death Event>"{,"<NPC Name>"});
  6100. <map name>,<x>,<y> refer to where the "respawn" base is, where the player group will respawn when they die.
  6101. <On Quit Event> refers to an NPC label that attaches to the character and is run when they relog.
  6102. <On Death Event> refers to an NPC label that attaches to the character and is run when they die. Can be "" for empty.
  6103. Unlike the prior command, the latter will attach a GROUP in a waiting room to the battleground, and
  6104. sets the array $@arenamembers[0] where 0 holds the IDs of the first group, and 1 holds the IDs of the second.
  6105. If the optional NPC Name parameter is left out, the waiting room of the current NPC is used.
  6106. Example:
  6107. // Battle Group will be referred to as $@KvM01BG_id1, and when they die, respawn at bat_c01,52,129.
  6108. set $@KvM01BG_id1, waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
  6109. end;
  6110. ---------------------------------------
  6111. *bg_team_setxy <Battle Group ID>,<x>,<y>;
  6112. Updates the respawn point of the given Battle Group to x,y on the same map. <Battle Group ID> can be retrieved using getcharid(4).
  6113. Example:
  6114. bg_team_setxy getcharid(4),56,212;
  6115. mapannounce "bat_a01", "Group [1] has taken the work shop, and will now respawn there.",bc_map,"0xFFCE00";
  6116. end;
  6117. ---------------------------------------
  6118. *bg_warp <Battle Group>,"<map name>",<x>,<y>;
  6119. Similar to the 'warp' command.
  6120. Places all members of <Battle Group> at the specified map and coordinates.
  6121. Example:
  6122. //place the battle group one for Tierra Gorge at starting position.
  6123. bg_warp $@TierraBG1_id1,"bat_a01",352,342;
  6124. end;
  6125. ---------------------------------------
  6126. *bg_monster <Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>";
  6127. *bg_monster(<Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>");
  6128. Similar to the 'monster' command.
  6129. Spawns a monster with allegiance to the given Battle Group.
  6130. Does not allow for the summoning of multiple monsters.
  6131. Monsters are similar to those in War of Emperium, in that the specified Battle Group is considered friendly.
  6132. Example:
  6133. // It can be used in two different ways.
  6134. bg_monster $@TierraBG1_id2,"bat_a01",167,50,"Food Depot",1910,"Feed Depot#1::OnMyMobDead";
  6135. end;
  6136. // Alternatively, you can set an ID for the monster using "set".
  6137. // This becomes useful when used with the command below.
  6138. set $@Guardian_3, bg_monster($@TierraBG1_id2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  6139. end;
  6140. ---------------------------------------
  6141. *bg_monster_set_team <GID>,<Battle Group>;
  6142. This command will change the allegiance if a monster in a battle ground.
  6143. GID can be set when spawning the monster via the 'bg_monster' command.
  6144. Example:
  6145. end;
  6146. OnEnable:
  6147. mapannounce "A guardian has been summoned for Battle Group 2!",bc_map,"0xFFCE00";
  6148. set $@Guardian, bg_monster($@BG_2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  6149. initnpctimer;
  6150. end;
  6151. OnTimer1000:
  6152. stopnpctimer;
  6153. mapannounce "Erm, sorry about that! This monster was meant for Battle Group 1.",bc_map,"0xFFCE00";
  6154. bg_monster_set_team $@Guardian, $@BG_1;
  6155. end;
  6156. ---------------------------------------
  6157. *bg_leave {<char_id>};
  6158. Removes attached player from their Battle Group.
  6159. ---------------------------------------
  6160. *bg_destroy <Batte Group>;
  6161. Destroys the Battle Group created for that battle ground.
  6162. ---------------------------------------
  6163. *areapercentheal "<map name>",<x1>,<y1>,<x2>,<y2>,<hp>,<sp>;
  6164. Restores a percentage of the maximum HP/SP of players within a defined area.
  6165. This is primarily used in battleground scripts, but is not limited to them.
  6166. Example:
  6167. areapercentheal "bat_a01",52,208,61,217,100,100;
  6168. end;
  6169. ---------------------------------------
  6170. *bg_get_data(<Battle Group>,<type>);
  6171. Retrieves data related to given Battle Group. Type can be one of the following:
  6172. 0 - Amount of players currently belonging to the group.
  6173. ---------------------------------------
  6174. *bg_getareausers(<Battle Group>,"<map name>",<x0>,<y0>,<x1>,<y1>);
  6175. Retrieves the amount of players belonging to the given Battle Group on the given
  6176. map within the specified rectangular area.
  6177. ---------------------------------------
  6178. *bg_updatescore "<map name>",<Guillaume Score>,<Croix Score>;
  6179. This command will force the update of the displayed scoreboard.
  6180. It is only usable when the map is defined as a Type 2 Battleground:
  6181. mapflag <map name> battleground 2
  6182. ---------------------------------------
  6183. ====================
  6184. |10.- Pet commands.|
  6185. ====================
  6186. ---------------------------------------
  6187. *bpet;
  6188. This command opens up a pet hatching window on the client connected to the
  6189. invoking character. It is used in item script for the pet incubators and will
  6190. let the player hatch an owned egg. If the character has no eggs, it will just
  6191. open up an empty incubator window.
  6192. This is still usable outside item scripts.
  6193. ---------------------------------------
  6194. *pet <pet id>;
  6195. This command is used in all the item scripts for taming items. Running this
  6196. command will make the pet catching cursor appear on the client connected to the
  6197. invoking character, usable on the monsters with the specified pet ID number. It
  6198. will still work outside an item script.
  6199. A full list of pet IDs can be found inside 'db/pet_db.txt'.
  6200. ---------------------------------------
  6201. *makepet <pet id>;
  6202. This command will create a pet egg and put it in the invoking character's
  6203. inventory. The kind of pet is specified by pet ID numbers listed in
  6204. 'db/pet_db.txt'. The egg is created exactly as if the character just successfully
  6205. caught a pet in the normal way.
  6206. // This will make you a poring:
  6207. makepet 1002;
  6208. Notice that you absolutely have to create pet eggs with this command. If you try
  6209. to give a pet egg with 'getitem', pet data will not be created by the char
  6210. server and the egg will disappear when anyone tries to hatch it.
  6211. ---------------------------------------
  6212. *getpetinfo(<type>{,<char_id>})
  6213. This function will return pet information for the pet the invoking character
  6214. currently has active. Valid types are:
  6215. PETINFO_ID - Pet ID
  6216. PETINFO_CLASS - Pet class number as per 'db/pet_db.txt' - will tell you what kind of a pet it
  6217. is.
  6218. PETINFO_NAME - Pet name. Will return "null" if there's no pet.
  6219. PETINFO_INTIMATE - Pet friendly level (intimacy score). 1000 is full loyalty.
  6220. PETINFO_HUNGRY - Pet hungry level. 100 is completely full.
  6221. PETINFO_RENAMED - Pet rename flag. 0 means this pet has not been named yet.
  6222. PETINFO_LEVEL - Pet level
  6223. PETINFO_BLOCKID - Pet Game ID
  6224. ---------------------------------------
  6225. =============================
  6226. |10.1.- The Pet AI commands.|
  6227. =============================
  6228. ---------------------------------------
  6229. These commands will only work if the invoking character has a pet, and are meant
  6230. to be executed from pet scripts. They will modify the pet AI decision-making for
  6231. the current pet of the invoking character, and will NOT have any independent
  6232. effect by themselves, which is why only one of them each may be in effect at any
  6233. time for a specific pet. A pet may have 'petloot', 'petskillbonus',
  6234. 'petskillattack' OR 'petpetskillattack2' and 'petskillsupport' OR 'petheal' at
  6235. the same time. 'petheal' is deprecated and is no longer used in the default pet
  6236. scripts.
  6237. All commands with delays and durations will only make the behavior active for
  6238. the specified duration of seconds, with a delay of the specified number of
  6239. seconds between activations. Rates are a chance of the effect occurring and are
  6240. given in percent. 'bonusrate' is added to the normal rate if the pet intimacy is
  6241. at the maximum possible.
  6242. The behavior modified with the below mentioned commands will only be exhibited if
  6243. the pet is loyal and appropriate configuration options are set in
  6244. 'battle_athena.conf'.
  6245. Pet scripts in the database normally run whenever a pet of that type hatches
  6246. from the egg. Other commands usable in item scripts (see 'bonus') will also
  6247. happily run from pet scripts. Apparently, the pet-specific commands will also
  6248. work in NPC scripts and modify the behavior of the current pet up until the pet
  6249. is hatched again. (Which will also occur when the character is logged in again
  6250. with the pet still out of the egg.) It is not certain for how long the effect of
  6251. such command running from an NPC script will eventually persist, but apparently,
  6252. it is possible to usefully employ them in usable item scripts to create pet
  6253. buffing items.
  6254. Nobody tried this before, so you're essentially on your own here.
  6255. ---------------------------------------
  6256. *petskillbonus <bonus type>,<value>,<duration>,<delay>;
  6257. This command will make the pet give a bonus to the owner's stat in certain
  6258. duration in seconds and will be repeated for certain delay in seconds.
  6259. For a full bonus list, see 'doc/item_bonus.txt'
  6260. NOTE: Currently ONLY supported for bonuses that used by 'bonus' script.
  6261. ---------------------------------------
  6262. *petrecovery <status type>,<delay>;
  6263. This command will make the pet cure a specified status condition. The curing
  6264. actions will occur once every Delay seconds. For a full list of status
  6265. conditions that can be cured, see the list of 'SC_' status condition constants
  6266. in 'db/const.txt'.
  6267. ---------------------------------------
  6268. *petloot <max items>;
  6269. This command will turn on pet looting, with a maximum number of items to loot
  6270. specified. Pet will store items and return them when the maximum is reached or
  6271. when pet performance is activated.
  6272. ---------------------------------------
  6273. *petskillsupport <skill id>,<skill level>,<delay>,<percent hp>,<percent sp>;
  6274. *petskillsupport "<skill name>",<skill level>,<delay>,<percent hp>,<percent sp>;
  6275. *petheal <level>,<delay>,<percent hp>,<percent sp>;
  6276. This will make the pet use a specified support skill on the owner whenever the
  6277. HP and SP are below the given percent values, with a specified delay time
  6278. between activations. The skill numbers are as per 'db/(pre-)re/skill_db.txt'.
  6279. 'petheal' works the same as 'petskillsupport' but has the skill ID hard-coded to
  6280. AL_HEAL (ID:28). This command is deprecated.
  6281. It's not quite certain who's stats will be used for the skills cast, the
  6282. character's or the pets. Probably, Skotlex can answer that question.
  6283. ---------------------------------------
  6284. *petskillattack <skill id>,<skill level>,<rate>,<bonusrate>;
  6285. *petskillattack "<skill name>",<skill level>,<rate>,<bonusrate>;
  6286. *petskillattack2 <skill id>,<damage>,<number of attacks>,<rate>,<bonusrate>;
  6287. *petskillattack2 "<skill name>",<damage>,<number of attacks>,<rate>,<bonusrate>;
  6288. These two commands will make the pet cast an attack skill on the enemy the pet's
  6289. owner is currently fighting. Skill IDs and levels are as per 'petskillsupport'.
  6290. 'petskillattack2' will make the pet cast the skill with a fixed amount of damage
  6291. inflicted and the specified number of attacks.
  6292. Value of 'rate' is between 1 and 100. 100 = 100%
  6293. ---------------------------------------
  6294. ===========================
  6295. |11.- Homunculus commands.|
  6296. ===========================
  6297. ---------------------------------------
  6298. *homevolution;
  6299. This command will try to evolve the current player's homunculus.
  6300. If it doesn't work, the /swt emotion is shown.
  6301. To evolve a homunculus, the invoking player must have a homunculus,
  6302. the homunculus must not be the last evolution and
  6303. the homunculus must have above 91000 intimacy with its owner.
  6304. ---------------------------------------
  6305. *morphembryo;
  6306. This command will try to put the invoking player's Homunculus in an
  6307. uncallable state, required for mutation into a Homunculus S. The player
  6308. will also receive a Strange Embryo (ID 6415) in their inventory if
  6309. successful, which is deleted upon mutation.
  6310. The command will fail if the invoking player does not have an evolved
  6311. Homunculus at level 99 or above. The /swt emotion is shown upon failure.
  6312. Returns 1 upon success and 0 for all failures.
  6313. ---------------------------------------
  6314. *hommutate {<ID>};
  6315. This command will try to mutate the invoking player's Homunculus into
  6316. a Homunculus S. The Strange Embryo (ID 6415) is deleted upon success.
  6317. The command will fail if the invoking player does not have an evolved
  6318. Homunculus at level 99 or above, if it is not in the embryo state
  6319. (from the 'morphembryo' command), or if the invoking player does not
  6320. possess a Strange Embryo. The /swt emotion is shown upon failure.
  6321. If the optional parameter <ID> is set, the invoking player's Homunculus
  6322. will change into the specified Homunculus ID. Otherwise, a random Homunculus S
  6323. will be chosen. See 'db/homunculus_db.txt' for a full list of IDs.
  6324. Returns 1 upon success and 0 for all failures.
  6325. ---------------------------------------
  6326. *checkhomcall()
  6327. This function checks if the attached player's Homunculus is active,
  6328. and will return the following values:
  6329. -1: The player has no Homunculus.
  6330. 0: The player's Homunculus is active.
  6331. 1: The player's Homunculus is vaporized.
  6332. 2: The player's Homunculus is in morph state.
  6333. ---------------------------------------
  6334. *gethominfo(<type>{,<char_id>})
  6335. This function will return Homunculus information for the Homunculus of the
  6336. invoking character, regardless of its vaporize state. It returns zero or
  6337. "null" if the player does not own a Homunculus.
  6338. Valid types are:
  6339. 0 - Homunculus ID
  6340. 1 - Homunculus Class
  6341. 2 - Homunculus Name
  6342. 3 - Homunculus friendly level (intimacy score). 100000 is full loyalty.
  6343. 4 - Homunculus hungry level. 100 is completely full.
  6344. 5 - Homunculus rename flag. 0 means this homunculus has not been named yet.
  6345. 6 - Homunculus level
  6346. 7 - Homunculus Game ID
  6347. ---------------------------------------
  6348. *homshuffle;
  6349. This will recalculate the homunculus stats according to its level, of the
  6350. current invoking character.
  6351. ---------------------------------------
  6352. ==========================
  6353. |12.- Mercenary commands.|
  6354. ==========================
  6355. ---------------------------------------
  6356. *mercenary_create <class>,<contract time>;
  6357. This command summons a mercenary for a given time (in milliseconds). For a
  6358. list of all available classes, see 'db/mercenary_db.txt'.
  6359. This command is typically used in item scripts of mercenary scrolls.
  6360. ---------------------------------------
  6361. *mercenary_heal <hp>,<sp>;
  6362. This command works like 'heal', but affects the mercenary of the
  6363. currently attached character.
  6364. ---------------------------------------
  6365. *mercenary_sc_start <type>,<tick>,<val1>;
  6366. This command works like 'sc_start', but affects the mercenary of the
  6367. currently attached character.
  6368. ---------------------------------------
  6369. *mercenary_get_calls(<guild>);
  6370. *mercenary_set_calls <guild>,<value>;
  6371. Sets or gets the mercenary calls value for given guild for currently
  6372. attached character. Guild can be one or the following constants:
  6373. ARCH_MERC_GUILD
  6374. SPEAR_MERC_GUILD
  6375. SWORD_MERC_GUILD
  6376. ---------------------------------------
  6377. *mercenary_get_faith(<guild>);
  6378. *mercenary_set_faith <guild>,<value>;
  6379. Sets or gets the mercenary faith value for given guild for currently
  6380. attached character. Guild can be one or the following constants:
  6381. ARCH_MERC_GUILD
  6382. SPEAR_MERC_GUILD
  6383. SWORD_MERC_GUILD
  6384. ---------------------------------------
  6385. *getmercinfo(<type>{,<char id>});
  6386. Retrieves information about mercenary of the currently attached
  6387. character. If char id is given, the information of that character is
  6388. retrieved instead. Type specifies what information to retrieve and
  6389. can be one of the following:
  6390. 0 - Mercenary ID
  6391. 1 - Mercenary Class
  6392. 2 - Mercenary Name
  6393. 3 - Mercenary faith value for this mercenary's guild, if any
  6394. 4 - Mercenary calls value for this mercenary's guild, if any
  6395. 5 - Mercenary kill count
  6396. 6 - Mercenary remaining life time in msec
  6397. 7 - Mercenary level
  6398. 8 - Mercenary Game ID
  6399. If the character does not have a mercenary, the command returns ""
  6400. for name and 0 for all other types.
  6401. ---------------------------------------
  6402. ======================
  6403. |13.- Party commands.|
  6404. ======================
  6405. ---------------------------------------
  6406. *getpartyname(<party id>)
  6407. This function will return the name of a party that has the specified ID number.
  6408. If there is no such party ID, "null" will be returned.
  6409. Lets say the ID of a party was saved as a global variable:
  6410. // This would return the name of the party from the ID stored in a variable
  6411. mes "You're in the '"+getpartyname($@var)+"' party, I know!";
  6412. ---------------------------------------
  6413. *getpartymember <party id>{,<type>{,<array_variable>}};
  6414. This command will find all members of a specified party and returns their names
  6415. (or character id or account id depending on the value of "type") into an array
  6416. of temporary global variables. There's actually quite a few commands like this
  6417. which will fill a special variable with data upon execution and not do anything
  6418. else.
  6419. Upon executing this,
  6420. $@partymembername$[] is a global temporary string array which contains all the
  6421. names of these party members
  6422. (only set when type is 0 or not specified)
  6423. $@partymembercid[] is a global temporary number array which contains the
  6424. character id of these party members.
  6425. (only set when type is 1)
  6426. $@partymemberaid[] is a global temporary number array which contains the
  6427. account id of these party members.
  6428. (only set when type is 2)
  6429. $@partymembercount is the number of party members that were found.
  6430. The party members will (apparently) be found regardless of whether they are
  6431. online or offline. Note that the names come in no particular order.
  6432. Be sure to use $@partymembercount to go through this array, and not
  6433. 'getarraysize', because it is not cleared between runs of 'getpartymember'. If
  6434. someone with 7 party members invokes this script, the array would have 7
  6435. elements. But if another person calls up the NPC, and he has a party of 5, the
  6436. server will not clear the array for you, overwriting the values instead. So in
  6437. addition to returning the 5 member names, the 6th and 7th elements from the last
  6438. call remain, and you will get 5+2 members, of which the last 2 don't belong to
  6439. the new guy's party. $@partymembercount will always contain the correct number,
  6440. (5) unlike 'getarraysize()' which will return 7 in this case.
  6441. If 'array_variable' is set, the result will be stored to that variable instead
  6442. using global variable.
  6443. Example 1: list party member names
  6444. // get the party member names
  6445. getpartymember getcharid(1),0;
  6446. // It's a good idea to copy the global temporary $@partymember*****
  6447. // variables to your own scope variables because if you have pauses in this
  6448. // script (sleep, sleep2, next, close2, input, menu, select, or prompt),
  6449. // another player could click this NPC, trigger 'getpartymember', and
  6450. // overwrite the $@partymember***** variables.
  6451. .@count = $@partymembercount;
  6452. copyarray .@name$[0], $@partymembername$[0], $@partymembercount;
  6453. // list the party member names
  6454. for (.@i = 0; .@i < .@count; .@i++)
  6455. mes (.@i +1) + ". ^0000FF" + .@name$[.@i] + "^000000";
  6456. close;
  6457. Example 2: check party count (with a 'next' pause), before warping to event
  6458. .register_num = 5; // How many party members are required?
  6459. // get the charID and accountID of character's party members
  6460. getpartymember getcharid(1), 1;
  6461. getpartymember getcharid(1), 2;
  6462. if ( $@partymembercount != .register_num ) {
  6463. mes "Please form a party of "+ .register_num +" to continue";
  6464. close;
  6465. }
  6466. // loop through both and use 'isloggedin' to count online party members
  6467. for ( .@i = 0; .@i < $@partymembercount; .@i++ )
  6468. if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
  6469. .@count_online++;
  6470. // We search accountID & charID because a single party can have multiple
  6471. // characters from the same account. Without searching through the charID,
  6472. // if a player has 2 characters from the same account inside the party but
  6473. // only 1 char online, it would count their online char twice.
  6474. if ( .@count_online != .register_num ) {
  6475. mes "All your party members must be online to continue";
  6476. close;
  6477. }
  6478. // copy the array to prevent players cheating the system
  6479. copyarray .@partymembercid, $@partymembercid, .register_num;
  6480. mes "Are you ready ?";
  6481. next; // careful here
  6482. select("Yes");
  6483. // When a script hits a next, menu, sleep or input that pauses the script,
  6484. // players can invite or /leave and make changes in their party. To prevent
  6485. // this, we call getpartymember again and compare with the original values.
  6486. getpartymember getcharid(1), 1;
  6487. if ( $@partymembercount != .register_num ) {
  6488. mes "You've made changes to your party !";
  6489. close;
  6490. }
  6491. for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
  6492. if ( .@partymembercid[.@i] != $@partymembercid[.@i] ) {
  6493. mes "You've made changes to your party !";
  6494. close;
  6495. }
  6496. }
  6497. // Finally, it's safe to start the event!
  6498. warpparty "event_map", 0,0, getcharid(1);
  6499. ---------------------------------------
  6500. *getpartyleader(<party id>{,<type>})
  6501. This function returns some information about the given party-id's leader.
  6502. When type is omitted, the default information retrieved is the leader's name.
  6503. Possible types are:
  6504. 1: Leader account id
  6505. 2: Leader character id
  6506. 3: Leader's class
  6507. 4: Leader's current map name
  6508. 5: Leader's current level as stored on the party structure (may not be
  6509. current level if leader leveled up recently).
  6510. If retrieval fails (leader not found or party does not exist), this function
  6511. returns "null" instead of the character name, and -1 for the other types.
  6512. ---------------------------------------
  6513. *party_create("<party name>"{,<character id>{,<item share>,<item share type>}});
  6514. Organizes a party with the attached or specified character as leader. If
  6515. successful, the command returns 1 and sets the global temporary variable
  6516. "$@party_create_id" to the ID of the party created.
  6517. Additionally, item sharing options can be provided:
  6518. - Item Share: 0-Each Take (default), 1-Party Share
  6519. - Item Share Type: 0-Each Take (default), 1-Even Share
  6520. These values are returned upon failure:
  6521. 0: Unknown error.
  6522. -1: Player not found.
  6523. -2: Player already has a party.
  6524. -3: Party name exists.
  6525. ---------------------------------------
  6526. *party_destroy(<party id>);
  6527. Disbands a party. The command returns 1 upon success and 0 upon failure.
  6528. ---------------------------------------
  6529. *party_addmember(<party id>,<character id>);
  6530. Adds a player to an existing party.
  6531. The command returns 1 upon success, and these values upon failure:
  6532. 0: Unknown error.
  6533. -1: Player not found.
  6534. -2: Player already has a party.
  6535. -3: Party not found.
  6536. -4: Party is full.
  6537. ---------------------------------------
  6538. *party_delmember({<character id>,<party id>});
  6539. Removes a player from his/her party. If no player is specified, the command
  6540. will run for the invoking player. If that player is the only party member
  6541. remaining, the party will be disbanded.
  6542. The command returns 1 upon success, and these values upon failure:
  6543. 0: Unknown error.
  6544. -1: Player not found.
  6545. -2: Party not found.
  6546. -3: Player is not in the party.
  6547. ---------------------------------------
  6548. *party_changeleader(<party id>,<character id>);
  6549. Transfers leadership of a party to the specified character.
  6550. The command returns 1 upon success, and these values upon failure:
  6551. 0: Unknown error.
  6552. -1: Party not found.
  6553. -2: Player not found.
  6554. -3: Player is not in the party.
  6555. -4: Player is already party leader.
  6556. ---------------------------------------
  6557. *party_changeoption(<party id>,<option>,<flag>);
  6558. Changes a party option.
  6559. Valid options are:
  6560. 0 - Exp Share (flags: 0-Each Take, 1-Even Share)
  6561. 1 - Item Share (flags: 0-Each Take, 1-Party Share)
  6562. 2 - Item Share Type (flags: 0-Each Take, 1-Even Share)
  6563. The command returns 1 upon success, and these values upon failure:
  6564. 0: Invalid option.
  6565. -1: Party not found.
  6566. ---------------------------------------
  6567. Whew.
  6568. That's about all of them.