script_commands.txt 306 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508
  1. //===== rAthena Documentation ================================
  2. //= rAthena Script Commands
  3. //===== By: ==================================================
  4. //= rAthena Dev Team
  5. //===== Last Updated: ========================================
  6. //= 20140313
  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. This will define a shop NPC, which, when triggered (which can only be done by
  210. clicking) will cause a shop window to come up. No code whatsoever runs in shop
  211. NPCs and you can't change the prices otherwise than by editing the script
  212. itself. (No variables even exist at this point of scripting, so don't even
  213. bother trying to use them.)
  214. The item id is the number of item in the 'item_db.txt' database. If Price is set
  215. to -1, the 'buy price' given in the item database will be used. Otherwise, the
  216. price you gave will be used for this item, which is how you create differing
  217. prices for items in different shops.
  218. Since trunk r12264 you can alternatively use "cashshop" in place of "shop"
  219. to use the Cash Shop interface, allowing you to buy items with special points
  220. (Currently stored as account vars in global_reg #CASHPOINTS and #KAFRAPOINTS.)
  221. This type of shop will not allow you to sell items at it, you may only
  222. purchase items here. The layout used to define sale items still count, and
  223. "<price>" refers to how many points will be spent purchasing the them.
  224. Since trunk rX you can alternatively use "itemshop" or "pointshop" in place
  225. of "shop" to use the Shop interface, allowing you to buy items with a specific
  226. item or special points from a variable. 'pointshop' only supported variable types
  227. are permanent character variables, temporary character variables, permanent
  228. local account variables, or permanent global account variables. These variables
  229. must be of integer type, not string. 'discount' flag is an option, makes the price
  230. at that shop is affected by discount skill.
  231. ** Define an warp/shop/cashshop/itemshop/pointshop/NPC duplicate.
  232. warp: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
  233. shop/cashshop/itemshop/pointshop/npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  234. shop/cashshop/itemshop/pointshop/npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  235. npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  236. npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  237. This will duplicate an warp/shop/cashshop/itemshop/pointshop/NPC referred to by 'label'.
  238. Warp duplicates inherit the target location.
  239. Shop/cashshop/itemshop/pointshop duplicates inherit the item list.
  240. NPC duplicates inherit the script code.
  241. The rest (name, location, facing, sprite ID, span/trigger area)
  242. is obtained from the definition of the duplicate (not inherited).
  243. ** Define a function object
  244. function%TAB%script%TAB%<function name>%TAB%{<code>}
  245. This will define a function object, callable with the 'callfunc' command (see
  246. below). This object will load on every map server separately, so you can get at
  247. it from anywhere. It's not possible to call the code in this object by
  248. anything other than the 'callfunc' script command.
  249. The code part is the script code that will execute whenever the function is
  250. called with 'callfunc'. It has to be in curly brackets, unlike elsewhere where
  251. we use curly brackets, these do NOT signify an optional parameter.
  252. Once an object is defined which has a 'code' field to its definition, it
  253. contains script commands which can actually be triggered and executed.
  254. ~ RID? GID? ~
  255. What a RID is and why do you need to know
  256. -----------------------------------------
  257. Most scripting commands and functions will want to request data about a
  258. character, store variables referenced to that character, send stuff to the
  259. client connected to that specific character. Whenever a script is invoked by a
  260. character, it is passed a so-called RID - this is the account ID number of a
  261. character that caused the code to execute by clicking on it, walking into its
  262. OnTouch zone, or otherwise.
  263. If you are only writing common NPCs, you don't need to bother with it. However,
  264. if you use functions, if you use timers, if you use clock-based script
  265. activation, you need to be aware of all cases when a script execution can be
  266. triggered without a RID attached. This will make a lot of commands and functions
  267. unusable, since they want data from a specific character, want to send stuff to
  268. a specific client, want to store variables specific to that character, and they
  269. would not know what character to work on if there's no RID.
  270. Unless you use 'attachrid' to explicitly attach a character to the script first.
  271. Whenever we say 'invoking character', we mean 'the character who's RID is
  272. attached to the running script. The script function "playerattached" can be
  273. used to check which is the currently attached player to the script (it will
  274. return 0 if the there is no player attached or the attached player no longer
  275. is logged on to the map-server).
  276. But what about GID?
  277. --- ---- ----- ----
  278. GID stands for the Game ID of something, this can either be the GID obtained
  279. through mobspawn (mob control commands) or the account ID of a character.
  280. Another way would be to right click on a mob,
  281. NPC or char as GM sprited char to view the GID.
  282. This is mostly used for the new version of skill and the mob control commands
  283. implemented (but NEVER documented by Lance. Shame on you...).
  284. Item and pet scripts
  285. --------------------
  286. Each item in the item database has three special fields - Script , OnEquip_Script
  287. and OnUnequip_Script. The first is script code run every time a character equips the item,
  288. with the RID of the equipping character. Every time they unequip an item, all
  289. temporary bonuses given by the script commands are cleared, and all the scripts
  290. are executed once again to rebuild them. This also happens in several other
  291. situations (like upon login) but the full list is currently unknown.
  292. OnEquip_Script is a piece of script code run whenever the item is used by a character
  293. by double-clicking on it. OnUnequip_Script runs whenever the
  294. equipment is unequip by a character
  295. Not all script commands work properly in the item scripts. Where commands and
  296. functions are known to be meant specifically for use in item scripts, they are
  297. described as such.
  298. Every pet in the pet database has a PetScript field, which determines pet
  299. behavior. It is invoked wherever a pet of the specified type is spawned.
  300. (hatched from an egg, or loaded from the char server when a character who had
  301. that pet following them connects) This may occur in some other situations as
  302. well. Don't expect anything other than commands definitely marked as usable in
  303. pet scripts to work in there reliably.
  304. Numbers
  305. -------
  306. Beside the common decimal numbers, which are nothing special whatsoever (though
  307. do not expect to use fractions, since ALL numbers are integer in this language),
  308. the script engine also handles hexadecimal numbers, which are otherwise
  309. identical. Writing a number like '0x<hex digits>' will make it recognized as a
  310. hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try
  311. to 'mes 0x10' it will print '16'.
  312. Number values can't exceed the limits of an integer variable: Any number
  313. greater than INT_MAX (2147483647) or smaller than INT_MIN (-2147483648) will
  314. be capped to those values and will cause a warning to be reported.
  315. Variables
  316. ---------
  317. The meat of every programming language is variables - places where you store
  318. data.
  319. In the rAthena scripting language, variable names are not case sensitive.
  320. Variables are divided into and uniquely identified by the combination of:
  321. prefix - determines the scope and extent (or lifetime) of the variable
  322. name - an identifier consisting of '_' and alphanumeric characters
  323. postfix - determines the type of the variable: integer or string
  324. Scope can be:
  325. global - global to all servers
  326. local - local to the server
  327. account - attached to the account of the character identified by RID
  328. character - attached to the character identified by RID
  329. npc - attached to the NPC
  330. scope - attached to the scope of the instance
  331. Extent can be:
  332. permanent - They still exist when the server resets.
  333. temporary - They cease to exist when the server resets.
  334. Prefix: scope and extent
  335. nothing - A permanent variable attached to the character, the default variable
  336. type. They are stored in the `global_reg_value` table using type 3.
  337. "@" - A temporary variable attached to the character.
  338. SVN versions before 2094 revision and RC5 version will also treat
  339. 'l' as a temporary variable prefix, so beware of having variable
  340. names starting with 'l' if you want full backward compatibility.
  341. "$" - A global permanent variable.
  342. They are stored in database table `mapreg`.
  343. "$@" - A global temporary variable.
  344. This is important for scripts which are called with no RID
  345. attached, that is, not triggered by a specific character object.
  346. "." - A NPC variable.
  347. They exist in the NPC and disappear when the server restarts or the
  348. NPC is reloaded. Can be accessed from inside the NPC or by calling
  349. 'getvariableofnpc'. Function objects can also have .variables which
  350. are accessible from inside the function, however 'getvariableofnpc'
  351. does NOT work on function objects.
  352. ".@" - A scope variable.
  353. They are unique to the instance and scope. Each instance has its
  354. own scope that ends when the script ends. Calling a function with
  355. callsub/callfunc starts a new scope, returning from the function
  356. ends it. When a scope ends, its variables are converted to values
  357. ('return .@var;' returns a value, not a reference).
  358. "'" - An instance variable
  359. These are used with the instancing system, and are unique to each
  360. party's instance.
  361. "#" - A permanent local account variable.
  362. They are stored in the `global_reg_value` table using type 2.
  363. "##" - A permanent global account variable stored by the login server.
  364. They are stored in the `global_reg_value` table using type 1.
  365. The only difference you will note from normal # variables is when
  366. you have multiple char-servers connected to the same login server.
  367. The # variables are unique to each char-server, while the ## variables
  368. are shared by all these char-servers.
  369. Postfix: integer or string
  370. nothing - integer variable, can store positive and negative numbers, but only
  371. whole numbers (so don't expect to do any fractional math)
  372. '$' - string variable, can store text
  373. Examples:
  374. name - permanent character integer variable
  375. name$ - permanent character string variable
  376. @name - temporary character integer variable
  377. @name$ - temporary character string variable
  378. $name - permanent global integer variable
  379. $name$ - permanent global string variable
  380. $@name - temporary global integer variable
  381. $@name$ - temporary global string variable
  382. .name - NPC integer variable
  383. .name$ - NPC string variable
  384. .@name - scope integer variable
  385. .@name$ - scope string variable
  386. #name - permanent local account integer variable
  387. #name$ - permanent local account string variable
  388. ##name - permanent global account integer variable
  389. ##name$ - permanent global account string variable
  390. If a variable was never set, it is considered to equal zero for integer
  391. variables or an empty string ("", nothing between the quotes) for string
  392. variables. Once you set it to that, the variable is as good as forgotten
  393. forever, and no trace remains of it even if it was stored with character or
  394. account data.
  395. Some variables are special, that is, they are already defined for you by the
  396. scripting engine. You can see the full list somewhere in 'db/const.txt', which
  397. is a file you should read, since it also allows you to replace lots of numbered
  398. arguments for many commands with easier to read text. The special variables most
  399. commonly used are all permanent character-based variables:
  400. Zeny - Amount of Zeny.
  401. Hp - Current amount of hit points.
  402. MaxHp - Maximum amount of hit points.
  403. Sp - Current spell points.
  404. MaxSp - Maximum amount of spell points.
  405. StatusPoint - Amount of status points remaining.
  406. SkillPoint - Amount of skill points remaining.
  407. BaseLevel - Character's base level.
  408. JobLevel - Character's job level.
  409. BaseExp - Amount of base experience points.
  410. JobExp - Amount of job experience points.
  411. NextBaseExp - Amount of base experience points needed to reach the next level.
  412. NextJobExp - Amount of job experience points needed to reach the next level.
  413. Weight - Amount of weight the character currently carries.
  414. MaxWeight - Maximum weight the character can carry.
  415. Sex - 0 if female, 1 if male.
  416. Class - Character's job.
  417. Upper - 0 if the character is a normal class, 1 if advanced, 2 if baby.
  418. BaseClass - The character's 1-1 'normal' job, regardless of Upper value.
  419. For example, this will return Job_Acolyte for Acolyte, Priest/Monk,
  420. High Priest/Champion, and Arch Bishop/Sura. If the character has not
  421. reached a 1-1 class, it will return Job_Novice.
  422. BaseJob - The character's 'normal' job, regardless of Upper value.
  423. For example, this will return Job_Acolyte for Acolyte,
  424. Baby Acolyte, and High Acolyte.
  425. Karma - The character's karma. Karma system is not fully functional, but
  426. this doesn't mean this doesn't work at all. Not tested.
  427. Manner - The character's manner rating. Becomes negative if the player
  428. utters words forbidden through the use of 'manner.txt' client-side
  429. file.
  430. While these behave as variables, do not always expect to just set them - it is
  431. not certain whether this will work for all of them. Whenever there is a command
  432. or a function to set something, it's usually preferable to use that instead. The
  433. notable exception is Zeny, which you can and often will address directly -
  434. setting it will make the character own this number of Zeny.
  435. If you try to set Zeny to a negative number, the script will be terminated with an error.
  436. Some source-end constants can also be accessed in scripts. This list is located in
  437. 'src/map/script.c' in the 'script_hardcoded_constants' function, which contains
  438. constants such as server defines and status options:
  439. PACKETVER, MAX_LEVEL, MAX_STORAGE, MAX_INVENTORY, MAX_CART, MAX_ZENY, MAX_PARTY,
  440. MAX_GUILD, MAX_GUILDLEVEL, MAX_GUILD_STORAGE, MAX_BG_MEMBERS, MAX_CHAT_USERS,
  441. VIP_SCRIPT, MIN_STORAGE
  442. Option_Nothing, Option_Sight, Option_Hide, Option_Cloak, Option_Falcon, Option_Riding,
  443. Option_Invisible, Option_Orcish, Option_Wedding, Option_Chasewalk, Option_Flying,
  444. Option_Xmas, Option_Transform, Option_Summer, Option_Dragon1, Option_Wug,
  445. Option_Wugrider, Option_Madogear, Option_Dragon2, Option_Dragon3, Option_Dragon4,
  446. Option_Dragon5, Option_Hanbok, Option_Oktoberfest, Option_Dragon, Option_Costume
  447. Assigning variables
  448. --------- ---------
  449. As of rAthena revision 15982, variables can be accessed and assigned values directly
  450. without the use of the built-in 'set' function. This means that variables can be
  451. accessed and modified much like other programming languages.
  452. @x = 100;
  453. @x = @y = 100;
  454. Support for modifying variable values using 'set' is still supported (and required
  455. to exist for this new method to work) so previous scripts will continue to work.
  456. When assigning values, all operator methods are supported which exist in the below
  457. 'Operators' section. For instance:
  458. @x += 100;
  459. @x -= 100;
  460. @x *= 2;
  461. @x /= 2;
  462. @x %= 5;
  463. @x >>= 2;
  464. @x <<= 2;
  465. Will all work. For more information on available operators, see the Operators section
  466. described below. All operators listed there may be placed in-front of the '=' sign
  467. when modifying variables to perform the action as required.
  468. Note:
  469. !! Currently the scripting engine does not support directly copying array variables.
  470. !! In order to copy arrays between variables the use of 'copyarray' function is still
  471. !! required.
  472. Strings
  473. -------
  474. To include symbol '"' in a string you should use prefix '\"'
  475. Arrays
  476. ------
  477. Arrays (in rAthena at least) are essentially a set of variables going under the
  478. same name. You can tell between the specific variables of an array with an
  479. 'array index', a number of a variable in that array:
  480. <variable name>[<array index>]
  481. Variables stored in this way, inside an array, are also called 'array elements'.
  482. Arrays are specifically useful for storing a set of similar data (like several
  483. item IDs for example) and then looping through it. You can address any array
  484. variable as if it was a normal variable:
  485. set @arrayofnumbers[0],1;
  486. You can also do sneaky things like using a variable (or an expression, or even a
  487. value from an another array) to get at an array value:
  488. set @x,100;
  489. set @arrayofnumbers[@x],10;
  490. This will make @arrayofnumbers[100] equal to 10.
  491. Notice that index numbering always starts with 0. Arrays cannot hold more than
  492. 128 variables. (So the last one can't have a number higher than 127)
  493. And array indexes probably can't be negative. Nobody tested what happens when
  494. you try to get a negatively numbered variable from an array, but it's not going
  495. to be pretty. :)
  496. Arrays can naturally store strings:
  497. @menulines$[0] is the 0th element of the @menulines$ array of strings. Notice
  498. the '$', normally denoting a string variable, before the square brackets that
  499. denotes an array index.
  500. Resume of the allowed variable and array scopes
  501. ------ -- --- ------- -------- --- ----- ------
  502. +==========+======+=======+
  503. |VarType | Norm | Array |
  504. +==========+======+=======+
  505. |$Str$ | OK! | OK! |
  506. +----------+------+-------+
  507. |$@Str$ | OK! | OK! |
  508. +----------+------+-------+
  509. |@Str$ | OK! | OK! |
  510. +----------+------+-------+
  511. |#Str$ | OK! | FAIL! |
  512. +----------+------+-------+
  513. |Str$ | OK! | FAIL! |
  514. +----------+------+-------+
  515. |$Int | OK! | OK! |
  516. +----------+------+-------+
  517. |$@Int | OK! | OK! |
  518. +----------+------+-------+
  519. |@Int | OK! | OK! |
  520. +----------+------+-------+
  521. |#Int | OK! | FAIL! |
  522. +----------+------+-------+
  523. |Int | OK! | FAIL! |
  524. +----------+------+-------+
  525. |.Str$ | OK! | OK! |
  526. +----------+------+-------+
  527. |.Int | OK! | OK! |
  528. +----------+------+-------+
  529. |.@Str$ | OK! | OK! |
  530. +----------+------+-------+
  531. |.@Int | OK! | OK! |
  532. +----------+------+-------+
  533. Variable References
  534. -------------------
  535. //##TODO
  536. Operators
  537. ---------
  538. Operators are things you can do to variables and numbers. They are either the
  539. common mathematical operations or conditional operators
  540. + - will add two numbers. If you try to add two strings, the result will be a
  541. string glued together at the +. You can add a number to a string, and the
  542. result will be a string. No other math operators work with strings.
  543. - - will subtract two numbers.
  544. * - will multiply two numbers.
  545. / - will divide two numbers. Note that this is an integer division, i.e.
  546. 7/2 is not equal 3.5, it's equal 3.
  547. % - will give you the remainder of the division. 7%2 is equal to 1.
  548. There are also conditional operators. This has to do with the conditional
  549. command 'if' and they are meant to return either 1 if the condition is satisfied
  550. and 0 if it isn't. (That's what they call 'boolean' variables. 0 means 'False'.
  551. Anything except the zero is 'True' Odd as it is, -1 and -5 and anything below
  552. zero will also be True.)
  553. You can compare numbers to each other and you compare strings to each other, but
  554. you can not compare numbers to strings.
  555. == - Is true if both sides are equal. For strings, it means they are the same.
  556. >= - True if the first value is equal to, or greater than, the second value.
  557. <= - True if the first value is equal to, or less than, the second value
  558. > - True if the first value greater than the second value
  559. < - True if the first value is less than the second value
  560. != - True if the first value IS NOT equal to the second one
  561. Examples:
  562. 1==1 is True.
  563. 1<2 is True while 1>2 is False.
  564. @x>2 is True if @x is equal to 3. But it isn't true if @x is 2.
  565. Only '==' and '!=' have been tested for comparing strings. Since there's no way
  566. to code a seriously complex data structure in this language, trying to sort
  567. strings by alphabet would be pointless anyway.
  568. Comparisons can be stacked in the same condition:
  569. && - Is True if and only if BOTH sides are true.
  570. ('1==1 && 2==2' is true. '2==1 && 1==1' is false.)
  571. || - Is True if either side of this expression is True.
  572. 1==1 && 2==2 is True.
  573. 1==1 && 2==1 is False.
  574. 1==1 || 2==1 is True.
  575. Logical bitwise operators work only on numbers, and they are the following:
  576. << - Left shift.
  577. >> - Right shift.
  578. Left shift moves the binary 1(s) of a number n positions to the left,
  579. which is the same as multiplying by 2, n times.
  580. In the other hand, Right shift moves the binary 1(s) of a number n positions
  581. to the right, which is the same as dividing by 2, n times.
  582. Example:
  583. set b,2;
  584. set a, b << 3;
  585. mes a;
  586. set a, a >> 2;
  587. mes a;
  588. The first mes command would display 16, which is the same as 2 x (2 x 2 x 2) = 16.
  589. The second mes command would display 4, which is the same as 16 / 2 = 8. 8 / 2 = 4.
  590. & - And.
  591. | - Or.
  592. The bitwise operator AND (&) is used to test two values against each other,
  593. and results in setting bits which are active in both arguments. This can
  594. be used for a few things, but in rAthena this operator is usually used to
  595. create bit-masks in scripts.
  596. The bitwise operator OR (|)sets to 1 a binary position if the binary position
  597. of one of the numbers is 1. This way a variable can hold several values we can check,
  598. known as bit-mask. A variable currently can hold up to 32 bit-masks (from position 0
  599. to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks
  600. that a player can have.
  601. A bit-mask basically is (ab)using the variables bits to set various options in
  602. one variable. With the current limit if variables it is possible to store 32
  603. different options in one variable (by using the bits on position 0 to 31).
  604. Example(s):
  605. - Basic example of the & operator, bit example:
  606. 10 & 2 = 2
  607. Why? :
  608. 10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010
  609. 2 = 2^1 (2), so in bits (same size) it would be 0010
  610. The & (AND) operator sets bits which are active (1) in both arguments, so in the
  611. example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit
  612. 0010, which is 2.
  613. - Basic example of creating and using a bit-mask:
  614. set @options,2|4|16; //(note: this is the same as 2+4+16, or 22)
  615. if (@options & 1) mes "Option 1 is activated";
  616. if (@options & 2) mes "Option 2 is activated";
  617. if (@options & 4) mes "Option 3 is activated";
  618. if (@options & 8) mes "Option 4 is activated";
  619. if (@options & 16) mes "Options 5 is activated";
  620. This would return the messages about option 2, 3 and 5 being shown (since we've set
  621. the 2,4 and 16 bit to 1).
  622. ^ - Xor.
  623. The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if both
  624. numbers have the same value in the said position. On the other hand, it
  625. sets to 1 if they have different values in the said binary position.
  626. This is another way of setting and unsetting bits in bit-masks.
  627. Example:
  628. - First let's set the quests that are currently in progress:
  629. set inProgress,1|8|16; // quest 1,8 and 16 are in progress
  630. - After playing for a bit, the player starts another quest:
  631. if( inProgress&2 == 0 ){
  632. // this will set the bit for quest 2 (inProgress has that bit set to 0)
  633. set inProgress,inProgress^2;
  634. mes "Quest 2: find a newbie and be helpful to him for an hour.";
  635. close;
  636. }
  637. - After spending some time reading info on Xor's, the player finally completes quest 1:
  638. if( inProgress&1 && isComplete ){
  639. // this will unset the bit for quest 1 (inProgress has that bit set to 1)
  640. set inProgress,inProgress^1;
  641. mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
  642. close;
  643. }
  644. Unary operators with only with a single number, which follows the operator, and
  645. are following:
  646. - - Negation.
  647. The sign of the number will be reversed. If the number was positive, it will
  648. become negative and vice versa.
  649. Example:
  650. set .@myvar,10;
  651. mes "Negative 10 is "+(-.@myvar);
  652. ! - Logical Not.
  653. Reverses the boolean result of an expression. True will become false and
  654. false will become true.
  655. Example:
  656. if(!callfunc("F_dosomething"))
  657. {
  658. mes "Doing something failed.";
  659. close;
  660. }
  661. ~ - Bitwise Not.
  662. Reverses each bit in a number, also known as one's complement. Cleared bits
  663. are set, and set bits are cleared.
  664. Example:
  665. - Ensure, that quest 2 is disabled, while keeping all other active, if they are.
  666. set inProgress,inProgress&(~2); // same as set inProgress,inProgress&0xfffffffd
  667. Ternary operators take three expressions (numbers, strings or boolean), and are
  668. following:
  669. ?: - Conditional operator
  670. Very useful e.g. to replace
  671. if(Sex) mes "..."; else mes "...";
  672. clauses with simple
  673. mes "Welcome, " + (Sex?"Mr.":"Mrs.") + " " + strcharinfo(0);
  674. or to replace any other simple if-else clauses. It might be worth
  675. mentioning that ?: has low priority and has to be enclosed with
  676. parenthesis in most (if not all) cases.
  677. Labels
  678. ------
  679. Within executable script code, some lines can be labels:
  680. <label name>:
  681. Labels are points of reference in your script, which can be used to route
  682. execution with 'goto', 'menu' and 'jump_zero' commands, invoked with 'doevent'
  683. and 'donpcevent' commands and are otherwise essential. A label's name may not be
  684. longer than 22 characters. (23rd is the ':'.) There is some confusion in the
  685. source about whether it's 22, 23 or 24 all over the place, so keeping labels
  686. under 22 characters could be wise. It may only contain alphanumeric characters
  687. and underscore. In addition to labels you name yourself, there are also some
  688. special labels which the script engine will start execution from if a special
  689. event happens:
  690. OnClock<hour><minute>:
  691. OnMinute<minute>:
  692. OnHour<hour>:
  693. On<weekday><hour><minute>:
  694. OnDay<month><day>:
  695. This will execute when the server clock hits the specified date or time. Hours
  696. and minutes are given in military time. ('0105' will mean 01:05 AM). Weekdays
  697. are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01 to 31.
  698. Remember the zero. :)
  699. OnInit:
  700. OnInterIfInit:
  701. OnInterIfInitOnce:
  702. OnInit will execute every time the scripts loading is complete, including when
  703. they are reloaded with @reloadscript command. OnInterIfInit will execute when
  704. the map server connects to a char server, OnInterIfInitOnce will only execute
  705. once and will not execute if the map server reconnects to the char server later.
  706. OnAgitStart:
  707. OnAgitEnd:
  708. OnAgitInit:
  709. OnAgitStart2:
  710. OnAgitEnd2:
  711. OnAgitInit2:
  712. OnAgitStart will run whenever the server shifts into WoE mode, whether it is
  713. done with @agitstart GM command or with 'AgitStart' script command. OnAgitEnd
  714. will do likewise for the end of WoE.
  715. OnAgitInit will run when data for all castles and all guilds that hold a castle
  716. is received by map-server from the char-server after initial connect.
  717. No RID will be attached while any of the above mentioned labels are triggered, so
  718. no character or account-based variables will be accessible, until you attach a
  719. RID with 'attachrid' (see below).
  720. The above also applies to, the last three labels, the only difference is that
  721. these labels are used exclusively for WoE SE, and are called independently.
  722. OnInstanceInit:
  723. This label will be executed when an instance is created and initialized through
  724. the 'instance_create' command. It will run again if @reloadscript is used while
  725. an instance is in progress.
  726. OnTouch:
  727. This label will be executed if a trigger area is defined for the NPC object it's
  728. in. If it isn't present, the execution will start from the beginning of the NPC
  729. code. The RID of the triggering character object will be attached.
  730. OnTouch_:
  731. Similar to OnTouch, but will only run one instance. Another character is
  732. chosen once the triggering character leaves the area.
  733. OnTouchNPC:
  734. Similar to OnTouch, but will only trigger for monsters.
  735. OnPCLoginEvent:
  736. OnPCLogoutEvent:
  737. OnPCBaseLvUpEvent:
  738. OnPCJobLvUpEvent:
  739. It's pretty obvious when these four special labels will be invoked.
  740. OnPCDieEvent:
  741. This special label triggers when a player dies. The variable 'killerrid' is
  742. set to the ID of the killer.
  743. OnPCKillEvent:
  744. This special label triggers when a player kills another player. The variable
  745. 'killedrid' is set to the ID of the player killed.
  746. OnNPCKillEvent:
  747. This special label triggers when a player kills a monster. The variable
  748. 'killedrid' is set to the Class (mob ID) of the monster killed.
  749. OnPCLoadMapEvent:
  750. This special label triggers when a player steps in a map marked with the
  751. 'loadevent' mapflag and attaches its RID. The fact that this label requires a
  752. mapflag for it to work is because, otherwise, it'd be server-wide and trigger
  753. every time a player would change maps. Imagine the server load with 1,000 players
  754. (oh the pain...)
  755. OnPCStatCalcEvent:
  756. This special label triggers when a player's stats are recalculated, such as when
  757. changing stats, equipment, or maps, as well as when logging in, leveling up, and
  758. mounting a job mount. This can be used to grant additional item bonuses to certain
  759. player groups, for instance.
  760. OnWhisperGlobal:
  761. This special label triggers when a player whispers the NPC, and will run with the
  762. player's RID attached. It can accept up to ten parameters, which will be stored
  763. into separate temporary character string variables @whispervar0$ to @whispervar9$.
  764. See 'doc/whisper_sys.txt' for further documentation.
  765. Only the special labels which are not associated with any script command are
  766. listed here. There are other kinds of labels which may be triggered in a similar
  767. manner, but they are described with their associated commands.
  768. On<label name>:
  769. These special labels are used with Mob scripts mostly, and script commands
  770. that requires you to point/link a command to a mob or another NPC, giving a label
  771. name to start from. The label name can be any of your liking, but must be
  772. Example:
  773. monster "prontera",123,42,"Poringz0rd",2341,23,"Master::OnThisMobDeath";
  774. amatsu,13,152,4 script Master 767,{
  775. mes "Hi there";
  776. close;
  777. OnThisMobDeath:
  778. announce "Hey, "+strcharinfo(0)+" just killed a Poringz0rd!",bc_blue|bc_all;
  779. end;
  780. }
  781. Each time you kill one, that announce will appear in blue to everyone.
  782. "Global" labels
  783. There's a catch with labels and doevent. If you call a label (using doevent)
  784. and called label is in NPC that has trigger area, that label must end with
  785. "Global" to work globally (i.e. if RID is outside of the trigger area, which
  786. usually happens since otherwise there would be no point calling the label with
  787. doevent, because OnTouch would do the job). For further reference look for
  788. npc_event in npc.c.
  789. Scripting commands and functions
  790. --------------------------------
  791. The commands and functions are listed here in no particular order. There's a
  792. difference between commands and functions - commands leave no 'return value'
  793. which might be used in a conditional statement, as a command argument, or stored
  794. in a variable. Calling commands as if they were functions will sometimes work,
  795. but is not advised, as this can lead to some hard to track errors. Calling
  796. functions as if they were commands will mess up the stack, so 'return' command
  797. will not return correctly after this happens in a particular script.
  798. All commands must end with a ';'. Actually, you may expect to have multiple
  799. commands on one line if you properly terminate them with a ';', but it's better
  800. if you don't, since it is not certain just whether the scripting engine will
  801. behave nicely if you do.
  802. -------------------------
  803. From here on, we will have the commands sorted as follow:
  804. 1.- Basic commands.
  805. 2.- Information-retrieving commands.
  806. 3.- Checking commands.
  807. 4.- Player-related commands.
  808. 5.- Mob / NPC -related commands.
  809. 6.- Other commands.
  810. 7.- Instance commands.
  811. 8.- Quest Log commands.
  812. 9.- Battleground commands.
  813. 10.- Pet commands.
  814. 11.- Homunculus commands.
  815. 12.- Mercenary commands.
  816. 13.- Party commands.
  817. =====================
  818. |1.- Basic commands.|
  819. =====================
  820. ---------------------------------------
  821. *mes "<string>"{,"<string>"{,...}};
  822. This command will display a box on the screen for the invoking character, if no
  823. such box is displayed already, and will print the string specified into that
  824. box. There is normally no 'close' or 'next' button on this box, unless you
  825. create one with 'close' or 'next', and while it's open the player can't do much
  826. else, so it's important to create a button later. If the string is empty, it
  827. will show up as an empty line.
  828. mes "Text that will appear in the box";
  829. Colors
  830. ------
  831. Inside the string you may put color codes, which will alter the color of the
  832. text printed after them. The color codes are all '^<R><G><B>' and contain three
  833. hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is
  834. bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.
  835. ^FF00FF is a pure magenta, but it's also a color that is considered transparent
  836. whenever the client is drawing windows on screen, so printing text in that color
  837. will have kind of a weird effect. Once you've set a text's color to something,
  838. you have to set it back to black unless you want all the rest of the text be in
  839. that color:
  840. mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";
  841. Notice that the text coloring is handled purely by the client. If you use non-
  842. English characters, the color codes might get screwed if they stick to letters
  843. with no intervening space. Separating them with spaces from the letters on
  844. either side solves the problem.
  845. Multiple Lines
  846. --------------
  847. To display multiple lines of message while only using a single 'mes' command,
  848. use the script command in the following format:
  849. mes "Line 1", "Line 2", "Line 3";
  850. This will display 3 different lines while only consuming a single line in
  851. the relevant script file.
  852. Navigation
  853. ----------
  854. For clients dated 2011-10-10aRagexe onwards, you can generate navigation links
  855. using HTML-like labels:
  856. <NAVI>Display Name<INFO>mapname,x,y,0,000,flag</INFO></NAVI>
  857. The "flag" parameter can be:
  858. 0: Do not open Navigation Window (default).
  859. 1: Open Navigation Window.
  860. The example below will make the [Tool Shop] text clickable and begin navigation
  861. to alberta (98,154) when clicked.
  862. mes "Have you checked out the <NAVI>[Tool Shop]<INFO>alberta,98,154,0,000,0</INFO></NAVI>?";
  863. URLs
  864. ----
  865. Similarly, you can create links to websites that launch in a new window:
  866. <URL>Display Name<INFO>http://www.example.com/</INFO></URL>";
  867. ---------------------------------------
  868. *next;
  869. This command will display a 'next' button in the message window for the
  870. invoking character. Clicking on it will cause the window to clear and display
  871. a new one. Used to segment NPC-talking, next is often used in combination with
  872. 'mes' and 'close'.
  873. If no window is currently on screen, one will be created, but once the invoking
  874. character clicks on it, a warning is thrown on the server console and the script
  875. will terminate.
  876. mes "[Woman]";
  877. mes "This would appear on the page";
  878. next;
  879. // This is needed since it is a new page and the top will now be blank
  880. mes "[Woman]";
  881. mes "This would appear on the 2nd page";
  882. ---------------------------------------
  883. *close;
  884. This command will create a 'close' button in the message window for the invoking
  885. character. If no window is currently on screen, the script execution will end. This is one
  886. of the ways to end a speech from an NPC. Once the button is clicked, the NPC
  887. script execution will end, and the message box will disappear.
  888. mes "[Woman]";
  889. mes "I am finished talking to you. Click the close button.";
  890. close;
  891. mes "This command will not run at all, since the script has ended.";
  892. ---------------------------------------
  893. *close2;
  894. This command will create a 'close' button in the message window for the invoking
  895. character. WARNING: If no window is currently on screen, the script execution will halt
  896. indefinitely! See 'close'. There is one important difference, though - even though
  897. the message box will have closed, the script execution will not stop, and commands after
  898. 'close2' will still run, meaning an 'end' has to be used to stop the script, unless you
  899. make it stop in some other manner.
  900. mes "[Woman]";
  901. mes "I will warp you now.";
  902. close2;
  903. warp "place",50,50;
  904. end;
  905. Don't expect things to run smoothly if you don't make your scripts 'end'.
  906. ---------------------------------------
  907. *end;
  908. This command will stop the execution for this particular script. The two
  909. versions are perfectly equivalent. It is the normal way to end a script which
  910. does not use 'mes'.
  911. if (BaseLevel<=10) goto L_Lvl10;
  912. if (BaseLevel<=20) goto L_Lvl20;
  913. if (BaseLevel<=30) goto L_Lvl30;
  914. if (BaseLevel<=40) goto L_Lvl40;
  915. if (BaseLevel<=50) goto L_Lvl50;
  916. if (BaseLevel<=60) goto L_Lvl60;
  917. if (BaseLevel<=70) goto L_Lvl70;
  918. L_Lvl10:
  919. npctalk "Look at that you are still a n00b";
  920. end;
  921. L_Lvl20:
  922. npctalk "Look at that you are getting better, but still a n00b";
  923. end;
  924. L_Lvl30:
  925. npctalk "Look at that you are getting there, you are almost 2nd profession now right???";
  926. end;
  927. L_Lvl40:
  928. npctalk "Look at that you are almost 2nd profession";
  929. end;
  930. Without the use of 'end' it would travel through the labels until the end of the
  931. script. If you were lvl 10 or less, you would see all the speech lines, the use
  932. of 'end' stops this, and ends the script.
  933. ---------------------------------------
  934. *set <variable>,<expression>;
  935. *set(<variable>,<expression>)
  936. This command will set a variable to the value that the expression results in.
  937. Variables may either be set through this command or directly, much like any
  938. other programming language (refer to the "Assigning variables" section).
  939. This is the most basic script command and is used a lot whenever you try to do
  940. anything more advanced than just printing text into a message box.
  941. set @x,100;
  942. will make @x equal 100.
  943. set @x,1+5/8+9;
  944. will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are
  945. integer in this language) and make @x equal it.
  946. Returns the variable reference (since trunk r12870).
  947. ---------------------------------------
  948. *setd "<variable name>",<value>;
  949. Works almost identically as set, except the variable name is identified as a string
  950. and can thus be constructed dynamically.
  951. This command is equivalent to:
  952. set getd("variable name"),<value>;
  953. Examples:
  954. setd ".@var$", "Poporing";
  955. mes .@var$; // Displays "Poporing".
  956. setd ".@" + .@var$ + "123$", "Poporing is cool";
  957. mes .@Poporing123$; // Displays "Poporing is cool".
  958. ---------------------------------------
  959. *getd("<variable name>")
  960. Returns a reference to a variable, the name can be constructed dynamically.
  961. Refer to 'setd' for usage.
  962. This can also be used to set an array dynamically:
  963. setarray getd(".array[0]"), 1, 2, 3, 4, 5;
  964. Examples:
  965. set getd("$varRefence"), 1;
  966. set @i, getd("$" + "pikachu");
  967. ---------------------------------------
  968. *getvariableofnpc(<variable>,"<npc name>")
  969. Returns a reference to a NPC variable (. prefix) from the target NPC.
  970. This can only be used to get . variables.
  971. Examples:
  972. //This will return the value of .var, note that this can't be used, since the value isn't caught.
  973. getvariableofnpc(.var,"TargetNPC");
  974. //This will set the .v variable to the value of the TargetNPC's .var variable.
  975. set .v, getvariableofnpc(.var,"TargetNPC");
  976. //This will set the .var variable of TargetNPC to 1.
  977. set getvariableofnpc(.var,"TargetNPC"), 1;
  978. Note: even though function objects can have .variables,
  979. getvariableofnpc will not work on them.
  980. ---------------------------------------
  981. *goto <label>;
  982. This command will make the script jump to a label, usually used in conjunction
  983. with other command, such as "if", but often used on its own.
  984. ...
  985. goto Label;
  986. mes "This will not be seen";
  987. Label:
  988. mes "This will be seen";
  989. Note by FlavioJS: goto's are "evil" and should be avoided if possible (ò_ó)
  990. ---------------------------------------
  991. *menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...};
  992. This command will create a selectable menu for the invoking character. Only one
  993. menu can be on screen at the same time.
  994. Depending on what the player picks from the menu, the script execution will
  995. continue from the corresponding label. (it's string-label pairs, not label-
  996. string)
  997. Options can be grouped together, separated by the character ':'.
  998. menu "A:B",L_Wrong,"C",L_Right;
  999. It also sets a special temporary character variable @menu, which contains the
  1000. number of option the player picked. (Numbering of options starts at 1.)
  1001. This number is consistent with empty options and grouped options.
  1002. menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
  1003. L_Wrong:
  1004. // If they click "A" or "B" they will end up here
  1005. // @menu == 1 if "A"
  1006. // @menu == 2 will never happen because the option is empty
  1007. // @menu == 3 if "B"
  1008. L_Impossible:
  1009. // Empty options are not displayed and therefore can't be selected
  1010. // this label will never be reached from the menu command
  1011. L_Right:
  1012. // If they click "C" they will end up here
  1013. // @menu == 5
  1014. If a label is '-', the script execution will continue right after the menu
  1015. command if that option is selected, this can be used to save you time, and
  1016. optimize big scripts.
  1017. menu "A::B:",-,"C",L_Right;
  1018. // If they click "A" or "B" they will end up here
  1019. // @menu == 1 if "A"
  1020. // @menu == 3 if "B"
  1021. L_Right:
  1022. // If they click "C" they will end up here
  1023. // @menu == 5
  1024. Both these examples will perform the exact same task.
  1025. If you give an empty string as a menu item, the item will not display. This
  1026. can effectively be used to script dynamic menus by using empty string for
  1027. entries that should be unavailable at that time.
  1028. You can do it by using arrays, but watch carefully - this trick isn't high
  1029. wizardry, but minor magic at least. You can't expect to easily duplicate it
  1030. until you understand how it works.
  1031. Create a temporary array of strings to contain your menu items, and populate it
  1032. with the strings that should go into the menu at this execution, making sure not
  1033. to leave any gaps. Normally, you do it with a loop and an extra counter, like
  1034. this:
  1035. setarray @possiblemenuitems$[0],<list of potential menu items>;
  1036. @j = 0; // That's the menu lines counter.
  1037. // We loop through the list of possible menu items.
  1038. // @i is our loop counter.
  1039. for( @i = 0; @i < getarraysize(@possiblemenuitems$); @i++ )
  1040. {
  1041. // That 'condition' is whatever condition that determines whether
  1042. // a menu item number @i actually goes into the menu or not.
  1043. if (<condition>)
  1044. {
  1045. // We record the option into the list of options actually available.
  1046. @menulist$[@j] = @possiblemenuitems$[@i];
  1047. // We just copied the string, we do need its number for later
  1048. // though, so we record it as well.
  1049. @menureference[@j] = @i;
  1050. // Since we've just added a menu item into the list, we increment
  1051. // the menu lines counter.
  1052. @j++;
  1053. }
  1054. // We go on to the next possible menu item.
  1055. }
  1056. This will create you an array @menulist$ which contains the text of all items
  1057. that should actually go into the menu based on your condition, and an array
  1058. @menureference, which contains their numbers in the list of possible menu items.
  1059. (Remember, arrays start with 0.) There's less of them than the possible menu
  1060. items you've defined, but the menu command can handle the empty lines - only if
  1061. they are last in the list, and if it's made this way, they are. Now comes a
  1062. dirty trick:
  1063. // X is whatever the most menu items you expect to handle.
  1064. menu @menulist$[0],-,@menulist$[1],-,....@menulist$[<X>],-;
  1065. This calls up a menu of all your items. Since you didn't copy some of the
  1066. possible menu items into the list, its end is empty and so no menu items will
  1067. show up past the end. But this menu call doesn't jump anywhere, it just
  1068. continues execution right after the menu command. (And it's a good thing it
  1069. doesn't, cause you can only explicitly define labels to jump to, and how do you
  1070. know which ones to define if you don't know beforehand which options will end up
  1071. where in your menu?)
  1072. But how do you figure out which option the user picked? Enter the @menu.
  1073. @menu contains the number of option that the user selected from the list,
  1074. starting with 1 for the first option. You know now which option the user picked
  1075. and which number in your real list of possible menu items it translated to:
  1076. mes "You selected "+@possiblemenuitems$[@menureference[@menu-1]]+"!";
  1077. @menu is the number of option the user picked.
  1078. @menu-1 is the array index for the list of actually used menu items that we
  1079. made.
  1080. @menureference[@menu-1] is the number of the item in the array of possible menu
  1081. items that we've saved just for this purpose.
  1082. And @possiblemenuitems$[@menureference[@menu-1]] is the string that we used to
  1083. display the menu line the user picked. (Yes, it's a handful, but it works.)
  1084. You can set up a bunch of 'if (@menureference[@menu-1]==X) goto Y' statements to
  1085. route your execution based on the line selected and still generate a different
  1086. menu every time, which is handy when you want to, for example, make users select
  1087. items in any specific order before proceeding, or make a randomly shuffled menu.
  1088. Kafra code bundled with the standard distribution uses a similar array-based
  1089. menu technique for teleport lists, but it's much simpler and doesn't use @menu,
  1090. probably since that wasn't documented anywhere.
  1091. See also 'select', which is probably better in this particular case. Instead of
  1092. menu, you could use 'select' like this:
  1093. @dummy = select(@menulist$[0],@menulist$[1],....@menulist$[<X>]);
  1094. For the purposes of the technique described above these two statements are
  1095. perfectly equivalent.
  1096. ---------------------------------------
  1097. *select("<option>"{,"<option>",...})
  1098. *prompt("<option>"{,"<option>",...})
  1099. This function is a handy replacement for 'menu' for some specific cases where
  1100. you don't want a complex label structure - like, for example, asking simple yes-
  1101. no questions. It will return the number of menu option picked, starting with 1.
  1102. Like 'menu', it will also set the variable @menu to contain the option the user
  1103. picked.
  1104. if (select("Yes:No")==1) mes "You said yes, I know.";
  1105. And like 'menu', the selected option is consistent with grouped options
  1106. and empty options.
  1107. 'prompt' works almost the same as select, except that when a character clicks
  1108. the Cancel button, this function will return 255 instead.
  1109. ---------------------------------------
  1110. *input(<variable>{,<min>{,<max>}})
  1111. This command will make an input box pop up on the client connected to the
  1112. invoking character, to allow entering of a number or a string. This has many
  1113. uses, one example would be a guessing game, also making use of the 'rand'
  1114. function:
  1115. mes "[Woman]";
  1116. mes "Try and guess the number I am thinking of.";
  1117. mes "The number will be between 1 and 10.";
  1118. next;
  1119. .@number = rand(1,10);
  1120. input .@guess;
  1121. if (.@guess == .@number) {
  1122. mes "[Woman]";
  1123. mes "Well done, that was the number I was thinking of!";
  1124. close;
  1125. } else {
  1126. mes "[Woman]";
  1127. mes "Sorry, that wasn't the number I was thinking of.";
  1128. close;
  1129. }
  1130. If you give the input command a string variable to put the input in, it will
  1131. allow the player to enter text. Otherwise, only numbers will be allowed.
  1132. mes "[Woman]";
  1133. mes "Please say HELLO";
  1134. next;
  1135. input .@var$;
  1136. if (.@var$ == "HELLO") {
  1137. mes "[Woman]";
  1138. mes "Well done, you typed it correctly.";
  1139. close;
  1140. } else {
  1141. mes "[Woman]";
  1142. mes "Sorry, you got it wrong.";
  1143. close;
  1144. }
  1145. Normally you may not input a negative number with this command.
  1146. This is done to prevent exploits in badly written scripts, which would
  1147. let people, for example, put negative amounts of Zeny into a bank script and
  1148. receive free Zeny as a result.
  1149. Since trunk r12192 the command has two optional arguments and a return value.
  1150. The default value of 'min' and 'max' can be set with 'input_min_value' and
  1151. 'input_max_value' in script_athena.conf.
  1152. For numeric inputs the value is capped to the range [min,max]. Returns 1 if
  1153. the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
  1154. For string inputs it returns 1 if the string was longer than 'max', -1 is
  1155. shorter than 'min' and 0 otherwise.
  1156. ---------------------------------------
  1157. *callfunc "<function>"{,<argument>,...<argument>};
  1158. *callfunc("<function>"{,<argument>,...<argument>})
  1159. This command lets you call up a function NPC. A function NPC can be called from
  1160. any script on any map server. Using the 'return' command it will come back to
  1161. the place that called it.
  1162. place,50,50,6%TAB%script%TAB%Woman%TAB%115,{
  1163. mes "[Woman]"
  1164. mes "Let's see if you win...";
  1165. callfunc "funcNPC";
  1166. mes "Well done, you have won!";
  1167. close;
  1168. }
  1169. function%TAB%script%TAB%funcNPC%TAB%{
  1170. .@win = rand(2);
  1171. if (.@win == 0) return;
  1172. mes "Sorry, you lost.";
  1173. close;
  1174. }
  1175. You can pass arguments to your function - values telling it what exactly to do -
  1176. which will be available there with getarg() (see 'getarg')
  1177. Notice that returning is not mandatory, you can end execution right there.
  1178. If you want to return a real value from inside your function NPC, it is better
  1179. to write it in the function form, which will also work and will make the script
  1180. generally cleaner:
  1181. place,50,50,6%TAB%script%TAB%Man%TAB%115,{
  1182. mes "[Man]"
  1183. mes "Gimme a number!";
  1184. next;
  1185. input @number;
  1186. if (callfunc("OddFunc",@number)) mes "It's Odd!";
  1187. close;
  1188. }
  1189. function%TAB%script%TAB%OddFunc%TAB%{
  1190. if (getarg(0)%2==0) return 0;// it's even
  1191. return 1;// it's odd
  1192. }
  1193. Alternately, as of rAthena revision 15979 and 15981, user-defined functions
  1194. may be called directly without the use of the 'callfunc' script command.
  1195. function<tab>script<tab>SayHello<tab>{
  1196. mes "Hello " + getarg(0);
  1197. return 0;
  1198. }
  1199. place,50,50,6<tab>script<tab>Man<tab>115,{
  1200. mes "[Man]";
  1201. SayHello strcharinfo(0);
  1202. close;
  1203. }
  1204. Note:
  1205. !! A user-defined function must be declared /before/ a script attempts to
  1206. !! call it. That is to say, any functions should be placed above scripts or NPCs
  1207. !! (or loaded in a separate file first) before attempting to call them directly.
  1208. ---------------------------------------
  1209. *callsub <label>{,<argument>,...<argument>};
  1210. *callsub(<label>{,<argument>,...<argument>})
  1211. This command will go to a specified label within the current script (do NOT use
  1212. quotes around it) coming in as if it were a 'callfunc' call, and pass it
  1213. arguments given, if any, which can be recovered there with 'getarg'. When done
  1214. there, you should use the 'return' command to go back to the point from where
  1215. this label was called. This is used when there is a specific thing the script
  1216. will do over and over, this lets you use the same bit of code as many times as
  1217. you like, to save space and time, without creating extra NPC objects which are
  1218. needed with 'callfunc'. A label is not callable in this manner from another
  1219. script.
  1220. Example 1: callsub for checking (if checks pass, return to script)
  1221. callsub S_CheckFull, "guild_vs2",50;
  1222. switch( rand(4) ) {
  1223. case 0: warp "guild_vs2",9,50; end;
  1224. case 1: warp "guild_vs2",49,90; end;
  1225. case 2: warp "guild_vs2",90,50; end;
  1226. case 3: warp "guild_vs2",49,9; end;
  1227. }
  1228. ...
  1229. S_CheckFull:
  1230. if (getmapusers(getarg(0)) >= getarg(1)) {
  1231. mes "I'm sorry, this arena is full. Please try again later.";
  1232. close;
  1233. }
  1234. return;
  1235. Example 2: callsub used repeatedly, with different arguments
  1236. // notice how the Zeny check/delete is reused, instead of copy-pasting for every warp
  1237. switch(select("Abyss Lake:Amatsu Dungeon:Anthell:Ayothaya Dungeon:Beacon Island, Pharos") {
  1238. case 1: callsub S_DunWarp,"hu_fild05",192,207;
  1239. case 2: callsub S_DunWarp,"ama_in02",119,181;
  1240. case 3: callsub S_DunWarp,"moc_fild20",164,145;
  1241. case 4: callsub S_DunWarp,"ayo_fild02",279,150;
  1242. case 5: callsub S_DunWarp,"cmd_fild07",132,125;
  1243. // etc
  1244. }
  1245. ...
  1246. S_DunWarp:
  1247. // getarg(0) = "map name"
  1248. // getarg(1) = x
  1249. // getarg(2) = y
  1250. if (Zeny >= 100) {
  1251. Zeny -= 100;
  1252. warp getarg(0),getarg(1),getarg(2);
  1253. } else {
  1254. mes "Dungeon warp costs 100 Zeny.";
  1255. }
  1256. close;
  1257. ---------------------------------------
  1258. *getarg(<index>{,<default_value>})
  1259. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1260. call you can specify variables that will make that call different from another
  1261. one. This function will return an argument the function or subroutine was
  1262. called with, and is the normal way to get them.
  1263. This is another thing that can let you use the same code more than once.
  1264. Argument numbering starts with 0, i.e. the first argument you gave is number 0.
  1265. If no such argument was given, a zero is returned.
  1266. place,50,50,6%TAB%script%TAB%Woman1%TAB%115,{
  1267. mes "[Woman]";
  1268. mes "Let's see if you win...";
  1269. callfunc "funcNPC",2;
  1270. mes "Well done, you have won!";
  1271. close;
  1272. }
  1273. place,52,50,6%TAB%script%TAB%Woman2%TAB%115,{
  1274. mes "[Woman]";
  1275. mes "Let's see if you win...";
  1276. callfunc "funcNPC",5;
  1277. mes "Well done, you have won!";
  1278. close;
  1279. }
  1280. function%TAB%script%TAB%funcNPC%TAB%{
  1281. .@win = rand(getarg(0));
  1282. if (.@win == 0) return;
  1283. mes "Sorry, you lost.";
  1284. close;
  1285. |
  1286. "woman1" NPC object calls the funcNPC. The argument it gives in this call is
  1287. stated as 2, so when the random number is generated by the 'rand' function, it
  1288. can only be 0 or 1. Whereas "woman2" gives 5 as the argument number 0 when
  1289. calling the function, so the random number could be 0, 1, 2, 3 or 4, this makes
  1290. "woman2" less likely to say the player won.
  1291. You can pass multiple arguments in a function call:
  1292. callfunc "funcNPC",5,4,3;
  1293. getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3.
  1294. 'getarg' has an optional argument since trunk r10773 and stable r10958.
  1295. If the target argument exists, it is returned.
  1296. Otherwise, if <default_value> is present it is returned instead,
  1297. if not the script terminates immediately.
  1298. In the previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1.
  1299. ---------------------------------------
  1300. *getargcount()
  1301. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1302. call you can specify arguments. This function will return the number of arguments
  1303. provided.
  1304. Example:
  1305. callfunc "funcNPC",5,4,3;
  1306. ...
  1307. function%TAB%script%TAB%funcNPC%TAB%{
  1308. .@count = getargcount(); // 3
  1309. ...
  1310. }
  1311. ---------------------------------------
  1312. *return {<value>};
  1313. This command causes the script execution to leave previously called function
  1314. with callfunc or script with callsub and return to the location, where the call
  1315. originated from. Optionally a return value can be supplied, when the call was
  1316. done using the function form.
  1317. Using this command outside of functions or scripts referenced by callsub will
  1318. result in error and termination of the script.
  1319. callfunc "<your function>";// when nothing is returned
  1320. set <variable>,callfunc("<your function>");// when a value is being returned
  1321. ---------------------------------------
  1322. *function <function name>;
  1323. *<function name>{(<argument>,...<argument>)};
  1324. *function <function name> {
  1325. <code>
  1326. }
  1327. This works like callfunc, and is used for cleaner and faster scripting. The function
  1328. must be defined and used within a script, and works like a label with arguments.
  1329. Note that the name may only contain alphanumeric characters and underscore.
  1330. Usage:
  1331. 1. Declare the function.
  1332. function <function name>;
  1333. 2. Call the function anywhere within the script.
  1334. It can also return a value when used with parentheses.
  1335. <function name>;
  1336. 3. Define the function within the script.
  1337. <function name> {<code>}
  1338. Example:
  1339. prontera,154,189,4 script Item Seller 767,{
  1340. /* Function declaration */
  1341. function SF_Selling;
  1342. if (Zeny > 50) {
  1343. mes "Welcome!";
  1344. /* Function call */
  1345. SF_Selling;
  1346. }
  1347. else mes "You need 50z, sorry!";
  1348. close;
  1349. /* Function definition */
  1350. function SF_Selling {
  1351. mes "Would you like to buy a phracon for 50z?";
  1352. next;
  1353. if(select("Yes","No, thanks") == 1) {
  1354. Zeny -= Zeny;
  1355. getitem 1010,1;
  1356. mes "Thank you!";
  1357. }
  1358. return;
  1359. }
  1360. }
  1361. Example with parameters and return value:
  1362. prontera,150,150,0 script TestNPC 123,{
  1363. /* Function declaration */
  1364. function MyAdd;
  1365. mes "Enter two numbers.";
  1366. next;
  1367. input .@a;
  1368. input .@b;
  1369. /* Function call */
  1370. mes .@a+" + "+.@b+" = "+MyAdd(.@a,.@b);
  1371. close;
  1372. /* Function definition */
  1373. function MyAdd {
  1374. return getarg(0)+getarg(1);
  1375. }
  1376. }
  1377. ---------------------------------------
  1378. *is_function("<function name>")
  1379. This command checks whether a function exists.
  1380. It returns 1 if function is found, or 0 if it isn't.
  1381. Example:
  1382. function script try {
  1383. dothat;
  1384. }
  1385. - script test -1,{
  1386. .@try = is_function("try"); // 1
  1387. .@not = is_function("not"); // 0
  1388. }
  1389. ---------------------------------------
  1390. *if (<condition>) <statement>;
  1391. This is the basic conditional statement command, and just about the only one
  1392. available in this scripting language.
  1393. The condition can be any expression. All expressions resulting in a non-zero
  1394. value will be considered True, including negative values. All expressions
  1395. resulting in a zero are false.
  1396. If the expression results in True, the statement will be executed. If it isn't
  1397. true, nothing happens and we move on to the next line of the script.
  1398. if (1) mes "This will always print.";
  1399. if (0) mes "And this will never print.";
  1400. if (5) mes "This will also always print.";
  1401. if (-1) mes "Funny as it is, this will also print just fine.";
  1402. For more information on conditional operators see the operators section above.
  1403. Anything that is returned by a function can be used in a condition check without
  1404. bothering to store it in a specific variable:
  1405. if (strcharinfo(0)=="Daniel Jackson") mes "It is true, you are Daniel!";
  1406. More examples of using the 'if' command in the real world:
  1407. Example 1:
  1408. .@answer = 1;
  1409. input .@input;
  1410. if (.@input == .@answer)
  1411. close;
  1412. mes "Sorry, your answer is incorrect.";
  1413. close;
  1414. Example 2:
  1415. .@answer = 1;
  1416. input .@input;
  1417. if (.@input != .@answer)
  1418. mes "Sorry, your answer is incorrect.";
  1419. close;
  1420. Notice that examples 1 and 2 have the same effect.
  1421. Example 3:
  1422. @count++;
  1423. mes "[Forgetful Man]";
  1424. if (@count == 1) mes "This is the first time you have talked to me.";
  1425. if (@count == 2) mes "This is the second time you have talked to me.";
  1426. if (@count == 3) mes "This is the third time you have talked to me.";
  1427. if (@count == 4) {
  1428. mes "This is the fourth time you have talked to me.";
  1429. mes "I think I am getting amnesia, I have forgotten about you...";
  1430. @count = 0;
  1431. }
  1432. close;
  1433. Example 4:
  1434. mes "[Quest Person]";
  1435. if (countitem(512) < 1) { // 512 is the item ID for Apple, found in item_db
  1436. mes "Can you please bring me an apple?";
  1437. close;
  1438. }
  1439. mes "Oh, you brought an Apple!";
  1440. mes "I didn't want it, I just wanted to see one.";
  1441. close;
  1442. Example 5:
  1443. mes "[Person Checker]";
  1444. if ($@name$ == "") { // global variable not yet set
  1445. mes "Please tell me someones name";
  1446. next;
  1447. input $@name$;
  1448. $@name2$ = strcharinfo(0);
  1449. mes "[Person Checker]";
  1450. mes "Thank you.";
  1451. close;
  1452. }
  1453. if ($@name$ == strcharinfo(0)) { // player name matches $@name$
  1454. mes "You are the person that " +$@name2$+ " just mentioned.";
  1455. mes "Nice to meet you!";
  1456. // reset the global variables
  1457. $@name$ = "";
  1458. $@name2$ = "";
  1459. close;
  1460. }
  1461. mes "You are not the person that " +$name2$+ " mentioned.";
  1462. close;
  1463. See 'strcharinfo' for an explanation of what this function does.
  1464. Example 6: Using complex conditions.
  1465. mes "[Multiple Checks]";
  1466. if ( (@queststarted == 1) && (countitem(512) >= 5) ) {
  1467. mes "Well done, you have started the quest and brought me 5 Apples.";
  1468. @queststarted = 0;
  1469. delitem 512,5;
  1470. close;
  1471. }
  1472. mes "Please bring me 5 apples.";
  1473. @queststarted = 1;
  1474. close;
  1475. The script engine also supports nested 'if' statements:
  1476. if (<condition>)
  1477. dothis;
  1478. else
  1479. dothat;
  1480. If the condition isn't met, it'll do the action following the 'else'.
  1481. We can also group several actions depending on a condition:
  1482. if (<condition>) {
  1483. dothis1;
  1484. dothis2;
  1485. } else {
  1486. dothat1;
  1487. dothat2;
  1488. dothat3;
  1489. }
  1490. Remember that if you plan to do several actions upon the condition being false, and
  1491. you forget to use the curly braces (the { } ), the second action will be executed regardless
  1492. the output of the condition, unless of course, you stop the execution of the script if the
  1493. condition is true (that is, in the first grouping using a return; , and end; or a close; )
  1494. Also, you can have multiple conditions nested or chained, and don't worry about limits as to
  1495. how many nested if you can have, there is no spoon ;)
  1496. if (<condition 1>)
  1497. dothis;
  1498. else if (<condition 2>) {
  1499. dothat;
  1500. end;
  1501. } else
  1502. dothis;
  1503. ---------------------------------------
  1504. *jump_zero (<condition>),<label>;
  1505. This command works kinda like an 'if'+'goto' combination in one go. (See 'if').
  1506. If the condition is false (equal to zero) this command will immediately jump to
  1507. the specified label like in 'goto'. While 'if' is more generally useful, for
  1508. some cases this could be an optimization.
  1509. The main reason for this command is that other control statements, like
  1510. 'switch', 'for' or 'while', are disassembled into simple expressions together
  1511. with this command when a script is parsed.
  1512. ---------------------------------------
  1513. *switch (expression);
  1514. The switch statement is similar to a series of if statements on the same expression.
  1515. In many occasions, you may want to compare the same variable (or expression)
  1516. with many different values, and execute a different piece of code depending
  1517. on which value it equals to. This is exactly what the switch statement is for.
  1518. It is important to understand how the switch statement is executed in order
  1519. to avoid mistakes. The switch statement executes line by line (actually, statement by statement).
  1520. In the beginning, no code is executed. Only when a case statement is found
  1521. with a value that matches the value of the switch expression the case statement(s)
  1522. will to executed. The parser continues to execute the statements until the end
  1523. of the switch block, or the first time it sees a break statement. If you don't
  1524. write a break statement at the end of a case's statement list, the parser will
  1525. go on executing the statements of the following case (fall-through).
  1526. Example 1:
  1527. switch(select("Yes:No")) {
  1528. case 1:
  1529. mes "You said yes!";
  1530. break;
  1531. case 2:
  1532. mes "Aww, why?";
  1533. break;
  1534. }
  1535. close;
  1536. The example above would work like a menu and would go to the first case if
  1537. the user selects option, otherwise, would go to the second one.
  1538. Example 2:
  1539. switch(getgroupid()) {
  1540. case 1:
  1541. mes "Wow, you're super!";
  1542. break;
  1543. case 2:
  1544. mes "A helping hand!";
  1545. break;
  1546. case 3:
  1547. mes "10001010010011";
  1548. break;
  1549. case 4:
  1550. mes "Yes, milord?";
  1551. break;
  1552. default:
  1553. mes "Hello there!";
  1554. break;
  1555. }
  1556. The example above would print a message depending on the player's groupid.
  1557. If there is no statement declared for the corresponding groupid, the script
  1558. would use the 'default' statement that applies to rest of possible values,
  1559. similar to 'else' in the if-else statement.
  1560. ---------------------------------------
  1561. *while (<condition>) <statement>;
  1562. This is probably the simplest and most frequently used loop structure. The 'while'
  1563. statement can be interpreted as "while <condition> is true, perform <statement>".
  1564. It is a pretest loop, meaning the conditional expression is tested before any of the
  1565. statements in the body of the loop are performed. If the condition evaluates to
  1566. false, the statement(s) in the body of the loop is/are never executed. If the
  1567. condition evaluates to true, the statement(s) are executed, then control transfers
  1568. back to the conditional expression, which is reevaluated and the cycle continues.
  1569. Multiple statements can be grouped with { }, curly braces, just like with the 'if' statement.
  1570. Example 1:
  1571. while (switch(select("Yes:No") == 2 ))
  1572. mes "You picked no.";
  1573. close;
  1574. Example 2: multiple statements
  1575. while (switch(select("Yes:No") == 2 )) {
  1576. mes "Why did you pick no?";
  1577. mes "You should pick yes instead!";
  1578. }
  1579. close;
  1580. Example 3: counter-controlled loop
  1581. .@i = 1;
  1582. while (.@i <= 5) {
  1583. mes "This line will print 5 times.";
  1584. .@i += 1;
  1585. }
  1586. close;
  1587. Example 4: sentinel-controlled loop
  1588. mes "Input 0 to stop";
  1589. input .@num;
  1590. while (.@num != 0) {
  1591. mes "You entered " + .@num;
  1592. input .@num;
  1593. }
  1594. close;
  1595. ---------------------------------------
  1596. *for (<variable initialization>; <condition>; <variable update>) <statement>;
  1597. Another pretest looping structure is the 'for' statement. It is considered a
  1598. specialized form of the 'while' statement, and is usually associated with counter-
  1599. controlled loops. Here are the steps of the 'for' statement: the initialize
  1600. statement is executed first and only once. The condition test is performed.
  1601. When the condition evaluates to false, the rest of the for statement is skipped.
  1602. When the condition evaluates to true, the body of the loop is executed, then the
  1603. update statement is executed (this usually involves incrementing a variable).
  1604. Then the condition is reevaluated and the cycle continues.
  1605. Example 1:
  1606. for( .@i = 1; .@i <= 5; .@i++ )
  1607. mes "This line will print 5 times.";
  1608. Example 2:
  1609. mes "This will print the numbers 1 - 5.";
  1610. for( .@i = 1; .@i <= 5; .@i++ )
  1611. mes "Number: " + .@i;
  1612. ---------------------------------------
  1613. *do { <statement>; } while (<condition>);
  1614. The 'do...while' is the only post-test loop structure available in this script
  1615. language. With a post-test, the statements are executed once before the condition
  1616. is tested. When the condition is true, the statement(s) are repeated. When the
  1617. condition is false, control is transferred to the statement following the
  1618. 'do...while' loop expression.
  1619. Example 1: sentinel-controlled loop
  1620. mes "This menu will keep appearing until you pick Cancel";
  1621. do {
  1622. .@menu = select("One:Two:Three:Cancel");
  1623. } while (.@menu != 4);
  1624. Example 2: counter-controlled loop
  1625. mes "This will countdown from 10 to 1.";
  1626. .@i = 10;
  1627. do {
  1628. mes .@i;
  1629. .@i -= 1;
  1630. } while (.@i > 0);
  1631. ---------------------------------------
  1632. *freeloop({<toggle>})
  1633. Toggling this to enabled (1) allows the script instance to bypass the infinite loop
  1634. protection, allowing your script to loop as much as it may need. Disabling (0) will
  1635. warn you if an infinite loop is detected.
  1636. The command will return the state of freeloop for the attached script, even if no
  1637. argument is provided.
  1638. Example:
  1639. freeloop(1); // enable script to loop freely
  1640. // be careful with what you do here
  1641. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1642. dothis;
  1643. // will sleep the script for 1ms when detect an infinity loop to
  1644. // let rAthena do what it needs to do (socket, timer, process, etc.)
  1645. }
  1646. freeloop(0); // disable freeloop
  1647. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1648. dothis;
  1649. // throw an infinity loop error
  1650. }
  1651. ---------------------------------------
  1652. *setarray <array name>[<first value>],<value>{,<value>...<value>};
  1653. This command will allow you to quickly fill up an array in one go. Check the
  1654. Kafra scripts in the distribution to see this used a lot.
  1655. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1656. First value is the index of the first element of the array to alter. For
  1657. example:
  1658. setarray @array[0],200,200,200;
  1659. setarray @array[1],300,150;
  1660. will produce:
  1661. @array[0]=200
  1662. @array[1]=300
  1663. @array[2]=150
  1664. ---------------------------------------
  1665. *cleararray <array name>[<first value to alter>],<value>,<number of values to set>;
  1666. This command will change many array values at the same time to the same value.
  1667. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1668. // This will make all 6 values 0
  1669. cleararray @array[0],0,6;
  1670. // This will make array element 0 change to 245
  1671. cleararray @array[0],245,1;
  1672. // This will make elements 1 and 2 change to 345
  1673. cleararray @array[1],345,2;
  1674. See 'setarray'.
  1675. ---------------------------------------
  1676. *copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>;
  1677. This command lets you quickly shuffle a lot of data between arrays, which is in
  1678. some cases invaluable.
  1679. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1680. // So we have made @array[]
  1681. copyarray @array2[0],@array[2],2;
  1682. // Now, @array2[0] will be equal to @array[2] (300) and
  1683. // @array2[1] will be equal to @array[3].
  1684. So using the examples above:
  1685. @array[0] = 100
  1686. @array[1] = 200
  1687. @array[2] = 300
  1688. @array[3] = 400
  1689. @array[4] = 500
  1690. @array[5] = 600
  1691. New Array:
  1692. @array2[0] = 300
  1693. @array2[1] = 400
  1694. @array2[2] = 0
  1695. @array2[3] = 0
  1696. Notice that @array[4] and @array[5] won't be copied to the second array, and it will return a
  1697. 0.
  1698. ---------------------------------------
  1699. *deletearray <array name>[<first value>],<how much to delete>;
  1700. This command will delete a specified number of array elements totally from an
  1701. array, shifting all the elements beyond this towards the beginning.
  1702. // This will delete array element 0, and move all the other array elements
  1703. // up one place.
  1704. deletearray @array[0],1
  1705. // This would delete array elements numbered 1, 2 and 3, leave element 0 in its
  1706. // place, and move the other elements ups, so there are no gaps.
  1707. deletearray @array[1],3
  1708. ---------------------------------------
  1709. ======================================
  1710. |2.- Information-retrieving commands.|
  1711. ======================================
  1712. ---------------------------------------
  1713. *strcharinfo(<type>)
  1714. This function will return either the name, party name or guild name for the
  1715. invoking character. Whatever it returns is determined by type.
  1716. 0 - Character's name.
  1717. 1 - The name of the party they're in if any.
  1718. 2 - The name of the guild they're in if any.
  1719. 3 - The name of the map the character is in.
  1720. If a character is not a member of any party or guild, an empty string will be
  1721. returned when requesting that information.
  1722. ---------------------------------------
  1723. *strnpcinfo(<type>)
  1724. This function will return the various parts of the name of the calling NPC.
  1725. Whatever it returns is determined by type.
  1726. 0 - The NPC's display name (visible#hidden)
  1727. 1 - The visible part of the NPC's display name
  1728. 2 - The hidden part of the NPC's display name
  1729. 3 - The NPC's unique name (::name)
  1730. 4 - The name of the map the NPC is in.
  1731. ---------------------------------------
  1732. *getarraysize(<array name>)
  1733. This function returns the number of values that are contained inside the
  1734. specified array. Notice that zeros and empty strings at the end of this array
  1735. are not counted towards this number.
  1736. For example:
  1737. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1738. set @arraysize,getarraysize(@array);
  1739. This will make @arraysize == 6. But if you try this:
  1740. setarray @array[0], 100, 200, 300, 400, 500, 600, 0;
  1741. set @arraysize,getarraysize(@array);
  1742. @arraysize will still equal 6, even though you've set 7 values.
  1743. ---------------------------------------
  1744. *getelementofarray(<array name>,<index>)
  1745. This command retrieves the value of the element of given array at given index.
  1746. This is equivalent to using:
  1747. <array name>[<index>]
  1748. The reason for this is, that this short form is internally converted into a call
  1749. to getelementofarray, when the script is loaded.
  1750. Also useful when passing arrays to functions or accessing another npc's arrays:
  1751. getelementofarray(getarg(0),<index>)
  1752. getelementofarray(getvariableofnpc(.var, "testNPC"),<index>)
  1753. ---------------------------------------
  1754. *readparam(<parameter number>{,"<character name>"})
  1755. This function will return the specified stat of the invoking character, or, if a
  1756. character name is specified, of that player. The stat can either be a number or
  1757. paramter name, defined in 'db/const.txt'.
  1758. Some example parameters:
  1759. StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight, MaxWeight,
  1760. JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp, Sp, MaxSp,
  1761. BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk
  1762. All of these also behave as variables, but don't expect to be able to just 'set'
  1763. them - some will not work for various internal reasons.
  1764. Example 1:
  1765. // Returns how many status points you haven't spent yet.
  1766. mes "Unused status points: "+readparam(9);
  1767. Using this particular information as a function call is not required. Typing this
  1768. will return the same result:
  1769. mes "Unused status points: "+StatusPoint;
  1770. Example 2:
  1771. You can also use this command to get stat values.
  1772. if (readparam(bVit) > 77)
  1773. mes "Only people with over 77 Vit are reading this!";
  1774. ---------------------------------------
  1775. *getcharid(<type>{,"<character name>"})
  1776. This function will return a unique ID number of the invoking character, or, if a
  1777. character name is specified, of that player.
  1778. Type is the kind of associated ID number required:
  1779. 0 - Character ID number.
  1780. 1 - Party ID number.
  1781. 2 - Guild ID number.
  1782. 3 - Account ID number.
  1783. 4 - Battle ground ID
  1784. For most purposes other than printing it, a number is better to have than a name
  1785. (people do horrifying things to their character names).
  1786. If the character is not in a party or not in a guild, the function will return 0
  1787. if guild or party number is requested. If a name is specified and the character
  1788. is not found, 0 is returned.
  1789. If getcharid(0) returns a zero, the script got called not by a character and
  1790. doesn't have an attached RID. Note that this will cause the map server to
  1791. print "player not attached!" error messages, so it is preferred to use
  1792. "playerattached" to check for the character attached to the script.
  1793. if (getcharid(2) == 0)
  1794. mes "Only members of a guild are allowed here!";
  1795. ---------------------------------------
  1796. *getnpcid(<type>{,"<npc name>"});
  1797. Retrieves IDs of the currently invoked NPC. If a unique npc name is
  1798. given, IDs of that NPC are retrieved instead. Type specifies what ID
  1799. to retrieve and can be one of the following:
  1800. 0 - Unit ID (GID)
  1801. If an invalid type is given or the NPC does not exist, 0 is returned.
  1802. ---------------------------------------
  1803. *getchildid()
  1804. *getmotherid()
  1805. *getfatherid()
  1806. These functions return the character ID of the attached player's child,
  1807. mother, mother, or father, respectively. It returns 0 if no ID is found.
  1808. if (getmotherid()) mes "Your mother's ID is: "+getmotherid();
  1809. ---------------------------------------
  1810. *ispartneron()
  1811. This function returns 1 if the invoking character's marriage partner is
  1812. currently online and 0 if they are not or if the character has no partner.
  1813. ---------------------------------------
  1814. *getpartnerid()
  1815. This function returns the character ID of the invoking character's marriage
  1816. partner, if any. If the invoking character is not married, it will return 0,
  1817. which is a quick way to see if they are married:
  1818. if (getpartnerid()) mes "I'm not going to be your girlfriend!";
  1819. if (getpartnerid()) mes "You're married already!";
  1820. ---------------------------------------
  1821. *getlook(<type>)
  1822. This function will return the number for the current character look value
  1823. specified by type. See 'setlook' for valid look types.
  1824. This can be used to make a certain script behave differently for characters
  1825. dressed in black. :)
  1826. ---------------------------------------
  1827. *getsavepoint(<information type>)
  1828. This function will return information about the invoking character's save point.
  1829. You can use it to let a character swap between several recorded save points.
  1830. Available information types are:
  1831. 0 - Map name (a string)
  1832. 1 - X coordinate
  1833. 2 - Y coordinate
  1834. ---------------------------------------
  1835. *getcharip({"<character name>"|<account id>|<char id>})
  1836. This function will return the IP address of the invoking character, or, if a player
  1837. is specified, of that character. A blank string is returned if no player is attached.
  1838. Examples:
  1839. // Outputs IP address of attached player.
  1840. mes "Your IP: " + getcharip();
  1841. // Outputs IP address of character "Silver".
  1842. mes "Silver's IP: " + getcharip("Silver");
  1843. ---------------------------------------
  1844. *vip_status(<type>,{"<character name>"})
  1845. Returns various information about a player's VIP status.
  1846. Valid types:
  1847. 1 - VIP status. (1 if VIP, 0 if non-VIP)
  1848. 2 - VIP expire date. (timestamp string if VIP, 0 if non-VIP)
  1849. 3 - VIP time remaining. (timestamp string if VIP, 0 if non-VIP)
  1850. NOTE: This command is only available if the VIP System is enabled.
  1851. ---------------------------------------
  1852. *vip_time <time>,{"<character name>"};
  1853. Changes a player's VIP time (in minutes). A positive value will increase time, and a
  1854. negative value will decrease time.
  1855. NOTE: This command is only available if the VIP System is enabled.
  1856. ---------------------------------------
  1857. *addspiritball <count>,<duration>{,<char_id>};
  1858. Adds spirit ball to player for 'duration' in milisecond.
  1859. ---------------------------------------
  1860. *delspiritball <count>{,<char_id>};
  1861. Deletes the spirit ball(s) from player.
  1862. ---------------------------------------
  1863. *countspiritball {<char_id>};
  1864. Counts the spirit ball that player has.
  1865. ---------------------------------------
  1866. \\
  1867. 2,2 Item-related commands
  1868. \\
  1869. ---------------------------------------
  1870. *getequipid(<equipment slot>)
  1871. This function returns the item ID of the item equipped in the equipment slot
  1872. specified on the invoking character. If nothing is equipped there, it returns -1.
  1873. Valid equipment slots are:
  1874. EQI_HEAD_TOP (1) - Upper Headear
  1875. EQI_ARMOR (2) - Armor (jackets, robes)
  1876. EQI_HAND_L (3) - Left hand (weapons, shields)
  1877. EQI_HAND_R (4) - Right hand (weapons)
  1878. EQI_GARMENT (5) - Garment (mufflers, hoods, manteaus)
  1879. EQI_SHOES (6) - Footgear (shoes, boots)
  1880. EQI_ACC_L (7) - Accessory 1
  1881. EQI_ACC_R (8) - Accessory 2
  1882. EQI_HEAD_MID (9) - Middle Headgear (masks, glasses)
  1883. EQI_HEAD_LOW (10) - Lower Headgear (beards, some masks)
  1884. EQI_COSTUME_HEAD_LOW (11) - Lower Costume Headgear
  1885. EQI_COSTUME_HEAD_MID (12) - Middle Costume Headgear
  1886. EQI_COSTUME_HEAD_TOP (13) - Upper Costume Headgear
  1887. EQI_COSTUME_GARMENT (14) - Costume Garment
  1888. EQI_AMMO (15) - Arrow/Ammunition
  1889. EQI_SHADOW_ARMOR (16) - Shadow Armor
  1890. EQI_SHADOW_WEAPON (17) - Shadow Weapon
  1891. EQI_SHADOW_SHIELD (18) - Shadow Shield
  1892. EQI_SHADOW_SHOES (19) - Shadow Shoes
  1893. EQI_SHADOW_ACC_R (20) - Shadow Accessory 2
  1894. EQI_SHADOW_ACC_L (21) - Shadow Accessory 1
  1895. Notice that a few items occupy several equipment slots, and if the character is
  1896. wearing such an item, 'getequipid' will return its ID number for either slot.
  1897. Can be used to check if you have something equipped, or if you haven't got
  1898. something equipped:
  1899. if(getequipid(EQI_HEAD_TOP)==2234) goto L_WearingTiara;
  1900. mes "Come back when you have a Tiara on";
  1901. close;
  1902. L_WearingTiara:
  1903. mes "What a lovely Tiara you have on";
  1904. close;
  1905. You can also use it to make sure people don't pass a point before removing an
  1906. item totally from them. Let's say you don't want people to wear Legion Plate
  1907. armor, but also don't want them to equip if after the check, you would do this:
  1908. if ((getequipid(EQI_ARMOR) == 2341) || (getequipid(EQI_ARMOR) == 2342) goto L_EquipedLegionPlate;
  1909. // the || is used as an or argument, there is 2341 and 2342 cause there are
  1910. // two different legion plate armors, one with a slot one without.
  1911. if ((countitem(2341) > 0) || (countitem(2432) > 0) goto L_InventoryLegionPlate;
  1912. mes "I will lets you pass";
  1913. close2;
  1914. warp "place",50,50;
  1915. end;
  1916. L_EquipedLegionPlate:
  1917. mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
  1918. close;
  1919. L_InventoryLegionPlate:
  1920. mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
  1921. close;
  1922. ---------------------------------------
  1923. *getequipuniqueid(<equipment slot>)
  1924. This function returns the unique ID (as a string) of the item equipped in the equipment slot
  1925. specified on the invoking character. If nothing is equipped there, it returns an empty string.
  1926. See 'getequipid' for a full list of valid equipment slots.
  1927. ---------------------------------------
  1928. *getequipname(<equipment slot>)
  1929. Returns the jname of the item equipped in the specified equipment slot on the
  1930. invoking character, or an empty string if nothing is equipped in that position.
  1931. Does the same thing as getitemname(getequipid()). Useful for an NPC to state
  1932. what your are wearing, or maybe saving as a string variable.
  1933. See 'getequipid' for a full list of valid equipment slots.
  1934. if( getequipname(EQI_HEAD_TOP) != "" )
  1935. mes "So you are wearing a "+getequipname(EQI_HEAD_TOP)+" on your head";
  1936. else
  1937. mes "You are not wearing any head gear";
  1938. ---------------------------------------
  1939. *getitemname(<item id>)
  1940. Given the database ID number of an item, this function will return the text
  1941. stored in the 'japanese name' field (which, in rAthena, stores an English name
  1942. the players would normally see on screen.)
  1943. ---------------------------------------
  1944. *getbrokenid(<number>)
  1945. This function will search the invoking character's inventory for any broken
  1946. items, and will return their item ID numbers. Since the character may have
  1947. several broken items, 1 given as an argument will return the first one found, 2
  1948. will return the second one, etc. Will return 0 if no such item is found.
  1949. // Let's see if they have anything broken:
  1950. if (getbrokenid(1)==0) goto Skip;
  1951. // They do, so let's print the name of the first broken item:
  1952. mes "Oh, I see you have a broken "+getitemname(getbrokenid(1))+" here!";
  1953. Skip:
  1954. mes "You don't have anything broken, quit bothering me.";
  1955. ---------------------------------------
  1956. *getequipisequiped(<equipment slot>)
  1957. This functions will return 1 if there is an equipment placed on the specified
  1958. equipment slot and 0 otherwise. For a list of equipment slots
  1959. see 'getequipid'. Function originally used by the refining NPCs:
  1960. if (getequipisequiped(EQI_HEAD_TOP)) goto L_equipped;
  1961. mes "[Refiner]";
  1962. mes "Do you want me to refine your dumb head?";
  1963. close;
  1964. L_equipped:
  1965. mes "[Refiner]";
  1966. mes "That's a fine hat you are wearing there...";
  1967. close;
  1968. ---------------------------------------
  1969. *getequipisenableref(<equipment slot>)
  1970. Will return 1 if the item equipped on the invoking character in the specified
  1971. equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
  1972. see 'getequipid'.
  1973. if (getequipisenableref(EQI_HEAD_TOP)) goto L_Refine;
  1974. mes "[Refiner]";
  1975. mes "I can't refine this hat!...";
  1976. close;
  1977. L_Refine:
  1978. mes "[Refiner]";
  1979. mes "Ok I can refine this";
  1980. close;
  1981. ---------------------------------------
  1982. *getequiprefinerycnt(<equipment slot>)
  1983. Returns the current number of pluses for the item in the specified equipment
  1984. slot. For a list of equipment slots see 'getequipid'.
  1985. Can be used to check if you have reached a maximum refine value, default for
  1986. this is +10:
  1987. if(getequiprefinerycnt(EQI_HEAD_TOP) < 10) goto L_Refine_HeadGear;
  1988. mes "Sorry, it's not possible to refine hats better than +10";
  1989. close;
  1990. L_Refine_HeadGear:
  1991. mes "I will now upgrade your "+getequipname(EQI_HEAD_TOP);
  1992. ---------------------------------------
  1993. *getequipweaponlv(<equipment slot>)
  1994. This function returns the weapon level for the weapon equipped in the specified
  1995. equipment slot on the invoking character. For a list of equipment slots see
  1996. 'getequipid'.
  1997. Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons have
  1998. a weapon level. You can, however, probably, use this field for other equippable
  1999. custom items as a flag or something.
  2000. If no item is equipped in this slot, or if it doesn't have a weapon level
  2001. according to the database, 0 will be returned.
  2002. Examples:
  2003. // Right hand can only contain a weapon.
  2004. switch (getequipweaponlv(EQI_HAND_R)) {
  2005. case 1: mes "You are holding a lvl 1 weapon."; break;
  2006. case 2: mes "You are holding a lvl 2 weapon."; break;
  2007. case 3: mes "You are holding a lvl 3 weapon."; break;
  2008. case 4: mes "You are holding a lvl 4 weapon."; break;
  2009. case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
  2010. default: mes "Seems you don't have a weapon on."; break;
  2011. }
  2012. // Left hand can hold either a weapon or shield.
  2013. if (getequipid(EQI_HAND_R) == 0) {
  2014. mes "Seems you have nothing equipped here.";
  2015. close;
  2016. }
  2017. switch (getequipweaponlv(EQI_HAND_L)) {
  2018. case 0: mes "You are holding a shield, so it doesn't have a level."; break;
  2019. case 1: mes "You are holding a lvl 1 weapon."; break;
  2020. case 2: mes "You are holding a lvl 2 weapon."; break;
  2021. case 3: mes "You are holding a lvl 3 weapon."; break;
  2022. case 4: mes "You are holding a lvl 4 weapon."; break;
  2023. case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
  2024. }
  2025. ---------------------------------------
  2026. *getequippercentrefinery(<equipment slot>)
  2027. This function calculates and returns the percent value chance to successfully
  2028. refine the item found in the specified equipment slot of the invoking character
  2029. by +1. There is no actual formula, the success rate for a given weapon level of
  2030. a certain refine level is found in the db/refine_db.txt file. For a list of
  2031. equipment slots see 'getequipid'.
  2032. These values can be displayed for the player to see, or used to calculate the
  2033. random change of a refine succeeding or failing and then going through with it
  2034. (which is what the official NPC refinery scripts use it for)
  2035. // This will find a random number from 0 - 99 and if that is equal to or more
  2036. // than the value recovered by this command it will go to L_Fail
  2037. if (getequippercentrefinery(EQI_HAND_L)<=rand(100)) goto L_Fail;
  2038. ---------------------------------------
  2039. *getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
  2040. This function will count all the items with the specified ID number lying on the
  2041. ground on the specified map within the x1/y1-x2/y2 square on it and return that
  2042. number.
  2043. This is the only function around where a parameter may be either a string or a
  2044. number! If it's a number, it means that only the items with that item ID number
  2045. will be counted. If it is a string, it is assumed to mean the 'english name'
  2046. field from the item database. If you give it an empty string, or something that
  2047. isn't found from the item database, it will count items number '512' (apples).
  2048. ---------------------------------------
  2049. *getequipcardcnt(<equipment slot>)
  2050. This function will return the number of cards that have been compounded onto a
  2051. specific equipped item for the invoking character. See 'getequipid' for a list
  2052. of possible equipment slots.
  2053. ---------------------------------------
  2054. *getinventorylist;
  2055. This command sets a bunch of arrays with a complete list of whatever the
  2056. invoking character has in their inventory, including all the data needed to
  2057. recreate these items perfectly if they are destroyed. Here's what you get:
  2058. @inventorylist_id[] - array of item ids.
  2059. @inventorylist_amount[] - their corresponding item amounts.
  2060. @inventorylist_equip[] - whether the item is equipped or not.
  2061. @inventorylist_refine[] - for how much it is refined.
  2062. @inventorylist_identify[] - whether it is identified.
  2063. @inventorylist_attribute[] - whether it is broken.
  2064. @inventorylist_card1[] - These four arrays contain card data for the items.
  2065. @inventorylist_card2[] These data slots are also used to store names
  2066. @inventorylist_card3[] inscribed on the items, so you can explicitly check
  2067. @inventorylist_card4[] if the character owns an item made by a specific
  2068. craftsman.
  2069. @inventorylist_expire[] - expire time (Unix time stamp). 0 means never expires.
  2070. @inventorylist_bound[] - whether it is bound to the character
  2071. @inventorylist_count - the number of items in these lists.
  2072. This could be handy to save/restore a character's inventory, since no other
  2073. command returns such a complete set of data, and could also be the only way to
  2074. correctly handle an NPC trader for carded and named items who could resell them
  2075. - since NPC objects cannot own items, so they have to store item data in
  2076. variables and recreate the items.
  2077. Notice that the variables this command generates are all temporary, attached to
  2078. the character, and integer.
  2079. Be sure to use @inventorylist_count to go through these arrays, and not
  2080. 'getarraysize', because the arrays are not automatically cleared between runs
  2081. of 'getinventorylist'.
  2082. ---------------------------------------
  2083. *cardscnt()
  2084. This function will return the number of cards inserted into the equipment
  2085. from which the function is called.
  2086. This function is intended for use in item scripts.
  2087. ---------------------------------------
  2088. *getrefine()
  2089. This function will return the refine count of the equipment from which the
  2090. function is called.
  2091. This function is intended for use in item scripts.
  2092. ---------------------------------------
  2093. *getnameditem(<item id>,"<name to inscribe>");
  2094. *getnameditem("<item name>","<name to inscribe>");
  2095. This function is equivalent to using 'getitem', however, it will not just give
  2096. the character an item object, but will also inscribe it with a specified
  2097. character's name. You may not inscribe items with arbitrary strings, only with
  2098. names of characters that actually exist. While this isn't said anywhere
  2099. specifically, apparently, named items may not have cards in them, slots or no -
  2100. these data slots are taken by the character ID who's name is inscribed. Only one
  2101. remains free and it's not quite clear if a card may be there.
  2102. This function will return 1 if an item was successfully created and 0 if it
  2103. wasn't for whatever reason. Like 'getitem', this function will also accept an
  2104. 'english name' from the item database as an item name and will return 0 if no
  2105. such item exists.
  2106. ---------------------------------------
  2107. *getitemslots(<item ID>)
  2108. This function will look up the item with the specified ID number in the database
  2109. and return the number of slots this kind of items has - 0 if they are not
  2110. slotted. It will also be 0 for all non-equippable items, naturally, unless
  2111. someone messed up the item database. It will return -1 if there is no such item.
  2112. Example:
  2113. //.@slots now has the amount of slots of the item with ID 1205.
  2114. .@slots = getitemslots(1205);
  2115. ---------------------------------------
  2116. *getiteminfo(<item ID>,<type>)
  2117. This function will look up the item with the specified ID number in the database
  2118. and return the info set by TYPE argument.
  2119. It will return -1 if there is no such item.
  2120. Valid types are:
  2121. 0 - Buy Price
  2122. 1 - Sell Price
  2123. 2 - Type
  2124. 3 - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
  2125. if = 0, then monsters don't drop it at all (rare or a quest item)
  2126. if = 10000, then this item is sold in NPC shops only
  2127. 4 - Gender
  2128. 5 - Loc
  2129. 6 - Weight
  2130. 7 - ATK
  2131. 8 - DEF
  2132. 9 - Range
  2133. 10 - Slot
  2134. 11 - View
  2135. 12 - eLV
  2136. 13 - wLV
  2137. 14 - SpriteID from 'db/item_avail.txt'
  2138. 15 - matk if RENEWAL is defined
  2139. See the sample in 'doc/sample/getiteminfo.txt'.
  2140. ---------------------------------------
  2141. *getequipcardid(<equipment slot>,<card slot>)
  2142. Returns value from equipped item slot in the indicated slot (0, 1, 2, or 3).
  2143. This function returns CARD ID, 255,254,-255 (for card 0, if the item is produced).
  2144. It's useful for when you want to check whether an item contains cards or if it's signed.
  2145. ---------------------------------------
  2146. //
  2147. 2,1.- End of item-related commands.
  2148. //
  2149. ---------------------------------------
  2150. *getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})
  2151. This function will locate a character object, NPC object or pet's coordinates
  2152. and place their coordinates into the variables specified when calling it. It
  2153. will return 0 if the search was successful, and -1 if the parameters given were
  2154. not variables or the search was not successful.
  2155. Type is the type of object to search for:
  2156. 0 - Character object
  2157. 1 - NPC object
  2158. 2 - Pet object
  2159. 3 - Monster object
  2160. 4 - Homunculus object
  2161. 5 - Mercenary object
  2162. 6 - Elemental object
  2163. While 3 is meant to look for a monster object, no searching will be done if you
  2164. specify type 3, and the function will always return -1.
  2165. The search string is optional. If it is not specified, the location of the
  2166. invoking character will always be returned for types 0 and 2, the location of
  2167. the NPC running this function for type 1.
  2168. If a search string is specified, for types 0 and 1, the character or NPC with
  2169. the specified name will be located. If type is 3, the search will locate the
  2170. current pet of the character who's name is given in the search string, it will
  2171. NOT locate a pet by name.
  2172. Example:
  2173. prontera,164,301,3%TAB%script%TAB%Meh%TAB%730,{
  2174. mes "My name is Meh. I'm here so that Nyah can find me.";
  2175. close;
  2176. }
  2177. prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
  2178. mes "My name is Nyah.";
  2179. mes "I will now search for Meh all across the world!";
  2180. if (getmapxy(@mapname$,@mapx,@mapy,1,"Meh")!=0) {
  2181. mes "I can't seem to find Meh anywhere!";
  2182. close;
  2183. }
  2184. mes "And I found him on map "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !";
  2185. close;
  2186. }
  2187. Notice that NPC objects disabled with 'disablenpc' will still be located.
  2188. ---------------------------------------
  2189. *getgmlevel()
  2190. This function will return the (GM) level associated with the player group to which
  2191. the invoking character belongs. If this is somehow executed from a console command,
  2192. 99 will be returned, and 0 will be returned if the account has no GM level.
  2193. This allows you to make NPC's only accessible for certain GM levels, or behave
  2194. specially when talked to by GMs.
  2195. if (getgmlevel()) mes "What is your command, your godhood?";
  2196. ---------------------------------------
  2197. *getgroupid()
  2198. This function will return the group id to which the invoking player belongs.
  2199. ---------------------------------------
  2200. *gettimetick(<tick type>)
  2201. This function will return a tick depending on <tick type>:
  2202. 0: The server's tick, a measurement in milliseconds used by the server's timer
  2203. system. This tick is an unsigned int which loops every ~50 days.
  2204. 1: The time, in seconds, since the start of the current day.
  2205. 2: The system time in UNIX epoch time, or the number of seconds elapsed since
  2206. January 1st, 1970. Useful for reliably measuring time intervals.
  2207. ---------------------------------------
  2208. *gettime(<type>)
  2209. This function will return specified information about the current system time.
  2210. 1 - Seconds (of a minute)
  2211. 2 - Minutes (of an hour)
  2212. 3 - Hour (of a day)
  2213. 4 - Week day (0 for Sunday, 6 is Saturday)
  2214. 5 - Day of the month.
  2215. 6 - Number of the month.
  2216. 7 - Year.
  2217. 8 - Day of the year.
  2218. It will only return numbers.
  2219. if (gettime(4)==6) mes "It's a Saturday. I don't work on Saturdays.";
  2220. ---------------------------------------
  2221. *gettimestr(<format string>,<max length>)
  2222. This function will return a string containing time data as specified by the
  2223. format string.
  2224. This uses the C function 'strfmtime', which obeys special format characters. For
  2225. a full description see, for example, the description of 'strfmtime' at
  2226. http://www.delorie.com/gnu/docs/glibc/libc_437.html
  2227. All the format characters given in there should properly work.
  2228. Max length is the maximum length of a time string to generate.
  2229. The example given in rAthena sample scripts works like this:
  2230. mes gettimestr("%Y-%m/%d %H:%M:%S",21);
  2231. This will print a full date and time like 'YYYY-MM/DD HH:MM:SS'.
  2232. ---------------------------------------
  2233. *getusers(<type>)
  2234. This function will return a number of users on a map or the whole server. What
  2235. it returns is specified by Type.
  2236. Type can be one of the following values, which control what will be returned:
  2237. 0 - Count of all characters on the map of the invoking character.
  2238. 1 - Count of all characters in the entire server.
  2239. 8 - Count of all characters on the map of the NPC the script is
  2240. running in.
  2241. ---------------------------------------
  2242. *getmapusers("<map name>")
  2243. This function will return the number of users currently located on the specified
  2244. map.
  2245. This is used officially in PVP scripts to check whether a room is filled to capacity.
  2246. ---------------------------------------
  2247. *getareausers("<map name>",<x1>,<y1>,<x2>,<y2>)
  2248. This function will return the count of connected characters which are located
  2249. within the specified area - an x1/y1-x2/y2 square on the specified map.
  2250. This is useful for maps that are split into many buildings, such as all the
  2251. "*_in" maps, due to all the shops and houses.
  2252. ---------------------------------------
  2253. *getusersname;
  2254. This command will give the invoking character a list of names of the connected
  2255. characters (including themselves) into an NPC script message window (see 'mes')
  2256. paging it by 10 names as if with the 'next' command.
  2257. You need to put a 'close' after that yourself.
  2258. ---------------------------------------
  2259. \\
  2260. 2,2.- Guild-related commands
  2261. \\
  2262. ---------------------------------------
  2263. *getguildname(<guild id>)
  2264. This function returns a guild's name given an ID number. If there is no such
  2265. guild, "null" will be returned.
  2266. Example:
  2267. mes "The guild "+getguildname(10007)+" are all nice people.";
  2268. ---------------------------------------
  2269. *getguildmember <guild id>{,<type>};
  2270. This command will find all members of a specified guild and returns their names
  2271. (or character id or account id depending on the value of "type") into an array
  2272. of temporary global variables.
  2273. Upon executing this,
  2274. $@guildmembername$[] is a global temporary string array which contains all the
  2275. names of these guild members.
  2276. (only set when type is 0 or not specified)
  2277. $@guildmembercid[] is a global temporary number array which contains the
  2278. character id of these guild members.
  2279. (only set when type is 1)
  2280. $@guildmemberaid[] is a global temporary number array which contains the
  2281. account id of these guild members.
  2282. (only set when type is 2)
  2283. $@guildmembercount is the number of guild members that were found.
  2284. The guild members will be found regardless of whether they are online or offline.
  2285. Note that the names come in no particular order.
  2286. Be sure to use $@guildmembercount to go through this array, and not
  2287. 'getarraysize', because it is not cleared between runs of 'getguildmember'.
  2288. For usage examples, see 'getpartymember'.
  2289. ---------------------------------------
  2290. *getguildmaster(<guild id>)
  2291. This function return the name of the master of the guild which has the specified
  2292. ID number. If there is no such guild, "null" will be returned.
  2293. Example 1:
  2294. // Prints the guild master of guild 10007, whoever that might be.
  2295. mes getguildmaster(10007)+" runs "+getguildname(10007);
  2296. Example 2:
  2297. // Checks if the character is the guild master of the specified guild.
  2298. .@GID = getcharid(2);
  2299. if (.@GID == 0) {
  2300. mes "Sorry, you are not in a guild.";
  2301. close;
  2302. }
  2303. if (strcharinfo(0) != getguildmaster(.@GID)) {
  2304. mes "Sorry, you don't own the guild you are in.";
  2305. close;
  2306. }
  2307. mes "Welcome, guild master of "+getguildname(.@GID);
  2308. close;
  2309. ---------------------------------------
  2310. *getguildmasterid(<guild id>)
  2311. This function will return the character ID number of the guild master of the
  2312. guild specified by the ID. 0 if the character is not a guild master of any guild.
  2313. ---------------------------------------
  2314. *getcastlename("<map name>")
  2315. This function returns the name of the castle when given the map name for that
  2316. castle. The data is read from 'db/castle_db.txt'.
  2317. ---------------------------------------
  2318. *getcastledata("<map name>",<type of data>)
  2319. *setcastledata "<map name>",<type of data>,<value>;
  2320. This function returns the castle ownership information for the castle referred
  2321. to by its map name. Castle information is stored in `guild_castle` SQL table.
  2322. Types of data correspond to `guild_castle` table columns:
  2323. 1 - `guild_id` - Guild ID.
  2324. 2 - `economy` - Castle Economy score.
  2325. 3 - `defense` - Castle Defense score.
  2326. 4 - `triggerE` - Number of times the economy was invested in today.
  2327. 5 - `triggerD` - Number of times the defense was invested in today.
  2328. 6 - `nextTime` - unused
  2329. 7 - `payTime` - unused
  2330. 8 - `createTime` - unused
  2331. 9 - `visibleC` - Is 1 if a Kafra was hired for this castle, 0 otherwise.
  2332. 10 - `visibleG0` - Is 1 if the 1st guardian is present (Soldier Guardian)
  2333. 11 - `visibleG1` - Is 1 if the 2nd guardian is present (Soldier Guardian)
  2334. 12 - `visibleG2` - Is 1 if the 3rd guardian is present (Soldier Guardian)
  2335. 13 - `visibleG3` - Is 1 if the 4th guardian is present (Archer Guardian)
  2336. 14 - `visibleG4` - Is 1 if the 5th guardian is present (Archer Guardian)
  2337. 15 - `visibleG5` - Is 1 if the 6th guardian is present (Knight Guardian)
  2338. 16 - `visibleG6` - Is 1 if the 7th guardian is present (Knight Guardian)
  2339. 17 - `visibleG7` - Is 1 if the 8th guardian is present (Knight Guardian)
  2340. All types of data have their meaning determined by War of Emperium scripts,
  2341. with exception of:
  2342. - `guild_id` that is always considered ID of the guild that owns the castle,
  2343. - `defense` that is used in Guardians & Emperium HP calculations,
  2344. - `visibleG` that is always considered to hold guardian presence bits.
  2345. The 'setcastledata' command will behave identically, but instead of returning
  2346. values for the specified types of accessible data, it will alter them and cause
  2347. them to be sent to the char-server for storage.
  2348. Changing Guild ID or Castle Defense will trigger additional actions, like
  2349. recalculating guardians' HP.
  2350. ---------------------------------------
  2351. *getgdskilllv(<guild id>,<skill id>)
  2352. *getgdskilllv(<guild id>,"<skill name>")
  2353. This function returns the level of the skill <skill id> of the guild <guild id>.
  2354. If the guild does not have that skill, 0 is returned.
  2355. If the guild does not exist, -1 is returned.
  2356. Refer to 'db/(pre-)re/skill_db.txt' for the full list of skills. (GD_* are guild skills)
  2357. ---------------------------------------
  2358. *requestguildinfo <guild id>{,"<event label>"};
  2359. This command requests the guild data from the char server and merrily continues
  2360. with the execution. Whenever the guild information becomes available (which
  2361. happens instantly if the guild information is already in memory, or later, if it
  2362. isn't and the map server has to wait for the char server to reply) it will run
  2363. the specified event as in a 'doevent' call.
  2364. ---------------------------------------
  2365. *getmapguildusers("<map name>",<guild id>)
  2366. Returns the amount of characters from the specified guild on the given map.
  2367. Example:
  2368. mes "You have "+getMapGuildUsers("prontera",getcharid(2))+" guild members in Prontera.";
  2369. ---------------------------------------
  2370. //
  2371. 2,2.- End of guild-related commands
  2372. //
  2373. ---------------------------------------
  2374. *getskilllv(<skill id>)
  2375. *getskilllv("<skill name>")
  2376. This function returns the level of the specified skill that the invoking
  2377. character has. If they don't have the skill, 0 will be returned. The full list
  2378. of character skills is available in 'db/(pre-)re/skill_db.txt'.
  2379. There are two main uses for this function, it can check whether the character
  2380. has a skill or not, and it can tell you if the level is high enough.
  2381. Example 1:
  2382. if (getskilllv(152)) goto L_HasSkillThrowStone;
  2383. mes "You don't have Throw Stone";
  2384. close;
  2385. L_HasSkillThrowStone:
  2386. mes "You have got the skill Throw Stone";
  2387. close;
  2388. Example 2:
  2389. if (getskilllv(28) >= 5) goto L_HasSkillHeallvl5orMore;
  2390. if (getskilllv(28) == 10) goto L_HasSkillHealMaxed;
  2391. mes "You heal skill is below lvl 5";
  2392. close;
  2393. L_HasSkillHeallvl6orMore:
  2394. mes "Your heal lvl is 5 or more";
  2395. close;
  2396. L_HasSkillHealMaxed:
  2397. mes "Your heal lvl has been maxed";
  2398. close;
  2399. ---------------------------------------
  2400. *getskilllist;
  2401. This command sets a bunch of arrays with a complete list of skills the
  2402. invoking character has. Here's what you get:
  2403. @skilllist_id[] - skill ids.
  2404. @skilllist_lv[] - skill levels.
  2405. @skilllist_flag[] - see 'skill' for the meaning of skill flags.
  2406. @skilllist_count - number of skills in the above arrays.
  2407. While 'getskillv' is probably more useful for most situations, this is the
  2408. easiest way to store all the skills and make the character something else for a
  2409. while. Advanced job for a day? :) This could also be useful to see how many
  2410. skills a character has.
  2411. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2412. ---------------------------------------
  2413. *getmonsterinfo(<mob ID>,<type>)
  2414. This function will look up the monster with the specified ID number in the
  2415. mob database and return the info set by TYPE argument.
  2416. It will return -1 if there is no such monster (or the type value is invalid),
  2417. or "null" if you requested the monster's name.
  2418. Valid types are listed in 'db/const.txt':
  2419. MOB_NAME 0
  2420. MOB_LV 1
  2421. MOB_MAXHP 2
  2422. MOB_BASEEXP 3
  2423. MOB_JOBEXP 4
  2424. MOB_ATK1 5
  2425. MOB_ATK2 6
  2426. MOB_DEF 7
  2427. MOB_MDEF 8
  2428. MOB_STR 9
  2429. MOB_AGI 10
  2430. MOB_VIT 11
  2431. MOB_INT 12
  2432. MOB_DEX 13
  2433. MOB_LUK 14
  2434. MOB_RANGE 15
  2435. MOB_RANGE2 16
  2436. MOB_RANGE3 17
  2437. MOB_SIZE 18
  2438. MOB_RACE 19
  2439. MOB_ELEMENT 20
  2440. MOB_MODE 21
  2441. MOB_MVPEXP 22
  2442. For more details, see the sample in 'doc/sample/getmonsterinfo.txt'.
  2443. ---------------------------------------
  2444. *getmobdrops(<mob id>)
  2445. This command will find all drops of the specified mob and return the item IDs
  2446. and drop percentages into arrays of temporary global variables.
  2447. 'getmobdrops' returns 1 if successful and 0 if the mob ID doesn't exist.
  2448. Upon executing this,
  2449. $@MobDrop_item[] is a global temporary number array which contains the
  2450. item IDs of the monster's drops.
  2451. $@MobDrop_rate[] is a global temporary number array which contains the
  2452. drop percentages of each item. (1 = .01%)
  2453. $@MobDrop_count is the number of item drops found.
  2454. Be sure to use $@MobDrop_count to go through the arrays, and not
  2455. 'getarraysize', because the temporary global arrays are not cleared between
  2456. runs of 'getmobdrops'. If a mob with 7 item drops is looked up, the arrays would
  2457. have 7 elements. But if another mob is looked up and it only has 5 item drops,
  2458. the server will not clear the arrays for you, overwriting the values instead. So
  2459. in addition to returning the 5 item drops, the 6th and 7th elements from the
  2460. last call remain, and you will get 5+2 item drops, of which the last 2 don't
  2461. belong to the new mob. $@MobDrop_count will always contain the correct number
  2462. (5), unlike 'getarraysize()' which would return 7 in this case.
  2463. Example:
  2464. // get a Mob ID from the user
  2465. input .@mob_id;
  2466. if (getmobdrops(.@mob_id)) { // 'getmobdrops' returns 1 on success
  2467. // immediately copy global temporary variables into scope variables,
  2468. // since we don't know when 'getmobdrops' will get called again for
  2469. // another mob, overwriting your global temporary variables
  2470. .@count = $@MobDrop_count;
  2471. copyarray .@item[0],$@MobDrop_item[0],.@count;
  2472. copyarray .@rate[0],$@MobDrop_rate[0],.@count;
  2473. mes getmonsterinfo(.@mob_id,MOB_NAME) + " - " + .@count + " drops found:";
  2474. for( .@i = 0; .@i < .@count; .@i++ ) {
  2475. mes .@item[.@i] + " (" + getitemname(.@item[.@i]) + ") " + .@rate[.@i]/100 + ((.@rate[.@i]%100 < 10) ? ".0":".") + .@rate[.@i]%100 + "%";
  2476. }
  2477. } else {
  2478. mes "Unknown monster ID.";
  2479. }
  2480. close;
  2481. ---------------------------------------
  2482. *skillpointcount()
  2483. Returns the total amount of skill points a character possesses (SkillPoint+SP's used in skills)
  2484. This command can be used to check the currently attached characters total amount of skill points.
  2485. This means the skill points used in skill are counted, and added to SkillPoints (number of skill points not used).
  2486. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2487. Example 1:
  2488. .@skillPoints = skillpointcount();
  2489. mes "You have " + .@skillPoints + " skill points in total!";
  2490. Example 2:
  2491. if (skillpointcount() > 20)
  2492. mes "Wow, you have more then 20 Skill Points in total!";
  2493. ---------------------------------------
  2494. *getscrate(<effect type>,<base rate>{,<GID>})
  2495. This function will return the chance of a status effect affecting the invoking
  2496. character, in percent, modified by the their current defense against said
  2497. status. The 'base rate' is the base chance of the status effect being inflicted,
  2498. in percent.
  2499. if (rand(100) > getscrate(Eff_Blind, 50)) goto BlindHimNow;
  2500. You can see the full list of available effect types you can possibly inflict in
  2501. 'db/const.txt' under 'Eff_'.
  2502. ---------------------------------------
  2503. ========================
  2504. |3.- Checking commands.|
  2505. ========================
  2506. -------------------------
  2507. *playerattached()
  2508. Returns the ID of the player currently attached to the script. It will return
  2509. 0 if no one is attached, or if the attached player no longer exists on the map
  2510. server. It is wise to check for the attached player in script functions that
  2511. deal with timers as there's no guarantee the player will still be logged on
  2512. when the timer triggers. Note that the ID of a player is actually their
  2513. account ID.
  2514. ---------------------------------------
  2515. *isloggedin(<account id>{,<char id>})
  2516. This function returns 1 if the specified account is logged in and 0 if they
  2517. aren't. You can also pass the char id to check for both account and char id.
  2518. ---------------------------------------
  2519. *checkweight(<item id>,<amount>{,<item id>,<amount>,<item id>,<amount>,...});
  2520. *checkweight("<item name>",<amount>{,"<item name>",<amount>,"<item name>",<amount>,...});
  2521. *checkweight2(<id_array>,<amount_array>);
  2522. These functions will compute and return 1 if the total weight of the specified
  2523. number of specific items does not exceed the invoking character's carrying
  2524. capacity, and 0 otherwise. It is important to see if a player can carry the
  2525. items you expect to give them, failing to do that may open your script up to
  2526. abuse or create some very unfair errors.
  2527. The second function will check an array of items and amounts, and also
  2528. returns 1 on success and 0 on failure.
  2529. The functions, in addition to checking to see if the player is capable of
  2530. holding a set amount of items, also ensure the player has room in their
  2531. inventory for the item(s) they will be receiving.
  2532. Like 'getitem', this function will also accept an 'english name' from the
  2533. database as an argument.
  2534. Example 1:
  2535. if (checkweight(512,10)) {
  2536. getitem 512,10;
  2537. } else {
  2538. mes "Sorry, you cannot hold this amount of apples!";
  2539. }
  2540. Example 2:
  2541. setarray .@item[0],512,513,514;
  2542. setarray .@amount[0],10,5,5;
  2543. if (!checkweight(.@item,.@amount)) {
  2544. mes "Sorry, you cannot hold this amount of fruit!";
  2545. }
  2546. ---------------------------------------
  2547. *basicskillcheck()
  2548. This function will return the state of the configuration option
  2549. 'basic_skill_check' in 'battle_athena.conf'. It returns 1 if the option is
  2550. enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which
  2551. it is by default, characters must have a certain number of basic skill levels to
  2552. sit, request a trade, use emotions, etc. Making your script behave differently
  2553. depending on whether the characters must actually have the skill to do all these
  2554. things might in some cases be required.
  2555. ---------------------------------------
  2556. *checkoption(<option number>)
  2557. *checkoption1(<option number>)
  2558. *checkoption2(<option number>)
  2559. *setoption <option number>{,<flag>};
  2560. The 'setoption' series of functions check for a so-called option that is set on
  2561. the invoking character. 'Options' are used to store status conditions and a lot
  2562. of other non-permanent character data of the yes-no kind. For most common cases,
  2563. it is better to use 'checkcart','checkfalcon','checkriding' and other similar
  2564. functions, but there are some options which you cannot get at this way. They
  2565. return 1 if the option is set and 0 if the option is not set.
  2566. Option numbers valid for the first (option) version of this command are:
  2567. 0x1 - Sight in effect.
  2568. 0x2 - Hide in effect.
  2569. 0x4 - Cloaking in effect.
  2570. 0x8 - Cart number 1 present.
  2571. 0x10 - Falcon present.
  2572. 0x20 - Peco Peco present.
  2573. 0x40 - GM Perfect Hide in effect.
  2574. 0x80 - Cart number 2 present.
  2575. 0x100 - Cart number 3 present.
  2576. 0x200 - Cart number 4 present.
  2577. 0x400 - Cart number 5 present.
  2578. 0x800 - Orc head present.
  2579. 0x1000 - The character is wearing a wedding sprite.
  2580. 0x2000 - Ruwach is in effect.
  2581. 0x4000 - Chasewalk in effect.
  2582. 0x8000 - Flying or Xmas suit.
  2583. 0x10000 - Sighttrasher.
  2584. 0x100000 - Warg present.
  2585. 0x200000 - The character is riding a warg.
  2586. Option numbers valid for the second version (opt1) of this command are:
  2587. 1 - Petrified.
  2588. 2 - Frozen.
  2589. 3 - Stunned.
  2590. 4 - Sleeping.
  2591. 6 - Petrifying (the state where you can still walk)
  2592. Option numbers valid for the third version (opt2) of this command are:
  2593. 0x1 - Poisoned.
  2594. 0x2 - Cursed.
  2595. 0x4 - Silenced.
  2596. 0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
  2597. 0x10 - Blinded.
  2598. 0x80 - Deadly poisoned.
  2599. Option numbers (except for opt1) are bit-masks - you can add them up to check
  2600. for several states, but the functions will return true if at least one of them
  2601. is in effect.
  2602. 'setoption' will set options on the invoking character. There are no second and
  2603. third versions of this command, so you can only change the values in the first
  2604. list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted),
  2605. the option will be added to what the character currently has; if 0, the option is removed.
  2606. This is definitely not a complete list of available option flag numbers. Ask a
  2607. core developer (or read the source: src/map/status.h) for the full list.
  2608. ---------------------------------------
  2609. *setcart {<type>};
  2610. *checkcart()
  2611. If <type> is 0 this command will remove the cart from the character.
  2612. Otherwise it gives the invoking character a cart. The cart given will be
  2613. cart number <type> and will work regardless of whether the character is a
  2614. merchant class or not.
  2615. Note: the character needs to have the skill MC_PUSHCART to gain a cart
  2616. The accompanying function will return 1 if the invoking character has a cart
  2617. (any kind of cart) and 0 if they don't.
  2618. if (checkcart()) mes "But you already have a cart!";
  2619. ---------------------------------------
  2620. *setfalcon {<flag>};
  2621. *checkfalcon()
  2622. If <flag> is 0 this command will remove the falcon from the character.
  2623. Otherwise it gives the invoking character a falcon. The falcon will be there
  2624. regardless of whether the character is a hunter or not. It will (probably) not
  2625. have any useful effects for non-hunters though.
  2626. Note: the character needs to have the skill HT_FALCON to gain a falcon
  2627. The accompanying function will return 1 if the invoking character has a falcon
  2628. and 0 if they don't.
  2629. if (checkfalcon()) mes "But you already have a falcon!";
  2630. ---------------------------------------
  2631. *setriding {<flag>};
  2632. *checkriding()
  2633. If <flag> is 0 this command will remove the mount from the character.
  2634. Otherwise it gives the invoking character a PecoPeco (if they are a Knight
  2635. series class), a GrandPeco (if they are a Crusader series class), or
  2636. a Gryphon (if they are a Royal Guard). Unlike 'setfalcon' and 'setcart'
  2637. this will not work at all if they aren't of a class which can ride.
  2638. Note: the character needs to have the skill KN_RIDING to gain a mount
  2639. The accompanying function will return 1 if the invoking character is riding a
  2640. bird and 0 if they aren't.
  2641. if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!";
  2642. ---------------------------------------
  2643. *setdragon {<color>};
  2644. *checkdragon()
  2645. The 'setdragon' function toggles mounting a dragon for the invoking character.
  2646. It will return 1 if successful, 0 otherwise.
  2647. The available colors are:
  2648. 1 - Green Dragon (default)
  2649. 2 - Brown Dragon
  2650. 3 - Gray Dragon
  2651. 4 - Blue Dragon
  2652. 5 - Red Dragon
  2653. Note: the character must be a Rune Knight and have the skill RK_DRAGONTRAINING to gain a mount
  2654. The accompanying function will return 1 if the invoking character is riding a
  2655. dragon and 0 if they aren't.
  2656. ---------------------------------------
  2657. *setmadogear {<flag>};
  2658. *checkmadogear()
  2659. If <flag> is 0 this command will remove the mount from the character.
  2660. Otherwise it gives the invoking character a Mado (if they are a Mechanic).
  2661. The accompanying function will return 1 if the invoking character has a
  2662. Mado and 0 if they don't.
  2663. ---------------------------------------
  2664. *setmounting;
  2665. *ismounting()
  2666. The 'setmounting' function toggles cash mount for the invoking character.
  2667. It will return 1 if successful, 0 otherwise.
  2668. Note: Character must not be mounting a non-cash mount (eg. dragon, peco, wug, etc.)
  2669. The accompanying function will return 1 if the invoking character has a
  2670. cash mount and 0 if they don't.
  2671. ---------------------------------------
  2672. *checkwug()
  2673. This function will return 1 if the invoking character has a
  2674. warg and 0 if they don't.
  2675. ---------------------------------------
  2676. *checkvending({"<Player Name>"})
  2677. *checkchatting({"<Player Name>"})
  2678. Checks if the player is vending or in a chatroom.
  2679. Name is optional, and defaults to the attached player if omitted.
  2680. Return values for 'checkvending' are
  2681. 0 = not vending
  2682. 1 = normal vending
  2683. 2 = vending using @autotrade
  2684. 'checkchatting' returns 1 if they are in a chat room, 0 if they are not.
  2685. Examples:
  2686. //This will check if Aaron is vending, and if so, put a message in front
  2687. //of the attached player saying Aaron is vending.
  2688. if (checkvending("Aaron"))
  2689. mes "Aaron is currently vending!";
  2690. //This will check if the attached player in a chat room or not.
  2691. if (checkchatting())
  2692. mes "You are currently in a chat room!";
  2693. ---------------------------------------
  2694. *checkidle({"<Player Name>"})
  2695. Returns the time, in seconds, that the specified player has been idle.
  2696. Name is optional, and defaults to the attached player if omitted.
  2697. ---------------------------------------
  2698. *agitcheck()
  2699. *agitcheck2()
  2700. These function will let you check whether the server is currently in WoE mode
  2701. (or WoE SE mode if the second function is called) and will return 1 if War of
  2702. Emperium is on and 0 if it isn't.
  2703. ---------------------------------------
  2704. *isnight()
  2705. *isday()
  2706. These functions will return 1 or 0 depending on whether the server is in night
  2707. mode or day mode. 'isnight' returns 1 if it's night and 0 if it isn't, 'isday'
  2708. the other way around. They can be used interchangeably, pick the one you like
  2709. more:
  2710. // These two are equivalent:
  2711. if (isday()) mes "I only prowl in the night.";
  2712. if (isnight()!=1) mes "I only prowl in the night.";
  2713. ---------------------------------------
  2714. *checkre(<type>)
  2715. Checks if a renewal feature is enabled or not in renewal.h, and returns 1 if
  2716. enabled and 0 for disabled.
  2717. The renewal feature to check is determined by type.
  2718. 0 - RENEWAL (game renewal server mode)
  2719. 1 - RENEWAL_CAST (renewal cast time)
  2720. 2 - RENEWAL_DROP (renewal drop rate algorithms)
  2721. 3 - RENEWAL_EXP (renewal exp rate algorithms)
  2722. 4 - RENEWAL_LVDMG (renewal level modifier on damage)
  2723. 5 - RENEWAL_ASPD (renewal ASPD)
  2724. ---------------------------------------
  2725. *is_clientver(<type>,<value>{,<char id>})
  2726. Checks a character's client version against a specified value. If no char id is
  2727. given, the command will run for the invoking character. The function will return
  2728. 1 if the player's version is greater than or equal to the value, and 0 otherwise.
  2729. Available types are:
  2730. 0 - version number (packet_db_ver)
  2731. 1 - client date (YYYYMMDD)
  2732. ---------------------------------------
  2733. \\
  2734. 3,1.- Item-related commands
  2735. \\
  2736. ---------------------------------------
  2737. *isequipped(<id>{,<id>{,<id>{,<id>}}})
  2738. This function will return 1 if the invoking character has all of the item
  2739. IDs given equipped (if card IDs are passed, then it checks if the cards are
  2740. inserted into slots in the equipment they are currently wearing). Theoretically
  2741. there is no limit to the number of items that may be tested for at the same time.
  2742. If even one of the items given is not equipped, 0 will be returned.
  2743. // (Poring,Santa Poring,Poporing,Marin)
  2744. if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
  2745. // (Poring)
  2746. if (isequipped(4001)) mes "A poring card is useful, don't you think?";
  2747. The function was meant for item scripts to support the cards released by Gravity
  2748. in February 2005, but it will work just fine in normal NPC scripts.
  2749. ---------------------------------------
  2750. *isequippedcnt(<card id>{,<card id>{,<card id>{,<card id>}}})
  2751. This function is similar to 'isequipped', but instead of 1 or 0, it will return
  2752. the number of cards in the list given that were found on the invoking character.
  2753. If a given parameter is not a card, the function returns the amount of that
  2754. item equipped on the invoking character.
  2755. if (isequippedcnt(4001,4005,4033,4196) == 4) mes "Finally got all four poring cards?";
  2756. ---------------------------------------
  2757. *checkequipedcard(<card id>)
  2758. This function will return 1 if the card specified by its item ID number is
  2759. inserted into any equipment they have in their inventory, currently equipped or
  2760. not.
  2761. ---------------------------------------
  2762. //
  2763. 3,1.- End of item-related commands
  2764. //
  2765. ---------------------------------------
  2766. ==============================
  2767. |4.- Player-related commands.|
  2768. ==============================
  2769. -------------------------
  2770. *attachrid(<account ID>)
  2771. *detachrid;
  2772. These commands allow the manipulation of the script's currently attached player.
  2773. While 'attachrid' allows attaching of a different player by using its account id
  2774. for the parameter RID, 'detachrid' makes the following commands run as if the
  2775. script was never invoked by a player.
  2776. The command returns 0 if the player cannot be attached (if the account is offline
  2777. or does not exist), and 1 upon success.
  2778. -------------------------
  2779. *addrid(<type>{,<flag>{,<parameters>}});
  2780. This command will attach other RIDs to the current script without detaching the
  2781. invoking RID. It returns 1 if successful and 0 upon failure.
  2782. <type> determines what RIDs are attached:
  2783. 0: All players in the server.
  2784. 1: All players in the map of the invoking player, or the invoking NPC if no player is attached.
  2785. 2: Party members of a specified party ID.
  2786. [ Parameters: <party id> ]
  2787. 3: Guild members of a specified guild ID.
  2788. [ Parameters: <guild id> ]
  2789. 4: All players in a specified area of the map of the invoking player (or NPC).
  2790. [ Parameters: <x0>,<y0>,<x1>,<y1> ]
  2791. Account ID: The specified account ID.
  2792. <flag> can prevent certain players from being attached:
  2793. 0: Players are always attached. (default)
  2794. 1: Players currently running another script will not be attached.
  2795. ---------------------------------------
  2796. *rid2name(<rid>)
  2797. Converts rid to name. Note: The player/monster/NPC must be online/enabled.
  2798. Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
  2799. Note: rid2name may not produce correct character names since rid = account id.
  2800. It will return the current online character of the account only.
  2801. ---------------------------------------
  2802. *message "<character name>","<message>";
  2803. That command will send a message to the chat window of the character specified
  2804. by name. The text will also appear above the head of that character. It will not
  2805. be seen by anyone else.
  2806. ---------------------------------------
  2807. *dispbottom "<message>",<color>;
  2808. This command will send the given message with color into the invoking character's chat
  2809. window. The color format is in RGB (0xRRGGBB). The color is
  2810. by default green
  2811. ---------------------------------------
  2812. *warp "<map name>",<x>,<y>;
  2813. This command will take the invoking character to the specified map, and if
  2814. wanted, specified coordinates too, but these can be random.
  2815. warp "place",50,55;
  2816. This would take them to X 50 Y 55 on the map called "place". If your X and Y
  2817. coordinates land on an unwalkable map square, it will send the warped character
  2818. to a random place. Same will happen if they are both zero:
  2819. warp "place",0,0;
  2820. Notice that while warping people to coordinates 0,0 will normally get them into
  2821. a random place, it's not certain to always be so. Darned if I know where this is
  2822. actually coded, it might be that this happens because square 0,0 is unwalkable
  2823. on all official maps. If you're using custom maps, beware.
  2824. There are also three special 'map names' you can use.
  2825. "Random" will warp the player randomly on the current map.
  2826. "Save" and "SavePoint" will warp the player back to their save point.
  2827. ---------------------------------------
  2828. *areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
  2829. This command is similar to 'warp', however, it will not refer to the invoking
  2830. character, but instead, all characters within a specified area, defined by the
  2831. x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
  2832. including the activating character, if they are outside the area.
  2833. areawarp "place",10,10,120,120,"place2",150,150;
  2834. Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
  2835. shape, on the map called "place", will be affected, and warped to "place2" X 150
  2836. Y 150
  2837. areawarp "place",10,10,120,120,"place2",0,0;
  2838. By using ,0,0; as the destination coordinates it will take all the characters in
  2839. the affected area to a random set of co-ordinates on "place2".
  2840. areawarp "place",10,10,120,120,"place2",150,150,200,200;
  2841. By using the optional x4 and y4 parameters, the destination coordinates will be a
  2842. random place within the defined x3/y3-x4/y4 square.
  2843. Like 'warp', areawarp will also explicitly warp characters randomly into the
  2844. current map if you give the 'to map name' as "Random".
  2845. See also 'warp'.
  2846. ---------------------------------------
  2847. *warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>"};
  2848. Warps a party to specified map and coordinate given the party ID, which you can get with
  2849. getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
  2850. You can use the following "map names" for special warping behavior:
  2851. Random: All party members are randomly warped in their current map (as if they
  2852. all used a fly wing)
  2853. SavePointAll: All party members are warped to their respective save point.
  2854. SavePoint: All party members are warped to the save point of the currently
  2855. attached player (will fail if there's no player attached).
  2856. Leader: All party members are warped to the leader's position. The leader must
  2857. be online and in the current map-server for this to work.
  2858. If you specify a from_mapname, 'warpparty' will only affect those on that map.
  2859. Example:
  2860. mes "[Party Warper]";
  2861. mes "Here you go!";
  2862. close2;
  2863. .@party_id = getcharid(1);
  2864. warpparty "prontera",150,100,.@party_id;
  2865. close;
  2866. ---------------------------------------
  2867. *warpchar "<map name>",<x>,<y>,<char id>;
  2868. Warps another player to specified map and coordinate given the char id, which you can get with
  2869. getcharid(0,<player_name>). Obviously this is useless if you want to warp the same player that
  2870. is executing this script, unless it's some kind of "chosen" script.
  2871. Example:
  2872. warpchar "prontera",150,100,150001;
  2873. ---------------------------------------
  2874. *warpguild "<map name>",<x>,<y>,<guild_id>;
  2875. Warps a guild to specified map and coordinate given the guild id, which you can get with
  2876. getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>).
  2877. You can use the following "map names" for special warping behavior:
  2878. Random: All guild members are randomly warped in their current map (as if they
  2879. all used a fly wing)
  2880. SavePointAll: All guild members are warped to their respective save point.
  2881. SavePoint: All guild members are warped to the save point of the currently
  2882. attached player (will fail if there's no player attached).
  2883. Example:
  2884. warpguild "prontera",x,y,Guild_ID;
  2885. ---------------------------------------
  2886. *warppartner("<map name>",<x>,<y>);
  2887. This function will find the invoking character's marriage partner, if any, and
  2888. warp them to the map and coordinates given. Go kidnap that spouse. :) It will
  2889. return 1 upon success and 0 if the partner is not online, the character is not
  2890. married, or if there's no invoking character (no RID). 0,0 will, as usual,
  2891. normally translate to random coordinates.
  2892. ---------------------------------------
  2893. *savepoint "<map name>",<x>,<y>;
  2894. *save "<map name>",<x>,<y>;
  2895. These commands save where the invoking character will return to upon clicking
  2896. "Return to Save Point", after death and in some other cases. The two versions are
  2897. equivalent. They ignore any and all mapflags, and can make a character respawn where
  2898. no teleportation is otherwise possible.
  2899. savepoint "place",350,75;
  2900. ---------------------------------------
  2901. *heal <hp>,<sp>;
  2902. This command will heal a set amount of HP and/or SP on the invoking character.
  2903. heal 30000,0; // This will heal 30,000 HP
  2904. heal 0,30000; // This will heal 30,000 SP
  2905. heal 300,300; // This will heal 300 HP and 300 SP
  2906. This command just alters the hit points and spell points of the invoking
  2907. character and produces no other output whatsoever.
  2908. ---------------------------------------
  2909. *itemheal <hp>,<sp>;
  2910. This command heals relative amounts of HP and/or SP on the invoking character.
  2911. Unlike heal, this command is intended for use in item scripts. It applies
  2912. potion-related bonuses, such as alchemist ranking, cards, and status changes.
  2913. When used inside an NPC script, certain bonuses are omitted.
  2914. The command also applies a SP/VIT-related bonus:
  2915. heal = heal * [(100 + STATUS*2) / 100]
  2916. Example:
  2917. // If the player has 50 vit and no bonuses, this will heal
  2918. // anything from 200 to 300 HP and 5 SP
  2919. itemheal rand(100,150),5;
  2920. ---------------------------------------
  2921. *percentheal <hp>,<sp>;
  2922. This command will heal the invoking character. It heals the character, but not
  2923. by a set value - it adds percent of their maximum HP/SP.
  2924. percentheal 100,0; // This will heal 100% HP
  2925. percentheal 0,100; // This will heal 100% SP
  2926. percentheal 50,50; // This will heal 50% HP and 50% SP
  2927. So the amount that this will heal will depend on the total amount of HP or SP
  2928. you have maximum. Like 'heal', this will not call up any animations or effects.
  2929. ---------------------------------------
  2930. *recovery <type>{,<option>,<revive_flag>{,<map name>}};
  2931. This command will revive and fully restore the HP/SP of the selected characters.
  2932. It returns 1 upon successful use.
  2933. <type> is the target, and determines the <option> parameter:
  2934. 0: Player -> Character ID number
  2935. 1: Party -> Party ID number
  2936. 2: Guild -> Guild ID number
  2937. 3: Map -> Map name (a string)
  2938. 4: All -> None (takes <revive_flag> as option)
  2939. If no option is specified, the invoking player's character ID, party ID, guild ID,
  2940. or map will be used.
  2941. <revive_flag> determines the action:
  2942. 1: Revive and heal all players (default)
  2943. 2: Heal living players only
  2944. 4: Revive dead players only
  2945. <map name> can optionally be used to define a single map to execute the command on
  2946. for types 1 (party) and 2 (guild).
  2947. Examples:
  2948. // Only revive characters in invoking party on map "morocc"
  2949. recovery 1,getcharid(1),4,"morocc";
  2950. // Fully heal (don't revive) all members of invoking character's guild
  2951. recovery 2,getcharid(2),2;
  2952. // Revive and fully heal everyone in map "prontera"
  2953. recovery 3,"prontera";
  2954. // Only revive all dead characters on server
  2955. recovery 4,4;
  2956. ---------------------------------------
  2957. *jobchange <job number>{,<upper flag>};
  2958. This command will change the job class of the invoking character.
  2959. jobchange 1; // This would change your player into a Swordman
  2960. jobchange 4002; // This would change your player into a Swordman High
  2961. This command does work with numbers, but you can also use job names. The full
  2962. list of job names and the numbers they correspond to can be found in
  2963. 'db/const.txt'.
  2964. // This would change your player into a Swordman
  2965. jobchange Job_Swordman;
  2966. // This would change your player into a Swordman High
  2967. jobchange Job_Swordman_High;
  2968. 'upper flag' can alternatively be used to specify the type of job one changes
  2969. to. For example, jobchange Job_Swordman,1; will change the character to a high
  2970. swordsman. The upper values are:
  2971. -1 (or when omitted): preserves the current job type.
  2972. 0: Normal/standard classes
  2973. 1: High/Advanced classes
  2974. 2: Baby classes
  2975. This command will also set a permanent character-based variable
  2976. 'jobchange_level' which will contain the job level at the time right before
  2977. changing jobs, which can be checked for later in scripts.
  2978. ---------------------------------------
  2979. *jobname(<job number>)
  2980. This command retrieves the name of the given job using the map_msg entries 550->655.
  2981. mes "[Kid]";
  2982. mes "I never thought I'd met a "+jobname(Class)+" here of all places.";
  2983. close;
  2984. ---------------------------------------
  2985. *eaclass({<job number>})
  2986. This commands returns the "eA job-number" corresponding to the given class, and
  2987. uses the invoking player's class if none is given. The eA job-number is also a
  2988. class number system, but it's one that comes with constants which make it easy
  2989. to convert among classes. The command will return -1 if you pass it a job number
  2990. which doesn't have an eA job-number equivalent.
  2991. @eac = eaclass();
  2992. if ((@eac&EAJ_BASEMASK) == EAJ_SWORDMAN)
  2993. mes "Your base job is Swordman.";
  2994. if (@eac&EAJL_UPPER)
  2995. mes "You are a rebirth job.";
  2996. if ((@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN)
  2997. mes "You must be a Swordman, Baby Swordman or High Swordman.";
  2998. For more information on the eA Job System, see the docs/ea_job_system.txt file.
  2999. ---------------------------------------
  3000. *roclass(<job number>{,<gender>})
  3001. Does the opposite of eaclass. That is, given an eA job-number, it returns the
  3002. corresponding RO class number. A gender is required because both Bard and Dancers
  3003. share the same eA job-number (EAJ_BARDDANCER), and uses the invoking player's
  3004. gender if none is given (if no player is attached, male will be used by default).
  3005. The command will return -1 if there is no valid class to represent the specified
  3006. job (for example, if you try to get the baby version of a Taekwon class).
  3007. @eac = eaclass();
  3008. //Check if class is already rebirth
  3009. if (@eac&EAJL_UPPER) {
  3010. mes "You look strong.";
  3011. close;
  3012. }
  3013. @eac = roclass(@eac|EAJL_UPPER);
  3014. //Check if class has a rebirth version
  3015. if (@eac != -1) {
  3016. mes "Bet you can't wait to become a "+jobname(@eac)+"!";
  3017. close;
  3018. }
  3019. ---------------------------------------
  3020. *changebase <job ID number>{,<account ID>};
  3021. This command will change a character's appearance to that of the specified job
  3022. class. Nothing but appearance will change.
  3023. The command will run for the invoking character unless an account ID is given.
  3024. changebase Job_Novice; // Changes player to Novice sprite.
  3025. changebase Class; // Changes player back to default sprite.
  3026. ---------------------------------------
  3027. *classchange <view id>,<type>;
  3028. This command is very ancient, its origins are clouded in mystery.
  3029. It will send a 'display id change' packet to everyone in the immediate area of
  3030. the NPC object, which will supposedly make the NPC look like a different sprite,
  3031. an NPC sprite ID, or a monster ID. This effect is not stored anywhere and will
  3032. not persist (Which is odd, cause it would be relatively easy to make it do so)
  3033. and most importantly, will not work at all since this command was broken with
  3034. the introduction of advanced classes. The code is written with the assumption
  3035. that the lowest sprite IDs are the job sprites and the anything beyond them is
  3036. monster and NPC sprites, but since the advanced classes rolled in, they got the
  3037. ID numbers on the other end of the number pool where monster sprites float.
  3038. As a result it is currently impossible to call this command with a valid view
  3039. id. It will do nothing whatsoever if the view ID is below 4047. Getting it to
  3040. run will actually just crash the client.
  3041. It could be a real gem if it can be gotten to actually do what it's supposed to
  3042. do, but this will only happen in a later SVN revision.
  3043. ---------------------------------------
  3044. *changesex;
  3045. This command will change the gender for the attached character's account. If it
  3046. was male, it will become female, if it was female, it will become male. The
  3047. change will be written to the character server, the player will receive the
  3048. message: "Need disconnection to perform change-sex request..." and the player
  3049. will be immediately kicked to the login screen. When they log back in, they will
  3050. be the opposite sex.
  3051. If there are any Dancer/Gypsy or Bard/Clown characters on the account,
  3052. they will also have their skills reset upon 'changesex'.
  3053. ---------------------------------------
  3054. *getexp <base xp>,<job xp>;
  3055. This command will give the invoking character a specified number of base and job
  3056. experience points. Can be used as a quest reward. Negative values won't work.
  3057. getexp 10000,5000;
  3058. You can also use the "set" command with the constants defined in 'db/const.txt':
  3059. // These 2 combined has the same effect as the above command
  3060. set BaseExp,BaseExp+10000;
  3061. set JobExp,JobExp+5000;
  3062. You can also reduce the amount of experience points:
  3063. set BaseExp,BaseExp-10000;
  3064. Note that 'getexp' is now subject to the 'quest_exp_rate' config option, which
  3065. adjusts the gained value. If you want to bypass this, use the 'set' method.
  3066. ---------------------------------------
  3067. *setlook <look type>,<look value>;
  3068. *changelook <look type>,<look value>;
  3069. 'setlook' will alter the look data for the invoking character. It is used
  3070. mainly for changing the palette used on hair and clothes: you specify which look
  3071. type you want to change, then the palette you want to use. Make sure you specify
  3072. a palette number that exists/is usable by the client you use.
  3073. 'changelook' works the same, but is only client side (it doesn't save the look value).
  3074. // This will change your hair(6), so that it uses palette 8, what ever your
  3075. // palette 8 is, your hair will use that color
  3076. setlook 6,8;
  3077. // This will change your clothes(7), so they are using palette 1, whatever
  3078. // your palette 1 is, your clothes will then use that set of colors.
  3079. setlook 7,1;
  3080. Here are the possible look types:
  3081. 0 - Base sprite
  3082. 1 - Hairstyle
  3083. 2 - Weapon
  3084. 3 - Head bottom
  3085. 4 - Head top
  3086. 5 - Head mid
  3087. 6 - Hair color
  3088. 7 - Clothes color
  3089. 8 - Shield
  3090. 9 - Shoes
  3091. Whatever 'shoes' means is anyone's guess, ask Gravity - the client does nothing
  3092. with this value. It still wants it from the server though, so it is kept, but
  3093. normally doesn't do a thing.
  3094. Only the look data for hairstyle, hair color and clothes color are saved to the
  3095. char server's database and will persist. The rest freely change as the character
  3096. puts on and removes equipment, changes maps, logs in and out and otherwise you
  3097. should not expect to set them. In fact, messing with them is generally
  3098. hazardous, do it at your own risk, it is not tested what will this actually do -
  3099. it won't cause database corruption and probably won't cause a server crash, but
  3100. it's easy to crash the client with just about anything unusual.
  3101. However, it might be an easy way to quickly check for empty view IDs for
  3102. sprites, which is essential for making custom headgear.
  3103. Since a lot of people have different palettes for hair and clothes, it's
  3104. impossible to tell you what all the color numbers are. If you want a serious
  3105. example, there is a Stylist script inside the default rAthena installation that
  3106. you can look at: 'npc/custom/stylist.txt'
  3107. ---------------------------------------
  3108. *pushpc <direction>,<cells>;
  3109. This command will push the currently attached player to given direction by given
  3110. amount of square cells. Direction is the same as used when declaring NPCs, and
  3111. can be specified by using one of the DIR_* constants (db/const.txt).
  3112. The knock-back is not restricted by items or map flags, only obstacles are taken
  3113. into account. If there is not enough space to perform the push (e.g. due to a
  3114. wall), the character is pushed only up to the obstacle.
  3115. // pushes the character 5 cells in 3 o'clock direction from its
  3116. // current position.
  3117. pushpc DIR_EAST, 5;
  3118. ---------------------------------------
  3119. *get_revision()
  3120. This command will return the SVN revision number that the server is currently
  3121. running on.
  3122. if ( get_revision() >= 15000 )
  3123. mes "Welcome to rAthena!";
  3124. ---------------------------------------
  3125. *get_githash()
  3126. This command will return the Git Hash that the server is currently running on.
  3127. mes "Welcome to rAthena! Git Hash: " + get_githash();
  3128. ---------------------------------------
  3129. \\
  3130. 4,1.- Item-related commands
  3131. \\
  3132. ---------------------------------------
  3133. *getitem <item id>,<amount>{,<account ID>};
  3134. *getitem "<item name>",<amount>{,<account ID>};
  3135. This command will give an amount of specified items to the invoking character.
  3136. If an optional account ID is specified, and the target character is currently
  3137. online, items will be created in their inventory instead. If they are not
  3138. online, nothing will happen.
  3139. In the first and most commonly used version of this command, items are
  3140. referred to by their database ID number found inside 'db/(pre-)re/item_db.txt'.
  3141. getitem 502,10 // The person will receive 10 apples
  3142. getitem 617,1 // The person will receive 1 Old Violet Box
  3143. This transaction is logged if the log script generated transactions option is
  3144. enabled.
  3145. You may also create an item by its name in the 'english name' field in the
  3146. item database:
  3147. getitem "RED_POTION",10;
  3148. Which will do what you'd expect. If it can't find that name in the database,
  3149. apples will be created anyway. It is often a VERY GOOD IDEA to use it like this.
  3150. This is used in pretty much all NPC scripts that have to do with items and
  3151. quite a few item scripts. For more examples check just about any official script.
  3152. ---------------------------------------
  3153. *getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3154. *getitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3155. This command will give an amount of specified items to the invoking character.
  3156. If an optional account ID is specified, and the target character is currently
  3157. online, items will be created in their inventory instead. If they are not
  3158. online, nothing will happen. It works essentially the same as 'getitem' but is
  3159. a lot more flexible.
  3160. Those parameters that are different from 'getitem' are:
  3161. identify - Whether you want the item to be identified (1) or not (0).
  3162. refine - For how many pluses will it be refined.
  3163. It will not let you refine an item higher than the max refine.
  3164. attribute - Whether the item is broken (1) or not (0).
  3165. card1,2,3,4 - If you want a card compound to it, place the card ID number into
  3166. the specific card slot.
  3167. Card1-card4 values are also used to store name information for named items, as
  3168. well as the elemental property of weapons and armor. You can create a named item
  3169. in this manner, however, if you just need a named piece of standard equipment,
  3170. it is much easier to the 'getnameditem' function instead.
  3171. You will need to keep these values if you want to destroy and then perfectly
  3172. recreate a named item, for this see 'getinventorylist'.
  3173. If you still want to try creating a named item with this command because
  3174. 'getnameditem' won't do it for you cause it's too limited, you can do it like
  3175. this. Careful, minor magic ahead.
  3176. // First, let's get an ID of a character who's name will be on the item.
  3177. // Only an existing character's name may be there.
  3178. // Let's assume our character is 'Adam' and find his ID.
  3179. @charid = getcharid(0,"Adam");
  3180. // Now we split the character ID number into two portions with a binary
  3181. // shift operation. If you don't understand what this does, just copy it.
  3182. @card3 = @charid & 65535;
  3183. @card4 = @charid >> 16;
  3184. // If you're inscribing non-equipment, @card1 must be 254.
  3185. // Arrows are also not equipment. :)
  3186. @card1 = 254;
  3187. // For named equipment, card2 means the Star Crumbs and elemental
  3188. // crystals used to make this equipment. For everything else, it's 0.
  3189. @card2 = 0;
  3190. // Now, let's give the character who invoked the script some
  3191. // Adam's Apples:
  3192. getitem2 512,1,1,0,0,@card1,@card2,@card3,@card4;
  3193. This wasn't tested with all possible items, so I can't give any promises,
  3194. experiment first before relying on it.
  3195. To create equipment, continue this example it like this:
  3196. // We've already have card3 and card4 loaded with correct
  3197. // values so we'll just set up card1 and card2 with data
  3198. // for an Ice Stiletto.
  3199. // If you're inscribing equipment, @card1 must be 255.
  3200. @card1 = 255;
  3201. // That's the number of star crumbs in a weapon.
  3202. @sc = 2;
  3203. // That's the number of elemental property of the weapon.
  3204. @ele = 1;
  3205. // And that's the wacky formula that makes them into
  3206. // a single number.
  3207. @card2 = @ele+((@sc*5)<<8);
  3208. // That will make us an Adam's +2 VVS Ice Stiletto:
  3209. getitem2 1216,1,1,2,0,@card1,@card2,@card3,@card4;
  3210. Experiment with the number of star crumbs - I'm not certain just how much will
  3211. work most and what it depends on. The valid element numbers are:
  3212. 1 - Ice, 2 - Earth 3 - Fire 4 - Wind.
  3213. You can, apparently, even create duplicates of the same pet egg with this
  3214. command, creating a pet which is the same, but simultaneously exists in two
  3215. eggs, and may hatch from either, although, I'm not sure what kind of a mess will
  3216. this really cause.
  3217. ---------------------------------------
  3218. *getitembound <item id>,<amount>,<bound type>{,<account ID>};
  3219. *getitembound "<item name>",<amount>,<bound type>{,<account ID>};
  3220. This command behaves identically to 'getitem', but the items created will be
  3221. bound to the target character as specified by the bound type. All items created
  3222. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3223. some cases cannot be traded or stored.
  3224. Valid bound types are:
  3225. Bound_Account : Account Bound item
  3226. Bound_Guild : Guild Bound item
  3227. Bound_Party : Party Bound item
  3228. Bound_Char : Character Bound item
  3229. ---------------------------------------
  3230. *getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3231. *getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3232. This command behaves identically to 'getitem2', but the items created will be
  3233. bound to the target character as specified by the bound type. All items created
  3234. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3235. some cases cannot be traded or stored.
  3236. For a list of bound types see 'getitembound'.
  3237. ---------------------------------------
  3238. *getnameditem <item id>,<character name|character ID>;
  3239. *getnameditem "<item name>",<character name|character ID>;
  3240. Create an item signed with the given character's name.
  3241. The command returns 1 when the item is created successfully, or 0 if it fails.
  3242. Failure occurs when:
  3243. - There is no player attached.
  3244. - Item name or ID is not valid.
  3245. - The given character ID/name is offline.
  3246. Example:
  3247. //This will give the currently attached player a Aaron's Apple (if Aaron is online).
  3248. getnameditem "Apple","Aaron";
  3249. //Self-explanatory (I hope).
  3250. if (getnameitem("Apple","Aaron")) {
  3251. mes "You now have a Aaron's Apple!";
  3252. }
  3253. ---------------------------------------
  3254. *rentitem <item id>,<time>;
  3255. *rentitem "<item name>",<time>;
  3256. Creates a rental item in the attached character's inventory. The item will expire
  3257. in <time> seconds and be automatically deleted. When receiving a rental item,
  3258. the character will receive a message in their chat window. The character will
  3259. also receive warning messages in their chat window before the item disappears.
  3260. This command can not be used to rent stackable items. Rental items cannot be
  3261. dropped, traded, sold to NPCs, or placed in guild storage. (i.e. trade mask 75)
  3262. Note: 'delitem' in an NPC script can still remove rental items.
  3263. ---------------------------------------
  3264. *rentitem2 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3265. *rentitem2 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3266. Creates a rental item in the attached character's inventory. The item will expire
  3267. in <time> seconds and be automatically deleted. See 'rentitem' for further details.
  3268. See 'getitem2' for an explanation of the expanded parameters.
  3269. ---------------------------------------
  3270. *makeitem <item id>,<amount>,"<map name>",<X>,<Y>;
  3271. *makeitem "<item name>",<amount>,"<map name>",<X>,<Y>;
  3272. This command will create an item on the specified cell of a map.
  3273. As with any dropped items, the items created with this command will disappear after
  3274. a period of time. Using an amount greater than 1 will create a single stack of the
  3275. given amount, not multiple stacks of 1.
  3276. Like 'getitem', it also accepts an 'english name' field from the database and creates
  3277. Apples if the name isn't found.
  3278. If the map name is given as "this", the map the invoking character is on will be used.
  3279. ---------------------------------------
  3280. *makeitem2 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3281. *makeitem2 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3282. This command will create an item on the specified cell of a map. See 'makeitem' for
  3283. further details.
  3284. See 'getitem2' for an explanation of the expanded parameters.
  3285. ---------------------------------------
  3286. *cleanarea "<map name>",<x1>,<y1>,<x2>,<y2>;
  3287. *cleanmap "<map name>";
  3288. These commands will clear all items lying on the ground on the specified map, either
  3289. within the x1/y1-x2/y2 rectangle or across the entire map.
  3290. ---------------------------------------
  3291. *searchitem <array name>,"<item name>";
  3292. This command will fill the given array with the ID of items whose name matches
  3293. the given one. It returns the number of items found. For performance reasons,
  3294. the results array is limited to 10 items.
  3295. mes "What item are you looking for?";
  3296. input .@name$;
  3297. .@qty = searchitem(.@matches[0],.@name$);
  3298. mes "I found " + .@qty + " items:";
  3299. for (.@i = 0; .@i < .@qty; .@i++)
  3300. // Display name (eg: "Apple[0]")
  3301. mes getitemname(.@matches[.@i]) + "[" + getitemslots(.@matches[.@i]) + "]";
  3302. ---------------------------------------
  3303. *delitem <item id>,<amount>{,<account ID>};
  3304. *delitem "<item name>",<amount>{,<account ID>};
  3305. This command will remove a specified amount of items from the invoking/target character.
  3306. Like all the item commands, it uses the item ID found inside 'db/(pre-)re/item_db.txt'.
  3307. delitem 502,10; // The person will lose 10 apples
  3308. delitem 617,1; // The person will lose 1 Old Violet Box
  3309. It is always a good idea to check if the player actually has the items before you delete them.
  3310. If you try to delete more items that the player has, the player will lose the ones he/she has
  3311. and the script will terminate with an error.
  3312. Like 'getitem', this command will also accept an 'english name' field from the
  3313. database. If the name is not found, nothing will be deleted.
  3314. ---------------------------------------
  3315. *cartdelitem <item id>,<amount>{,<account ID>};
  3316. *cartdelitem "<item name>",<amount>{,<account ID>};
  3317. *storagedelitem <item id>,<amount>{,<account ID>};
  3318. *storagedelitem "<item name>",<amount>{,<account ID>};
  3319. This command behaves identically to 'delitem', but deletes items from the player's
  3320. cart or storage. If no cart is mounted, 'cartdelitem' will fail.
  3321. ---------------------------------------
  3322. *delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3323. *delitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3324. This command will remove a specified amount of items from the invoking/target character.
  3325. See 'getitem2' for an explanation of the expanded parameters.
  3326. ---------------------------------------
  3327. *cartdelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3328. *cartdelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3329. *storagedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3330. *storagedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3331. This command behaves identically to 'delitem2', but deletes items from the player's
  3332. cart or storage. If no cart is mounted, 'cartdelitem2' will fail.
  3333. ---------------------------------------
  3334. *countitem(<item id>)
  3335. *countitem("<item name>")
  3336. This function will return the number of items for the specified item ID that the
  3337. invoking character has in the inventory.
  3338. mes "[Item Checker]";
  3339. mes "Hmmm, it seems you have "+countitem(502)+" apples";
  3340. close;
  3341. Like 'getitem', this function will also accept an 'english name' from the
  3342. database as an argument.
  3343. If you want to state the number at the end of a sentence, you can do it by
  3344. adding up strings:
  3345. mes "[Item Checker]";
  3346. mes "Hmmm, the total number of apples you are holding is "+countitem("APPLE");
  3347. close;
  3348. ---------------------------------------
  3349. *cartcountitem(<item id>)
  3350. *cartcountitem("<item name>")
  3351. *storagecountitem(<item id>)
  3352. *storagecountitem("<item name>")
  3353. This command behaves identically to 'countitem', but counts items from the player's
  3354. cart or storage. If no cart is mounted, 'cartcountitem' will return -1.
  3355. ---------------------------------------
  3356. *countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3357. *countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3358. Expanded version of 'countitem' function, used for created/carded/forged items.
  3359. This function will return the number of items for the specified item ID and
  3360. other parameters that the invoking character has in the inventory.
  3361. See 'getitem2' for an explanation of the expanded parameters.
  3362. ---------------------------------------
  3363. *cartcountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3364. *cartcountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3365. *storagecountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3366. *storagecountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3367. This command behaves identically to 'countitem2', but counts items from the player's
  3368. cart or storage. If no cart is mounted, 'cartcountitem2' will return -1.
  3369. ---------------------------------------
  3370. *countbound({<bound type>})
  3371. This function will return the number of bounded items in the character's
  3372. inventory, and sets an array @bound_items[] containing all item IDs of the
  3373. counted items. If a bound type is specified, only those items will be counted.
  3374. For a list of bound types see 'getitembound'.
  3375. Example:
  3376. mes "You currently have "+countbound()+" bounded items.";
  3377. next;
  3378. mes "The list of bounded items include:";
  3379. for(.@i = 0; .@i < getarraysize(@bound_items); .@i++)
  3380. mes getitemname(@bound_items[.@i]);
  3381. close;
  3382. ---------------------------------------
  3383. *groupranditem <group id>{,<sub_group>};
  3384. Returns the item_id of a random item picked from the group specified. The
  3385. different groups and their group number are specified in 'db/(pre-)re/item_group_db.txt'.
  3386. When used in conjunction with other functions, you can get a random item. For
  3387. example, for a random pet lure:
  3388. getitem groupranditem(15),1;
  3389. 'sub_group' is used to get the available random items of item group from specified random
  3390. group. More info, just like the explanation below.
  3391. ---------------------------------------
  3392. *getrandgroupitem <group id>,<quantity>{,<sub_group>};
  3393. Similar to the above example, this command allows players to obtain the specified
  3394. quantity of a random item from the group "<group id>". The different groups and
  3395. their group number are specified in db/(pre-)re/item_group_db.txt
  3396. For example, obtaining three of the same random item from Old Blue Box:
  3397. getrandgroupitem(1,3);
  3398. getrandgroupitem(IG_BlueBox,3); //see const.txt at 'Item Group ID' section
  3399. If quantity is 0, and if the item(s) at specified IG_ has defined amount, the amount of
  3400. the item that will be obtained, will according to the amount on that IG_ data.
  3401. By default, if getrandgroupitem is used to get random item from IG_ which has more than
  3402. defined random group, it always read random group 1, other item that as random item at
  3403. random group > 2 never been touched. Use 'sub_group' to choose which random group will be
  3404. obtained.
  3405. Example:
  3406. IG_ExGetGroupItem,Coat,2,2,1
  3407. IG_ExGetGroupItem,Muffler,2,3,1
  3408. IG_ExGetGroupItem,Yggdrasilberry,10,7,1
  3409. IG_ExGetGroupItem,Yggdrasilberry,10,7,2
  3410. IG_ExGetGroupItem,Seed_Of_Yggdrasil,5,15,2
  3411. 1. 'getrandgroupitem(IG_ExGetGroupItem,1)'
  3412. Player has chance to get 1x Coat or 1x Muffler or 1x Yggdrasilberry. Player never
  3413. has chance to get Seed_of_Yggdrasil because it is in different random group.
  3414. 2. 'getrandgroupitem(IG_ExGetGroupItem,0)'
  3415. Player has chance to get 2x Coat or 3x Muffler or 7x Yggdrasilberry. Player never
  3416. has chance to get Seed_of_Yggdrasil because it is in different random group.
  3417. 3. 'getrandgroupitem(IG_ExGetGroupItem,0,2)'
  3418. Player has chance to get 10x Yggdrasilberry or 15x Seed_of_Yggdrasil. Player never
  3419. has chance to get Coat, Muffler, and Seed_of_Yggdrasil because it is in different
  3420. random group.
  3421. ---------------------------------------
  3422. *getgroupitem <group_id>;
  3423. Gives item(s) to the attached player based on item group contents.
  3424. This is not working like 'getrandgroupitem' which only give 1 item for specified
  3425. item group.
  3426. For contants, see the "Item Group ID" section in 'db/const.txt'.
  3427. ---------------------------------------
  3428. *enable_items;
  3429. *disable_items;
  3430. These commands toggle the ability to change equipment while interacting with
  3431. an NPC. To avoid possible exploits, the commands affect the particular script
  3432. instance only. Note that if a different script also calls enable_items, it
  3433. will override the last call (so you may want to call this command at the start
  3434. of your script without assuming it is still in effect).
  3435. The default setting, 'item_enabled_npc', is defined in 'conf/battle/items.conf'.
  3436. ---------------------------------------
  3437. *itemskill <skill id>,<skill level>;
  3438. *itemskill "<skill name>",<skill level>;
  3439. This command is meant for item scripts to replicate single-use skills in usable
  3440. items. It will not work properly if there is a visible dialog window or menu.
  3441. If the skill is self or auto-targeting, it will be used immediately; otherwise a
  3442. target cursor is shown.
  3443. // When Anodyne is used, it will cast Endure (8), Level 1, as if the actual
  3444. // skill has been used from skill tree.
  3445. 605,Anodyne,Anodyne,11,2000,0,100,,,,,10477567,2,,,,,{ itemskill 8,1; },{}
  3446. ---------------------------------------
  3447. *consumeitem <item id>;
  3448. *consumeitem "<item name>";
  3449. This command will run the item script of the specified item on the invoking
  3450. character. The character does not need to possess the item, and the item will
  3451. not be deleted. While this command is intended for usable items, it will run
  3452. for any item type.
  3453. This command does not currently work with the 'itemskill' script command.
  3454. ---------------------------------------
  3455. *produce <item level>;
  3456. This command will open a crafting window on the client connected to the invoking
  3457. character. The 'item level' is a number which determines what kind of a crafting
  3458. window will pop-up.
  3459. You can see the full list of such item levels in 'db/produce_db.txt' which determines
  3460. what can actually be produced. The window will not be empty only if the invoking
  3461. character can actually produce the items of that type and has the appropriate raw
  3462. materials in their inventory.
  3463. The success rate to produce the item is the same as the success rate of the skill
  3464. associated with the item level. If there is no skill id, the success rate will be 50%.
  3465. Valid item levels are:
  3466. 1 - Level 1 Weapons
  3467. 2 - Level 2 Weapons
  3468. 3 - Level 3 Weapons
  3469. 21 - Blacksmith's Stones and Metals
  3470. 22 - Alchemist's Potions, Holy Water, Assassin Cross's Deadly Poison
  3471. 23 - Elemental Converters
  3472. ---------------------------------------
  3473. *cooking <dish level>;
  3474. This command will open a produce window on the client connected to the invoking
  3475. character. The 'dish level' is the number which determines what kind of dish
  3476. level you can produce. You can see the full list of dishes that can be produced in
  3477. 'db/produce_db.txt'.
  3478. The window will be shown empty if the invoking character does not have enough of
  3479. the required incredients to cook a dish.
  3480. Valid dish levels are:
  3481. 11 - Level 1 Dish
  3482. 12 - Level 2 Dish
  3483. 13 - Level 3 Dish
  3484. 14 - Level 4 Dish
  3485. 15 - Level 5 Dish
  3486. 16 - Level 6 Dish
  3487. 17 - Level 7 Dish
  3488. 18 - Level 8 Dish
  3489. 19 - Level 9 Dish
  3490. 20 - Level 10 Dish
  3491. Although it's required to set a dish level, it doesn't matter if you set it to 1
  3492. and you want to cook a level 10 dish, as long as you got the required incredients
  3493. to cook the dish the command works.
  3494. ---------------------------------------
  3495. *makerune <% success bonus>;
  3496. This command will open a rune crafting window on the client connected to the
  3497. invoking character. Since this command is officially used in rune ores, a bonus
  3498. success rate must be specified (which adds to the base formula).
  3499. You can see the full list of runes that can be produced in 'db/produce_db.txt'.
  3500. The window will not be empty only if the invoking character can actually produce
  3501. a rune and has the appropriate raw materials in their inventory.
  3502. ---------------------------------------
  3503. *successremovecards <equipment slot>;
  3504. This command will remove all cards from the item found in the specified
  3505. equipment slot of the invoking character, create new card items and give them to
  3506. the character. If any cards were removed in this manner, it will also show a
  3507. success effect.
  3508. ---------------------------------------
  3509. *failedremovecards <equipment slot>,<type>;
  3510. This command will remove all cards from the item found in the specified
  3511. equipment slot of the invoking character. 'type' determines what happens to the
  3512. item and the cards:
  3513. 0 - will destroy both the item and the cards.
  3514. 1 - will keep the item, but destroy the cards.
  3515. 2 - will keep the cards, but destroy the item.
  3516. Whatever the type is, it will also show a failure effect on screen.
  3517. ---------------------------------------
  3518. *repair <broken item number>;
  3519. This command repairs a broken piece of equipment, using the same list of broken
  3520. items as available through 'getbrokenid'.
  3521. ---------------------------------------
  3522. *repairall;
  3523. This command repairs all broken equipment in the attached player's inventory.
  3524. A repair effect will be shown if any items are repaired, else the command will
  3525. end silently.
  3526. ---------------------------------------
  3527. *successrefitem <equipment slot>{,<count>};
  3528. This command will refine an item in the specified equipment slot of the invoking
  3529. character by +1, or a count if given. For a list of equipment slots see 'getequipid'.
  3530. This command will also display a 'refine success' effect on the character and put
  3531. appropriate messages into their chat window. It will also give the character fame
  3532. points if a weapon reached +10 this way, even though these will only take effect for
  3533. blacksmith who will later forge a weapon.
  3534. ---------------------------------------
  3535. *failedrefitem <equipment slot>;
  3536. This command will fail to refine an item in the specified equipment slot of the
  3537. invoking character. The item will be destroyed. This will also display a 'refine
  3538. failure' effect on the character and put appropriate messages into their chat
  3539. window.
  3540. ---------------------------------------
  3541. *downrefitem <equipment slot>{,<count>};
  3542. This command will downgrade an item in the specified equipment slot of the invoking
  3543. character by -1, or a count if given. For a list of equipment slots see 'getequipid'.
  3544. This command will also display a 'refine failure' effect on the character and put
  3545. appropriate messages into their chat window.
  3546. ---------------------------------------
  3547. *unequip <equipment slot>;
  3548. This command will unequip whatever is currently equipped in the invoking
  3549. character's specified equipment slot. For a full list of possible equipment
  3550. slots see 'getequipid'.
  3551. If an item occupies several equipment slots, it will get unequipped from all of
  3552. them.
  3553. ---------------------------------------
  3554. *delequip <equipment slot>;
  3555. This command will destroy whatever is currently equipped in the invoking
  3556. character's specified equipment slot. For a full list of possible equipment
  3557. slots see 'getequipid'.
  3558. This command will return 1 if an item was deleted and 0 otherwise.
  3559. ---------------------------------------
  3560. *breakequip <equipment slot>;
  3561. This command will break and unequip whatever is currently equipped in the
  3562. invoking character's specified equipment slot. For a full list of possible
  3563. equipment slots see 'getequipid'.
  3564. This command will return 1 if an item was broken and 0 otherwise.
  3565. ---------------------------------------
  3566. *clearitem;
  3567. This command will destroy all items the invoking character has in their
  3568. inventory (including equipped items). It will not affect anything else, like
  3569. storage or cart.
  3570. ---------------------------------------
  3571. *equip <item id>;
  3572. *autoequip <item id>,<option>;
  3573. These commands are to equip a equipment on the attached character.
  3574. The equip function will equip the item ID given when the player has
  3575. this item in his/her inventory, while the autoequip function will
  3576. equip the given item ID when this is looted. The option parameter of
  3577. the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off.
  3578. Examples:
  3579. //This will equip a 1104 (falchion) on the character if this is in the inventory.
  3580. equip 1104;
  3581. //The invoked character will now automatically equip a falchion when it's looted.
  3582. autoequip 1104,1;
  3583. //The invoked character will no longer automatically equip a falchion.
  3584. autoequip 1104,0;
  3585. ---------------------------------------
  3586. *buyingstore <slots>;
  3587. Invokes buying store preparation window like the skill 'Open Buying Store',
  3588. without the item requirement. Amount of slots is limited by the server to
  3589. a maximum of 5 slots by default.
  3590. Example:
  3591. // Gives the player opportunity to buy 4 different kinds of items.
  3592. buyingstore 4;
  3593. ---------------------------------------
  3594. *searchstores <uses>,<effect>;
  3595. Invokes the store search window, which allows to search for both vending
  3596. and buying stores. Parameter uses indicates, how many searches can be
  3597. started, before the window has to be reopened. Effect value affects,
  3598. what happens, when a result item is double-clicked and can be one of the
  3599. following:
  3600. 0 = Shows the store's position on the mini-map and highlights the
  3601. shop sign with yellow color, when the store is on same map
  3602. as the invoking player.
  3603. 1 = Directly opens the shop, regardless of distance.
  3604. Example:
  3605. // Item Universal_Catalog_Gold (10 uses, effect: open shop)
  3606. searchstores 10,1;
  3607. ---------------------------------------
  3608. *enable_command;
  3609. *disable_command;
  3610. These commands toggle the ability to use atcommand while interacting with an NPC.
  3611. The default setting, 'atcommand_enable_npc', is defined in 'conf/battle/gm.conf'.
  3612. ---------------------------------------
  3613. //
  3614. 4,1.- End of item-related commands
  3615. //
  3616. ---------------------------------------
  3617. *openstorage;
  3618. This will open character's Kafra storage window on the client connected to the
  3619. invoking character. It can be used from any kind of NPC or item script, not just
  3620. limited to Kafra Staff.
  3621. The storage window opens regardless of whether there are open NPC dialogs or
  3622. not, but it is preferred to close the dialog before displaying the storage
  3623. window, to avoid any disruption when both windows overlap.
  3624. mes "Close this window to open your storage.";
  3625. close2;
  3626. openstorage;
  3627. end;
  3628. ---------------------------------------
  3629. *openmail;
  3630. This will open a character's Mail window on the client connected to the
  3631. invoking character.
  3632. mes "Close this window to open your mail inbox.";
  3633. close2;
  3634. openmail;
  3635. end;
  3636. ---------------------------------------
  3637. *openauction;
  3638. This will open the Auction window on the client connected to the invoking character.
  3639. mes "Close this window to open the Auction window.";
  3640. close2;
  3641. openauction;
  3642. end;
  3643. ---------------------------------------
  3644. \\
  3645. 4,2.- Guild-related commands
  3646. \\
  3647. ---------------------------------------
  3648. *guildopenstorage()
  3649. This function works the same as 'openstorage' but will open a guild storage
  3650. window instead for the guild storage of the guild the invoking character belongs
  3651. to. This is a function because it returns a value - 0 if the guild storage was
  3652. opened successfully and 1 if it wasn't. (Notice, it's a ZERO upon success.)
  3653. Since guild storage is only accessible to one character at one time, it may fail
  3654. if another character is accessing the guild storage at the same time.
  3655. This will also fail and return 2 if the character does not belong to any guild.
  3656. ---------------------------------------
  3657. *guildchangegm(<guild id>,<new master's name>)
  3658. This function will change the Guild Master of a guild. The ID is the guild's
  3659. id, and the new guild master's name must be passed.
  3660. Returns 1 on success, 0 otherwise.
  3661. ---------------------------------------
  3662. *guildgetexp <amount>;
  3663. This will give the specified amount of guild experience points to the guild the
  3664. invoking character belongs to. It will silently fail if they do not belong to
  3665. any guild.
  3666. ---------------------------------------
  3667. *guildskill <skill id>,<level>
  3668. *guildskill "<skill name>",<level>
  3669. This command will bump up the specified guild skill by the specified number of
  3670. levels. This refers to the invoking character and will only work if the invoking
  3671. character is a member of a guild AND its guild master, otherwise no failure
  3672. message will be given and no error will occur, but nothing will happen - same
  3673. about the guild skill trying to exceed the possible maximum. The full list of
  3674. guild skills is available in 'db/(pre-)re/skill_db.txt', these are all the GD_ skills at
  3675. the end.
  3676. // This would give your character's guild one level of Approval (GD_APPROVAL ID
  3677. // 10000). Notice that if you try to add two levels of Approval, or add
  3678. // Approval when the guild already has it, it will only have one level of
  3679. // Approval afterwards.
  3680. guildskill 10000,1,0;
  3681. You might want to make a quest for getting a certain guild skill, make it hard
  3682. enough that all the guild needs to help or something. Doing this for the Glory
  3683. of the Guild skill, which allows your guild to use an emblem, is a good idea for
  3684. a fun quest. (Wasting a level point on that is really annoying :D)
  3685. ---------------------------------------
  3686. //
  3687. 4,2 End of guild-related commands.
  3688. //
  3689. ---------------------------------------
  3690. *resetlvl <action type>;
  3691. This is a character reset command, meant mostly for rebirth script supporting
  3692. Advanced jobs, which will reset the invoking character's stats and level
  3693. depending on the action type given. Valid action types are:
  3694. 1 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp, wipes the
  3695. status effects (only the ones settable by 'setoption'), sets all stats to 1.
  3696. If the new job is 'Novice High', give 100 status points, give First Aid and
  3697. Play Dead skills.
  3698. 2 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp.
  3699. Skills and attribute values are not altered.
  3700. 3 - Base level 1, base exp 0. Nothing else is changed.
  3701. 4 - Job level 1, job exp 0. Nothing else is changed.
  3702. In all cases everything the character has on will be unequipped.
  3703. Even though it doesn't return a value, it is used as a function in the official
  3704. rebirth scripts. Ask AppleGirl why.
  3705. ---------------------------------------
  3706. *resetstatus;
  3707. This is a character reset command, which will reset the stats on the invoking
  3708. character and give back all the stat points used to raise them previously.
  3709. Nothing will happen to any other numbers about the character.
  3710. Used in reset NPC's (duh!)
  3711. ---------------------------------------
  3712. *resetskill;
  3713. This command takes off all the skill points on the invoking character, so they
  3714. only have Basic Skill blanked out (lvl 0) left, and returns the points for them
  3715. to spend again. Nothing else will change but the skills. Quest skills will also
  3716. reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If
  3717. the 'quest_skill_learn' option is set in there, the points in the quest skills
  3718. will also count towards the total.
  3719. Used in reset NPC's (duh!)
  3720. ---------------------------------------
  3721. *sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
  3722. *sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
  3723. *sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
  3724. *sc_end <effect type>{,<GID>};
  3725. These commands will bestow a status effect on a character.
  3726. The <effect type> determines which status is invoked. This can be either a number
  3727. or constant, with the common statuses (mostly negative) found in 'db/const.txt'
  3728. with the 'SC_' prefix. A full list is located in 'src/map/status.h', though
  3729. they are not currently documented.
  3730. The duration of the status is given in <ticks>, or milleseconds.
  3731. Certain status changes take an additional parameter <value 1>, which typically
  3732. modifies player stats by the given number or percentage. This differs for each
  3733. status, and is sometimes zero.
  3734. Optional value <rate> is the chance that the status will be invoked (100 = 1%).
  3735. This is used primarily in item scripts. When used in an NPC script, a flag MUST
  3736. be defined for the rate to work.
  3737. Optional value <flag> is how the status change start will be handled (a bitmask).
  3738. 1: Status change cannot be avoided.
  3739. 2: Tick cannot be reduced by stats (default).
  3740. 4: sc_data loaded, so no value will be altered.
  3741. 8: Rate cannot be reduced.
  3742. If a <GID> is given, the status change will be invoked on the specified character
  3743. instead of the one attached to the script. This can only be defined after setting
  3744. a rate and flag.
  3745. 'sc_start2' and 'sc_start4' allow extra parameters to be passed, and are used only
  3746. for effects that require them. The meaning of the extra values vary depending on the
  3747. effect type.
  3748. 'sc_end' will remove a specified status effect. If SC_ALL (-1) is given, it will
  3749. perform a complete removal of all statuses (although permanent ones will re-apply).
  3750. Examples:
  3751. // This will poison the invoking character for 10 minutes at 50% chance.
  3752. sc_start SC_POISON,600000,0,5000;
  3753. // This will bestow the effect of Level 10 Blessing.
  3754. sc_start 10,240000,10;
  3755. // Elemental armor defense takes the following four values:
  3756. // val1 is the first element, val2 is the resistance to the element val1.
  3757. // val3 is the second element, val4 is the resistance to the element val3.
  3758. sc_start4 SC_DefEle,60000,Ele_Fire,20,Ele_Water,-15;
  3759. // This will end the Freezing status for the invoking character.
  3760. sc_end SC_FREEZE;
  3761. Note: to use SC_NOCHAT you should alter Manner
  3762. set Manner, -5; // Will mute a user for 5 minutes
  3763. set Manner, 0; // Will unmute a user
  3764. set Manner, 5; // Will unmute a user and prevent the next use of 'Manner'
  3765. ---------------------------------------
  3766. *getstatus(<effect type>{,<type>})
  3767. Retrieve information about a specific status effect when called. Depending on <type>
  3768. specified the function will return different information.
  3769. Possible <type> values:
  3770. - 0 or undefined: whether the status is active
  3771. - 1: the val1 of the status
  3772. - 2: the val2 of the status
  3773. - 3: the val3 of the status
  3774. - 4: the val4 of the status
  3775. - 5: the amount of time in milliseconds that the status has remaining
  3776. If <type> is not defined or is set to 0, then the script function will either
  3777. return 1 if the status is active, or 0 if the status is not active. If the status
  3778. is not active when any of the <type> fields are provided, this script function
  3779. will always return 0.
  3780. ---------------------------------------
  3781. *skilleffect <skill id>,<number>;
  3782. *skilleffect "<skill name>",<number>;
  3783. This command displays visual and aural effects of given skill on currently
  3784. attached character. The number parameter is for skill whose visual effect
  3785. involves displaying of a number (healing or damaging). Note, that this command
  3786. will not actually use the skill, it is intended for scripts, which simulate
  3787. skill usage by the NPC, such as buffs, by setting appropriate status and
  3788. displaying the skill's effect.
  3789. mes "Be blessed!";
  3790. // Heal of 2000 HP
  3791. heal 2000,0;
  3792. skilleffect 28,2000;
  3793. // Blessing Level 10
  3794. sc_start 10,240000,10;
  3795. skilleffect 34,0;
  3796. // Increase AGI Level 5
  3797. sc_start 12,140000,5;
  3798. skilleffect 29,0;
  3799. This will heal the character with 2000 HP, buff it with Blessing Lv 10 and
  3800. Increase AGI Lv 5, and display appropriate effects.
  3801. ---------------------------------------
  3802. *npcskilleffect <skill id>,<number>,<x>,<y>;
  3803. *npcskilleffect "<skill name>",<number>,<x>,<y>;
  3804. This command behaves identically to 'skilleffect', however, the effect will not
  3805. be centered on the invoking character's sprite, nor on the NPC sprite, if any,
  3806. but will be centered at map coordinates given on the same map as the invoking
  3807. character.
  3808. ---------------------------------------
  3809. *specialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
  3810. This command will display special effect with the given number, centered on the
  3811. specified NPCs coordinates, if any. For a full list of special effect numbers
  3812. known see 'doc/effect_list.txt'. Some effect numbers are known not to work in
  3813. some client releases. (Notably, rain is absent from any client executables
  3814. released after April 2005.)
  3815. <NPC name> parameter will display <effect number> on another NPC. If the NPC
  3816. specified does not exist, the command will do nothing. When specifying an NPC,
  3817. <send_target> must be specified when specifying an <NPC Name>, specifying AREA
  3818. will retain the default behavior of the command.
  3819. // this will make the NPC "John Doe#1"
  3820. // show the effect "EF_HIT1" specified by
  3821. // Jane Doe. I wonder what John did...
  3822. mes "[Jane Doe]";
  3823. mes "Well, I never!";
  3824. specialeffect EF_HIT1,AREA,"John Doe#1";
  3825. close;
  3826. ---------------------------------------
  3827. *specialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
  3828. This command behaves identically to 'specialeffect', but the effect will be
  3829. centered on the invoking character's sprite.
  3830. <Player name> parameter will display <effect number> on another Player than the
  3831. one currently attached to the script. Like with specialeffect, when specifying
  3832. a player, <send_target> must be supplied, specifying AREA will retain the default
  3833. behavior of the command.
  3834. ---------------------------------------
  3835. *statusup <stat>;
  3836. This command will bump a specified stat of the invoking character up by one
  3837. permanently. Stats are to be given as number, but you can use these constants to
  3838. replace them:
  3839. bStr - Strength
  3840. bVit - Vitality
  3841. bInt - Intelligence
  3842. bAgi - Agility
  3843. bDex - Dexterity
  3844. bLuk - Luck
  3845. ---------------------------------------
  3846. *statusup2 <stat>,<amount>;
  3847. This command will bump a specified stat of the invoking character up by the
  3848. specified amount permanently. The amount can be negative. See 'statusup'.
  3849. // This will decrease a character's Vit forever.
  3850. statusup bVit,-1;
  3851. ---------------------------------------
  3852. *bonus <bonus type>,<val1>;
  3853. *bonus2 <bonus type>,<val1>,<val2>;
  3854. *bonus3 <bonus type>,<val1>,<val2>,<val3>;
  3855. *bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
  3856. *bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
  3857. These commands are meant to be used in item scripts. They will probably work
  3858. outside item scripts, but the bonus will not persist for long. They, as
  3859. expected, refer only to an invoking character.
  3860. You can find the full list of possible bonuses and which command to use for each
  3861. kind in 'doc/item_bonus.txt'.
  3862. ---------------------------------------
  3863. *autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  3864. *autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  3865. *autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
  3866. *autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
  3867. These commands are meant to be used in item scripts. They will probably work
  3868. outside item scripts, but the bonus will not persist for long. They, as
  3869. expected, refer only to an invoking character.
  3870. What these commands do is 'attach' a script to the player which will get
  3871. executed on attack (or when attacked in the case of autobonus2).
  3872. Rate is the trigger rate of the script (10000 = 100%).
  3873. Duration is the time that the bonus will last for since the script has triggered.
  3874. Skill ID/skill name the skill which will be used as trigger to start the bonus. (autobonus3)
  3875. The optional argument 'flag' is used to classify the type of attack where the script
  3876. can trigger (it shares the same flags as the bAutoSpell bonus script):
  3877. Range criteria:
  3878. BF_SHORT: Trigger on melee attack
  3879. BF_LONG: Trigger on ranged attack
  3880. Default: BF_SHORT+BF_LONG
  3881. Attack type criteria:
  3882. BF_WEAPON: Trigger on weapon skills
  3883. BF_MAGIC: Trigger on magic skills
  3884. BF_MISC: Trigger on misc skills
  3885. Default: BF_WEAPON
  3886. Skill criteria:
  3887. BF_NORMAL: Trigger on normal attacks
  3888. BF_SKILL: Trigger on skills
  3889. default: If the attack type is BF_WEAPON (only) BF_NORMAL is used,
  3890. otherwise BF_SKILL+BF_NORMAL is used.
  3891. The difference between the optional argument 'other script' and the 'bonus script' is that,
  3892. the former one triggers only when attacking(or attacked) and the latter one runs on
  3893. status calculation as well, which makes sure, within the duration, the "bonus" that get
  3894. lost on status calculation is restored. So, 'bonus script' is technically supposed to accept
  3895. "bonus" command only. And we usually use 'other script' to show visual effects.
  3896. In all cases, when the script triggers, the attached player will be the one
  3897. who holds the bonus. There is currently no way of knowing within this script
  3898. who was the other character (the attacker in autobonus2, or the target in
  3899. autobonus and autobonus3).
  3900. //Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
  3901. //using weapon or misc attacks (both melee and ranged skills) and shows a special
  3902. //effect when the bonus is active.
  3903. autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
  3904. ---------------------------------------
  3905. *bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};
  3906. This command will attach a script to a player for a given duration, in seconds.
  3907. After that time, the script will automatically expire. The same bonus cannot be
  3908. stacked. By default, this bonus will be stored on `bonus_script` table when player
  3909. logs out.
  3910. Note that the maximum number of 'bonus_script' commands that can run simultaneously
  3911. for a player is 10 (MAX_PC_BONUS_SCRIPT in 'src/map/pc.h').
  3912. Flags (bitmask):
  3913. 1 : Remove when dead.
  3914. 2 : Removable by Dispell.
  3915. 4 : Removable by Clearance.
  3916. 8 : Remove when player logs out.
  3917. 16 : Removeable by Banishing Buster.
  3918. 32 : Removable by Refresh.
  3919. 128 : Removable by Luxanima.
  3920. 256 : Remove when Madogear is activated or deactivated.
  3921. 512 : Remove when receive damage.
  3922. 1024: Script is permanent, cannot be cleared by bonus_script_clear
  3923. Types:
  3924. This will be used to decide negative or positive buff for 'debuff_on_logout'.
  3925. 0: Ignore the buff type and won't be removed if the flag is not &8 (Default)
  3926. 1: Buff
  3927. 2: Debuff
  3928. Status_icon: See "Status Icon" section in 'db/const.txt'. Default is SI_BLANK (-1).
  3929. Example:
  3930. // Apple gives you +5 Str bonus for 1 minute when it's consumed.
  3931. 512,Apple,Apple,0,15,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "{ bonus bStr,5; }",60; },{},{}
  3932. ---------------------------------------
  3933. *bonus_script_clear {<flag>,{<char_id>}};
  3934. Removes atatched bonus_script from player. If no 'char_id' given, it will removes
  3935. from the invoker.
  3936. If 'flag' is 1, means will clears all scripts even it's Permanent effect. By default,
  3937. it just removes non-permanent script.
  3938. ---------------------------------------
  3939. *skill <skill id>,<level>{,<flag>};
  3940. *skill "<skill name>",<level>{,<flag>};
  3941. *addtoskill <skill id>,<level>{,<flag>};
  3942. *addtoskill "<skill name>",<level>{,<flag>};
  3943. These commands will give the invoking character a specified skill. This is also
  3944. used for item scripts.
  3945. Level is obvious. Skill id is the ID number of the skill in question as per
  3946. 'db/(pre-)re/skill_db.txt'. It is not known for certain whether this can be used to give
  3947. a character a monster's skill, but you're welcome to try with the numbers given
  3948. in 'db/(pre-)re/mob_skill_db.txt'.
  3949. Flag is 0 if the skill is given permanently (will get written with the character
  3950. data) or 1 if it is temporary (will be lost eventually, this is meant for card
  3951. item scripts usage.). The flag parameter is optional, and defaults to 1 in
  3952. 'skill' and to 2 in 'addtoskill'.
  3953. Flag 2 means that the level parameter is to be interpreted as a stackable
  3954. additional bonus to the skill level. If the character did not have that skill
  3955. previously, they will now at 0+the level given.
  3956. Flag 4 is the same as flag 1 in that it saves to the database. However, these skills
  3957. are ignored when any action is taken that adjusts the skill tree (reset/job change).
  3958. // This will permanently give the character Stone Throw (TF_THROWSTONE,152), at
  3959. // level 1.
  3960. skill 152,1,0;
  3961. ---------------------------------------
  3962. *nude;
  3963. This command will unequip anything equipped on the invoking character.
  3964. It is not required to do this when changing jobs since 'jobchange' will unequip
  3965. everything not equippable by the new job class anyway.
  3966. ---------------------------------------
  3967. *sit {"<character name>"};
  3968. *stand {"<character name>"};
  3969. These commands will make a character sit or stand.
  3970. If no character is specified, the command will run for the invoking character.
  3971. ---------------------------------------
  3972. *disguise <Monster ID>;
  3973. *undisguise;
  3974. This command disguises the current player with a monster sprite.
  3975. The disguise lasts until 'undisguise' is issued or the player logs out.
  3976. Example:
  3977. disguise 1002; // Disguise character as a Poring.
  3978. next;
  3979. undisguise; // Return to normal character sprite.
  3980. ---------------------------------------
  3981. *transform <monster name/ID>,<duration>,<sc type>{,<val1>,<val2>,<val3>,<val4>};
  3982. This command will turn a player into a monster for a given duration and grants an
  3983. SC attribute effect while transformed. Note that players cannot be transformed
  3984. during War of Emperium or if already disguised.
  3985. ---------------------------------------
  3986. \\
  3987. 4,3 Marriage-related commands
  3988. \\
  3989. ---------------------------------------
  3990. *marriage("<spouse name>");
  3991. This function will marry two characters, the invoking character and the one
  3992. referred to by name given, together, setting them up as each other's marriage
  3993. partner. No second function call has to be issued (in current SVN at least) to
  3994. make sure the marriage works both ways. The function returns 1 upon success, or
  3995. 0 if the marriage could not be completed, either because the other character
  3996. wasn't found or because one of the two characters is already married.
  3997. This will do nothing else for the marriage except setting up the spouse ID for
  3998. both of these characters. No rings will be given and no effects will be shown.
  3999. ---------------------------------------
  4000. *wedding;
  4001. This command will call up wedding effects - the music and confetti - centered on
  4002. the invoking character. Example can be found in the wedding script.
  4003. ---------------------------------------
  4004. *divorce()
  4005. This function will "un-marry" the invoking character from whoever they were
  4006. married to. Both will no longer be each other's marriage partner, (at least in
  4007. current SVN, which prevents the cases of multi-spouse problems). It will return
  4008. 1 upon success or 0 if the character was not married at all.
  4009. This function will also destroy both wedding rings and send a message to both
  4010. players, telling them they are now divorced.
  4011. ---------------------------------------
  4012. //
  4013. 4,3.- End of marriage-related commands
  4014. //
  4015. ---------------------------------------
  4016. *pcfollow <id>,<target id>;
  4017. *pcstopfollow <id>;
  4018. Makes a character follow or stop following someone. This command does the same
  4019. as the @follow command. The main difference is that @follow can use character
  4020. names, and this commands needs the account ID for the target.
  4021. Examples:
  4022. // This will make Aaron follow Bullah, when both of these characters are online.
  4023. pcfollow getCharID(3,"Aaron"),getCharID(3,"Bullah");
  4024. // Makes Aaron stop following whoever he is following.
  4025. pcstopfollow getCharID(3,"Aaron");
  4026. ---------------------------------------
  4027. *pcblockmove <id>,<option>;
  4028. Prevents the given GID from moving when the option is 1, and enables the ID to
  4029. move again when the option is 0. This command will run for the attached player
  4030. if the given GID is zero.
  4031. Examples:
  4032. // Prevents the current char from moving away.
  4033. pcblockmove getcharid(3),1;
  4034. // Enables the current char to move again.
  4035. pcblockmove getcharid(3),0;
  4036. ---------------------------------------
  4037. ==================================
  4038. |5.- Mob / NPC -related commands.|
  4039. ==================================
  4040. ---------------------------------------
  4041. *monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4042. *areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4043. This command will spawn a monster on the specified coordinates on the specified
  4044. map. If the script is invoked by a character, a special map name, "this", will
  4045. be recognized to mean the name of the map the invoking character is located at.
  4046. This command works fine in the item scripts.
  4047. The same command arguments mean the same things as described above in the
  4048. beginning of this document when talking about permanent monster spawns. Monsters
  4049. spawned in this manner will not respawn upon being killed.
  4050. Unlike the permanent monster spawns, if the mob id is -1, a random monster will
  4051. be picked from the entire database according to the rules configured in the
  4052. server for dead branches. This will work for all other kinds of non-permanent
  4053. monster spawns.
  4054. The only very special thing about this command is an event label, which is an
  4055. optional parameter. This label is written like '<NPC object name>::<label name>'
  4056. and upon the monster being killed, it will execute the script inside of the
  4057. specified NPC object starting from the label given. The RID of the player
  4058. attached at this execution will be the RID of the killing character.
  4059. <size> can be:
  4060. 0 = medium (default)
  4061. 1 = small
  4062. 2 = big
  4063. <ai> can be:
  4064. 0 = none (default)
  4065. 1 = attack/friendly
  4066. 2 = sphere (Alchemist skill)
  4067. 3 = flora (Alchemist skill)
  4068. 4 = zanzou (Kagerou/Oboro skill)
  4069. monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
  4070. The coordinates of 0,0 will spawn the monster on a random place on the map.
  4071. The 'areamonster' command works much like the 'monster' command and is not
  4072. significantly different, but spawns the monsters within a square defined by
  4073. x1/y1-x2/y2.
  4074. Simple monster killing script:
  4075. <Normal NPC object definition. Let's assume you called him NPCNAME.>
  4076. mes "[Summon Man]";
  4077. mes "Want to start the Poring hunt?";
  4078. next;
  4079. if(select("Yes.:No.") == 2) {
  4080. mes "[Summon Man]";
  4081. mes "Come back later.";
  4082. close;
  4083. }
  4084. // Summon 10 Porings.
  4085. // Using coordinates 0,0 will spawn them in a random location.
  4086. monster "prontera",0,0,"Quest Poring",1002,10,"NPCNAME::OnPoringKilled";
  4087. mes "[Summon Man]";
  4088. mes "Now go and kill all the Porings I summoned.";
  4089. close;
  4090. OnPoringKilled:
  4091. $PoringKilled++;
  4092. if ($PoringKilled >= 10) goto L_AllDead;
  4093. end;
  4094. L_AllDead:
  4095. announce "Summon Man: Well done. All the Porings are dead!",3;
  4096. $PoringKilled = 0;
  4097. end;
  4098. For more good examples see just about any official 2-1 or 2-2 job quest script.
  4099. ---------------------------------------
  4100. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4101. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4102. This command will make all monsters of the specified mob ID in the specified
  4103. area use the specified skill. Map name, x, and y define the center of the area,
  4104. which extending <range> cells in each direction (ex: a range of 3 would create
  4105. a 7x7 square). The skill can be specified by skill ID or name. <cast time> is in
  4106. milliseconds (1000 = 1 second), and the rest should be self-explanatory.
  4107. <target type> can be:
  4108. 0 = self
  4109. 1 = the mob's current target
  4110. 2 = the mob's master
  4111. 3 = random target
  4112. Example:
  4113. // spawn 1 Shining Plant in the 5x5 area centered on (155,188)
  4114. areamonster "prontera",153,186,157,190,"Shining Plant",1083,1;
  4115. // make the plant cast level 10 Cold Bolt on a random target
  4116. areamobuseskill "prontera",155,188,2,1083,"MG_COLDBOLT",10,3000,1,e_gg,3;
  4117. ---------------------------------------
  4118. *killmonster "<map name>","<event label>"{,<type>};
  4119. This command will kill all monsters that were spawned with 'monster' or
  4120. 'addmonster' and have a specified event label attached to them. Commonly used to
  4121. get rid of remaining quest monsters once the quest is complete.
  4122. If the label is given as "All", all monsters which have their respawn times set
  4123. to -1 (like all the monsters summoned with 'monster' or 'areamonster' script
  4124. command, and all monsters summoned with GM commands, but no other ones - that
  4125. is, all non-permanent monsters) on the specified map will be killed regardless
  4126. of the event label value.
  4127. As of r12876 killmonster now supports an optional argument type. Using 1 for type
  4128. will make the command fire "OnMyMobDead" events from any monsters that do die
  4129. as a result of this command.
  4130. ---------------------------------------
  4131. *killmonsterall "<map name>"{,<type>};
  4132. This command will kill all monsters on a specified map name, regardless of how
  4133. they were spawned or what they are. As of r12873, The behavior has changed slightly.
  4134. In light of a label behavior fix for mob spawning commands that will now allow the label to
  4135. trigger when there is no player, killmonsterall has also been modified to support this.
  4136. Using this the normal/old way means labels don't trigger when a player didn't
  4137. attack/kill a monster. This is because it breaks compatibility with older scripts if
  4138. forced to use the new method. However, if you wish to use the new label type with this
  4139. command, simply use 1 for type. Any other number won't be recognized.
  4140. ---------------------------------------
  4141. *strmobinfo(<type>,<monster id>);
  4142. This function will return information about a monster record in the database, as
  4143. per 'db/(pre-)re/mob_db.txt'. Type is the kind of information returned. Valid types are:
  4144. It will return 0 if there is no such monster (or the type value is invalid),
  4145. or an empty string if you requested the monster's name.
  4146. 1 - 'english name' field in the database, a string.
  4147. 2 - 'japanese name' field in the database, a string.
  4148. All other returned values are numbers:
  4149. 3 - Level.
  4150. 4 - Maximum HP.
  4151. 5 - Maximum SP.
  4152. 6 - Experience reward.
  4153. 7 - Job experience reward.
  4154. ---------------------------------------
  4155. *mobcount("<map name>","<event label>")
  4156. This function will count all the monsters on the specified map that have a given
  4157. event label and return the number or 0 if it can't find any. Naturally, only
  4158. monsters spawned with 'monster' and 'areamonster' script commands can have non-empty
  4159. event label.
  4160. If you pass this function an empty string for the event label, it will return
  4161. the total count of monster without event label, including permanently spawning monsters.
  4162. With the dynamic mobs system enabled, where mobs are not kept
  4163. in memory for maps with no actual people playing on them, this will return a 0
  4164. for any such map.
  4165. If the event label is given as "all", all monsters will be counted, regardless of
  4166. having any event label attached.
  4167. If the map name is given as "this", the map the invoking character is on will
  4168. be used. If the map is not found, or the invoker is not a character while the map
  4169. is "this", it will return -1.
  4170. ---------------------------------------
  4171. *clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
  4172. This command creates a monster which is a copy of another player. The first
  4173. four arguments serve the same purpose as in the monster script command, The
  4174. <char id> is the character id of the player to clone (player must be online).
  4175. If <master id> is given, the clone will be a 'slave/minion' of it. Master_id
  4176. must be a character id of another online player.
  4177. The mode can be specified to determine the behavior of the clone. Its
  4178. values are the same as the ones used for the mode field in the mob_db. The
  4179. default mode is aggressive, assists, can move, can attack.
  4180. Flag can be either zero or one currently. If zero, the clone is a normal
  4181. monster that'll target players, if one, it is considered a summoned monster,
  4182. and as such, it'll target other monsters. Defaults to zero.
  4183. The duration specifies how long the clone will live before it is auto-removed.
  4184. Specified in seconds, defaults to no limit (zero).
  4185. Returned value is the monster ID of the spawned clone. If command fails,
  4186. returned value is zero.
  4187. ---------------------------------------
  4188. *summon "monster name",<monster id>{,<Time Out>{,"event label"}};
  4189. This command will summon a monster. (see also 'monster') Unlike monsters spawned
  4190. with other commands, this one will set up the monster to fight to protect the
  4191. invoking character. Monster name and mob id obey the same rules as the one given
  4192. at the beginning of this document for permanent monster spawns with the
  4193. exceptions mentioned when describing 'monster' command.
  4194. The effect for the skill 'Call Homunculus' will be displayed centered on the
  4195. invoking character.
  4196. Timeout is the time in milliseconds the summon lives, and is set default
  4197. to 60000 (1 minute). Note that also the value 0 will set the timer to default,
  4198. and it is not possible to create a spawn that lasts forever.
  4199. If an event label is given, upon the monster being killed, the event label will
  4200. run as if by 'donpcevent'.
  4201. // Will summon a dead branch-style monster to fight for the character.
  4202. summon "--ja--",-1;
  4203. ---------------------------------------
  4204. *addmonsterdrop <monster id>,<item id>,<rate>;
  4205. *addmonsterdrop "<monster name>",<item id>,<rate>;
  4206. *delmonsterdrop <monster id>,<item id>;
  4207. *delmonsterdrop "<monster name>",<item id>;
  4208. These commands will temporarily add or delete a monster drop, which will be reset
  4209. when the mob database reloads or the server shuts down. They return 1 upon success.
  4210. If the monster already drops the specified item, its drop rate will be updated with
  4211. the given rate (100 = 1%).
  4212. Examples:
  4213. // Makes Owl Baron drop Honey at an 80% rate.
  4214. addmonsterdrop 1295,518,8000;
  4215. // Deletes Executioner's Mitten from Rybio.
  4216. delmonsterdrop 1201,7017;
  4217. ---------------------------------------
  4218. *disablenpc "<NPC object name>";
  4219. *enablenpc "<NPC object name>";
  4220. These two commands will disable and enable, respectively, an NPC object
  4221. specified by name. The disabled NPC will disappear from sight and will no longer
  4222. be triggerable in the normal way. It is not clear whether it will still be
  4223. accessible through 'donpcevent' and other triggering commands, but it probably
  4224. will be. You can disable even warp NPCs if you know their object names, which is
  4225. an easy way to make a map only accessible through walking half the time. Then
  4226. you 'enablenpc' them back.
  4227. You can also use these commands to create the illusion of an NPC switching
  4228. between several locations, which is often better than actually moving the NPC -
  4229. create one NPC object with a visible and a hidden part to their name, make a few
  4230. copies, and then disable all except one.
  4231. ---------------------------------------
  4232. *hideonnpc "<NPC object name>";
  4233. *hideoffnpc "<NPC object name>";
  4234. These commands will make the NPC object specified display as hidden/visible,
  4235. even though not actually disabled per se. Hidden as in thief Hide skill, but
  4236. unfortunately, not detectable by Ruwach or Sight.
  4237. As they are now, these commands are pointless, it is suggested to use
  4238. 'disablenpc'/'enablenpc', because these two commands actually unload the NPC
  4239. sprite location and other accompanying data from memory when it is not used.
  4240. However, you can use these for some quest ideas (such as cloaking NPCs talking
  4241. while hidden then revealing.... you can wonder around =P
  4242. ---------------------------------------
  4243. *doevent "<NPC object name>::<event label>";
  4244. This command will start a new execution thread in a specified NPC object at the
  4245. specified label. The execution of the script running this command will not stop,
  4246. and the event called by the 'doevent' command will not run until the invoking
  4247. script has terminated. No parameters may be passed with a doevent call.
  4248. The script of the NPC object invoked in this manner will run as if it's been
  4249. invoked by the RID that was active in the script that issued a 'doevent'. As
  4250. such, the command will not work if an RID is not attached.
  4251. place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
  4252. mes "This is what you will see when you click me";
  4253. close;
  4254. OnLabel:
  4255. mes "This is what you will see if the doevent is activated";
  4256. close;
  4257. }
  4258. ....
  4259. doevent "NPC::OnLabel";
  4260. ---------------------------------------
  4261. *donpcevent "<NPC object name>::<event label>";
  4262. This command invokes the event label code within an another NPC or NPCs. It
  4263. starts a separate instance of execution, and the invoking NPC will resume
  4264. execution its immediately.
  4265. If the supplied event label has the form "NpcName::OnLabel", then only given
  4266. NPC's event label will be invoked (much like 'goto' into another NPC). If the
  4267. form is "::OnLabel" (NPC name omitted), the event code of all NPCs with given
  4268. label will be invoked, one after another. In both cases the invoked script
  4269. will run without an attached RID, whether or not the invoking script was
  4270. attached to a player. The event label name is required to start with "On".
  4271. This command can be used to make other NPCs act, as if they were responding to
  4272. the invoking NPC's actions, such as using an emotion or talking.
  4273. place,100,100,1%TAB%script%TAB%NPC1%TAB%53,{
  4274. mes "NPC2 copies my actions!";
  4275. close2;
  4276. donpcevent "NPC2::OnEmote";
  4277. OnEmote:
  4278. emotion rand(1,30);
  4279. end;
  4280. }
  4281. place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{
  4282. mes "NPC1 copies my actions!";
  4283. close2;
  4284. donpcevent "NPC1::OnEmote";
  4285. OnEmote:
  4286. emotion rand(1,30);
  4287. end;
  4288. }
  4289. Whichever of the both NPCs is talked to, both will show a random emotion at the
  4290. same time.
  4291. As of r16564, command now returns 1 or 0 on success and failure.
  4292. A debug message also shows on the console when no events are triggered.
  4293. ---------------------------------------
  4294. *cmdothernpc "<npc name>","<command>";
  4295. This is simply "donpcevent <npc name>::OnCommand<command>".
  4296. It is an approximation of official server script language's 'cmdothernpc'.
  4297. ---------------------------------------
  4298. *npctalk "<message>";
  4299. This command will display a message to the surrounding area as if the NPC object
  4300. running it was a player talking - that is, above their head and in the chat
  4301. window. The display name of the NPC will get appended in front of the message to
  4302. complete the effect.
  4303. // This will make everyone in the area see the NPC greet the character
  4304. // who just invoked it.
  4305. npctalk "Hello "+strcharinfo(0)+", how are you?";
  4306. ---------------------------------------
  4307. *setnpcdisplay("<npc name>", "<display name>", <class id>, <size>)
  4308. *setnpcdisplay("<npc name>", "<display name>", <class id>)
  4309. *setnpcdisplay("<npc name>", "<display name>")
  4310. *setnpcdisplay("<npc name>", <class id>)
  4311. Changes the display name and/or display class of the target NPC.
  4312. Returns 0 is successful, 1 if the NPC does not exist.
  4313. Size is 0 = normal 1 = small 2 = big.
  4314. ---------------------------------------
  4315. \\
  4316. 5,1.- Time-related commands
  4317. \\
  4318. ---------------------------------------
  4319. *addtimer <ticks>,"NPC::OnLabel";
  4320. *deltimer "NPC::OnLabel";
  4321. *addtimercount <ticks>,"NPC::OnLabel";
  4322. These commands will create, destroy, and delay a countdown timer - 'addtimer' to
  4323. create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified
  4324. number of ticks. For all three cases, the event label given is the identifier of
  4325. that timer. The timer runs on the character object that is attached to the script,
  4326. and can have multiple instances. When the label is run, it is run as if the player that
  4327. the timer runs on has clicked the NPC.
  4328. When this timer runs out, a new execution thread will start in the specified NPC
  4329. object at the specified label.
  4330. The ticks are given in 1/1000ths of a second.
  4331. One more thing. These timers are stored as part of player data. If the player
  4332. logs out, all of these get immediately deleted, without executing the script.
  4333. If this behavior is undesirable, use some other timer mechanism (like 'sleep').
  4334. Example:
  4335. <NPC Header> {
  4336. dispbottom "Starting a 5 second timer...";
  4337. addtimer 5000, strnpcinfo(3)+"::On5secs";
  4338. end;
  4339. On5secs:
  4340. dispbottom "5 seconds have passed!";
  4341. end;
  4342. }
  4343. ---------------------------------------
  4344. *initnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  4345. { "<NPC name>" | <Attach Flag> };
  4346. *stopnpctimer{ "<NPC name>" {, <Detach Flag>} } |
  4347. { "<NPC name>" | <Detach Flag> };
  4348. *startnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  4349. { "<NPC name>" | <Attach Flag> };
  4350. *setnpctimer <tick>{,"<NPC name>"};
  4351. *getnpctimer(<type of information>{,"<NPC name>"})
  4352. *attachnpctimer {"<character name>"};
  4353. *detachnpctimer {"<NPC name>"};
  4354. This set of commands and functions will create and manage an NPC-based timer.
  4355. The NPC name may be omitted, in which case the calling NPC is used as target.
  4356. Contrary to addtimer/deltimer commands which let you have many different timers
  4357. referencing different labels in the same NPC, each with their own countdown,
  4358. 'initnpctimer' can only have one per NPC object. But it can trigger many labels
  4359. and let you know how many were triggered already and how many still remain.
  4360. This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon
  4361. creating this timer, the execution will not stop, but will happily continue
  4362. onward. The timer will then invoke new execution threads at labels
  4363. "OnTimer<time>:" in the NPC object it is attached to.
  4364. To create the timer, use the 'initnpctimer', which will start it running.
  4365. 'stopnpctimer' will pause the timer, without clearing the current tick, while
  4366. 'startnpctimer' will let the paused timer continue.
  4367. By default timers do not have a RID attached, which lets them continue even
  4368. if the player that started them logs off. To attach a RID to a timer, you can
  4369. either use the optional "attach flag" when using 'initnpctimer/startnpctimer',
  4370. or do it manually by using 'attachnpctimer'. Likewise, the optional flag of
  4371. stopnpctimer lets you detach any RID after stopping the timer, and by using
  4372. 'detachnpctimer' you can detach a RID at any time.
  4373. Normally there is only a single timer per NPC, but as an exception, as long as
  4374. you attach a player to the timer, you can have multiple timers running at once,
  4375. because these will get stored on the players instead of the NPC.
  4376. NOTE: You need to attach the RID before the timer _before_ you start it to
  4377. get a player-attached timer. Otherwise it'll stay a NPC timer (no effect).
  4378. If the player that is attached to the npctimer logs out, the "OnTimerQuit:"
  4379. event label of that NPC will be triggered, so you can do the appropriate
  4380. cleanup (the player is still attached when this event is triggered).
  4381. The 'setnpctimer' command will explicitly set the timer to a given tick.
  4382. 'getnpctimer' provides timer information. Its parameter defines what type:
  4383. 0 - Will return the current tick count of the timer.
  4384. 1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the
  4385. specified NPC waiting for execution.
  4386. 2 - Will return the number of times the timer has triggered and will trigger
  4387. an "OnTimer<tick>:" label in the specified NPC.
  4388. Example 1:
  4389. <NPC Header> {
  4390. // We need to use attachnpctimer because the mes command below needs RID attach
  4391. attachnpctimer;
  4392. initnpctimer;
  4393. npctalk "I cant talk right now, give me 10 seconds";
  4394. end;
  4395. OnTimer5000:
  4396. npctalk "Ok 5 seconds more";
  4397. end;
  4398. OnTimer6000:
  4399. npctalk "4";
  4400. end;
  4401. OnTimer7000:
  4402. npctalk "3";
  4403. end;
  4404. OnTimer8000:
  4405. npctalk "2";
  4406. end;
  4407. OnTimer9000:
  4408. npctalk "1";
  4409. end;
  4410. OnTimer10000:
  4411. stopnpctimer;
  4412. mes "[Man]";
  4413. mes "Ok we can talk now";
  4414. detachnpctimer;
  4415. // and remember attachnpctimer and detachnpctimer can only use while the NPC timer is not running !
  4416. }
  4417. Example 2:
  4418. OnTimer15000:
  4419. npctalk "Another 15 seconds have passed.";
  4420. // You have to use 'initnpctimer' instead of 'setnpctimer 0'.
  4421. // This is equal to 'setnpctimer 0' + 'startnpctimer'.
  4422. // Alternatively, you can also insert another 'OnTimer15001' label so that the timer won't stop. */
  4423. initnpctimer;
  4424. end;
  4425. // This OnInit label will run when the script is loaded, so that the timer
  4426. // is initialized immediately as the server starts. It is dropped back to 0
  4427. // every time the NPC says something, so it will cycle continuously.
  4428. OnInit:
  4429. initnpctimer;
  4430. end;
  4431. Example 3:
  4432. mes "[Man]";
  4433. mes "I have been waiting "+(getnpctimer(0)/1000)+" seconds for you.";
  4434. // We divide the timer returned by 1000 to convert milliseconds to seconds.
  4435. close;
  4436. Example 4:
  4437. mes "[Man]";
  4438. mes "Ok, I will let you have 30 more seconds...";
  4439. close2;
  4440. setnpctimer (getnpctimer(0)-30000);
  4441. // Notice the 'close2'. If there were a 'next' there the timer would be
  4442. // changed only after the player pressed the 'next' button.
  4443. end;
  4444. ---------------------------------------
  4445. *sleep {<milliseconds>};
  4446. *sleep2 {<milliseconds>};
  4447. *awake "<NPC name>";
  4448. These commands are used to control the pause of a NPC.
  4449. sleep and sleep2 will pause the script for the given amount of milliseconds.
  4450. Awake is used to cancel a sleep. When awake is called on a NPC it will run as
  4451. if the sleep timer ran out, and thus making the script continue. Sleep and sleep2
  4452. basically do the same, but the main difference is that sleep will not keep the rid,
  4453. while sleep2 does.
  4454. Examples:
  4455. sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore)
  4456. sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached.
  4457. awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'.
  4458. ---------------------------------------
  4459. *progressbar "<color>",<seconds>;
  4460. This command works almost like sleep2, but displays a progress bar
  4461. above the head of the currently attached character (like cast bar).
  4462. Once the given amount of seconds passes, the script resumes. If the
  4463. character moves while the progress bar progresses, it is aborted and
  4464. the script ends. The color format is in RGB (0xRRGGBB). The color is
  4465. currently ignored by the client and appears always green.
  4466. ---------------------------------------
  4467. //
  4468. 5,1.- End of time-related commands
  4469. //
  4470. ---------------------------------------
  4471. *announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  4472. This command will broadcast a message to all or most players, similar to
  4473. @kami/@kamib GM commands.
  4474. announce "This will be shown to everyone at all in yellow.",0;
  4475. The region the broadcast is heard in (target), source of the broadcast
  4476. and the color the message will come up as is determined by the flags.
  4477. The flag values are coded as constants in 'db/const.txt' to make them easier to use.
  4478. Target flags:
  4479. - bc_all: Broadcast message is sent server-wide (default).
  4480. - bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below).
  4481. - bc_area: Message is sent to players in the vicinity of the source.
  4482. - bc_self: Message is sent only to current player.
  4483. You cannot use more than one target flag.
  4484. Source flags:
  4485. - bc_pc: Broadcast source is the attached player (default).
  4486. - bc_npc: Broadcast source is the NPC, not the player attached to the script
  4487. (useful when a player is not attached or the message should be sent to those
  4488. nearby the NPC).
  4489. You cannot use more than one source flag.
  4490. Special flags:
  4491. - bc_yellow: Broadcast will be displayed in yellow color (default).
  4492. - bc_blue: Broadcast will be displayed in blue color.
  4493. - bc_woe: Indicates that this broadcast is 'WoE Information' that can be disabled client-side.
  4494. Due to the way client handles broadcasts, it is impossible to set both bc_blue and bc_woe.
  4495. The optional parameters allow usage of broadcasts in custom colors, font-weights, sizes etc.
  4496. If any of the optional parameters is used, special flag is ignored.
  4497. Optional parameters may not work well (or at all) depending on a game client used.
  4498. The color parameter is a single number which can be in hexadecimal notation.
  4499. For example:
  4500. announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
  4501. Will display a global announce in green. The color format is in RGB (0xRRGGBB).
  4502. In official scripts only two font-weights (types) are used:
  4503. - normal (FW_NORMAL = 400, default),
  4504. - bold (FW_BOLD = 700).
  4505. Default font size is 12.
  4506. Using this for private messages to players is probably not that good an idea,
  4507. but it can be used instead in NPCs to "preview" an announce.
  4508. // This will be a private message to the player using the NPC that made the
  4509. // announcement
  4510. announce "This is my message just for you",bc_blue|bc_self;
  4511. // This will be shown on everyones screen that is in sight of the NPC.
  4512. announce "This is my message just for you people here",bc_npc|bc_area;
  4513. ---------------------------------------
  4514. *mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  4515. This command will work like 'announce' but will only broadcast to characters
  4516. currently residing on the specified map. The flag and optional parameters
  4517. parameters are the same as in 'announce', but target and source flags are ignored.
  4518. ---------------------------------------
  4519. *areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  4520. This command works like 'announce' but will only broadcast to characters
  4521. residing in the specified x1/y1-x2/y2 rectangle on the map given. The flags and
  4522. optional parameters are the same as in 'announce', but target and source flags are ignored.
  4523. areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0;
  4524. ---------------------------------------
  4525. *callshop "<name>",<option>;
  4526. These are a series of commands used to create dynamic shops.
  4527. The 'callshop' function calls an invisible shop (view -1) as if the player clicked on it.
  4528. The options are:
  4529. 0 = The normal window (buy, sell and cancel)
  4530. 1 = The buy window
  4531. 2 = The sell window
  4532. A shop called with this command will trigger the labels "OnBuyItem" and "OnSellItem"
  4533. (as long as an npcshop* command is executed from that NPC, see note below). These
  4534. labels, if used, will replace how the shop handles the buying and selling of items,
  4535. allowing for the creation of dynamic shops.
  4536. The label "OnBuyItem" sets the following arrays:
  4537. @bought_nameid - item ID bought
  4538. @bought_quantity - amount bought
  4539. The label "OnSellItem" sets the following arrays:
  4540. @sold_nameid - item ID sold
  4541. @sold_quantity - amount sold
  4542. @sold_refine - refine count
  4543. @sold_attribute - if the item is broken (1) or not (0)
  4544. @sold_identify - if the item is identified (1) or not (0)
  4545. @sold_card1 - card slot 1
  4546. @sold_card2 - card slot 2
  4547. @sold_card3 - card slot 3
  4548. @sold_card4 - card slot 4
  4549. Note: These labels will only be triggered if an npcshop* command is executed because these
  4550. commands set a special data on the shop NPC, named master_nd in the source. The above labels
  4551. are triggered in the NPC whose master_nd is given in the shop.
  4552. A full example of a dynamic shop can be found in doc/sample/npc_dynamic_shop.txt.
  4553. ---------------------------------------
  4554. *npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  4555. This command lets you override the contents of an existing NPC shop or cashshop. The
  4556. current sell list will be wiped, and only the items specified with the price
  4557. specified will be for sale.
  4558. The function returns 1 if shop was updated successfully, or 0 if not found.
  4559. Note that you cannot use -1 to specify default selling price!
  4560. ---------------------------------------
  4561. *npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  4562. This command will add more items at the end of the selling list for the
  4563. specified NPC shop or cashshop. If you specify an item already for sell, that item will
  4564. appear twice on the sell list.
  4565. The function returns 1 if shop was updated successfully, or 0 if not found.
  4566. Note that you cannot use -1 to specify default selling price!
  4567. ---------------------------------------
  4568. *npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}};
  4569. This command will remove items from the specified NPC shop or cashshop.
  4570. If the item to remove exists more than once on the shop, all instances will be
  4571. removed.
  4572. Note that the function returns 1 even if no items were removed. The return
  4573. value is only to confirm that the shop was indeed found.
  4574. ---------------------------------------
  4575. *npcshopattach "<name>"{,<flag>};
  4576. This command will attach the current script to the given NPC shop.
  4577. When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem"
  4578. of your script will be executed whenever a player buys/sells from the shop.
  4579. Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[]
  4580. and @sold_quantity[] will be filled up with the items and quantities
  4581. bought/sold.
  4582. The optional parameter specifies whether to attach ("1") or detach ("0") from
  4583. the shop (the default is to attach). Note that detaching will detach any NPC
  4584. attached to the shop, even if it's from another script, while attaching will
  4585. override any other script that may be already attached.
  4586. The function returns 0 if the shop was not found, 1 otherwise.
  4587. ---------------------------------------
  4588. *waitingroom "<chatroom name>",<limit>{,"<event label>"{,<trigger>{,<required zeny>{,<min lvl>{,<max lvl>}}}}};
  4589. This command will create a chat room, owned by the NPC object running this
  4590. script and displayed above the NPC sprite.
  4591. The maximum length of a chat room name is 60 letters.
  4592. The limit is the maximum number of people allowed to enter the chat room.
  4593. The attached NPC is included in this count. If the optional event and trigger
  4594. parameters are given, the event label ("<NPC object name>::<label name>")
  4595. will be invoked as if with a 'doevent' upon the number of people in the chat
  4596. room reaching the given triggering amount.
  4597. // The NPC will just show a box above its head that says "Hello World", clicking
  4598. // it will do nothing, since the limit is zero.
  4599. waitingroom "Hello World",0;
  4600. // The NPC will have a box above its head, it will say "Disco - Waiting Room"
  4601. // and will have 8 waiting slots. Clicking this will enter the chat room, where
  4602. // the player will be able to wait until 7 players accumulate. Once this happens,
  4603. // it will cause the NPC "Bouncer" run the label "OnStart".
  4604. waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",7;
  4605. // The NPC will have a box above its head, it will say "Party - Waiting Room"
  4606. // and will have 8 waiting slots. Clicking this will allow a player who has
  4607. // 5000 zeny and lvl 50~99 to enter the chat room, where the player will be
  4608. // able to wait until 7 players accumulate. Once this happens, it will cause
  4609. // the NPC "Bouncer" run the label "OnStart".
  4610. waitingroom "Party - Waiting Room",8,"Bouncer::OnStart",7,5000,50,99;
  4611. Creating a waiting room does not stop the execution of the script and it will
  4612. continue to the next line.
  4613. For more examples see the 2-1 and 2-2 job quest scripts which make extensive use
  4614. of waiting rooms.
  4615. ---------------------------------------
  4616. *delwaitingroom {"<NPC object name"};
  4617. This command will delete a waiting room. If no parameter is given, it will
  4618. delete a waiting room attached to the NPC object running this command, if it is,
  4619. it will delete a waiting room owned by another NPC object. This is the only way
  4620. to get rid of a waiting room, nothing else will cause it to disappear.
  4621. It's not clear what happens to a waiting room if the NPC is disabled with
  4622. 'disablenpc', by the way.
  4623. ---------------------------------------
  4624. *enablewaitingroomevent {"<NPC object name>"};
  4625. *disablewaitingroomevent {"<NPC object name>"};
  4626. *enablearena;
  4627. *disablearena;
  4628. This will enable and disable triggering the waiting room event (see
  4629. 'waitingroom') respectively. Optionally giving an NPC object name will do that
  4630. for a specified NPC object. The chat room will not disappear when triggering is
  4631. disabled and enabled in this manner and players will not be kicked out of it.
  4632. Enabling a chat room event will also cause it to immediately check whether the
  4633. number of users in it exceeded the trigger amount and trigger the event
  4634. accordingly.
  4635. Normally, whenever a waiting room was created to make sure that only one
  4636. character is, for example, trying to pass a job quest trial, and no other
  4637. characters are present in the room to mess up the script.
  4638. The 'enablearena'/'disablearena' commands are just aliases with no parameter.
  4639. These are supposedly left here for compatibility with official server scripts,
  4640. but no rAthena script uses these at the moment.
  4641. ---------------------------------------
  4642. *getwaitingroomstate(<information type>{,"<NPC object name>"})
  4643. This function will return information about the waiting room state for the
  4644. attached waiting room or for a waiting room attached to the specified NPC if
  4645. any.
  4646. The valid information types are:
  4647. 0 - Number of users currently chatting.
  4648. 1 - Maximum number of users allowed.
  4649. 2 - Will return 1 if the waiting room has a trigger set.
  4650. 0 otherwise.
  4651. 3 - Will return 1 if the waiting room is currently disabled.
  4652. 0 otherwise.
  4653. 4 - The Title of the waiting room (string)
  4654. 5 - Password of the waiting room, if any. Pointless, since there is no way to
  4655. set a password on a waiting room right now.
  4656. 16 - Event name of the waiting room (string)
  4657. 32 - Whether or not the waiting room is full.
  4658. 33 - Whether the amount of users in the waiting room is higher than the trigger
  4659. number.
  4660. ---------------------------------------
  4661. *warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
  4662. This command will warp the amount of characters equal to the trigger number of
  4663. the waiting room chat attached to the NPC object running this command to the
  4664. specified map and coordinates, kicking them out of the chat. Those waiting the
  4665. longest will get warped first. It can also do a random warp on the same map
  4666. ("Random" instead of map name) and warp to the save point ("SavePoint").
  4667. The list of characters to warp is taken from the list of the chat room members.
  4668. Those not in the chat room will not be considered even if they are talking to
  4669. the NPC in question. If the number of people is given, exactly this much people
  4670. will be warped.
  4671. This command can also keep track of who just got warped. It does this by setting
  4672. special variables:
  4673. $@warpwaitingpc[] is an array containing the account_id numbers of the
  4674. characters who were just warped.
  4675. $@warpwaitingpcnum contains the number of the character it just warped.
  4676. See also 'getpartymember' for advice on what to do with those variables.
  4677. The obvious way of using this effectively would be to set up a waiting room for
  4678. two characters to be warped onto a random PVP map for a one-on-one duel, for
  4679. example.
  4680. ---------------------------------------
  4681. *kickwaitingroomall {"<NPC object name>"};
  4682. This command kicks everybody out of a specified waiting room chat.
  4683. ---------------------------------------
  4684. *setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
  4685. This command sets the 'nosave' flag for the specified map and also gives an
  4686. alternate respawn-upon-relogin point.
  4687. It does not make a map impossible to make a save point on as you would normally
  4688. think, 'savepoint' will still work. It will, however, make the specified map
  4689. kick the reconnecting players off to the alternate map given to the coordinates
  4690. specified.
  4691. ---------------------------------------
  4692. *setmapflag "<map name>",<flag>{,<zone>{,<type>}};
  4693. This command marks a specified map with the given map flag, which will alter the
  4694. behavior of the map. A full list of mapflags is located in 'db/const.txt' with
  4695. the 'mf_' prefix, and documentation can be found in 'doc/mapflags.txt'.
  4696. The map flags alter the behavior of the map regarding teleporting (mf_nomemo,
  4697. mf_noteleport, mf_nowarp, mf_nogo), storing location when disconnected
  4698. (mf_nosave), dead branch usage (mf_nobranch), penalties upon death
  4699. (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty,
  4700. mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use
  4701. skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall),
  4702. current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds,
  4703. mf_fireworks) and whether night will be in effect on this map (mf_nightenabled).
  4704. The optional parameter 'zone' is used to set the zone for restricted mapflags.
  4705. For the 'skill_damage' mapflag, 'zone' functions as 'value' (-100 to 100000) and
  4706. 'type' can be:
  4707. 1: damage against players
  4708. 2: damage against mobs
  4709. 3: damage against bosses
  4710. 4: damage against other
  4711. 5: caster type
  4712. ---------------------------------------
  4713. *removemapflag "<map name>",<flag>{,<zone>};
  4714. This command removes a mapflag from a specified map.
  4715. See 'setmapflag' for a list of mapflags.
  4716. The optional parameter 'zone' is used to remove the zone from restricted mapflags.
  4717. ---------------------------------------
  4718. *getmapflag("<map name>",<flag>{,<type>})
  4719. This command checks the status of a given mapflag and returns the mapflag's state.
  4720. 0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.
  4721. The optional parameter 'type' is used in the 'skill_damage' mapflag:
  4722. 0: if mapflag is set (default)
  4723. 1: damage against players
  4724. 2: damage against mobs
  4725. 3: damage against bosses
  4726. 4: damage against other
  4727. 5: caster type
  4728. ---------------------------------------
  4729. *setbattleflag "<battle flag>",<value>;
  4730. *getbattleflag("<battle flag>")
  4731. Sets or gets the value of the given battle flag.
  4732. Battle flags are the flags found in the battle/*.conf files and is also used in Lupus' variable rates script.
  4733. Examples:
  4734. // Will set the base experience rate to 20x (2000%)
  4735. setBattleFlag "base_exp_rate",2000;
  4736. // Will return the value of the base experience rate (when used after the above example, it would print 2000).
  4737. mes getBattleFlag("base_exp_rate");
  4738. ---------------------------------------
  4739. *warpportal <source x>,<source y>,"<map name>",<target x>,<target y>;
  4740. Creates a warp portal identical to the Acolyte "Warp Portal" skill.
  4741. The source coordinates specify the portal's location on the map of the invoking NPC.
  4742. The target map and coordinates determine the destination of the portal.
  4743. Examples:
  4744. // Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180.
  4745. warpportal 150,150,"prontera",150,180;
  4746. ---------------------------------------
  4747. *mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
  4748. This command will collect all characters located on the From map and warp them
  4749. wholesale to the same point on the To map, or randomly distribute them there if
  4750. the coordinates are zero. "Random" is understood as a special To map name and
  4751. will mean randomly shuffling everyone on the same map.
  4752. Optionally, a type and ID can be specified. Available types are:
  4753. 0 - Everyone
  4754. 1 - Guild
  4755. 2 - Party
  4756. Example:
  4757. // Will warp all members of guild with ID 63 on map prontera to map alberta.
  4758. mapwarp "prontera","alberta",150,150,1,63;
  4759. ---------------------------------------
  4760. \\
  4761. 5,2.- Guild-related commands
  4762. \\
  4763. ---------------------------------------
  4764. *maprespawnguildid "<map name>",<guild id>,<flag>;
  4765. This command goes through the specified map and for each player and monster
  4766. found there does stuff.
  4767. Flag is a bit-mask (add up numbers to get effects you want)
  4768. 1 - warp all guild members to their save points.
  4769. 2 - warp all non-guild members (including guildless players) to their save points.
  4770. 4 - remove all monsters which are not guardian or Emperium.
  4771. Flag 7 will, therefore, mean 'wipe all mobs but guardians and the Emperium and
  4772. kick all characters out', which is what the official scripts do upon castle
  4773. surrender. Upon start of WoE, the scripts do 2 (warp all intruders out).
  4774. For examples, check the WoE scripts in the distribution.
  4775. ---------------------------------------
  4776. *agitstart;
  4777. *agitend;
  4778. *agitstart2;
  4779. *agitend2;
  4780. These four commands will start and end War of Emperium or War of Emperium SE.
  4781. This is a bit more complex than it sounds, since the commands themselves won't
  4782. actually do anything interesting, except causing all 'OnAgitStart:' and
  4783. 'OnAgitEnd:', or 'OnAgitStart2:' and 'OnAgitEnd2:' in the case of latter two
  4784. commands, events to run everywhere, respectively. They are used as simple
  4785. triggers to run a lot of complex scripts all across the server, and they,
  4786. in turn, are triggered by clock with an 'OnClock<time>:' time-triggering label.
  4787. ---------------------------------------
  4788. *gvgon "<map name>";
  4789. *gvgoff "<map name>";
  4790. These commands will turn GVG mode for the specified maps on and off, setting up
  4791. appropriate map flags. In GVG mode, maps behave as if during the time of WoE,
  4792. even though WoE itself may or may not actually be in effect.
  4793. ---------------------------------------
  4794. *flagemblem <guild id>;
  4795. This command only works when run by the NPC objects which have sprite id 722,
  4796. which is a 3D guild flag sprite. If it isn't, the data will change, but nothing
  4797. will be seen by anyone. If it is invoked in that manner, the emblem of the
  4798. specified guild will appear on the flag, though, if any players are watching it
  4799. at this moment, they will not see the emblem change until they move out of sight
  4800. of the flag and return.
  4801. This is commonly used in official guildwar scripts with a function call which
  4802. returns a guild id:
  4803. // This will change the emblem on the flag to that of the guild that owns
  4804. // "guildcastle"
  4805. flagemblem GetCastleData("guildcastle",1);
  4806. ---------------------------------------
  4807. *guardian "<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"{,<guardian index>}};
  4808. This command is roughly equivalent to 'monster', but is meant to be used with
  4809. castle guardian monsters and will only work with them. It will set the guardian
  4810. characteristics up according to the castle's investment values and otherwise
  4811. set the things up that only castle guardians need.
  4812. Since trunk r12524:
  4813. Returns the id of the mob or 0 if an error occurred.
  4814. When 'guardian index' isn't supplied it produces a temporary guardian.
  4815. Temporary guardians are not saved with the castle and can't be accessed by guardianinfo.
  4816. ---------------------------------------
  4817. *guardianinfo("<map name>", <guardian number>, <type>);
  4818. This function will return various info about the specified guardian, or -1
  4819. if it fails for some reason. It is primarily used in the castle manager NPC.
  4820. Map name and guardian number (value between 0 and 7) define the target.
  4821. Type indicates what information to return:
  4822. 0 - visibility (whether the guardian is installed or not)
  4823. 1 - max. hp
  4824. 2 - current hp
  4825. ---------------------------------------
  4826. //
  4827. 5,2.- End of guild-related commands
  4828. //
  4829. ---------------------------------------
  4830. *npcspeed <speed value>;
  4831. *npcwalkto <x>,<y>;
  4832. *npcstop;
  4833. These commands will make the NPC object in question move around the map. As they
  4834. currently are, they are a bit buggy and are not useful for much more than making
  4835. an NPC move randomly around the map.
  4836. 'npcspeed' will set the NPCs walking speed to a specified value. As in the
  4837. @speed GM command, 200 is the slowest possible speed while 0 is the fastest
  4838. possible (instant motion). 100 is the default character walking speed.
  4839. 'npcwalkto' will start the NPC sprite moving towards the specified coordinates
  4840. on the same map it is currently on. The script proceeds immediately after the
  4841. NPC begins moving.
  4842. 'npcstop' will stop the motion.
  4843. While in transit, the NPC will be clickable, but invoking it will cause it to
  4844. stop moving, which will make its coordinates different from what the client
  4845. computed based on the speed and motion coordinates. The effect is rather
  4846. unnerving.
  4847. Only a few NPC sprites have walking animations, and those that do, do not get
  4848. the animation invoked when moving the NPC, due to the problem in the NPC walking
  4849. code, which looks a bit silly. You might have better success by defining a job-
  4850. sprite based sprite id in 'db/mob_avail.txt' with this.
  4851. ---------------------------------------
  4852. *movenpc "<NPC name>",<x>,<y>{,<dir>};
  4853. This command looks like the NPCWalkToxy function,but is a little different.
  4854. While NPCWalkToXY just makes the NPC 'walk' to the coordinates given (which
  4855. sometimes gives problems if the path isn't a straight line without objects),
  4856. this command just moves the NPC. It basically warps out and in on the current
  4857. and given spot. Direction can be used to change the NPC's facing direction.
  4858. Example:
  4859. // This will move Bugga from to the coordinates 100,20 (if those coordinates are legit).
  4860. moveNPC "Bugga",100,20;
  4861. ---------------------------------------
  4862. =====================
  4863. |6.- Other commands.|
  4864. =====================
  4865. ---------------------------------------
  4866. *debugmes "<message>";
  4867. This command will send the message to the server console (map-server window). It
  4868. will not be displayed anywhere else.
  4869. // Displays "NAME has clicked me!" in the map-server window.
  4870. debugmes strcharinfo(0)+" has clicked me!";
  4871. ---------------------------------------
  4872. *logmes "<message>";
  4873. This command will write the message given to the map server NPC log file, as
  4874. specified in 'conf/log_athena.conf'. In the TXT version of the server, the log
  4875. file is 'log/npclog.log' by default. In the SQL version, if SQL logging is
  4876. enabled, the message will go to the 'npclog' table, otherwise, it will go to the
  4877. same log file.
  4878. If logs are not enabled, nothing will happen.
  4879. ---------------------------------------
  4880. *globalmes "<message>"{,"<NPC name>"};
  4881. This command will send a message to the chat window of all currently connected
  4882. characters.
  4883. If NPC name is specified, the message will be sent as if the sender would be
  4884. the NPC with the said name.
  4885. ---------------------------------------
  4886. *rand(<number>{,<number>});
  4887. This function returns a number ...
  4888. (if you specify one) ... randomly positioned between 0 and the number you specify -1.
  4889. (if you specify two) ... randomly positioned between the two numbers you specify.
  4890. rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9
  4891. rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
  4892. rand(2,5) would result in 2,3,4 or 5
  4893. ---------------------------------------
  4894. *viewpoint <action>,<x>,<y>,<point number>,<color>;
  4895. This command will mark places on the mini map in the client connected to the
  4896. invoking character. It uses the normal X and Y coordinates from the main map.
  4897. The colors of the marks are defined using a hexadecimal number, same as the ones
  4898. used to color text in 'mes' output, but are written as hexadecimal numbers in C.
  4899. (They look like 0x<six numbers>.)
  4900. Action is what you want to do with a point, 1 will set it, while 2 will clear
  4901. it. 0 will also set it, but automatically removes the point after 15 seconds.
  4902. Point number is the number of the point - you can have several. If more than
  4903. one point is drawn at the same coordinates, they will cycle, which can be used
  4904. to create flashing marks.
  4905. // This command will show a mark at coordinates X 30 Y 40, is mark number 1,
  4906. // and will be red.
  4907. viewpoint 1,30,40,1,0xFF0000;
  4908. This will create three points:
  4909. viewpoint 1,30,40,1,0xFF0000;
  4910. viewpoint 1,35,45,2,0xFF0000;
  4911. viewpoint 1,40,50,3,0xFF0000;
  4912. And this is how you remove them:
  4913. viewpoint 2,30,40,1,0xFF0000;
  4914. viewpoint 2,35,45,2,0xFF0000;
  4915. viewpoint 2,40,50,3,0xFF0000;
  4916. The client determines what it does with the points entirely, the server keeps no
  4917. memory of where the points are set whatsoever.
  4918. ---------------------------------------
  4919. *cutin "<filename>",<position>;
  4920. This command will display a picture, usually an NPC illustration, also called
  4921. cutin, for the currently attached client. The position parameter determines the
  4922. placement of the illustration and takes following values:
  4923. 0 - bottom left corner
  4924. 1 - bottom middle
  4925. 2 - bottom right corner
  4926. 3 - middle of screen in a movable window with an empty title bar
  4927. 4 - middle of screen without the window header, but still movable
  4928. The picture is read from data\texture\유저인터페이스\illust, from both the GRF archive
  4929. and data folder, and is required to be a bitmap. The file extension .bmp can be
  4930. omitted. Magenta color (#ff00ff) is considered transparent. There is no limit
  4931. placed on the size of the illustrations by the client, although loading of large
  4932. pictures (about 700x700 and larger) causes the client to freeze shortly (lag).
  4933. Typically the size is about 320x480. New illustrations can be added by just
  4934. putting the new file into the location above.
  4935. The client is able to display only one cutin at the same time and each new one
  4936. will cause the old one to disappear. To delete the currently displayed
  4937. illustration without displaying a new one, an empty file name and position 255
  4938. must be used.
  4939. // Displays the Comodo Kafra illustration in lower right corner.
  4940. cutin "kafra_07",2;
  4941. // Typical way to end a script, which displayed an illustration during a
  4942. // dialog with a player.
  4943. mes "See you.";
  4944. close2;
  4945. cutin "",255;
  4946. end;
  4947. ---------------------------------------
  4948. *emotion <emotion number>{,<target>{,"<target name>"}};
  4949. This command makes an object display an emotion sprite above their own as
  4950. if they were doing that emotion. For a full list of emotion numbers,
  4951. see 'db/const.txt' under 'e_'. The not so obvious ones are 'e_what' (a question mark)
  4952. and 'e_gasp' (the exclamation mark).
  4953. The optional target parameter specifies who will get the emotion on top of
  4954. their head. If 0 (the default if omitted), the NPC in current use will show
  4955. the emotion, if 1, the player that is running the script will display it.
  4956. Target name parameter allows to display emotion on top of other NPC/PC without
  4957. event labels. If specified name is not found, command does nothing.
  4958. ---------------------------------------
  4959. *misceffect <effect number>;
  4960. This command, if run from an NPC object that has a sprite, will call up a
  4961. specified effect number, centered on the NPC sprite. If the running code does
  4962. not have an object ID (a 'floating' NPC) or is not running from an NPC object at
  4963. all (an item script) the effect will be centered on the character who's RID got
  4964. attached to the script, if any. For usable item scripts, this command will
  4965. create an effect centered on the player using the item.
  4966. A full list of known effects is found in 'doc/effect_list.txt'. The list of
  4967. those that actually work may differ greatly between client versions.
  4968. ---------------------------------------
  4969. *soundeffect "<effect filename>",<type>;
  4970. *soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
  4971. These two commands will play a sound effect to either the invoking character
  4972. only ('soundeffect') or multiple characters ('soundeffectall'). If the running
  4973. code does not have an object ID (a 'floating' NPC) or is not running from an NPC
  4974. object at all (an item script) the sound will be centered on the character who's
  4975. RID got attached to the script, if any. If it does, it will be centered on that
  4976. object. (an NPC sprite)
  4977. Effect filename is the filename in a GRF. It must have the .wav extension.
  4978. It's not quite certain what the 'type' actually does, it is sent to the client
  4979. directly. It probably determines which directory to play the effect from.
  4980. It's certain that giving 0 for the number will play sound files from '\data\wav\',
  4981. but where the other numbers will read from is unclear.
  4982. The sound files themselves must be in the PCM format, and file names should also
  4983. have a maximum length of 23 characters including the .wav extension:
  4984. soundeffect "1234567890123456789.wav", 0; // this will play the soundeffect
  4985. soundeffect "12345678901234567890.wav", 0; // throw gravity error
  4986. You can add your own effects this way, naturally.
  4987. ---------------------------------------
  4988. *playBGM "<BGM filename>";
  4989. *playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
  4990. These two commands will play a Background Music to either the invoking character
  4991. only ('playBGM') or multiple characters ('playBGMall').
  4992. BGM filename is the filename in /BGM/ folder. It has to be in .mp3 extension.
  4993. It's not required to specify the extension inside the script.
  4994. If coordinates are omitted, BGM will be broadcasted on the entire map. If the map name
  4995. is omitted as well the BGM will be played for the entire server.
  4996. You can add your own BGMs this way, naturally.
  4997. ---------------------------------------
  4998. *pvpon "<map name>";
  4999. *pvpoff "<map name>";
  5000. These commands will turn PVP mode for the specified maps on and off. Beside
  5001. setting the flags referred to in 'setmapflag', 'pvpon' will also create a PVP
  5002. timer and ranking as will @pvpon GM command do.
  5003. ---------------------------------------
  5004. *atcommand "<command>";
  5005. This command will run the given command line exactly as if it was typed in from
  5006. the keyboard by the player connected to the invoking character, and that
  5007. character belonged to an account which had GM level 99.
  5008. // This will ask the invoker for a character name and then use the '@nuke'
  5009. // GM command on them, killing them mercilessly.
  5010. input @player$;
  5011. atcommand "@nuke "+@player$;
  5012. Note that for atcommands bound using 'bindatcmd', this command will execute the
  5013. original atcommand, not the script-bound atcommand.
  5014. ---------------------------------------
  5015. *charcommand "<command>";
  5016. This command will run the given command line exactly as if it was typed in from
  5017. the keyboard from a character that belonged to an account which had GM level 99.
  5018. The commands can also run without an attached rid.
  5019. // This would do the same as above, but now
  5020. // it doesn't need a player attached by default.
  5021. charcommand "#option 0 0 0 Roy";
  5022. ---------------------------------------
  5023. *bindatcmd "<command>","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};
  5024. This command will bind a NPC event label to an atcommand. Upon execution of the
  5025. atcommand, the user will invoke the NPC event label. Each atcommand is only allowed
  5026. one binding. If you rebind, it will override the original binding.
  5027. The following variables are set upon execution:
  5028. .@atcmd_command$ = The name of the @command used.
  5029. .@atcmd_parameters$[] = Array containing the given parameters, starting from an index of 0.
  5030. .@atcmd_numparameters = The number of parameters defined.
  5031. Example:
  5032. When a user types the command "@test", an angel effect will be shown.
  5033. - script atcmd_example -1,{
  5034. OnInit:
  5035. bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
  5036. end;
  5037. OnAtcommand:
  5038. specialeffect2 338;
  5039. end;
  5040. }
  5041. ---------------------------------------
  5042. *unbindatcmd "<command>";
  5043. This command will unbind a NPC event label from an atcommand.
  5044. ---------------------------------------
  5045. *useatcmd "<command>";
  5046. This command will execute a script-bound atcommand for the attached RID. If the
  5047. supplied command is not bound to any script, this command will act like 'atcommand'
  5048. and attempt to execute a source-defined command.
  5049. The three .@atcmd_***** variables will NOT be set when invoking script-bound atcommands
  5050. in this way.
  5051. ---------------------------------------
  5052. \\
  5053. 6,1.- Unit-related commands
  5054. \\
  5055. ---------------------------------------
  5056. *unitwalk <GID>,<x>,<y>;
  5057. *unitwalk <GID>,<Target ID>;
  5058. This command will tell a <GID> to walk to a position, defined either as a set of
  5059. coordinates or another object. The command returns a 1 for success and 0 upon failure.
  5060. If coordinates are passed, the <GID> will walk to the given x,y coordinates on the
  5061. unit's current map. While there is no way to move across an entire map with 1 command
  5062. use, this could be used in a loop to move long distances.
  5063. If an object ID is passed, the initial <GID> will walk to the <Target ID> (similar to
  5064. walking to attack). This is based on the distance from <GID> to <Target ID>. This command
  5065. uses a hard walk check, so it will calculate a walk path with obstacles. Sending a bad
  5066. target ID will result in an error.
  5067. Examples:
  5068. // Makes player walk to the coordinates (150,150).
  5069. unitwalk getcharid(3),150,150;
  5070. // Performs a conditional check with the command and reports success or failure to the player.
  5071. if(unitwalk(getcharid(3),150,150))
  5072. dispbottom "Walking you there...";
  5073. else
  5074. dispbottom "That's too far away, man.";
  5075. // Makes player walk to another character named "WalkToMe".
  5076. unitwalk getcharid(3),getcharid(3,"WalkToMe");
  5077. ---------------------------------------
  5078. *unitattack <GID>,<Target ID>{,<action type>};
  5079. *unitattack <GID>,"<Target Name>"{,<action type>};
  5080. This command will make a <GID> attack the specified target. It returns 1 upon
  5081. success and 0 for all failures.
  5082. If <GID> is a player and a non-zero <action type> is given, the unit will perform a
  5083. continuous attack instead of a single attack.
  5084. ---------------------------------------
  5085. *unitkill <GID>;
  5086. This command will kill a <GID>.
  5087. ---------------------------------------
  5088. *unitwarp <GID>,"<map name>",<x>,<y>;
  5089. This command will warp a <GID> to the specified map and coordinates.
  5090. If <GID> is zero, the command runs for the unit that invoked the script. This can be
  5091. used with "OnTouch" to warp monsters:
  5092. OnTouch:
  5093. unitwarp 0,"this",-1,-1;
  5094. ---------------------------------------
  5095. *unitstop <GID>;
  5096. This command will make a <GID> stop attacking and moving.
  5097. ---------------------------------------
  5098. *unittalk <GID>,"<text>";
  5099. This command will make a <GID> say a message.
  5100. ---------------------------------------
  5101. *unitemote <GID>,<emotion number>;
  5102. This command will make a <GID> display an emotion sprite.
  5103. For a full list of emotion numbers, see 'db/const.txt' under 'e_'.
  5104. ---------------------------------------
  5105. *unitskilluseid <GID>,<skill id>,<skill lvl>{,<target id>};
  5106. *unitskilluseid <GID>,"<skill name>",<skill lvl>{,<target id>};
  5107. *unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>;
  5108. *unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>;
  5109. This is the replacement of the older commands, these use the same values for
  5110. GID as the other unit* commands (See 'GID').
  5111. Skill ID is the ID of the skill, skill level is the level of the skill.
  5112. For the position, the x and y are given in the unitSkillUsePos.
  5113. ---------------------------------------
  5114. \\
  5115. 6,1.- End of unit-related commands
  5116. \\
  5117. ---------------------------------------
  5118. *npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;
  5119. *npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;
  5120. This command causes the attached NPC object to cast a skill on the attached
  5121. player. The skill will have no cast time or cooldown. The player must be
  5122. within the default skill range or the command will fail silently.
  5123. The "stat point" parameter temporarily sets all NPC stats to the given value,
  5124. and "NPC level" is the temporary level of the NPC (used in some skills).
  5125. Neither value can be greater than the max level defined in config, and will
  5126. not work properly if the NPC has a mob sprite.
  5127. // Casts Level 10 Heal on the attached player, calculated with
  5128. // all stats 99 and base level 60.
  5129. npcskill "AL_HEAL",10,99,60;
  5130. ---------------------------------------
  5131. *day;
  5132. *night;
  5133. These two commands will switch the entire server between day and night mode
  5134. respectively. If your server is set to cycle between day and night by
  5135. configuration, it will eventually return to that cycle.
  5136. Example:
  5137. - script DayNight -1,{
  5138. OnClock0600:
  5139. day;
  5140. end;
  5141. OnInit:
  5142. // setting correct mode upon server start-up
  5143. if(gettime(3)>=6 && gettime(3)<18) end;
  5144. OnClock1800:
  5145. night;
  5146. end;
  5147. }
  5148. This script allows to emulate the day/night cycle as the server does, but also
  5149. allows triggering additional effects upon change, like announces, gifts, etc.
  5150. The day/night cycle set by configuration should be disabled when this script is used.
  5151. ---------------------------------------
  5152. *defpattern <set number>,"<regular expression pattern>","<event label>";
  5153. *activatepset <set number>;
  5154. *deactivatepset <set number>;
  5155. *deletepset <set number>;
  5156. This set of commands is only available if the server is compiled with regular
  5157. expressions library enabled. Default compilation and most binary distributions
  5158. aren't, which is probably bad, since these, while complex to use, are quite
  5159. fascinating.
  5160. They will make the NPC object listen for text spoken publicly by players and
  5161. match it against regular expression patterns, then trigger labels associated
  5162. with these regular expression patterns.
  5163. Patterns are organized into sets, which are referred to by a set number. You can
  5164. have multiple sets patterns, and multiple patterns may be active at once.
  5165. Numbers for pattern sets start at 1.
  5166. 'defpattern' will associate a given regular expression pattern with an event
  5167. label. This event will be triggered whenever something a player says is matched
  5168. by this regular expression pattern, if the pattern is currently active.
  5169. 'activatepset' will make the pattern set specified active. An active pattern
  5170. will enable triggering labels defined with 'defpattern', which will not happen
  5171. by default.
  5172. 'deactivatepset' will deactivate a specified pattern set. Giving -1 as a pattern
  5173. set number in this case will deactivate all pattern sets defined.
  5174. 'deletepset' will delete a pattern set from memory, so you can create a new
  5175. pattern set in its place.
  5176. Using regular expressions is high wizardry. But with this high wizardry comes
  5177. unparalleled power of text manipulation. For an explanation of what a regular
  5178. expression pattern is, see a few web pages:
  5179. http://www.regular-expressions.info/
  5180. http://www.weitz.de/regex-coach/
  5181. For an example of this in use, see doc/sample/npc_test_pcre.txt
  5182. With this you could, for example, automatically punish players for asking for
  5183. Zeny in public places, or alternatively, automatically give them Zeny instead if
  5184. they want it so much.
  5185. ---------------------------------------
  5186. *pow(<number>,<power>)
  5187. Returns the result of the calculation.
  5188. Example:
  5189. .@i = pow(2,3); // .@i will be 8
  5190. ---------------------------------------
  5191. *sqrt(<number>)
  5192. Returns the square-root of a number.
  5193. Example:
  5194. .@i = sqrt(25); // .@i will be 5
  5195. ---------------------------------------
  5196. *distance(<x0>,<y0>,<x1>,<y1>)
  5197. Returns distance between 2 points.
  5198. Example:
  5199. .@i = distance(100,200,101,202);
  5200. ---------------------------------------
  5201. *md5("<string>")
  5202. Returns the md5 checksum of a number or string.
  5203. Example:
  5204. mes md5(12345);
  5205. mes md5("12345"); // Will both display 827ccb0eea8a706c4c34a16891f84e7b
  5206. mes md5("qwerty"); // Will display d8578edf8458ce06fbc5bb76a58c5ca4
  5207. ---------------------------------------
  5208. *query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  5209. *query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  5210. Executes an SQL query. A 'select' query can fill array variables with up to 128 rows of values,
  5211. and will return the number of rows (i.e. array size) or -1 on failure/empty array.
  5212. Note that 'query_sql' runs on the main database while 'query_logsql' runs on the log database.
  5213. Example:
  5214. .@nb = query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
  5215. mes "Hall Of Fame: TOP5";
  5216. mes "1."+.@name$[0]+"("+.@fame[0]+")"; // largest fame value.
  5217. mes "2."+.@name$[1]+"("+.@fame[1]+")";
  5218. mes "3."+.@name$[2]+"("+.@fame[2]+")";
  5219. mes "4."+.@name$[3]+"("+.@fame[3]+")";
  5220. mes "5."+.@name$[4]+"("+.@fame[4]+")";
  5221. ---------------------------------------
  5222. *escape_sql(<value>)
  5223. Converts the value to a string and escapes special characters so that it is safe to
  5224. use in query_sql(). Returns the escaped form of the given value.
  5225. Example:
  5226. .@name$ = "John's Laptop";
  5227. .@esc_str$ = escape_sql(.@name$); // Escaped string: John\'s Laptop
  5228. ---------------------------------------
  5229. *setiteminfo(<item id>,<type>,<value>)
  5230. This function will set some value of an item.
  5231. Returns the new value on success, or -1 on fail (item_id not found or invalid type).
  5232. Valid types are:
  5233. 0 - Buy Price; 1 - Sell Price; 2 - Item Type;
  5234. 3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc..
  5235. if = 0, then monsters don't drop it at all (rare or a quest item)
  5236. if = 10000, then this item is sold in NPC shops only
  5237. 4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
  5238. 10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id
  5239. Example:
  5240. setiteminfo 7049,6,9990; // Stone now weighs 999.0
  5241. ---------------------------------------
  5242. *setitemscript(<item id>,<"{ new item script }">{,<type>});
  5243. Set a new script bonus to the Item. Very useful for game events.
  5244. You can remove an item's itemscript by leaving the itemscript argument empty.
  5245. Returns 1 on success, or 0 on fail (item_id not found or new item script is invalid).
  5246. Type can optionally be used indicates which script to set (default is 0):
  5247. 0 - Script
  5248. 1 - OnEquip_Script
  5249. 2 - OnUnequip_Script
  5250. Example:
  5251. setitemscript 2637,"{ if(isequipped(2236)==0)end; if(getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
  5252. setitemscript 2637,"";
  5253. ---------------------------------------
  5254. *atoi("<string>")
  5255. *axtoi("<string>")
  5256. *strtol("<string>", base)
  5257. These commands are used to convert strings to numbers. 'atoi' will interpret
  5258. given string as a decimal number (base 10), while 'axtoi' interprets strings as
  5259. hexadecimal numbers (base 16). 'strtol' lets the user specify a base (valid range
  5260. is between 2 and 36 inclusive, or the special value0, which means auto-detection).
  5261. The 'atoi' and 'strtol' functions conform to the C functions with the same names,
  5262. and 'axtoi' is the same as strtol, with a base of 16. Results are clamped to signed
  5263. 32 bit int range (INT_MIN ~ INT_MAX).
  5264. Examples:
  5265. .@var = atoi("11"); // Sets .@var to 11
  5266. .@var = axtoi("FF"); // Sets .@var to 255
  5267. mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16)
  5268. .@var = strtol("11", 10); // Sets .@var to 11 (11 base 10)
  5269. .@var = strtol("11", 16); // Sets .@var to 17 (11 base 16)
  5270. .@var = strtol("11", 0); // Sets .@var to 11 (11 base 10, auto-detected)
  5271. .@var = strtol("0x11", 0); // Sets .@var to 17 (11 base 16, auto-detected because of the "0x" prefix)
  5272. .@var = strtol("011", 0); // Sets .@var to 9 (11 base 8, auto-detected because of the "0" prefix)
  5273. .@var = strtol("11", 2); // Sets .@var to 3 (binary 11)
  5274. ---------------------------------------
  5275. *compare("<string>","<substring>")
  5276. This command returns 1 or 0 when the substring is in the main string (1) or not (0).
  5277. This command is not case sensitive.
  5278. Examples:
  5279. //dothis; will be executed ('Bloody Murderer' contains 'Blood').
  5280. if (compare("Bloody Murderer","Blood"))
  5281. dothis;
  5282. //dothat; will not be executed ('Blood butterfly' does not contain 'Bloody').
  5283. if (compare("Blood Butterfly","Bloody"))
  5284. dothat;
  5285. ---------------------------------------
  5286. *strcmp("<string>","<string>")
  5287. This command compares two strings are returns a value:
  5288. 1: string 1 > string 2
  5289. 0: strings are equal
  5290. -1: string 1 < string 2
  5291. ---------------------------------------
  5292. *getstrlen("<string>")
  5293. This function will return the length of the string given as an argument. It is
  5294. useful to check if anything input by the player exceeds name length limits and
  5295. other length limits and asking them to try to input something else.
  5296. ---------------------------------------
  5297. *charisalpha("<string>",<position>)
  5298. This function will return 1 if the character number Position in the given string
  5299. is a letter, 0 if it isn't a letter but a digit or a space.
  5300. The first letter is position 0.
  5301. ---------------------------------------
  5302. *charat(<string>,<index>)
  5303. Returns char at specified index. If index is out of range, returns empty string.
  5304. The first letter of a string is index 0.
  5305. Example:
  5306. charat("This is a string", 10); //returns "s"
  5307. ---------------------------------------
  5308. *setchar(<string>,<char>,<index>)
  5309. Returns the original string with the char at the specified index set to the
  5310. specified char. If index out of range, the original string will be returned.
  5311. Only the 1st char in the <char> parameter will be used.
  5312. Example:
  5313. setchar("Cat", "B", 0); //returns "Bat"
  5314. ---------------------------------------
  5315. *insertchar(<string>,<char>,<index>)
  5316. Returns the original string with the specified char inserted at the specified
  5317. index. If index is out of range, the char will be inserted on the end of the
  5318. string that it is closest. Only the 1st char in the <char> parameter will be used.
  5319. Example:
  5320. insertchar("laughter", "s", 0); //returns "slaughter"
  5321. ---------------------------------------
  5322. *delchar(<string>,<index>)
  5323. Returns the original string with the char at the specified index removed.
  5324. If index is out of range, original string will be returned.
  5325. Example:
  5326. delchar("Diet", 3); //returns "Die"
  5327. ---------------------------------------
  5328. *strtoupper(<string>)
  5329. *strtolower(<string>)
  5330. Returns the specified string in its uppercase/lowercase form.
  5331. All non-alpha characters will be preserved.
  5332. Example:
  5333. strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!"
  5334. ---------------------------------------
  5335. *charisupper(<string>,<index>)
  5336. *charislower(<string>,<index>)
  5337. Returns 1 if character at specified index of specified string is
  5338. uppercase/lowercase. Otherwise, 0. Characters not of the alphabet will return 0.
  5339. Example:
  5340. charisupper("rAthena", 1); //returns 1
  5341. ---------------------------------------
  5342. *substr(<string>,<start_index>,<end_index>)
  5343. Returns the sub-string of the specified string inclusively between the set
  5344. indexes. If indexes are out of range, or the start index is after the end
  5345. index, an empty string will be returned.
  5346. Example:
  5347. substr("foobar", 3, 5); //returns "bar"
  5348. ---------------------------------------
  5349. *explode(<dest_array>,<string>,<delimiter>)
  5350. Breaks a string up into substrings based on the specified delimiter. Substrings
  5351. will be stored within the specified string array. Only the 1st char of the
  5352. delimiter parameter will be used. If an empty string is passed as a delimiter,
  5353. the string will be placed in the array in its original form.
  5354. Example:
  5355. explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
  5356. //.@my_array$ contents will be...
  5357. //.@my_array$[0]: "Explode"
  5358. //.@my_array$[1]: "Test"
  5359. //.@my_array$[2]: "1965"
  5360. //.@my_array$[3]: "red"
  5361. //.@my_array$[4]: "PIE"
  5362. ---------------------------------------
  5363. *implode(<string_array>{,<glue>})
  5364. Combines all substrings within the specified string array into a single string.
  5365. If the glue parameter is specified, it will be inserted inbetween each substring.
  5366. Example:
  5367. setarray .@my_array$[0], "This", "is", "a", "test";
  5368. implode(.@my_array$, " "); //returns "This is a test"
  5369. ---------------------------------------
  5370. *sprintf(<format>[,param[,param[,...]]])
  5371. C style sprintf. The resulting string is returned same as in PHP. All C format
  5372. specifiers are supported except %n. More info: sprintf @ www.cplusplus.com.
  5373. The number of params is only limited by rA's script engine.
  5374. Example:
  5375. .@format$ = "The %s contains %d monkeys";
  5376. dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys"
  5377. dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys"
  5378. ---------------------------------------
  5379. *sscanf(<string>,<format>[,param[,param[,...]]])
  5380. C style sscanf. All C format specifiers are supported.
  5381. More info: sscanf @ www.cplusplus.com. The number of params is only limited
  5382. by rA's script engine.
  5383. Example:
  5384. sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$);
  5385. dispbottom(.@num + " " + .@str$); //prints "42 foobar"
  5386. ---------------------------------------
  5387. *strpos(<haystack>,<needle>{,<offset>})
  5388. PHP style strpos. Finds a substring (needle) within a string (haystack).
  5389. The offset parameter indicates the index of the string to start searching.
  5390. Returns index of substring on successful search, else -1.
  5391. Comparison is case sensitive.
  5392. Example:
  5393. strpos("foobar", "bar", 0); //returns 3
  5394. strpos("foobarfoo", "foo", 0); //returns 0
  5395. strpos("foobarfoo", "foo", 1); //returns 6
  5396. ---------------------------------------
  5397. *replacestr(<input>, <search>, <replace>{, <usecase>{, <count>}})
  5398. Replaces all instances of a search string in the input with the specified
  5399. replacement string. By default is case sensitive unless <usecase> is set
  5400. to 0. If specified it will only replace as many instances as specified
  5401. in the count parameter.
  5402. Example:
  5403. replacestr("testing tester", "test", "dash"); //returns "dashing dasher"
  5404. replacestr("Donkey", "don", "mon", 0); //returns "monkey"
  5405. replacestr("test test test test test", "test", "yay", 0, 3); //returns "yay yay yay test test"
  5406. ---------------------------------------
  5407. *countstr(<input>, <search>{, <usecase>})
  5408. Counts all instances of a search string in the input. By default is case
  5409. sensitive unless <usecase> is set to 0.
  5410. Example:
  5411. countstr("test test test Test", "test"); //returns 3
  5412. countstr("cake Cake", "Cake", 0); //returns 2
  5413. ---------------------------------------
  5414. *preg_match(<regular expression pattern>,<string>{,<offset>})
  5415. Searches a string for a match to the regular expression provided. The
  5416. offset parameter indicates the index of the string to start searching.
  5417. Returns offsets to captured substrings, or 0 if no match is found.
  5418. This command is only available if the server is compiled with the regular
  5419. expressions library enabled.
  5420. ---------------------------------------
  5421. *setfont <font>;
  5422. This command sets the current RO client interface font to one of the
  5423. fonts stored in data\*.eot by using an ID of the font. When the ID
  5424. of the currently used font is used, default interface font is used
  5425. again.
  5426. 0 - Default
  5427. 1 - RixLoveangel
  5428. 2 - RixSquirrel
  5429. 3 - NHCgogo
  5430. 4 - RixDiary
  5431. 5 - RixMiniHeart
  5432. 6 - RixFreshman
  5433. 7 - RixKid
  5434. 8 - RixMagic
  5435. 9 - RixJJangu
  5436. ---------------------------------------
  5437. *showdigit <value>{,<type>};
  5438. Displays given numeric 'value' in large digital clock font on top of
  5439. the screen. The optional parameter 'type' specifies visual aspects
  5440. of the "clock" and can be one of the following values:
  5441. 0 - Displays the value for 5 seconds (default).
  5442. 1 - Incremental counter (1 tick/second).
  5443. 2 - Decremental counter (1 tick/second). Does not stop at zero,
  5444. but overflows.
  5445. 3 - Decremental counter (1 tick/second). Two digits only, stops
  5446. at zero.
  5447. For type 1 and 2 the start value is set by using negative number of
  5448. the one intended to set (ex. -10 starts the counter at 10 seconds).
  5449. Except for type 3 the value is interpreted as seconds and formatted
  5450. as time in days, hours, minutes and seconds. Note, that the official
  5451. script command does not have the optional parameter.
  5452. // displays 23:59:59 for 5 seconds
  5453. showdigit 86399;
  5454. // counter that starts at 60 and runs for 60 seconds
  5455. showdigit 60,3;
  5456. ---------------------------------------
  5457. *setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
  5458. Each map cell has several 'flags' that specify the properties of that cell.
  5459. These include terrain properties (walkability, shootability, presence of water),
  5460. skills (basilica, land protector, ...) and other (NPC nearby, no vending, ...).
  5461. Each of these can be 'on' or 'off'. Together they define a cell's behavior.
  5462. This command lets you alter these flags for all map cells in the specified
  5463. (x1,y1)-(x2,y2) rectangle. The 'flag' can be 0 or 1 (0:clear flag, 1:set flag).
  5464. The 'type' defines which flag to modify. Possible options see 'db/const.txt'.
  5465. Example:
  5466. setcell "arena",0,0,300,300,cell_basilica,1;
  5467. setcell "arena",140,140,160,160,cell_basilica,0;
  5468. setcell "arena",135,135,165,165,cell_walkable,0;
  5469. setcell "arena",140,140,160,160,cell_walkable,1;
  5470. This will add a makeshift ring into the center of the map. The ring will be
  5471. surrounded by a 5-cell wide 'gap' to prevent interference from outside, and
  5472. the rest of the map will be marked as 'basilica', preventing observers from
  5473. casting any offensive skills or fighting among themselves. Note that the wall
  5474. will not be shown nor known client-side, which may cause movement problems.
  5475. Another example:
  5476. OnBarricadeDeploy:
  5477. setcell "schg_cas05",114,51,125,51,cell_walkable,0;
  5478. end;
  5479. OnBarricadeBreak:
  5480. setcell "schg_cas05",114,51,125,51,cell_walkable,1;
  5481. end;
  5482. This could be a part of the WoE:SE script, where attackers are not allowed
  5483. to proceed until all barricades are destroyed. This script would place and
  5484. remove a nonwalkable row of cells after the barricade mobs.
  5485. ---------------------------------------
  5486. *checkcell ("<map name>",<x>,<y>,<type>);
  5487. This command will return 1 or 0, depending on whether the specified cell has
  5488. the 'type' flag set or not. There are various types to check, all mimicking
  5489. the server's cell_chk enumeration. The types can be found in 'db/const.txt'.
  5490. The meaning of the individual types can be confusing, so here's an overview:
  5491. - cell_chkwall/water/cliff
  5492. these check directly for the 'terrain component' of the specified cell
  5493. - cell_chkpass/reach/nopass/noreach
  5494. passable = not wall & not cliff, reachable = passable wrt. no-stacking mod
  5495. - cell_chknpc/basilica/landprotector/novending/nochat
  5496. these check for specific dynamic flags (their name indicates what they do)
  5497. Example:
  5498. mes "Pick a destination map.";
  5499. input .@map$;
  5500. mes "Alright, now give me the coordinates.";
  5501. input .@x;
  5502. input .@y;
  5503. if( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) {
  5504. mes "Can't warp you there, sorry!";
  5505. close;
  5506. } else {
  5507. mes "Ok, get ready...";
  5508. close2;
  5509. warp .@map$, .@x, .@y;
  5510. end;
  5511. }
  5512. ---------------------------------------
  5513. *setwall "<map name>",<x>,<y>,<size>,<dir>,<shootable>,"<name>";
  5514. *delwall "<name>";
  5515. Creates an invisible wall, an array of "setcell" starting from x,y and doing a
  5516. line of the given size in the given direction. The difference with setcell is
  5517. this one update client part too to avoid the glitch problem. Directions are the
  5518. same as NPC sprite facing directions: 0=north, 1=northwest, 2=west, etc.
  5519. ---------------------------------------
  5520. *readbook <book id>,<page>;
  5521. This command will open a book item at the specified page.
  5522. ---------------------------------------
  5523. ========================
  5524. |7.- Instance commands.|
  5525. ========================
  5526. ---------------------------------------
  5527. *instance_create("<instance name>");
  5528. Creates an instance for the party of the attached player. The instance name,
  5529. along with all other instance data, is read from 'db/(pre-)re/instance_db.txt'.
  5530. Upon success, the command generates a unique instance ID, duplicates all listed
  5531. maps and NPCs, sets the alive time, and triggers the "OnInstanceInit" label in
  5532. all NPCs inside the instance.
  5533. The command returns the instance ID upon success, and these values upon failure:
  5534. -1: Invalid type.
  5535. -2: Party not found.
  5536. -3: Instance already exists.
  5537. -4: No free instances (MAX_INSTANCE exceeded).
  5538. ---------------------------------------
  5539. *instance_destroy {<instance id>};
  5540. Destroys instance with the ID <instance id>. If no ID is specified, the instance
  5541. the script is attached to is used. If the script is not attached to an instance,
  5542. the instance of the currently attached player's party is used. If that fails,
  5543. the script will come to a halt.
  5544. ---------------------------------------
  5545. *instance_enter("<instance name>"{,<x>,<y>});
  5546. Warps player to the specified instance after the script terminates. The map and
  5547. coordinates are located in 'db/(pre-)re/instance_db.txt'.
  5548. The command returns 0 upon success, and these values upon failure:
  5549. 1: Party not found.
  5550. 2: Party does not have an instance.
  5551. 3: Other errors (invalid instance name, instance doesn't match with party).
  5552. ---------------------------------------
  5553. *instance_npcname("<npc name>"{,<instance id>})
  5554. Returns the unique name of the instanced script. If no ID is specified,
  5555. the instance the script is attached to is used. If the script is not attached to
  5556. an instance, the instance of the currently attached player's party is used. If
  5557. that fails, the script will come to a halt.
  5558. ---------------------------------------
  5559. *instance_mapname("<map name>"{,<instance id>})
  5560. Returns the unique name of the instanced map. If no instance ID is specified,
  5561. the instance the script is attached to is used. If the script is not attached to
  5562. an instance, the instance of the currently attached player's party is used. If
  5563. that fails, the command returns an empty string instead.
  5564. ---------------------------------------
  5565. *instance_id()
  5566. Returns the unique instance id of the attached script. If the script is not
  5567. attached to an instance, the instance of the currently attached player's party is
  5568. used. If that fails, the function will return 0.
  5569. ---------------------------------------
  5570. *instance_warpall "<map name>",<x>,<y>{,<instance id>};
  5571. Warps all players in the instance <instance id> to <map name> at given
  5572. coordinates. If no ID is specified, the instance the script is attached to
  5573. is used. If the script is not attached to an instance, the instance of the
  5574. currently attached player's party is used. If that fails, the script will
  5575. come to a halt.
  5576. ---------------------------------------
  5577. *instance_announce <instance id>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  5578. Broadcasts a message to all players in the instance <instance id> currently
  5579. residing on an instance map. If -1 is specified for <instance id>, the instance
  5580. the script is attached to is used. If the script is not attached to an instance,
  5581. the instance of the currently attached player's party is used.
  5582. For details on the other parameters, see 'announce'.
  5583. ---------------------------------------
  5584. *instance_check_party(<party id>{,<amount>{,<min>{,<max>}}})
  5585. This function checks if a party meets certain requirements, returning 1 if all
  5586. conditions are met and 0 otherwise. It will only check online characters.
  5587. amount - number of online party members (default is 1).
  5588. min - minimum level of all characters in the party (default is 1).
  5589. max - maximum level of all characters in the party (default is max level in conf).
  5590. Example:
  5591. if (instance_check_party(getcharid(1),2,2,149)) {
  5592. mes "Your party meets the Memorial Dungeon requirements.",
  5593. mes "All online members are between levels 1-150 and at least two are online.";
  5594. close;
  5595. } else {
  5596. mes "Sorry, your party does not meet requirements.";
  5597. close;
  5598. }
  5599. ---------------------------------------
  5600. =========================
  5601. |8.- Quest Log commands.|
  5602. =========================
  5603. ---------------------------------------
  5604. *questinfo <Quest ID>, <Icon> {, <Map Mark Color>{, <Job Class>}};
  5605. This is esentially a combination of checkquest and showevent. Use this only
  5606. in an OnInit label. For the Quest ID, specify the quest ID that you want
  5607. checked if it has been started yet.
  5608. For Icon, use one of the following:
  5609. No Icon : QTYPE_NONE
  5610. ! Quest Icon : QTYPE_QUEST
  5611. ? Quest Icon : QTYPE_QUEST2
  5612. ! Job Icon : QTYPE_JOB
  5613. ? Job Icon : QTYPE_JOB2
  5614. ! Event Icon : QTYPE_EVENT
  5615. ? Event Icon : QTYPE_EVENT2
  5616. Warg : QTYPE_WARG
  5617. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410)
  5618. Map Mark Color, when used, creates a mark in the user's mini map on the position of the NPC,
  5619. the available color values are:
  5620. 0 - No Marker
  5621. 1 - Yellow Marker
  5622. 2 - Green Marker
  5623. 3 - Purple Marker
  5624. When a user shows up on a map, each NPC is checked for questinfo that has been set.
  5625. If questinfo is present, it will check if the quest has been started, if it has not, the bubble will appear.
  5626. Optionally, you can also specify a Job Class if the quest bubble should only appear for a certain class.
  5627. Example
  5628. izlude,100,100,4 script Test 844,{
  5629. mes "[Test]";
  5630. mes "Hello World.";
  5631. close;
  5632. OnInit:
  5633. questinfo 1001, QTYPE_QUEST, 0, Job_Novice;
  5634. end;
  5635. }
  5636. ---------------------------------------
  5637. *setquest <ID>;
  5638. Place quest of <ID> in the users quest log, the state of which is "active".
  5639. If *questinfo is set, and the same ID is specified here, the icon will be cleared when the quest is set.
  5640. ---------------------------------------
  5641. *completequest <ID>;
  5642. Change the state for the given quest <ID> to "complete" and remove from the users quest log.
  5643. ---------------------------------------
  5644. *erasequest <ID>;
  5645. Remove the quest of the given <ID> from the user's quest log.
  5646. ---------------------------------------
  5647. *changequest <ID>,<ID2>;
  5648. Remove quest of the given <ID> from the user's quest log.
  5649. Add quest of the <ID2> to the the quest log, and the state is "active".
  5650. ---------------------------------------
  5651. *checkquest(<ID>{,PLAYTIME|HUNTING})
  5652. If no additional argument supplied, return the state of the quest:
  5653. -1 = Quest not started (not in quest log)
  5654. 0 = Quest has been given, but the state is "inactive"
  5655. 1 = Quest has been given, and the state is "active"
  5656. 2 = Quest completed
  5657. If parameter "PLAYTIME" is supplied:
  5658. -1 = Quest not started (not in quest log)
  5659. 0 = the time limit has not yet been reached
  5660. 1 = the time limit has not been reached but the quest is marked as complete
  5661. 2 = the time limit has been reached
  5662. If parameter "HUNTING" is supplied:
  5663. -1 = Quest not started (not in quest log)
  5664. 0 = you haven't killed all of the target monsters and the time limit has not been reached.
  5665. 1 = you haven't killed all of the target monsters but the time limit has been reached.
  5666. 2 = you've killed all of the target monsters
  5667. ---------------------------------------
  5668. *isbegin_quest(<ID>)
  5669. Return the state of the quest:
  5670. 0 = Quest not started (not in quest log)
  5671. 1 = Quest has been given (state is either "inactive" or "active")
  5672. 2 = Quest completed
  5673. ---------------------------------------
  5674. *showevent <icon>{,<mark color>}
  5675. Show an emotion on top of a NPC, and optionally,
  5676. a colored mark in the mini-map like "viewpoint".
  5677. This is used to indicate that a NPC has a quest or an event to
  5678. a certain player.
  5679. Available Icons:
  5680. Remove Icon : QTYPE_NONE
  5681. ! Quest Icon : QTYPE_QUEST
  5682. ? Quest Icon : QTYPE_QUEST2
  5683. ! Job Icon : QTYPE_JOB
  5684. ? Job Icon : QTYPE_JOB2
  5685. ! Event Icon : QTYPE_EVENT
  5686. ? Event Icon : QTYPE_EVENT2
  5687. Warg : QTYPE_WARG
  5688. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410)
  5689. Mark Color:
  5690. 0 - No Mark
  5691. 1 - Yellow Mark
  5692. 2 - Green Mark
  5693. 3 - Purple Mark
  5694. ---------------------------------------
  5695. ============================
  5696. |9.- Battleground commands.|
  5697. ============================
  5698. ---------------------------------------
  5699. *waitingroom2bg_single(<battle group>,"<map name>",<x>,<y>,"<npc name>");
  5700. Adds the first waiting player from the chat room of the given NPC to an
  5701. existing battleground group and warps it to the specified coordinates on
  5702. the given map.
  5703. ---------------------------------------
  5704. *waitingroom2bg("<map name>",<x>,<y>,"<On Quit Event>","<On Death Event>"{,"<NPC Name>"});
  5705. <map name>,<x>,<y> refer to where the "respawn" base is, where the player group will respawn when they die.
  5706. <On Quit Event> refers to an NPC label that attaches to the character and is run when they relog.
  5707. <On Death Event> refers to an NPC label that attaches to the character and is run when they die. Can be "" for empty.
  5708. Unlike the prior command, the latter will attach a GROUP in a waiting room to the battleground, and
  5709. sets the array $@arenamembers[0] where 0 holds the IDs of the first group, and 1 holds the IDs of the second.
  5710. If the optional NPC Name parameter is left out, the waiting room of the current NPC is used.
  5711. Example:
  5712. // Battle Group will be referred to as $@KvM01BG_id1, and when they die, respawn at bat_c01,52,129.
  5713. set $@KvM01BG_id1, waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
  5714. end;
  5715. ---------------------------------------
  5716. *bg_team_setxy <Battle Group ID>,<x>,<y>;
  5717. 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).
  5718. Example:
  5719. bg_team_setxy getcharid(4),56,212;
  5720. mapannounce "bat_a01", "Group [1] has taken the work shop, and will now respawn there.",bc_map,"0xFFCE00";
  5721. end;
  5722. ---------------------------------------
  5723. *bg_warp <Battle Group>,"<map name>",<x>,<y>;
  5724. Similar to the 'warp' command.
  5725. Places all members of <Battle Group> at the specified map and coordinates.
  5726. Example:
  5727. //place the battle group one for Tierra Gorge at starting position.
  5728. bg_warp $@TierraBG1_id1,"bat_a01",352,342;
  5729. end;
  5730. ---------------------------------------
  5731. *bg_monster <Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>";
  5732. *bg_monster(<Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>");
  5733. Similar to the 'monster' command.
  5734. Spawns a monster with allegiance to the given Battle Group.
  5735. Does not allow for the summoning of multiple monsters.
  5736. Monsters are similar to those in War of Emperium, in that the specified Battle Group is considered friendly.
  5737. Example:
  5738. // It can be used in two different ways.
  5739. bg_monster $@TierraBG1_id2,"bat_a01",167,50,"Food Depot",1910,"Feed Depot#1::OnMyMobDead";
  5740. end;
  5741. // Alternatively, you can set an ID for the monster using "set".
  5742. // This becomes useful when used with the command below.
  5743. set $@Guardian_3, bg_monster($@TierraBG1_id2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  5744. end;
  5745. ---------------------------------------
  5746. *bg_monster_set_team <GID>,<Battle Group>;
  5747. This command will change the allegiance if a monster in a battle ground.
  5748. GID can be set when spawning the monster via the 'bg_monster' command.
  5749. Example:
  5750. end;
  5751. OnEnable:
  5752. mapannounce "A guardian has been summoned for Battle Group 2!",bc_map,"0xFFCE00";
  5753. set $@Guardian, bg_monster($@BG_2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  5754. initnpctimer;
  5755. end;
  5756. OnTimer1000:
  5757. stopnpctimer;
  5758. mapannounce "Erm, sorry about that! This monster was meant for Battle Group 1.",bc_map,"0xFFCE00";
  5759. bg_monster_set_team $@Guardian, $@BG_1;
  5760. end;
  5761. ---------------------------------------
  5762. *bg_leave;
  5763. Removes attached player from their Battle Group.
  5764. ---------------------------------------
  5765. *bg_destroy <Batte Group>;
  5766. Destroys the Battle Group created for that battle ground.
  5767. ---------------------------------------
  5768. *areapercentheal "<map name>",<x1>,<y1>,<x2>,<y2>,<hp>,<sp>;
  5769. Restores a percentage of the maximum HP/SP of players within a defined area.
  5770. This is primarily used in battleground scripts, but is not limited to them.
  5771. Example:
  5772. areapercentheal "bat_a01",52,208,61,217,100,100;
  5773. end;
  5774. ---------------------------------------
  5775. *bg_get_data(<Battle Group>,<type>);
  5776. Retrieves data related to given Battle Group. Type can be one of the following:
  5777. 0 - Amount of players currently belonging to the group.
  5778. ---------------------------------------
  5779. *bg_getareausers(<Battle Group>,"<map name>",<x0>,<y0>,<x1>,<y1>);
  5780. Retrieves the amount of players belonging to the given Battle Group on the given
  5781. map within the specified rectangular area.
  5782. ---------------------------------------
  5783. *bg_updatescore "<map name>",<Guillaume Score>,<Croix Score>;
  5784. This command will force the update of the displayed scoreboard.
  5785. It is only usable when the map is defined as a Type 2 Battleground:
  5786. mapflag <map name> battleground 2
  5787. ---------------------------------------
  5788. ====================
  5789. |10.- Pet commands.|
  5790. ====================
  5791. ---------------------------------------
  5792. *bpet;
  5793. This command opens up a pet hatching window on the client connected to the
  5794. invoking character. It is used in item script for the pet incubators and will
  5795. let the player hatch an owned egg. If the character has no eggs, it will just
  5796. open up an empty incubator window.
  5797. This is still usable outside item scripts.
  5798. ---------------------------------------
  5799. *pet <pet id>;
  5800. This command is used in all the item scripts for taming items. Running this
  5801. command will make the pet catching cursor appear on the client connected to the
  5802. invoking character, usable on the monsters with the specified pet ID number. It
  5803. will still work outside an item script.
  5804. A full list of pet IDs can be found inside 'db/pet_db.txt'.
  5805. ---------------------------------------
  5806. *makepet <pet id>;
  5807. This command will create a pet egg and put it in the invoking character's
  5808. inventory. The kind of pet is specified by pet ID numbers listed in
  5809. 'db/pet_db.txt'. The egg is created exactly as if the character just successfully
  5810. caught a pet in the normal way.
  5811. // This will make you a poring:
  5812. makepet 1002;
  5813. Notice that you absolutely have to create pet eggs with this command. If you try
  5814. to give a pet egg with 'getitem', pet data will not be created by the char
  5815. server and the egg will disappear when anyone tries to hatch it.
  5816. ---------------------------------------
  5817. *getpetinfo(<type>)
  5818. This function will return pet information for the pet the invoking character
  5819. currently has active. Valid types are:
  5820. 0 - Unique pet ID number as stored by the char server and distinguishing it
  5821. from all other pets the characters actually have. This value is currently
  5822. useless, at most you can use it to tell pets apart reliably.
  5823. 1 - Pet class number as per 'db/pet_db.txt' - will tell you what kind of a pet it
  5824. is.
  5825. 2 - Pet name. Will return "null" if there's no pet.
  5826. 3 - Pet friendly level (intimacy score). 1000 is full loyalty.
  5827. 4 - Pet hungry level. 100 is completely full.
  5828. 5 - Pet rename flag. 0 means this pet has not been named yet.
  5829. 6 - Pet level
  5830. ---------------------------------------
  5831. * The Pet AI commands
  5832. -------------------
  5833. These commands will only work if the invoking character has a pet, and are meant
  5834. to be executed from pet scripts. They will modify the pet AI decision-making for
  5835. the current pet of the invoking character, and will NOT have any independent
  5836. effect by themselves, which is why only one of them each may be in effect at any
  5837. time for a specific pet. A pet may have 'petloot', 'petskillbonus',
  5838. 'petskillattack' OR 'petpetskillattack2' and 'petskillsupport' OR 'petheal' at
  5839. the same time. 'petheal' is deprecated and is no longer used in the default pet
  5840. scripts.
  5841. All commands with delays and durations will only make the behavior active for
  5842. the specified duration of seconds, with a delay of the specified number of
  5843. seconds between activations. Rates are a chance of the effect occurring and are
  5844. given in percent. 'bonusrate' is added to the normal rate if the pet intimacy is
  5845. at the maximum possible.
  5846. The behavior modified with the below mentioned commands will only be exhibited if
  5847. the pet is loyal and appropriate configuration options are set in
  5848. 'battle_athena.conf'.
  5849. Pet scripts in the database normally run whenever a pet of that type hatches
  5850. from the egg. Other commands usable in item scripts (see 'bonus') will also
  5851. happily run from pet scripts. Apparently, the pet-specific commands will also
  5852. work in NPC scripts and modify the behavior of the current pet up until the pet
  5853. is hatched again. (Which will also occur when the character is logged in again
  5854. with the pet still out of the egg.) It is not certain for how long the effect of
  5855. such command running from an NPC script will eventually persist, but apparently,
  5856. it is possible to usefully employ them in usable item scripts to create pet
  5857. buffing items.
  5858. Nobody tried this before, so you're essentially on your own here.
  5859. ---------------------------------------
  5860. *petskillbonus <bonus type>,<value>,<duration>,<delay>;
  5861. This command will make the pet give a bonus to the owner's stat (bonus type -
  5862. bInt,bVit,bDex,bAgi,bLuk,bStr,bSpeedRate - for a full list, see the values
  5863. starting with 'b' in 'db/const.txt')
  5864. ---------------------------------------
  5865. *petrecovery <status type>,<delay>;
  5866. This command will make the pet cure a specified status condition. The curing
  5867. actions will occur once every Delay seconds. For a full list of status
  5868. conditions that can be cured, see the list of 'SC_' status condition constants
  5869. in 'db/const.txt'.
  5870. ---------------------------------------
  5871. *petloot <max items>;
  5872. This command will turn on pet looting, with a maximum number of items to loot
  5873. specified. Pet will store items and return them when the maximum is reached or
  5874. when pet performance is activated.
  5875. ---------------------------------------
  5876. *petskillsupport <skill id>,<skill level>,<delay>,<percent hp>,<percent sp>;
  5877. *petskillsupport "<skill name>",<skill level>,<delay>,<percent hp>,<percent sp>;
  5878. *petheal <level>,<delay>,<percent hp>,<percent sp>;
  5879. This will make the pet use a specified support skill on the owner whenever the
  5880. HP and SP are below the given percent values, with a specified delay time
  5881. between activations. The skill numbers are as per 'db/(pre-)re/skill_db.txt'.
  5882. 'petheal' works the same as 'petskillsupport' but has the skill ID hard-coded to
  5883. 28 (Heal). This command is deprecated.
  5884. It's not quite certain who's stats will be used for the skills cast, the
  5885. character's or the pets. Probably, Skotlex can answer that question.
  5886. ---------------------------------------
  5887. *petskillattack <skill id>,<skill level>,<rate>,<bonusrate>;
  5888. *petskillattack "<skill name>",<skill level>,<rate>,<bonusrate>;
  5889. *petskillattack2 <skill id>,<damage>,<number of attacks>,<rate>,<bonusrate>;
  5890. *petskillattack2 "<skill name>",<damage>,<number of attacks>,<rate>,<bonusrate>;
  5891. These two commands will make the pet cast an attack skill on the enemy the pet's
  5892. owner is currently fighting. Skill IDs and levels are as per 'petskillsupport'.
  5893. 'petskillattack2' will make the pet cast the skill with a fixed amount of damage
  5894. inflicted and the specified number of attacks.
  5895. ---------------------------------------
  5896. ===========================
  5897. |11.- Homunculus commands.|
  5898. ===========================
  5899. ---------------------------------------
  5900. *homevolution;
  5901. This command will try to evolve the current player's homunculus.
  5902. If it doesn't work, the /swt emotion is shown.
  5903. To evolve a homunculus, the invoking player must have a homunculus,
  5904. the homunculus must not be the last evolution and
  5905. the homunculus must have above 91000 intimacy with its owner.
  5906. ---------------------------------------
  5907. *morphembryo;
  5908. This command will try to put the invoking player's Homunculus in an
  5909. uncallable state, required for mutation into a Homunculus S. The player
  5910. will also receive a Strange Embryo (ID 6415) in their inventory if
  5911. successful, which is deleted upon mutation.
  5912. The command will fail if the invoking player does not have an evolved
  5913. Homunculus at level 99 or above. The /swt emotion is shown upon failure.
  5914. Returns 1 upon success and 0 for all failures.
  5915. ---------------------------------------
  5916. *hommutate {<ID>};
  5917. This command will try to mutate the invoking player's Homunculus into
  5918. a Homunculus S. The Strange Embryo (ID 6415) is deleted upon success.
  5919. The command will fail if the invoking player does not have an evolved
  5920. Homunculus at level 99 or above, if it is not in the embryo state
  5921. (from the 'morphembryo' command), or if the invoking player does not
  5922. possess a Strange Embryo. The /swt emotion is shown upon failure.
  5923. If the optional parameter <ID> is set, the invoking player's Homunculus
  5924. will change into the specified Homunculus ID. Otherwise, a random Homunculus S
  5925. will be chosen. See 'db/homunculus_db.txt' for a full list of IDs.
  5926. Returns 1 upon success and 0 for all failures.
  5927. ---------------------------------------
  5928. *checkhomcall()
  5929. This function checks if the attached player's Homunculus is active,
  5930. and will return the following values:
  5931. -1: The player has no Homunculus.
  5932. 0: The player's Homunculus is active.
  5933. 1: The player's Homunculus is vaporized.
  5934. 2: The player's Homunculus is in morph state.
  5935. ---------------------------------------
  5936. *gethominfo(<type>)
  5937. This function will return Homunculus information for the Homunculus of the
  5938. invoking character, regardless of its vaporize state. It returns zero or
  5939. "null" if the player does not own a Homunculus.
  5940. Valid types are:
  5941. 0 - Homunculus unique ID
  5942. 1 - Homunculus Class
  5943. 2 - Name
  5944. 3 - Friendly level (intimacy score). 100000 is full loyalty.
  5945. 4 - Hungry level. 100 is completely full.
  5946. 5 - Rename flag. 0 means this homunculus has not been named yet.
  5947. 6 - Homunculus level
  5948. ---------------------------------------
  5949. *homshuffle;
  5950. This will recalculate the homunculus stats according to its level, of the
  5951. current invoking character.
  5952. ---------------------------------------
  5953. ==========================
  5954. |12.- Mercenary commands.|
  5955. ==========================
  5956. ---------------------------------------
  5957. *mercenary_create <class>,<contract time>;
  5958. This command summons a mercenary for a given time (in milliseconds). For a
  5959. list of all available classes, see 'db/mercenary_db.txt'.
  5960. This command is typically used in item scripts of mercenary scrolls.
  5961. ---------------------------------------
  5962. *mercenary_heal <hp>,<sp>;
  5963. This command works like 'heal', but affects the mercenary of the
  5964. currently attached character.
  5965. ---------------------------------------
  5966. *mercenary_sc_start <type>,<tick>,<val1>;
  5967. This command works like 'sc_start', but affects the mercenary of the
  5968. currently attached character.
  5969. ---------------------------------------
  5970. *mercenary_get_calls(<guild>);
  5971. *mercenary_set_calls <guild>,<value>;
  5972. Sets or gets the mercenary calls value for given guild for currently
  5973. attached character. Guild can be one or the following constants:
  5974. ARCH_MERC_GUILD
  5975. SPEAR_MERC_GUILD
  5976. SWORD_MERC_GUILD
  5977. ---------------------------------------
  5978. *mercenary_get_faith(<guild>);
  5979. *mercenary_set_faith <guild>,<value>;
  5980. Sets or gets the mercenary faith value for given guild for currently
  5981. attached character. Guild can be one or the following constants:
  5982. ARCH_MERC_GUILD
  5983. SPEAR_MERC_GUILD
  5984. SWORD_MERC_GUILD
  5985. ---------------------------------------
  5986. *getmercinfo(<type>{,<char id>});
  5987. Retrieves information about mercenary of the currently attached
  5988. character. If char id is given, the information of that character is
  5989. retrieved instead. Type specifies what information to retrieve and
  5990. can be one of the following:
  5991. 0 - Database ID
  5992. 1 - Class
  5993. 2 - Name
  5994. 3 - Faith value for this mercenary's guild, if any
  5995. 4 - Calls value for this mercenary's guild, if any
  5996. 5 - Kill count
  5997. 6 - Remaining life time in msec
  5998. 7 - Level
  5999. If the character does not have a mercenary, the command returns ""
  6000. for name and 0 for all other types.
  6001. ---------------------------------------
  6002. ======================
  6003. |13.- Party commands.|
  6004. ======================
  6005. ---------------------------------------
  6006. *getpartyname(<party id>)
  6007. This function will return the name of a party that has the specified ID number.
  6008. If there is no such party ID, "null" will be returned.
  6009. Lets say the ID of a party was saved as a global variable:
  6010. // This would return the name of the party from the ID stored in a variable
  6011. mes "You're in the '"+getpartyname($@var)+"' party, I know!";
  6012. ---------------------------------------
  6013. *getpartymember <party id>{,<type>};
  6014. This command will find all members of a specified party and returns their names
  6015. (or character id or account id depending on the value of "type") into an array
  6016. of temporary global variables. There's actually quite a few commands like this
  6017. which will fill a special variable with data upon execution and not do anything
  6018. else.
  6019. Upon executing this,
  6020. $@partymembername$[] is a global temporary string array which contains all the
  6021. names of these party members
  6022. (only set when type is 0 or not specified)
  6023. $@partymembercid[] is a global temporary number array which contains the
  6024. character id of these party members.
  6025. (only set when type is 1)
  6026. $@partymemberaid[] is a global temporary number array which contains the
  6027. account id of these party members.
  6028. (only set when type is 2)
  6029. $@partymembercount is the number of party members that were found.
  6030. The party members will (apparently) be found regardless of whether they are
  6031. online or offline. Note that the names come in no particular order.
  6032. Be sure to use $@partymembercount to go through this array, and not
  6033. 'getarraysize', because it is not cleared between runs of 'getpartymember'. If
  6034. someone with 7 party members invokes this script, the array would have 7
  6035. elements. But if another person calls up the NPC, and he has a party of 5, the
  6036. server will not clear the array for you, overwriting the values instead. So in
  6037. addition to returning the 5 member names, the 6th and 7th elements from the last
  6038. call remain, and you will get 5+2 members, of which the last 2 don't belong to
  6039. the new guy's party. $@partymembercount will always contain the correct number,
  6040. (5) unlike 'getarraysize()' which will return 7 in this case.
  6041. Example 1: list party member names
  6042. // get the party member names
  6043. getpartymember getcharid(1),0;
  6044. // It's a good idea to copy the global temporary $@partymember*****
  6045. // variables to your own scope variables because if you have pauses in this
  6046. // script (sleep, sleep2, next, close2, input, menu, select, or prompt),
  6047. // another player could click this NPC, trigger 'getpartymember', and
  6048. // overwrite the $@partymember***** variables.
  6049. .@count = $@partymembercount;
  6050. copyarray .@name$[0], $@partymembername$[0], $@partymembercount;
  6051. // list the party member names
  6052. for (.@i = 0; .@i < .@count; .@i++)
  6053. mes (.@i +1) + ". ^0000FF" + .@name$[.@i] + "^000000";
  6054. close;
  6055. Example 2: check party count (with a 'next' pause), before warping to event
  6056. .register_num = 5; // How many party members are required?
  6057. // get the charID and accountID of character's party members
  6058. getpartymember getcharid(1), 1;
  6059. getpartymember getcharid(1), 2;
  6060. if ( $@partymembercount != .register_num ) {
  6061. mes "Please form a party of "+ .register_num +" to continue";
  6062. close;
  6063. }
  6064. // loop through both and use 'isloggedin' to count online party members
  6065. for ( .@i = 0; .@i < $@partymembercount; .@i++ )
  6066. if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
  6067. .@count_online++;
  6068. // We search accountID & charID because a single party can have multiple
  6069. // characters from the same account. Without searching through the charID,
  6070. // if a player has 2 characters from the same account inside the party but
  6071. // only 1 char online, it would count their online char twice.
  6072. if ( .@count_online != .register_num ) {
  6073. mes "All your party members must be online to continue";
  6074. close;
  6075. }
  6076. // copy the array to prevent players cheating the system
  6077. copyarray .@partymembercid, $@partymembercid, .register_num;
  6078. mes "Are you ready ?";
  6079. next; // careful here
  6080. select("Yes");
  6081. // When a script hits a next, menu, sleep or input that pauses the script,
  6082. // players can invite or /leave and make changes in their party. To prevent
  6083. // this, we call getpartymember again and compare with the original values.
  6084. getpartymember getcharid(1), 1;
  6085. if ( $@partymembercount != .register_num ) {
  6086. mes "You've made changes to your party !";
  6087. close;
  6088. }
  6089. for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
  6090. if ( .@partymembercid[.@i] != $@partymembercid[.@i] ) {
  6091. mes "You've made changes to your party !";
  6092. close;
  6093. }
  6094. }
  6095. // Finally, it's safe to start the event!
  6096. warpparty "event_map", 0,0, getcharid(1);
  6097. ---------------------------------------
  6098. *getpartyleader(<party id>{,<type>})
  6099. This function returns some information about the given party-id's leader.
  6100. When type is omitted, the default information retrieved is the leader's name.
  6101. Possible types are:
  6102. 1: Leader account id
  6103. 2: Leader character id
  6104. 3: Leader's class
  6105. 4: Leader's current map name
  6106. 5: Leader's current level as stored on the party structure (may not be
  6107. current level if leader leveled up recently).
  6108. If retrieval fails (leader not found or party does not exist), this function
  6109. returns "null" instead of the character name, and -1 for the other types.
  6110. ---------------------------------------
  6111. *party_create("<party name>"{,<character id>{,<item share>,<item share type>}});
  6112. Organizes a party with the attached or specified character as leader. If
  6113. successful, the command returns 1 and sets the global temporary variable
  6114. "$@party_create_id" to the ID of the party created.
  6115. Additionally, item sharing options can be provided:
  6116. - Item Share: 0-Each Take (default), 1-Party Share
  6117. - Item Share Type: 0-Each Take (default), 1-Even Share
  6118. These values are returned upon failure:
  6119. 0: Unknown error.
  6120. -1: Player not found.
  6121. -2: Player already has a party.
  6122. -3: Party name exists.
  6123. ---------------------------------------
  6124. *party_destroy(<party id>);
  6125. Disbands a party. The command returns 1 upon success and 0 upon failure.
  6126. ---------------------------------------
  6127. *party_addmember(<party id>,<character id>);
  6128. Adds a player to an existing party.
  6129. The command returns 1 upon success, and these values upon failure:
  6130. 0: Unknown error.
  6131. -1: Player not found.
  6132. -2: Player already has a party.
  6133. -3: Party not found.
  6134. -4: Party is full.
  6135. ---------------------------------------
  6136. *party_delmember({<character id>,<party id>});
  6137. Removes a player from his/her party. If no player is specified, the command
  6138. will run for the invoking player. If that player is the only party member
  6139. remaining, the party will be disbanded.
  6140. The command returns 1 upon success, and these values upon failure:
  6141. 0: Unknown error.
  6142. -1: Player not found.
  6143. -2: Party not found.
  6144. -3: Player is not in the party.
  6145. ---------------------------------------
  6146. *party_changeleader(<party id>,<character id>);
  6147. Transfers leadership of a party to the specified character.
  6148. The command returns 1 upon success, and these values upon failure:
  6149. 0: Unknown error.
  6150. -1: Party not found.
  6151. -2: Player not found.
  6152. -3: Player is not in the party.
  6153. -4: Player is already party leader.
  6154. ---------------------------------------
  6155. *party_changeoption(<party id>,<option>,<flag>);
  6156. Changes a party option.
  6157. Valid options are:
  6158. 0 - Exp Share (flags: 0-Each Take, 1-Even Share)
  6159. 1 - Item Share (flags: 0-Each Take, 1-Party Share)
  6160. 2 - Item Share Type (flags: 0-Each Take, 1-Even Share)
  6161. The command returns 1 upon success, and these values upon failure:
  6162. 0: Invalid option.
  6163. -1: Party not found.
  6164. ---------------------------------------
  6165. Whew.
  6166. That's about all of them.