script_commands.txt 316 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759
  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. <map name>,<x>,<y>,<facing>%TAB%marketshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>:<quantity>{,<itemid>:<price>:<quantity>...}
  210. This will define a shop NPC, which, when triggered (which can only be done by
  211. clicking) will cause a shop window to come up. No code whatsoever runs in shop
  212. NPCs and you can't change the prices otherwise than by editing the script
  213. itself. (No variables even exist at this point of scripting, so don't even
  214. bother trying to use them.)
  215. The item id is the number of item in the 'item_db.txt' database. If Price is set
  216. to -1, the 'buy price' given in the item database will be used. Otherwise, the
  217. price you gave will be used for this item, which is how you create differing
  218. prices for items in different shops.
  219. Since trunk r12264 you can alternatively use "cashshop" in place of "shop"
  220. to use the Cash Shop interface, allowing you to buy items with special points
  221. (Currently stored as account variables in global_reg #CASHPOINTS and #KAFRAPOINTS.)
  222. This type of shop will not allow you to sell items at it, you may only
  223. purchase items here. The layout used to define sale items still count, and
  224. "<price>" refers to how many points will be spent purchasing the them.
  225. Since trunk rX you can alternatively use "itemshop" or "pointshop" in place
  226. of "shop" to use the Shop interface, allowing you to buy items with a specific
  227. item or special points from a variable. 'pointshop' only supported variable types
  228. are permanent character variables, temporary character variables, permanent
  229. local account variables, or permanent global account variables. These variables
  230. must be of integer type, not string. 'discount' flag is an option, makes the price
  231. at that shop is affected by discount skill.
  232. ** Define an warp/shop/cashshop/itemshop/pointshop/NPC duplicate.
  233. warp: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
  234. shop/cashshop/itemshop/pointshop/npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  235. shop/cashshop/itemshop/pointshop/npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  236. npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  237. npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  238. This will duplicate an warp/shop/cashshop/itemshop/pointshop/NPC referred to by 'label'.
  239. Warp duplicates inherit the target location.
  240. Shop/cashshop/itemshop/pointshop duplicates inherit the item list.
  241. NPC duplicates inherit the script code.
  242. The rest (name, location, facing, sprite ID, span/trigger area)
  243. is obtained from the definition of the duplicate (not inherited).
  244. ** Define a function object
  245. function%TAB%script%TAB%<function name>%TAB%{<code>}
  246. This will define a function object, callable with the 'callfunc' command (see
  247. below). This object will load on every map server separately, so you can get at
  248. it from anywhere. It's not possible to call the code in this object by
  249. anything other than the 'callfunc' script command.
  250. The code part is the script code that will execute whenever the function is
  251. called with 'callfunc'. It has to be in curly brackets, unlike elsewhere where
  252. we use curly brackets, these do NOT signify an optional parameter.
  253. Once an object is defined which has a 'code' field to its definition, it
  254. contains script commands which can actually be triggered and executed.
  255. ~ RID? GID? ~
  256. What a RID is and why do you need to know
  257. -----------------------------------------
  258. Most scripting commands and functions will want to request data about a
  259. character, store variables referenced to that character, send stuff to the
  260. client connected to that specific character. Whenever a script is invoked by a
  261. character, it is passed a so-called RID - this is the account ID number of a
  262. character that caused the code to execute by clicking on it, walking into its
  263. OnTouch zone, or otherwise.
  264. If you are only writing common NPCs, you don't need to bother with it. However,
  265. if you use functions, if you use timers, if you use clock-based script
  266. activation, you need to be aware of all cases when a script execution can be
  267. triggered without a RID attached. This will make a lot of commands and functions
  268. unusable, since they want data from a specific character, want to send stuff to
  269. a specific client, want to store variables specific to that character, and they
  270. would not know what character to work on if there's no RID.
  271. Unless you use 'attachrid' to explicitly attach a character to the script first.
  272. Whenever we say 'invoking character', we mean 'the character who's RID is
  273. attached to the running script. The script function "playerattached" can be
  274. used to check which is the currently attached player to the script (it will
  275. return 0 if the there is no player attached or the attached player no longer
  276. is logged on to the map-server).
  277. But what about GID?
  278. -------------------
  279. GID stands for the Game ID of something, this can either be the GID obtained
  280. through mobspawn (mob control commands) or the account ID of a character.
  281. Another way would be to right click on a mob,
  282. NPC or char as GM sprited char to view the GID.
  283. This is mostly used for the new version of skill and the mob control commands
  284. implemented.
  285. Item and pet scripts
  286. --------------------
  287. Each item in the item database has three special fields - Script , OnEquip_Script
  288. and OnUnequip_Script. The first is script code run every time a character equips the item,
  289. with the RID of the equipping character. Every time they unequip an item, all
  290. temporary bonuses given by the script commands are cleared, and all the scripts
  291. are executed once again to rebuild them. This also happens in several other
  292. situations (like upon login) but the full list is currently unknown.
  293. OnEquip_Script is a piece of script code run whenever the item is used by a character
  294. by double-clicking on it. OnUnequip_Script runs whenever the
  295. equipment is unequip by a character
  296. Not all script commands work properly in the item scripts. Where commands and
  297. functions are known to be meant specifically for use in item scripts, they are
  298. described as such.
  299. Every pet in the pet database has a PetScript field, which determines pet
  300. behavior. It is invoked wherever a pet of the specified type is spawned.
  301. (hatched from an egg, or loaded from the char server when a character who had
  302. that pet following them connects) This may occur in some other situations as
  303. well. Don't expect anything other than commands definitely marked as usable in
  304. pet scripts to work in there reliably.
  305. Numbers
  306. -------
  307. Beside the common decimal numbers, which are nothing special whatsoever (though
  308. do not expect to use fractions, since ALL numbers are integer in this language),
  309. the script engine also handles hexadecimal numbers, which are otherwise
  310. identical. Writing a number like '0x<hex digits>' will make it recognized as a
  311. hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try
  312. to 'mes 0x10' it will print '16'.
  313. Number values can't exceed the limits of an integer variable: Any number
  314. greater than INT_MAX (2147483647) or smaller than INT_MIN (-2147483648) will
  315. be capped to those values and will cause a warning to be reported.
  316. Variables
  317. ---------
  318. The meat of every programming language is variables - places where you store
  319. data.
  320. In the rAthena scripting language, variable names are not case sensitive.
  321. Variables are divided into and uniquely identified by the combination of:
  322. prefix - determines the scope and extent (or lifetime) of the variable
  323. name - an identifier consisting of '_' and alphanumeric characters
  324. postfix - determines the type of the variable: integer or string
  325. Scope can be:
  326. global - global to all servers
  327. local - local to the server
  328. account - attached to the account of the character identified by RID
  329. character - attached to the character identified by RID
  330. npc - attached to the NPC
  331. scope - attached to the scope of the instance
  332. Extent can be:
  333. permanent - They still exist when the server resets.
  334. temporary - They cease to exist when the server resets.
  335. Prefix: scope and extent
  336. nothing - A permanent variable attached to the character, the default variable
  337. type. They are stored in the `global_reg_value` table using type 3.
  338. "@" - A temporary variable attached to the character.
  339. SVN versions before 2094 revision and RC5 version will also treat
  340. 'l' as a temporary variable prefix, so beware of having variable
  341. names starting with 'l' if you want full backward compatibility.
  342. "$" - A global permanent variable.
  343. They are stored in database table `mapreg`.
  344. "$@" - A global temporary variable.
  345. This is important for scripts which are called with no RID
  346. attached, that is, not triggered by a specific character object.
  347. "." - A NPC variable.
  348. They exist in the NPC and disappear when the server restarts or the
  349. NPC is reloaded. Can be accessed from inside the NPC or by calling
  350. 'getvariableofnpc'. Function objects can also have .variables which
  351. are accessible from inside the function, however 'getvariableofnpc'
  352. does NOT work on function objects.
  353. ".@" - A scope variable.
  354. They are unique to the instance and scope. Each instance has its
  355. own scope that ends when the script ends. Calling a function with
  356. callsub/callfunc starts a new scope, returning from the function
  357. ends it. When a scope ends, its variables are converted to values
  358. ('return .@var;' returns a value, not a reference).
  359. "'" - An instance variable
  360. These are used with the instancing system, and are unique to each
  361. party's instance.
  362. "#" - A permanent local account variable.
  363. They are stored in the `global_reg_value` table using type 2.
  364. "##" - A permanent global account variable stored by the login server.
  365. They are stored in the `global_reg_value` table using type 1.
  366. The only difference you will note from normal # variables is when
  367. you have multiple char-servers connected to the same login server.
  368. The # variables are unique to each char-server, while the ## variables
  369. are shared by all these char-servers.
  370. Postfix: integer or string
  371. nothing - integer variable, can store positive and negative numbers, but only
  372. whole numbers (so don't expect to do any fractional math)
  373. '$' - string variable, can store text
  374. Examples:
  375. name - permanent character integer variable
  376. name$ - permanent character string variable
  377. @name - temporary character integer variable
  378. @name$ - temporary character string variable
  379. $name - permanent global integer variable
  380. $name$ - permanent global string variable
  381. $@name - temporary global integer variable
  382. $@name$ - temporary global string variable
  383. .name - NPC integer variable
  384. .name$ - NPC string variable
  385. .@name - scope integer variable
  386. .@name$ - scope string variable
  387. #name - permanent local account integer variable
  388. #name$ - permanent local account string variable
  389. ##name - permanent global account integer variable
  390. ##name$ - permanent global account string variable
  391. If a variable was never set, it is considered to equal zero for integer
  392. variables or an empty string ("", nothing between the quotes) for string
  393. variables. Once you set it to that, the variable is as good as forgotten
  394. forever, and no trace remains of it even if it was stored with character or
  395. account data.
  396. Some variables are special, that is, they are already defined for you by the
  397. scripting engine. You can see the full list somewhere in 'db/const.txt', which
  398. is a file you should read, since it also allows you to replace lots of numbered
  399. arguments for many commands with easier to read text. The special variables most
  400. commonly used are all permanent character-based variables:
  401. Zeny - Amount of Zeny.
  402. Hp - Current amount of hit points.
  403. MaxHp - Maximum amount of hit points.
  404. Sp - Current spell points.
  405. MaxSp - Maximum amount of spell points.
  406. StatusPoint - Amount of status points remaining.
  407. SkillPoint - Amount of skill points remaining.
  408. BaseLevel - Character's base level.
  409. JobLevel - Character's job level.
  410. BaseExp - Amount of base experience points.
  411. JobExp - Amount of job experience points.
  412. NextBaseExp - Amount of base experience points needed to reach the next level.
  413. NextJobExp - Amount of job experience points needed to reach the next level.
  414. Weight - Amount of weight the character currently carries.
  415. MaxWeight - Maximum weight the character can carry.
  416. Sex - 0 if female, 1 if male.
  417. Class - Character's job.
  418. Upper - 0 if the character is a normal class, 1 if advanced, 2 if baby.
  419. BaseClass - The character's 1-1 'normal' job, regardless of Upper value.
  420. For example, this will return Job_Acolyte for Acolyte, Priest/Monk,
  421. High Priest/Champion, and Arch Bishop/Sura. If the character has not
  422. reached a 1-1 class, it will return Job_Novice.
  423. BaseJob - The character's 'normal' job, regardless of Upper value.
  424. For example, this will return Job_Acolyte for Acolyte,
  425. Baby Acolyte, and High Acolyte.
  426. Karma - The character's karma. Karma system is not fully functional, but
  427. this doesn't mean this doesn't work at all. Not tested.
  428. Manner - The character's manner rating. Becomes negative if the player
  429. utters words forbidden through the use of 'manner.txt' client-side
  430. file.
  431. While these behave as variables, do not always expect to just set them - it is
  432. not certain whether this will work for all of them. Whenever there is a command
  433. or a function to set something, it's usually preferable to use that instead. The
  434. notable exception is Zeny, which you can and often will address directly -
  435. setting it will make the character own this number of Zeny.
  436. If you try to set Zeny to a negative number, the script will be terminated with an error.
  437. Some source-end constants can also be accessed in scripts. This list is located in
  438. 'src/map/script.c' in the 'script_hardcoded_constants' function, which contains
  439. constants such as server defines and status options:
  440. PACKETVER, MAX_LEVEL, MAX_STORAGE, MAX_INVENTORY, MAX_CART, MAX_ZENY, MAX_PARTY,
  441. MAX_GUILD, MAX_GUILDLEVEL, MAX_GUILD_STORAGE, MAX_BG_MEMBERS, MAX_CHAT_USERS,
  442. VIP_SCRIPT, MIN_STORAGE
  443. Option_Nothing, Option_Sight, Option_Hide, Option_Cloak, Option_Falcon, Option_Riding,
  444. Option_Invisible, Option_Orcish, Option_Wedding, Option_Chasewalk, Option_Flying,
  445. Option_Xmas, Option_Transform, Option_Summer, Option_Dragon1, Option_Wug,
  446. Option_Wugrider, Option_Madogear, Option_Dragon2, Option_Dragon3, Option_Dragon4,
  447. Option_Dragon5, Option_Hanbok, Option_Oktoberfest, Option_Dragon, Option_Costume
  448. Assigning variables
  449. --------- ---------
  450. As of rAthena revision 15982, variables can be accessed and assigned values directly
  451. without the use of the built-in 'set' function. This means that variables can be
  452. accessed and modified much like other programming languages.
  453. @x = 100;
  454. @x = @y = 100;
  455. Support for modifying variable values using 'set' is still supported (and required
  456. to exist for this new method to work) so previous scripts will continue to work.
  457. When assigning values, all operator methods are supported which exist in the below
  458. 'Operators' section. For instance:
  459. @x += 100;
  460. @x -= 100;
  461. @x *= 2;
  462. @x /= 2;
  463. @x %= 5;
  464. @x >>= 2;
  465. @x <<= 2;
  466. Will all work. For more information on available operators, see the Operators section
  467. described below. All operators listed there may be placed in-front of the '=' sign
  468. when modifying variables to perform the action as required.
  469. Note:
  470. !! Currently the scripting engine does not support directly copying array variables.
  471. !! In order to copy arrays between variables the use of 'copyarray' function is still
  472. !! required.
  473. Strings
  474. -------
  475. To include symbol '"' in a string you should use prefix '\"'
  476. Arrays
  477. ------
  478. Arrays (in rAthena at least) are essentially a set of variables going under the
  479. same name. You can tell between the specific variables of an array with an
  480. 'array index', a number of a variable in that array:
  481. <variable name>[<array index>]
  482. Variables stored in this way, inside an array, are also called 'array elements'.
  483. Arrays are specifically useful for storing a set of similar data (like several
  484. item IDs for example) and then looping through it. You can address any array
  485. variable as if it was a normal variable:
  486. set @arrayofnumbers[0],1;
  487. You can also do sneaky things like using a variable (or an expression, or even a
  488. value from an another array) to get at an array value:
  489. set @x,100;
  490. set @arrayofnumbers[@x],10;
  491. This will make @arrayofnumbers[100] equal to 10.
  492. Notice that index numbering always starts with 0. Arrays cannot hold more than
  493. 128 variables. (So the last one can't have a number higher than 127)
  494. And array indexes probably can't be negative. Nobody tested what happens when
  495. you try to get a negatively numbered variable from an array, but it's not going
  496. to be pretty. :)
  497. Arrays can naturally store strings:
  498. @menulines$[0] is the 0th element of the @menulines$ array of strings. Notice
  499. the '$', normally denoting a string variable, before the square brackets that
  500. denotes an array index.
  501. Resume of the allowed variable and array scopes
  502. -----------------------------------------------
  503. +==========+======+=======+
  504. |VarType | Norm | Array |
  505. +==========+======+=======+
  506. |$Str$ | OK! | OK! |
  507. +----------+------+-------+
  508. |$@Str$ | OK! | OK! |
  509. +----------+------+-------+
  510. |@Str$ | OK! | OK! |
  511. +----------+------+-------+
  512. |#Str$ | OK! | FAIL! |
  513. +----------+------+-------+
  514. |Str$ | OK! | FAIL! |
  515. +----------+------+-------+
  516. |$Int | OK! | OK! |
  517. +----------+------+-------+
  518. |$@Int | OK! | OK! |
  519. +----------+------+-------+
  520. |@Int | OK! | OK! |
  521. +----------+------+-------+
  522. |#Int | OK! | FAIL! |
  523. +----------+------+-------+
  524. |Int | OK! | FAIL! |
  525. +----------+------+-------+
  526. |.Str$ | OK! | OK! |
  527. +----------+------+-------+
  528. |.Int | OK! | OK! |
  529. +----------+------+-------+
  530. |.@Str$ | OK! | OK! |
  531. +----------+------+-------+
  532. |.@Int | OK! | OK! |
  533. +----------+------+-------+
  534. Variable References
  535. -------------------
  536. //##TODO
  537. Operators
  538. ---------
  539. Operators are things you can do to variables and numbers. They are either the
  540. common mathematical operations or conditional operators
  541. + - will add two numbers. If you try to add two strings, the result will be a
  542. string glued together at the +. You can add a number to a string, and the
  543. result will be a string. No other math operators work with strings.
  544. - - will subtract two numbers.
  545. * - will multiply two numbers.
  546. / - will divide two numbers. Note that this is an integer division, i.e.
  547. 7/2 is not equal 3.5, it's equal 3.
  548. % - will give you the remainder of the division. 7%2 is equal to 1.
  549. There are also conditional operators. This has to do with the conditional
  550. command 'if' and they are meant to return either 1 if the condition is satisfied
  551. and 0 if it isn't. (That's what they call 'boolean' variables. 0 means 'False'.
  552. Anything except the zero is 'True' Odd as it is, -1 and -5 and anything below
  553. zero will also be True.)
  554. You can compare numbers to each other and you compare strings to each other, but
  555. you can not compare numbers to strings.
  556. == - Is true if both sides are equal. For strings, it means they are the same.
  557. >= - True if the first value is equal to, or greater than, the second value.
  558. <= - True if the first value is equal to, or less than, the second value
  559. > - True if the first value greater than the second value
  560. < - True if the first value is less than the second value
  561. != - True if the first value IS NOT equal to the second one
  562. Examples:
  563. 1==1 is True.
  564. 1<2 is True while 1>2 is False.
  565. @x>2 is True if @x is equal to 3. But it isn't true if @x is 2.
  566. Only '==' and '!=' have been tested for comparing strings. Since there's no way
  567. to code a seriously complex data structure in this language, trying to sort
  568. strings by alphabet would be pointless anyway.
  569. Comparisons can be stacked in the same condition:
  570. && - Is True if and only if BOTH sides are true.
  571. ('1==1 && 2==2' is true. '2==1 && 1==1' is false.)
  572. || - Is True if either side of this expression is True.
  573. 1==1 && 2==2 is True.
  574. 1==1 && 2==1 is False.
  575. 1==1 || 2==1 is True.
  576. Logical bitwise operators work only on numbers, and they are the following:
  577. << - Left shift.
  578. >> - Right shift.
  579. Left shift moves the binary 1(s) of a number n positions to the left,
  580. which is the same as multiplying by 2, n times.
  581. In the other hand, Right shift moves the binary 1(s) of a number n positions
  582. to the right, which is the same as dividing by 2, n times.
  583. Example:
  584. set b,2;
  585. set a, b << 3;
  586. mes a;
  587. set a, a >> 2;
  588. mes a;
  589. The first mes command would display 16, which is the same as 2 x (2 x 2 x 2) = 16.
  590. The second mes command would display 4, which is the same as 16 / 2 = 8. 8 / 2 = 4.
  591. & - And.
  592. | - Or.
  593. The bitwise operator AND (&) is used to test two values against each other,
  594. and results in setting bits which are active in both arguments. This can
  595. be used for a few things, but in rAthena this operator is usually used to
  596. create bit-masks in scripts.
  597. The bitwise operator OR (|)sets to 1 a binary position if the binary position
  598. of one of the numbers is 1. This way a variable can hold several values we can check,
  599. known as bit-mask. A variable currently can hold up to 32 bit-masks (from position 0
  600. to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks
  601. that a player can have.
  602. A bit-mask basically is (ab)using the variables bits to set various options in
  603. one variable. With the current limit if variables it is possible to store 32
  604. different options in one variable (by using the bits on position 0 to 31).
  605. Example(s):
  606. - Basic example of the & operator, bit example:
  607. 10 & 2 = 2
  608. Why? :
  609. 10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010
  610. 2 = 2^1 (2), so in bits (same size) it would be 0010
  611. The & (AND) operator sets bits which are active (1) in both arguments, so in the
  612. example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit
  613. 0010, which is 2.
  614. - Basic example of creating and using a bit-mask:
  615. set @options,2|4|16; //(note: this is the same as 2+4+16, or 22)
  616. if (@options & 1) mes "Option 1 is activated";
  617. if (@options & 2) mes "Option 2 is activated";
  618. if (@options & 4) mes "Option 3 is activated";
  619. if (@options & 8) mes "Option 4 is activated";
  620. if (@options & 16) mes "Options 5 is activated";
  621. This would return the messages about option 2, 3 and 5 being shown (since we've set
  622. the 2,4 and 16 bit to 1).
  623. ^ - Xor.
  624. The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if both
  625. numbers have the same value in the said position. On the other hand, it
  626. sets to 1 if they have different values in the said binary position.
  627. This is another way of setting and unsetting bits in bit-masks.
  628. Example:
  629. - First let's set the quests that are currently in progress:
  630. set inProgress,1|8|16; // quest 1,8 and 16 are in progress
  631. - After playing for a bit, the player starts another quest:
  632. if( inProgress&2 == 0 ){
  633. // this will set the bit for quest 2 (inProgress has that bit set to 0)
  634. set inProgress,inProgress^2;
  635. mes "Quest 2: find a newbie and be helpful to him for an hour.";
  636. close;
  637. }
  638. - After spending some time reading info on Xor's, the player finally completes quest 1:
  639. if( inProgress&1 && isComplete ){
  640. // this will unset the bit for quest 1 (inProgress has that bit set to 1)
  641. set inProgress,inProgress^1;
  642. mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
  643. close;
  644. }
  645. Unary operators with only with a single number, which follows the operator, and
  646. are following:
  647. - - Negation.
  648. The sign of the number will be reversed. If the number was positive, it will
  649. become negative and vice versa.
  650. Example:
  651. set .@myvar,10;
  652. mes "Negative 10 is "+(-.@myvar);
  653. ! - Logical Not.
  654. Reverses the boolean result of an expression. True will become false and
  655. false will become true.
  656. Example:
  657. if(!callfunc("F_dosomething"))
  658. {
  659. mes "Doing something failed.";
  660. close;
  661. }
  662. ~ - Bitwise Not.
  663. Reverses each bit in a number, also known as one's complement. Cleared bits
  664. are set, and set bits are cleared.
  665. Example:
  666. - Ensure, that quest 2 is disabled, while keeping all other active, if they are.
  667. set inProgress,inProgress&(~2); // same as set inProgress,inProgress&0xfffffffd
  668. Ternary operators take three expressions (numbers, strings or boolean), and are
  669. following:
  670. ?: - Conditional operator
  671. Very useful e.g. to replace
  672. if(Sex) mes "..."; else mes "...";
  673. clauses with simple
  674. mes "Welcome, " + (Sex?"Mr.":"Mrs.") + " " + strcharinfo(0);
  675. or to replace any other simple if-else clauses. It might be worth
  676. mentioning that ?: has low priority and has to be enclosed with
  677. parenthesis in most (if not all) cases.
  678. Labels
  679. ------
  680. Within executable script code, some lines can be labels:
  681. <label name>:
  682. Labels are points of reference in your script, which can be used to route
  683. execution with 'goto', 'menu' and 'jump_zero' commands, invoked with 'doevent'
  684. and 'donpcevent' commands and are otherwise essential. A label's name may not be
  685. longer than 22 characters. (23rd is the ':'.) There is some confusion in the
  686. source about whether it's 22, 23 or 24 all over the place, so keeping labels
  687. under 22 characters could be wise. It may only contain alphanumeric characters
  688. and underscore. In addition to labels you name yourself, there are also some
  689. special labels which the script engine will start execution from if a special
  690. event happens:
  691. OnClock<hour><minute>:
  692. OnMinute<minute>:
  693. OnHour<hour>:
  694. On<weekday><hour><minute>:
  695. OnDay<month><day>:
  696. This will execute when the server clock hits the specified date or time. Hours
  697. and minutes are given in military time. ('0105' will mean 01:05 AM). Weekdays
  698. are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01 to 31.
  699. Remember the zero. :)
  700. OnInit:
  701. OnInterIfInit:
  702. OnInterIfInitOnce:
  703. OnInit will execute every time the scripts loading is complete, including when
  704. they are reloaded with @reloadscript command. OnInterIfInit will execute when
  705. the map server connects to a char server, OnInterIfInitOnce will only execute
  706. once and will not execute if the map server reconnects to the char server later.
  707. OnAgitStart:
  708. OnAgitEnd:
  709. OnAgitInit:
  710. OnAgitStart2:
  711. OnAgitEnd2:
  712. OnAgitInit2:
  713. OnAgitStart will run whenever the server shifts into WoE mode, whether it is
  714. done with @agitstart GM command or with 'AgitStart' script command. OnAgitEnd
  715. will do likewise for the end of WoE.
  716. OnAgitInit will run when data for all castles and all guilds that hold a castle
  717. is received by map-server from the char-server after initial connect.
  718. No RID will be attached while any of the above mentioned labels are triggered, so
  719. no character or account-based variables will be accessible, until you attach a
  720. RID with 'attachrid' (see below).
  721. The above also applies to, the last three labels, the only difference is that
  722. these labels are used exclusively for WoE SE, and are called independently.
  723. OnInstanceInit:
  724. This label will be executed when an instance is created and initialized through
  725. the 'instance_create' command. It will run again if @reloadscript is used while
  726. an instance is in progress.
  727. OnTouch:
  728. This label will be executed if a trigger area is defined for the NPC object it's
  729. in. If it isn't present, the execution will start from the beginning of the NPC
  730. code. The RID of the triggering character object will be attached.
  731. OnTouch_:
  732. Similar to OnTouch, but will only run one instance. Another character is
  733. chosen once the triggering character leaves the area.
  734. OnTouchNPC:
  735. Similar to OnTouch, but will only trigger for monsters. For this case, by using
  736. 'getattachedrid' will returns GID (ID that returned when use 'monster').
  737. OnPCLoginEvent:
  738. OnPCLogoutEvent:
  739. OnPCBaseLvUpEvent:
  740. OnPCJobLvUpEvent:
  741. It's pretty obvious when these four special labels will be invoked.
  742. OnPCDieEvent:
  743. This special label triggers when a player dies. The variable 'killerrid' is
  744. set to the ID of the killer.
  745. OnPCKillEvent:
  746. This special label triggers when a player kills another player. The variable
  747. 'killedrid' is set to the ID of the player killed.
  748. OnNPCKillEvent:
  749. This special label triggers when a player kills a monster. The variable
  750. 'killedrid' is set to the Class (mob ID) of the monster killed.
  751. OnPCLoadMapEvent:
  752. This special label triggers when a player steps in a map marked with the
  753. 'loadevent' mapflag and attaches its RID. The fact that this label requires a
  754. mapflag for it to work is because, otherwise, it'd be server-wide and trigger
  755. every time a player would change maps. Imagine the server load with 1,000 players
  756. (oh the pain...)
  757. OnPCStatCalcEvent:
  758. This special label triggers when a player's stats are recalculated, such as when
  759. changing stats, equipment, or maps, as well as when logging in, leveling up, and
  760. mounting a job mount. This can be used to grant additional item bonuses to certain
  761. player groups, for instance.
  762. OnWhisperGlobal:
  763. This special label triggers when a player whispers the NPC, and will run with the
  764. player's RID attached. It can accept up to ten parameters, which will be stored
  765. into separate temporary character string variables @whispervar0$ to @whispervar9$.
  766. See 'doc/whisper_sys.txt' for further documentation.
  767. Only the special labels which are not associated with any script command are
  768. listed here. There are other kinds of labels which may be triggered in a similar
  769. manner, but they are described with their associated commands.
  770. On<label name>:
  771. These special labels are used with Mob scripts mostly, and script commands
  772. that requires you to point/link a command to a mob or another NPC, giving a label
  773. name to start from. The label name can be any of your liking, but must be
  774. Example:
  775. monster "prontera",123,42,"Poringz0rd",2341,23,"Master::OnThisMobDeath";
  776. amatsu,13,152,4 script Master 767,{
  777. mes "Hi there";
  778. close;
  779. OnThisMobDeath:
  780. announce "Hey, "+strcharinfo(0)+" just killed a Poringz0rd!",bc_blue|bc_all;
  781. end;
  782. }
  783. Each time you kill one, that announce will appear in blue to everyone.
  784. "Global" labels
  785. There's a catch with labels and doevent. If you call a label (using doevent)
  786. and called label is in NPC that has trigger area, that label must end with
  787. "Global" to work globally (i.e. if RID is outside of the trigger area, which
  788. usually happens since otherwise there would be no point calling the label with
  789. doevent, because OnTouch would do the job). For further reference look for
  790. npc_event in npc.c.
  791. Scripting commands and functions
  792. --------------------------------
  793. The commands and functions are listed here in no particular order. There's a
  794. difference between commands and functions - commands leave no 'return value'
  795. which might be used in a conditional statement, as a command argument, or stored
  796. in a variable. Calling commands as if they were functions will sometimes work,
  797. but is not advised, as this can lead to some hard to track errors. Calling
  798. functions as if they were commands will mess up the stack, so 'return' command
  799. will not return correctly after this happens in a particular script.
  800. All commands must end with a ';'. Actually, you may expect to have multiple
  801. commands on one line if you properly terminate them with a ';', but it's better
  802. if you don't, since it is not certain just whether the scripting engine will
  803. behave nicely if you do.
  804. -------------------------
  805. From here on, we will have the commands sorted as follow:
  806. 1.- Basic commands.
  807. 2.- Information-retrieving commands.
  808. 3.- Checking commands.
  809. 4.- Player-related commands.
  810. 5.- Mob / NPC -related commands.
  811. 6.- Other commands.
  812. 7.- Instance commands.
  813. 8.- Quest Log commands.
  814. 9.- Battleground commands.
  815. 10.- Pet commands.
  816. 10.1.- The Pet AI commands.
  817. 11.- Homunculus commands.
  818. 12.- Mercenary commands.
  819. 13.- Party commands.
  820. =====================
  821. |1.- Basic commands.|
  822. =====================
  823. ---------------------------------------
  824. *mes "<string>"{,"<string>"{,...}};
  825. This command will display a box on the screen for the invoking character, if no
  826. such box is displayed already, and will print the string specified into that
  827. box. There is normally no 'close' or 'next' button on this box, unless you
  828. create one with 'close' or 'next', and while it's open the player can't do much
  829. else, so it's important to create a button later. If the string is empty, it
  830. will show up as an empty line.
  831. mes "Text that will appear in the box";
  832. Colors
  833. ------
  834. Inside the string you may put color codes, which will alter the color of the
  835. text printed after them. The color codes are all '^<R><G><B>' and contain three
  836. hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is
  837. bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.
  838. ^FF00FF is a pure magenta, but it's also a color that is considered transparent
  839. whenever the client is drawing windows on screen, so printing text in that color
  840. will have kind of a weird effect. Once you've set a text's color to something,
  841. you have to set it back to black unless you want all the rest of the text be in
  842. that color:
  843. mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";
  844. Notice that the text coloring is handled purely by the client. If you use non-
  845. English characters, the color codes might get screwed if they stick to letters
  846. with no intervening space. Separating them with spaces from the letters on
  847. either side solves the problem.
  848. Multiple Lines
  849. --------------
  850. To display multiple lines of message while only using a single 'mes' command,
  851. use the script command in the following format:
  852. mes "Line 1", "Line 2", "Line 3";
  853. This will display 3 different lines while only consuming a single line in
  854. the relevant script file.
  855. Navigation
  856. ----------
  857. For clients dated 2011-10-10aRagexe onwards, you can generate navigation links
  858. using HTML-like labels:
  859. <NAVI>Display Name<INFO>mapname,x,y,0,000,flag</INFO></NAVI>
  860. The "flag" parameter can be:
  861. 0: Do not open Navigation Window (default).
  862. 1: Open Navigation Window.
  863. The example below will make the [Tool Shop] text clickable and begin navigation
  864. to alberta (98,154) when clicked.
  865. mes "Have you checked out the <NAVI>[Tool Shop]<INFO>alberta,98,154,0,000,0</INFO></NAVI>?";
  866. URLs
  867. ----
  868. Similarly, you can create links to websites that launch in a new window:
  869. <URL>Display Name<INFO>http://www.example.com/</INFO></URL>";
  870. ---------------------------------------
  871. *next;
  872. This command will display a 'next' button in the message window for the
  873. invoking character. Clicking on it will cause the window to clear and display
  874. a new one. Used to segment NPC-talking, next is often used in combination with
  875. 'mes' and 'close'.
  876. If no window is currently on screen, one will be created, but once the invoking
  877. character clicks on it, a warning is thrown on the server console and the script
  878. will terminate.
  879. mes "[Woman]";
  880. mes "This would appear on the page";
  881. next;
  882. // This is needed since it is a new page and the top will now be blank
  883. mes "[Woman]";
  884. mes "This would appear on the 2nd page";
  885. ---------------------------------------
  886. *close;
  887. This command will create a 'close' button in the message window for the invoking
  888. character. If no window is currently on screen, the script execution will end. This is one
  889. of the ways to end a speech from an NPC. Once the button is clicked, the NPC
  890. script execution will end, and the message box will disappear.
  891. mes "[Woman]";
  892. mes "I am finished talking to you. Click the close button.";
  893. close;
  894. mes "This command will not run at all, since the script has ended.";
  895. ---------------------------------------
  896. *close2;
  897. This command will create a 'close' button in the message window for the invoking
  898. character. WARNING: If no window is currently on screen, the script execution will halt
  899. indefinitely! See 'close'. There is one important difference, though - even though
  900. the message box will have closed, the script execution will not stop, and commands after
  901. 'close2' will still run, meaning an 'end' has to be used to stop the script, unless you
  902. make it stop in some other manner.
  903. mes "[Woman]";
  904. mes "I will warp you now.";
  905. close2;
  906. warp "place",50,50;
  907. end;
  908. Don't expect things to run smoothly if you don't make your scripts 'end'.
  909. ---------------------------------------
  910. *end;
  911. This command will stop the execution for this particular script. The two
  912. versions are perfectly equivalent. It is the normal way to end a script which
  913. does not use 'mes'.
  914. if (BaseLevel<=10) goto L_Lvl10;
  915. if (BaseLevel<=20) goto L_Lvl20;
  916. if (BaseLevel<=30) goto L_Lvl30;
  917. if (BaseLevel<=40) goto L_Lvl40;
  918. if (BaseLevel<=50) goto L_Lvl50;
  919. if (BaseLevel<=60) goto L_Lvl60;
  920. if (BaseLevel<=70) goto L_Lvl70;
  921. L_Lvl10:
  922. npctalk "Look at that you are still a n00b";
  923. end;
  924. L_Lvl20:
  925. npctalk "Look at that you are getting better, but still a n00b";
  926. end;
  927. L_Lvl30:
  928. npctalk "Look at that you are getting there, you are almost 2nd profession now right???";
  929. end;
  930. L_Lvl40:
  931. npctalk "Look at that you are almost 2nd profession";
  932. end;
  933. Without the use of 'end' it would travel through the labels until the end of the
  934. script. If you were lvl 10 or less, you would see all the speech lines, the use
  935. of 'end' stops this, and ends the script.
  936. ---------------------------------------
  937. *set <variable>,<expression>{,<char_id>};
  938. *set(<variable>,<expression>{,<char id>})
  939. This command will set a variable to the value that the expression results in.
  940. Variables may either be set through this command or directly, much like any
  941. other programming language (refer to the "Assigning variables" section).
  942. This is the most basic script command and is used a lot whenever you try to do
  943. anything more advanced than just printing text into a message box.
  944. set @x,100;
  945. will make @x equal 100.
  946. set @x,1+5/8+9;
  947. will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are
  948. integer in this language) and make @x equal it.
  949. Returns the variable reference (since trunk r12870).
  950. ---------------------------------------
  951. *setd "<variable name>",<value>{,<char_id>};
  952. Works almost identically as set, except the variable name is identified as a string
  953. and can thus be constructed dynamically.
  954. This command is equivalent to:
  955. set getd("variable name"),<value>;
  956. Examples:
  957. setd ".@var$", "Poporing";
  958. mes .@var$; // Displays "Poporing".
  959. setd ".@" + .@var$ + "123$", "Poporing is cool";
  960. mes .@Poporing123$; // Displays "Poporing is cool".
  961. NOTE:
  962. 'char_id' only works for non-server variables.
  963. Player with Character ID 'char_id' must be online.
  964. ---------------------------------------
  965. *getd("<variable name>")
  966. Returns a reference to a variable, the name can be constructed dynamically.
  967. Refer to 'setd' for usage.
  968. This can also be used to set an array dynamically:
  969. setarray getd(".array[0]"), 1, 2, 3, 4, 5;
  970. Examples:
  971. set getd("$varRefence"), 1;
  972. set @i, getd("$" + "pikachu");
  973. ---------------------------------------
  974. *getvariableofnpc(<variable>,"<npc name>")
  975. Returns a reference to a NPC variable (. prefix) from the target NPC.
  976. This can only be used to get . variables.
  977. Examples:
  978. //This will return the value of .var, note that this can't be used, since the value isn't caught.
  979. getvariableofnpc(.var,"TargetNPC");
  980. //This will set the .v variable to the value of the TargetNPC's .var variable.
  981. set .v, getvariableofnpc(.var,"TargetNPC");
  982. //This will set the .var variable of TargetNPC to 1.
  983. set getvariableofnpc(.var,"TargetNPC"), 1;
  984. Note: even though function objects can have .variables,
  985. getvariableofnpc will not work on them.
  986. ---------------------------------------
  987. *getvar <variable>,<char_id>;
  988. Get variable value from the specified player. Only player/account variables
  989. are allowed to be used (temporary character variable "@", permanent
  990. character "", permanent local account "#", and permanent global account "##").
  991. ---------------------------------------
  992. *goto <label>;
  993. This command will make the script jump to a label, usually used in conjunction
  994. with other command, such as "if", but often used on its own.
  995. ...
  996. goto Label;
  997. mes "This will not be seen";
  998. Label:
  999. mes "This will be seen";
  1000. Note by FlavioJS: goto's are "evil" and should be avoided if possible (ò_ó)
  1001. ---------------------------------------
  1002. *menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...};
  1003. This command will create a selectable menu for the invoking character. Only one
  1004. menu can be on screen at the same time.
  1005. Depending on what the player picks from the menu, the script execution will
  1006. continue from the corresponding label. (it's string-label pairs, not label-
  1007. string)
  1008. Options can be grouped together, separated by the character ':'.
  1009. menu "A:B",L_Wrong,"C",L_Right;
  1010. It also sets a special temporary character variable @menu, which contains the
  1011. number of option the player picked. (Numbering of options starts at 1.)
  1012. This number is consistent with empty options and grouped options.
  1013. menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
  1014. L_Wrong:
  1015. // If they click "A" or "B" they will end up here
  1016. // @menu == 1 if "A"
  1017. // @menu == 2 will never happen because the option is empty
  1018. // @menu == 3 if "B"
  1019. L_Impossible:
  1020. // Empty options are not displayed and therefore can't be selected
  1021. // this label will never be reached from the menu command
  1022. L_Right:
  1023. // If they click "C" they will end up here
  1024. // @menu == 5
  1025. If a label is '-', the script execution will continue right after the menu
  1026. command if that option is selected, this can be used to save you time, and
  1027. optimize big scripts.
  1028. menu "A::B:",-,"C",L_Right;
  1029. // If they click "A" or "B" they will end up here
  1030. // @menu == 1 if "A"
  1031. // @menu == 3 if "B"
  1032. L_Right:
  1033. // If they click "C" they will end up here
  1034. // @menu == 5
  1035. Both these examples will perform the exact same task.
  1036. If you give an empty string as a menu item, the item will not display. This
  1037. can effectively be used to script dynamic menus by using empty string for
  1038. entries that should be unavailable at that time.
  1039. You can do it by using arrays, but watch carefully - this trick isn't high
  1040. wizardry, but minor magic at least. You can't expect to easily duplicate it
  1041. until you understand how it works.
  1042. Create a temporary array of strings to contain your menu items, and populate it
  1043. with the strings that should go into the menu at this execution, making sure not
  1044. to leave any gaps. Normally, you do it with a loop and an extra counter, like
  1045. this:
  1046. setarray @possiblemenuitems$[0],<list of potential menu items>;
  1047. @j = 0; // That's the menu lines counter.
  1048. // We loop through the list of possible menu items.
  1049. // @i is our loop counter.
  1050. for( @i = 0; @i < getarraysize(@possiblemenuitems$); @i++ )
  1051. {
  1052. // That 'condition' is whatever condition that determines whether
  1053. // a menu item number @i actually goes into the menu or not.
  1054. if (<condition>)
  1055. {
  1056. // We record the option into the list of options actually available.
  1057. @menulist$[@j] = @possiblemenuitems$[@i];
  1058. // We just copied the string, we do need its number for later
  1059. // though, so we record it as well.
  1060. @menureference[@j] = @i;
  1061. // Since we've just added a menu item into the list, we increment
  1062. // the menu lines counter.
  1063. @j++;
  1064. }
  1065. // We go on to the next possible menu item.
  1066. }
  1067. This will create you an array @menulist$ which contains the text of all items
  1068. that should actually go into the menu based on your condition, and an array
  1069. @menureference, which contains their numbers in the list of possible menu items.
  1070. (Remember, arrays start with 0.) There's less of them than the possible menu
  1071. items you've defined, but the menu command can handle the empty lines - only if
  1072. they are last in the list, and if it's made this way, they are. Now comes a
  1073. dirty trick:
  1074. // X is whatever the most menu items you expect to handle.
  1075. menu @menulist$[0],-,@menulist$[1],-,....@menulist$[<X>],-;
  1076. This calls up a menu of all your items. Since you didn't copy some of the
  1077. possible menu items into the list, its end is empty and so no menu items will
  1078. show up past the end. But this menu call doesn't jump anywhere, it just
  1079. continues execution right after the menu command. (And it's a good thing it
  1080. doesn't, cause you can only explicitly define labels to jump to, and how do you
  1081. know which ones to define if you don't know beforehand which options will end up
  1082. where in your menu?)
  1083. But how do you figure out which option the user picked? Enter the @menu.
  1084. @menu contains the number of option that the user selected from the list,
  1085. starting with 1 for the first option. You know now which option the user picked
  1086. and which number in your real list of possible menu items it translated to:
  1087. mes "You selected "+@possiblemenuitems$[@menureference[@menu-1]]+"!";
  1088. @menu is the number of option the user picked.
  1089. @menu-1 is the array index for the list of actually used menu items that we
  1090. made.
  1091. @menureference[@menu-1] is the number of the item in the array of possible menu
  1092. items that we've saved just for this purpose.
  1093. And @possiblemenuitems$[@menureference[@menu-1]] is the string that we used to
  1094. display the menu line the user picked. (Yes, it's a handful, but it works.)
  1095. You can set up a bunch of 'if (@menureference[@menu-1]==X) goto Y' statements to
  1096. route your execution based on the line selected and still generate a different
  1097. menu every time, which is handy when you want to, for example, make users select
  1098. items in any specific order before proceeding, or make a randomly shuffled menu.
  1099. Kafra code bundled with the standard distribution uses a similar array-based
  1100. menu technique for teleport lists, but it's much simpler and doesn't use @menu,
  1101. probably since that wasn't documented anywhere.
  1102. See also 'select', which is probably better in this particular case. Instead of
  1103. menu, you could use 'select' like this:
  1104. @dummy = select(@menulist$[0],@menulist$[1],....@menulist$[<X>]);
  1105. For the purposes of the technique described above these two statements are
  1106. perfectly equivalent.
  1107. ---------------------------------------
  1108. *select("<option>"{,"<option>",...})
  1109. *prompt("<option>"{,"<option>",...})
  1110. This function is a handy replacement for 'menu' for some specific cases where
  1111. you don't want a complex label structure - like, for example, asking simple yes-
  1112. no questions. It will return the number of menu option picked, starting with 1.
  1113. Like 'menu', it will also set the variable @menu to contain the option the user
  1114. picked.
  1115. if (select("Yes:No")==1) mes "You said yes, I know.";
  1116. And like 'menu', the selected option is consistent with grouped options
  1117. and empty options.
  1118. 'prompt' works almost the same as select, except that when a character clicks
  1119. the Cancel button, this function will return 255 instead.
  1120. ---------------------------------------
  1121. *input(<variable>{,<min>{,<max>}})
  1122. This command will make an input box pop up on the client connected to the
  1123. invoking character, to allow entering of a number or a string. This has many
  1124. uses, one example would be a guessing game, also making use of the 'rand'
  1125. function:
  1126. mes "[Woman]";
  1127. mes "Try and guess the number I am thinking of.";
  1128. mes "The number will be between 1 and 10.";
  1129. next;
  1130. .@number = rand(1,10);
  1131. input .@guess;
  1132. if (.@guess == .@number) {
  1133. mes "[Woman]";
  1134. mes "Well done, that was the number I was thinking of!";
  1135. close;
  1136. } else {
  1137. mes "[Woman]";
  1138. mes "Sorry, that wasn't the number I was thinking of.";
  1139. close;
  1140. }
  1141. If you give the input command a string variable to put the input in, it will
  1142. allow the player to enter text. Otherwise, only numbers will be allowed.
  1143. mes "[Woman]";
  1144. mes "Please say HELLO";
  1145. next;
  1146. input .@var$;
  1147. if (.@var$ == "HELLO") {
  1148. mes "[Woman]";
  1149. mes "Well done, you typed it correctly.";
  1150. close;
  1151. } else {
  1152. mes "[Woman]";
  1153. mes "Sorry, you got it wrong.";
  1154. close;
  1155. }
  1156. Normally you may not input a negative number with this command.
  1157. This is done to prevent exploits in badly written scripts, which would
  1158. let people, for example, put negative amounts of Zeny into a bank script and
  1159. receive free Zeny as a result.
  1160. Since trunk r12192 the command has two optional arguments and a return value.
  1161. The default value of 'min' and 'max' can be set with 'input_min_value' and
  1162. 'input_max_value' in script_athena.conf.
  1163. For numeric inputs the value is capped to the range [min,max]. Returns 1 if
  1164. the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
  1165. For string inputs it returns 1 if the string was longer than 'max', -1 is
  1166. shorter than 'min' and 0 otherwise.
  1167. ---------------------------------------
  1168. *callfunc "<function>"{,<argument>,...<argument>};
  1169. *callfunc("<function>"{,<argument>,...<argument>})
  1170. This command lets you call up a function NPC. A function NPC can be called from
  1171. any script on any map server. Using the 'return' command it will come back to
  1172. the place that called it.
  1173. place,50,50,6%TAB%script%TAB%Woman%TAB%115,{
  1174. mes "[Woman]"
  1175. mes "Let's see if you win...";
  1176. callfunc "funcNPC";
  1177. mes "Well done, you have won!";
  1178. close;
  1179. }
  1180. function%TAB%script%TAB%funcNPC%TAB%{
  1181. .@win = rand(2);
  1182. if (.@win == 0) return;
  1183. mes "Sorry, you lost.";
  1184. close;
  1185. }
  1186. You can pass arguments to your function - values telling it what exactly to do -
  1187. which will be available there with getarg() (see 'getarg')
  1188. Notice that returning is not mandatory, you can end execution right there.
  1189. If you want to return a real value from inside your function NPC, it is better
  1190. to write it in the function form, which will also work and will make the script
  1191. generally cleaner:
  1192. place,50,50,6%TAB%script%TAB%Man%TAB%115,{
  1193. mes "[Man]"
  1194. mes "Gimme a number!";
  1195. next;
  1196. input @number;
  1197. if (callfunc("OddFunc",@number)) mes "It's Odd!";
  1198. close;
  1199. }
  1200. function%TAB%script%TAB%OddFunc%TAB%{
  1201. if (getarg(0)%2==0) return 0;// it's even
  1202. return 1;// it's odd
  1203. }
  1204. Alternately, as of rAthena revision 15979 and 15981, user-defined functions
  1205. may be called directly without the use of the 'callfunc' script command.
  1206. function<tab>script<tab>SayHello<tab>{
  1207. mes "Hello " + getarg(0);
  1208. return 0;
  1209. }
  1210. place,50,50,6<tab>script<tab>Man<tab>115,{
  1211. mes "[Man]";
  1212. SayHello strcharinfo(0);
  1213. close;
  1214. }
  1215. Note:
  1216. !! A user-defined function must be declared /before/ a script attempts to
  1217. !! call it. That is to say, any functions should be placed above scripts or NPCs
  1218. !! (or loaded in a separate file first) before attempting to call them directly.
  1219. ---------------------------------------
  1220. *callsub <label>{,<argument>,...<argument>};
  1221. *callsub(<label>{,<argument>,...<argument>})
  1222. This command will go to a specified label within the current script (do NOT use
  1223. quotes around it) coming in as if it were a 'callfunc' call, and pass it
  1224. arguments given, if any, which can be recovered there with 'getarg'. When done
  1225. there, you should use the 'return' command to go back to the point from where
  1226. this label was called. This is used when there is a specific thing the script
  1227. will do over and over, this lets you use the same bit of code as many times as
  1228. you like, to save space and time, without creating extra NPC objects which are
  1229. needed with 'callfunc'. A label is not callable in this manner from another
  1230. script.
  1231. Example 1: callsub for checking (if checks pass, return to script)
  1232. callsub S_CheckFull, "guild_vs2",50;
  1233. switch( rand(4) ) {
  1234. case 0: warp "guild_vs2",9,50; end;
  1235. case 1: warp "guild_vs2",49,90; end;
  1236. case 2: warp "guild_vs2",90,50; end;
  1237. case 3: warp "guild_vs2",49,9; end;
  1238. }
  1239. ...
  1240. S_CheckFull:
  1241. if (getmapusers(getarg(0)) >= getarg(1)) {
  1242. mes "I'm sorry, this arena is full. Please try again later.";
  1243. close;
  1244. }
  1245. return;
  1246. Example 2: callsub used repeatedly, with different arguments
  1247. // notice how the Zeny check/delete is reused, instead of copy-pasting for every warp
  1248. switch(select("Abyss Lake:Amatsu Dungeon:Anthell:Ayothaya Dungeon:Beacon Island, Pharos") {
  1249. case 1: callsub S_DunWarp,"hu_fild05",192,207;
  1250. case 2: callsub S_DunWarp,"ama_in02",119,181;
  1251. case 3: callsub S_DunWarp,"moc_fild20",164,145;
  1252. case 4: callsub S_DunWarp,"ayo_fild02",279,150;
  1253. case 5: callsub S_DunWarp,"cmd_fild07",132,125;
  1254. // etc
  1255. }
  1256. ...
  1257. S_DunWarp:
  1258. // getarg(0) = "map name"
  1259. // getarg(1) = x
  1260. // getarg(2) = y
  1261. if (Zeny >= 100) {
  1262. Zeny -= 100;
  1263. warp getarg(0),getarg(1),getarg(2);
  1264. } else {
  1265. mes "Dungeon warp costs 100 Zeny.";
  1266. }
  1267. close;
  1268. ---------------------------------------
  1269. *getarg(<index>{,<default_value>})
  1270. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1271. call you can specify variables that will make that call different from another
  1272. one. This function will return an argument the function or subroutine was
  1273. called with, and is the normal way to get them.
  1274. This is another thing that can let you use the same code more than once.
  1275. Argument numbering starts with 0, i.e. the first argument you gave is number 0.
  1276. If no such argument was given, a zero is returned.
  1277. place,50,50,6%TAB%script%TAB%Woman1%TAB%115,{
  1278. mes "[Woman]";
  1279. mes "Let's see if you win...";
  1280. callfunc "funcNPC",2;
  1281. mes "Well done, you have won!";
  1282. close;
  1283. }
  1284. place,52,50,6%TAB%script%TAB%Woman2%TAB%115,{
  1285. mes "[Woman]";
  1286. mes "Let's see if you win...";
  1287. callfunc "funcNPC",5;
  1288. mes "Well done, you have won!";
  1289. close;
  1290. }
  1291. function%TAB%script%TAB%funcNPC%TAB%{
  1292. .@win = rand(getarg(0));
  1293. if (.@win == 0) return;
  1294. mes "Sorry, you lost.";
  1295. close;
  1296. |
  1297. "woman1" NPC object calls the funcNPC. The argument it gives in this call is
  1298. stated as 2, so when the random number is generated by the 'rand' function, it
  1299. can only be 0 or 1. Whereas "woman2" gives 5 as the argument number 0 when
  1300. calling the function, so the random number could be 0, 1, 2, 3 or 4, this makes
  1301. "woman2" less likely to say the player won.
  1302. You can pass multiple arguments in a function call:
  1303. callfunc "funcNPC",5,4,3;
  1304. getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3.
  1305. 'getarg' has an optional argument since trunk r10773 and stable r10958.
  1306. If the target argument exists, it is returned.
  1307. Otherwise, if <default_value> is present it is returned instead,
  1308. if not the script terminates immediately.
  1309. In the previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1.
  1310. ---------------------------------------
  1311. *getargcount()
  1312. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1313. call you can specify arguments. This function will return the number of arguments
  1314. provided.
  1315. Example:
  1316. callfunc "funcNPC",5,4,3;
  1317. ...
  1318. function%TAB%script%TAB%funcNPC%TAB%{
  1319. .@count = getargcount(); // 3
  1320. ...
  1321. }
  1322. ---------------------------------------
  1323. *return {<value>};
  1324. This command causes the script execution to leave previously called function
  1325. with callfunc or script with callsub and return to the location, where the call
  1326. originated from. Optionally a return value can be supplied, when the call was
  1327. done using the function form.
  1328. Using this command outside of functions or scripts referenced by callsub will
  1329. result in error and termination of the script.
  1330. callfunc "<your function>";// when nothing is returned
  1331. set <variable>,callfunc("<your function>");// when a value is being returned
  1332. ---------------------------------------
  1333. *function <function name>;
  1334. *<function name>{(<argument>,...<argument>)};
  1335. *function <function name> {
  1336. <code>
  1337. }
  1338. This works like callfunc, and is used for cleaner and faster scripting. The function
  1339. must be defined and used within a script, and works like a label with arguments.
  1340. Note that the name may only contain alphanumeric characters and underscore.
  1341. Usage:
  1342. 1. Declare the function.
  1343. function <function name>;
  1344. 2. Call the function anywhere within the script.
  1345. It can also return a value when used with parentheses.
  1346. <function name>;
  1347. 3. Define the function within the script.
  1348. <function name> {<code>}
  1349. Example:
  1350. prontera,154,189,4 script Item Seller 767,{
  1351. /* Function declaration */
  1352. function SF_Selling;
  1353. if (Zeny > 50) {
  1354. mes "Welcome!";
  1355. /* Function call */
  1356. SF_Selling;
  1357. }
  1358. else mes "You need 50z, sorry!";
  1359. close;
  1360. /* Function definition */
  1361. function SF_Selling {
  1362. mes "Would you like to buy a phracon for 50z?";
  1363. next;
  1364. if(select("Yes","No, thanks") == 1) {
  1365. Zeny -= Zeny;
  1366. getitem 1010,1;
  1367. mes "Thank you!";
  1368. }
  1369. return;
  1370. }
  1371. }
  1372. Example with parameters and return value:
  1373. prontera,150,150,0 script TestNPC 123,{
  1374. /* Function declaration */
  1375. function MyAdd;
  1376. mes "Enter two numbers.";
  1377. next;
  1378. input .@a;
  1379. input .@b;
  1380. /* Function call */
  1381. mes .@a+" + "+.@b+" = "+MyAdd(.@a,.@b);
  1382. close;
  1383. /* Function definition */
  1384. function MyAdd {
  1385. return getarg(0)+getarg(1);
  1386. }
  1387. }
  1388. ---------------------------------------
  1389. *is_function("<function name>")
  1390. This command checks whether a function exists.
  1391. It returns 1 if function is found, or 0 if it isn't.
  1392. Example:
  1393. function script try {
  1394. dothat;
  1395. }
  1396. - script test -1,{
  1397. .@try = is_function("try"); // 1
  1398. .@not = is_function("not"); // 0
  1399. }
  1400. ---------------------------------------
  1401. *if (<condition>) <statement>;
  1402. This is the basic conditional statement command, and just about the only one
  1403. available in this scripting language.
  1404. The condition can be any expression. All expressions resulting in a non-zero
  1405. value will be considered True, including negative values. All expressions
  1406. resulting in a zero are false.
  1407. If the expression results in True, the statement will be executed. If it isn't
  1408. true, nothing happens and we move on to the next line of the script.
  1409. if (1) mes "This will always print.";
  1410. if (0) mes "And this will never print.";
  1411. if (5) mes "This will also always print.";
  1412. if (-1) mes "Funny as it is, this will also print just fine.";
  1413. For more information on conditional operators see the operators section above.
  1414. Anything that is returned by a function can be used in a condition check without
  1415. bothering to store it in a specific variable:
  1416. if (strcharinfo(0)=="Daniel Jackson") mes "It is true, you are Daniel!";
  1417. More examples of using the 'if' command in the real world:
  1418. Example 1:
  1419. .@answer = 1;
  1420. input .@input;
  1421. if (.@input == .@answer)
  1422. close;
  1423. mes "Sorry, your answer is incorrect.";
  1424. close;
  1425. Example 2:
  1426. .@answer = 1;
  1427. input .@input;
  1428. if (.@input != .@answer)
  1429. mes "Sorry, your answer is incorrect.";
  1430. close;
  1431. Notice that examples 1 and 2 have the same effect.
  1432. Example 3:
  1433. @count++;
  1434. mes "[Forgetful Man]";
  1435. if (@count == 1) mes "This is the first time you have talked to me.";
  1436. if (@count == 2) mes "This is the second time you have talked to me.";
  1437. if (@count == 3) mes "This is the third time you have talked to me.";
  1438. if (@count == 4) {
  1439. mes "This is the fourth time you have talked to me.";
  1440. mes "I think I am getting amnesia, I have forgotten about you...";
  1441. @count = 0;
  1442. }
  1443. close;
  1444. Example 4:
  1445. mes "[Quest Person]";
  1446. if (countitem(512) < 1) { // 512 is the item ID for Apple, found in item_db
  1447. mes "Can you please bring me an apple?";
  1448. close;
  1449. }
  1450. mes "Oh, you brought an Apple!";
  1451. mes "I didn't want it, I just wanted to see one.";
  1452. close;
  1453. Example 5:
  1454. mes "[Person Checker]";
  1455. if ($@name$ == "") { // global variable not yet set
  1456. mes "Please tell me someones name";
  1457. next;
  1458. input $@name$;
  1459. $@name2$ = strcharinfo(0);
  1460. mes "[Person Checker]";
  1461. mes "Thank you.";
  1462. close;
  1463. }
  1464. if ($@name$ == strcharinfo(0)) { // player name matches $@name$
  1465. mes "You are the person that " +$@name2$+ " just mentioned.";
  1466. mes "Nice to meet you!";
  1467. // reset the global variables
  1468. $@name$ = "";
  1469. $@name2$ = "";
  1470. close;
  1471. }
  1472. mes "You are not the person that " +$name2$+ " mentioned.";
  1473. close;
  1474. See 'strcharinfo' for an explanation of what this function does.
  1475. Example 6: Using complex conditions.
  1476. mes "[Multiple Checks]";
  1477. if ( (@queststarted == 1) && (countitem(512) >= 5) ) {
  1478. mes "Well done, you have started the quest and brought me 5 Apples.";
  1479. @queststarted = 0;
  1480. delitem 512,5;
  1481. close;
  1482. }
  1483. mes "Please bring me 5 apples.";
  1484. @queststarted = 1;
  1485. close;
  1486. The script engine also supports nested 'if' statements:
  1487. if (<condition>)
  1488. dothis;
  1489. else
  1490. dothat;
  1491. If the condition isn't met, it'll do the action following the 'else'.
  1492. We can also group several actions depending on a condition:
  1493. if (<condition>) {
  1494. dothis1;
  1495. dothis2;
  1496. } else {
  1497. dothat1;
  1498. dothat2;
  1499. dothat3;
  1500. }
  1501. Remember that if you plan to do several actions upon the condition being false, and
  1502. you forget to use the curly braces (the { } ), the second action will be executed regardless
  1503. the output of the condition, unless of course, you stop the execution of the script if the
  1504. condition is true (that is, in the first grouping using a return; , and end; or a close; )
  1505. Also, you can have multiple conditions nested or chained, and don't worry about limits as to
  1506. how many nested if you can have, there is no spoon ;)
  1507. if (<condition 1>)
  1508. dothis;
  1509. else if (<condition 2>) {
  1510. dothat;
  1511. end;
  1512. } else
  1513. dothis;
  1514. ---------------------------------------
  1515. *jump_zero (<condition>),<label>;
  1516. This command works kinda like an 'if'+'goto' combination in one go. (See 'if').
  1517. If the condition is false (equal to zero) this command will immediately jump to
  1518. the specified label like in 'goto'. While 'if' is more generally useful, for
  1519. some cases this could be an optimization.
  1520. The main reason for this command is that other control statements, like
  1521. 'switch', 'for' or 'while', are disassembled into simple expressions together
  1522. with this command when a script is parsed.
  1523. ---------------------------------------
  1524. *switch (expression);
  1525. The switch statement is similar to a series of if statements on the same expression.
  1526. In many occasions, you may want to compare the same variable (or expression)
  1527. with many different values, and execute a different piece of code depending
  1528. on which value it equals to. This is exactly what the switch statement is for.
  1529. It is important to understand how the switch statement is executed in order
  1530. to avoid mistakes. The switch statement executes line by line (actually, statement by statement).
  1531. In the beginning, no code is executed. Only when a case statement is found
  1532. with a value that matches the value of the switch expression the case statement(s)
  1533. will to executed. The parser continues to execute the statements until the end
  1534. of the switch block, or the first time it sees a break statement. If you don't
  1535. write a break statement at the end of a case's statement list, the parser will
  1536. go on executing the statements of the following case (fall-through).
  1537. Example 1:
  1538. switch(select("Yes:No")) {
  1539. case 1:
  1540. mes "You said yes!";
  1541. break;
  1542. case 2:
  1543. mes "Aww, why?";
  1544. break;
  1545. }
  1546. close;
  1547. The example above would work like a menu and would go to the first case if
  1548. the user selects option, otherwise, would go to the second one.
  1549. Example 2:
  1550. switch(getgroupid()) {
  1551. case 1:
  1552. mes "Wow, you're super!";
  1553. break;
  1554. case 2:
  1555. mes "A helping hand!";
  1556. break;
  1557. case 3:
  1558. mes "10001010010011";
  1559. break;
  1560. case 4:
  1561. mes "Yes, milord?";
  1562. break;
  1563. default:
  1564. mes "Hello there!";
  1565. break;
  1566. }
  1567. The example above would print a message depending on the player's groupid.
  1568. If there is no statement declared for the corresponding groupid, the script
  1569. would use the 'default' statement that applies to rest of possible values,
  1570. similar to 'else' in the if-else statement.
  1571. ---------------------------------------
  1572. *while (<condition>) <statement>;
  1573. This is probably the simplest and most frequently used loop structure. The 'while'
  1574. statement can be interpreted as "while <condition> is true, perform <statement>".
  1575. It is a pretest loop, meaning the conditional expression is tested before any of the
  1576. statements in the body of the loop are performed. If the condition evaluates to
  1577. false, the statement(s) in the body of the loop is/are never executed. If the
  1578. condition evaluates to true, the statement(s) are executed, then control transfers
  1579. back to the conditional expression, which is reevaluated and the cycle continues.
  1580. Multiple statements can be grouped with { }, curly braces, just like with the 'if' statement.
  1581. Example 1:
  1582. while (switch(select("Yes:No") == 2 ))
  1583. mes "You picked no.";
  1584. close;
  1585. Example 2: multiple statements
  1586. while (switch(select("Yes:No") == 2 )) {
  1587. mes "Why did you pick no?";
  1588. mes "You should pick yes instead!";
  1589. }
  1590. close;
  1591. Example 3: counter-controlled loop
  1592. .@i = 1;
  1593. while (.@i <= 5) {
  1594. mes "This line will print 5 times.";
  1595. .@i += 1;
  1596. }
  1597. close;
  1598. Example 4: sentinel-controlled loop
  1599. mes "Input 0 to stop";
  1600. input .@num;
  1601. while (.@num != 0) {
  1602. mes "You entered " + .@num;
  1603. input .@num;
  1604. }
  1605. close;
  1606. ---------------------------------------
  1607. *for (<variable initialization>; <condition>; <variable update>) <statement>;
  1608. Another pretest looping structure is the 'for' statement. It is considered a
  1609. specialized form of the 'while' statement, and is usually associated with counter-
  1610. controlled loops. Here are the steps of the 'for' statement: the initialize
  1611. statement is executed first and only once. The condition test is performed.
  1612. When the condition evaluates to false, the rest of the for statement is skipped.
  1613. When the condition evaluates to true, the body of the loop is executed, then the
  1614. update statement is executed (this usually involves incrementing a variable).
  1615. Then the condition is reevaluated and the cycle continues.
  1616. Example 1:
  1617. for( .@i = 1; .@i <= 5; .@i++ )
  1618. mes "This line will print 5 times.";
  1619. Example 2:
  1620. mes "This will print the numbers 1 - 5.";
  1621. for( .@i = 1; .@i <= 5; .@i++ )
  1622. mes "Number: " + .@i;
  1623. ---------------------------------------
  1624. *do { <statement>; } while (<condition>);
  1625. The 'do...while' is the only post-test loop structure available in this script
  1626. language. With a post-test, the statements are executed once before the condition
  1627. is tested. When the condition is true, the statement(s) are repeated. When the
  1628. condition is false, control is transferred to the statement following the
  1629. 'do...while' loop expression.
  1630. Example 1: sentinel-controlled loop
  1631. mes "This menu will keep appearing until you pick Cancel";
  1632. do {
  1633. .@menu = select("One:Two:Three:Cancel");
  1634. } while (.@menu != 4);
  1635. Example 2: counter-controlled loop
  1636. mes "This will countdown from 10 to 1.";
  1637. .@i = 10;
  1638. do {
  1639. mes .@i;
  1640. .@i -= 1;
  1641. } while (.@i > 0);
  1642. ---------------------------------------
  1643. *freeloop({<toggle>})
  1644. Toggling this to enabled (1) allows the script instance to bypass the infinite loop
  1645. protection, allowing your script to loop as much as it may need. Disabling (0) will
  1646. warn you if an infinite loop is detected.
  1647. The command will return the state of freeloop for the attached script, even if no
  1648. argument is provided.
  1649. Example:
  1650. freeloop(1); // enable script to loop freely
  1651. // be careful with what you do here
  1652. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1653. dothis;
  1654. // will sleep the script for 1ms when detect an infinity loop to
  1655. // let rAthena do what it needs to do (socket, timer, process, etc.)
  1656. }
  1657. freeloop(0); // disable freeloop
  1658. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1659. dothis;
  1660. // throw an infinity loop error
  1661. }
  1662. ---------------------------------------
  1663. *setarray <array name>[<first value>],<value>{,<value>...<value>};
  1664. This command will allow you to quickly fill up an array in one go. Check the
  1665. Kafra scripts in the distribution to see this used a lot.
  1666. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1667. First value is the index of the first element of the array to alter. For
  1668. example:
  1669. setarray @array[0],200,200,200;
  1670. setarray @array[1],300,150;
  1671. will produce:
  1672. @array[0]=200
  1673. @array[1]=300
  1674. @array[2]=150
  1675. ---------------------------------------
  1676. *cleararray <array name>[<first value to alter>],<value>,<number of values to set>;
  1677. This command will change many array values at the same time to the same value.
  1678. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1679. // This will make all 6 values 0
  1680. cleararray @array[0],0,6;
  1681. // This will make array element 0 change to 245
  1682. cleararray @array[0],245,1;
  1683. // This will make elements 1 and 2 change to 345
  1684. cleararray @array[1],345,2;
  1685. See 'setarray'.
  1686. ---------------------------------------
  1687. *copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>;
  1688. This command lets you quickly shuffle a lot of data between arrays, which is in
  1689. some cases invaluable.
  1690. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1691. // So we have made @array[]
  1692. copyarray @array2[0],@array[2],2;
  1693. // Now, @array2[0] will be equal to @array[2] (300) and
  1694. // @array2[1] will be equal to @array[3].
  1695. So using the examples above:
  1696. @array[0] = 100
  1697. @array[1] = 200
  1698. @array[2] = 300
  1699. @array[3] = 400
  1700. @array[4] = 500
  1701. @array[5] = 600
  1702. New Array:
  1703. @array2[0] = 300
  1704. @array2[1] = 400
  1705. @array2[2] = 0
  1706. @array2[3] = 0
  1707. Notice that @array[4] and @array[5] won't be copied to the second array, and it will return a
  1708. 0.
  1709. ---------------------------------------
  1710. *deletearray <array name>[<first value>],<how much to delete>;
  1711. This command will delete a specified number of array elements totally from an
  1712. array, shifting all the elements beyond this towards the beginning.
  1713. // This will delete array element 0, and move all the other array elements
  1714. // up one place.
  1715. deletearray @array[0],1
  1716. // This would delete array elements numbered 1, 2 and 3, leave element 0 in its
  1717. // place, and move the other elements ups, so there are no gaps.
  1718. deletearray @array[1],3
  1719. ---------------------------------------
  1720. ======================================
  1721. |2.- Information-retrieving commands.|
  1722. ======================================
  1723. ---------------------------------------
  1724. *strcharinfo(<type>{,<char_id>})
  1725. This function will return either the name, party name or guild name for the
  1726. invoking character. Whatever it returns is determined by type.
  1727. 0 - Character's name.
  1728. 1 - The name of the party they're in if any.
  1729. 2 - The name of the guild they're in if any.
  1730. 3 - The name of the map the character is in.
  1731. If a character is not a member of any party or guild, an empty string will be
  1732. returned when requesting that information.
  1733. ---------------------------------------
  1734. *strnpcinfo(<type>)
  1735. This function will return the various parts of the name of the calling NPC.
  1736. Whatever it returns is determined by type.
  1737. 0 - The NPC's display name (visible#hidden)
  1738. 1 - The visible part of the NPC's display name
  1739. 2 - The hidden part of the NPC's display name
  1740. 3 - The NPC's unique name (::name)
  1741. 4 - The name of the map the NPC is in.
  1742. ---------------------------------------
  1743. *getarraysize(<array name>)
  1744. This function returns the number of values that are contained inside the
  1745. specified array. Notice that zeros and empty strings at the end of this array
  1746. are not counted towards this number.
  1747. For example:
  1748. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1749. set @arraysize,getarraysize(@array);
  1750. This will make @arraysize == 6. But if you try this:
  1751. setarray @array[0], 100, 200, 300, 400, 500, 600, 0;
  1752. set @arraysize,getarraysize(@array);
  1753. @arraysize will still equal 6, even though you've set 7 values.
  1754. ---------------------------------------
  1755. *getelementofarray(<array name>,<index>)
  1756. This command retrieves the value of the element of given array at given index.
  1757. This is equivalent to using:
  1758. <array name>[<index>]
  1759. The reason for this is, that this short form is internally converted into a call
  1760. to getelementofarray, when the script is loaded.
  1761. Also useful when passing arrays to functions or accessing another npc's arrays:
  1762. getelementofarray(getarg(0),<index>)
  1763. getelementofarray(getvariableofnpc(.var, "testNPC"),<index>)
  1764. ---------------------------------------
  1765. *readparam(<parameter number>{,"<character name>"})
  1766. This function will return the specified stat of the invoking character, or, if a
  1767. character name is specified, of that player. The stat can either be a number or
  1768. parameter name, defined in 'db/const.txt'.
  1769. Some example parameters:
  1770. StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight, MaxWeight,
  1771. JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp, Sp, MaxSp,
  1772. BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk
  1773. All of these also behave as variables, but don't expect to be able to just 'set'
  1774. them - some will not work for various internal reasons.
  1775. Example 1:
  1776. // Returns how many status points you haven't spent yet.
  1777. mes "Unused status points: "+readparam(9);
  1778. Using this particular information as a function call is not required. Typing this
  1779. will return the same result:
  1780. mes "Unused status points: "+StatusPoint;
  1781. Example 2:
  1782. You can also use this command to get stat values.
  1783. if (readparam(bVit) > 77)
  1784. mes "Only people with over 77 Vit are reading this!";
  1785. ---------------------------------------
  1786. *getcharid(<type>{,"<character name>"})
  1787. This function will return a unique ID number of the invoking character, or, if a
  1788. character name is specified, of that player.
  1789. Type is the kind of associated ID number required:
  1790. 0 - Character ID
  1791. 1 - Party ID
  1792. 2 - Guild ID
  1793. 3 - Account ID
  1794. 4 - Battle Ground ID
  1795. For most purposes other than printing it, a number is better to have than a name
  1796. (people do horrifying things to their character names).
  1797. If the character is not in a party or not in a guild, the function will return 0
  1798. if guild or party number is requested. If a name is specified and the character
  1799. is not found, 0 is returned.
  1800. If getcharid(0) returns a zero, the script got called not by a character and
  1801. doesn't have an attached RID. Note that this will cause the map server to
  1802. print "player not attached!" error messages, so it is preferred to use
  1803. "playerattached" to check for the character attached to the script.
  1804. if (getcharid(2) == 0)
  1805. mes "Only members of a guild are allowed here!";
  1806. ---------------------------------------
  1807. *getnpcid(<type>{,"<npc name>"});
  1808. Retrieves IDs of the currently invoked NPC. If a unique npc name is
  1809. given, IDs of that NPC are retrieved instead. Type specifies what ID
  1810. to retrieve and can be one of the following:
  1811. 0 - NPC Game ID
  1812. If an invalid type is given or the NPC does not exist, 0 is returned.
  1813. ---------------------------------------
  1814. *getchildid({<char_id>})
  1815. *getmotherid({<char_id>})
  1816. *getfatherid({<char_id>})
  1817. These functions return the character ID of the attached player's child,
  1818. mother, mother, or father, respectively. It returns 0 if no ID is found.
  1819. if (getmotherid()) mes "Your mother's ID is: "+getmotherid();
  1820. ---------------------------------------
  1821. *ispartneron({<char_id>})
  1822. This function returns 1 if the invoking character's marriage partner is
  1823. currently online and 0 if they are not or if the character has no partner.
  1824. ---------------------------------------
  1825. *getpartnerid({<char_id>})
  1826. This function returns the character ID of the invoking character's marriage
  1827. partner, if any. If the invoking character is not married, it will return 0,
  1828. which is a quick way to see if they are married:
  1829. if (getpartnerid()) mes "I'm not going to be your girlfriend!";
  1830. if (getpartnerid()) mes "You're married already!";
  1831. ---------------------------------------
  1832. *getlook(<type>{,<char_id>})
  1833. This function will return the number for the current character look value
  1834. specified by type. See 'setlook' for valid look types.
  1835. This can be used to make a certain script behave differently for characters
  1836. dressed in black. :)
  1837. ---------------------------------------
  1838. *getsavepoint(<information type>{,<char_id>})
  1839. This function will return information about the invoking character's save point.
  1840. You can use it to let a character swap between several recorded save points.
  1841. Available information types are:
  1842. 0 - Map name (a string)
  1843. 1 - X coordinate
  1844. 2 - Y coordinate
  1845. ---------------------------------------
  1846. *getcharip({"<character name>"|<account id>|<char id>})
  1847. This function will return the IP address of the invoking character, or, if a player
  1848. is specified, of that character. A blank string is returned if no player is attached.
  1849. Examples:
  1850. // Outputs IP address of attached player.
  1851. mes "Your IP: " + getcharip();
  1852. // Outputs IP address of character "Silver".
  1853. mes "Silver's IP: " + getcharip("Silver");
  1854. ---------------------------------------
  1855. *vip_status(<type>,{"<character name>"})
  1856. Returns various information about a player's VIP status.
  1857. Valid types:
  1858. 1 - VIP status. (1 if VIP, 0 if non-VIP)
  1859. 2 - VIP expire date. (timestamp string if VIP, 0 if non-VIP)
  1860. 3 - VIP time remaining. (timestamp string if VIP, 0 if non-VIP)
  1861. NOTE: This command is only available if the VIP System is enabled.
  1862. ---------------------------------------
  1863. *vip_time <time>,{"<character name>"};
  1864. Changes a player's VIP time (in minutes). A positive value will increase time, and a
  1865. negative value will decrease time.
  1866. NOTE: This command is only available if the VIP System is enabled.
  1867. ---------------------------------------
  1868. *addspiritball <count>,<duration>{,<char_id>};
  1869. Adds spirit ball to player for 'duration' in milisecond.
  1870. ---------------------------------------
  1871. *delspiritball <count>{,<char_id>};
  1872. Deletes the spirit ball(s) from player.
  1873. ---------------------------------------
  1874. *countspiritball {<char_id>};
  1875. Counts the spirit ball that player has.
  1876. ---------------------------------------
  1877. *ignoretimeout <flag>{,<char_id>};
  1878. Disables the SECURE_NPCTIMEOUT function on the character invoking the script,
  1879. or by the given character ID/character name.
  1880. Valid flag:
  1881. 0 - Enabled SECURE_NPCTIMEOUT.
  1882. 1 - Disable SECURE_NPCTIMEOUT.
  1883. Note: SECURE_NPCTIMEOUT must be enabled for this to work.
  1884. ---------------------------------------
  1885. \\
  1886. 2,2 Item-related commands
  1887. \\
  1888. ---------------------------------------
  1889. *getequipid(<equipment slot>{,<char_id>})
  1890. This function returns the item ID of the item equipped in the equipment slot
  1891. specified on the invoking character. If nothing is equipped there, it returns -1.
  1892. Valid equipment slots are:
  1893. EQI_HEAD_TOP (1) - Upper Headgear
  1894. EQI_ARMOR (2) - Armor (jackets, robes)
  1895. EQI_HAND_L (3) - Left hand (weapons, shields)
  1896. EQI_HAND_R (4) - Right hand (weapons)
  1897. EQI_GARMENT (5) - Garment (mufflers, hoods, manteaus)
  1898. EQI_SHOES (6) - Footgear (shoes, boots)
  1899. EQI_ACC_L (7) - Accessory 1
  1900. EQI_ACC_R (8) - Accessory 2
  1901. EQI_HEAD_MID (9) - Middle Headgear (masks, glasses)
  1902. EQI_HEAD_LOW (10) - Lower Headgear (beards, some masks)
  1903. EQI_COSTUME_HEAD_LOW (11) - Lower Costume Headgear
  1904. EQI_COSTUME_HEAD_MID (12) - Middle Costume Headgear
  1905. EQI_COSTUME_HEAD_TOP (13) - Upper Costume Headgear
  1906. EQI_COSTUME_GARMENT (14) - Costume Garment
  1907. EQI_AMMO (15) - Arrow/Ammunition
  1908. EQI_SHADOW_ARMOR (16) - Shadow Armor
  1909. EQI_SHADOW_WEAPON (17) - Shadow Weapon
  1910. EQI_SHADOW_SHIELD (18) - Shadow Shield
  1911. EQI_SHADOW_SHOES (19) - Shadow Shoes
  1912. EQI_SHADOW_ACC_R (20) - Shadow Accessory 2
  1913. EQI_SHADOW_ACC_L (21) - Shadow Accessory 1
  1914. Notice that a few items occupy several equipment slots, and if the character is
  1915. wearing such an item, 'getequipid' will return its ID number for either slot.
  1916. Can be used to check if you have something equipped, or if you haven't got
  1917. something equipped:
  1918. if(getequipid(EQI_HEAD_TOP)==2234) goto L_WearingTiara;
  1919. mes "Come back when you have a Tiara on";
  1920. close;
  1921. L_WearingTiara:
  1922. mes "What a lovely Tiara you have on";
  1923. close;
  1924. You can also use it to make sure people don't pass a point before removing an
  1925. item totally from them. Let's say you don't want people to wear Legion Plate
  1926. armor, but also don't want them to equip if after the check, you would do this:
  1927. if ((getequipid(EQI_ARMOR) == 2341) || (getequipid(EQI_ARMOR) == 2342) goto L_EquipedLegionPlate;
  1928. // the || is used as an or argument, there is 2341 and 2342 cause there are
  1929. // two different legion plate armors, one with a slot one without.
  1930. if ((countitem(2341) > 0) || (countitem(2432) > 0) goto L_InventoryLegionPlate;
  1931. mes "I will lets you pass";
  1932. close2;
  1933. warp "place",50,50;
  1934. end;
  1935. L_EquipedLegionPlate:
  1936. mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
  1937. close;
  1938. L_InventoryLegionPlate:
  1939. mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
  1940. close;
  1941. ---------------------------------------
  1942. *getequipuniqueid(<equipment slot>{,<char_id>})
  1943. This function returns the unique ID (as a string) of the item equipped in the equipment slot
  1944. specified on the invoking character. If nothing is equipped there, it returns an empty string.
  1945. See 'getequipid' for a full list of valid equipment slots.
  1946. ---------------------------------------
  1947. *getequipname(<equipment slot>{,<char_id>})
  1948. Returns the jname of the item equipped in the specified equipment slot on the
  1949. invoking character, or an empty string if nothing is equipped in that position.
  1950. Does the same thing as getitemname(getequipid()). Useful for an NPC to state
  1951. what your are wearing, or maybe saving as a string variable.
  1952. See 'getequipid' for a full list of valid equipment slots.
  1953. if( getequipname(EQI_HEAD_TOP) != "" )
  1954. mes "So you are wearing a "+getequipname(EQI_HEAD_TOP)+" on your head";
  1955. else
  1956. mes "You are not wearing any head gear";
  1957. ---------------------------------------
  1958. *getitemname(<item id>)
  1959. Given the database ID number of an item, this function will return the text
  1960. stored in the 'japanese name' field (which, in rAthena, stores an English name
  1961. the players would normally see on screen.)
  1962. ---------------------------------------
  1963. *getbrokenid(<number>{,<char_id>})
  1964. This function will search the invoking character's inventory for any broken
  1965. items, and will return their item ID numbers. Since the character may have
  1966. several broken items, 1 given as an argument will return the first one found, 2
  1967. will return the second one, etc. Will return 0 if no such item is found.
  1968. // Let's see if they have anything broken:
  1969. if (getbrokenid(1)==0) goto Skip;
  1970. // They do, so let's print the name of the first broken item:
  1971. mes "Oh, I see you have a broken "+getitemname(getbrokenid(1))+" here!";
  1972. Skip:
  1973. mes "You don't have anything broken, quit bothering me.";
  1974. ---------------------------------------
  1975. *getequipisequiped(<equipment slot>{,<char_id>})
  1976. This functions will return 1 if there is an equipment placed on the specified
  1977. equipment slot and 0 otherwise. For a list of equipment slots
  1978. see 'getequipid'. Function originally used by the refining NPCs:
  1979. if (getequipisequiped(EQI_HEAD_TOP)) goto L_equipped;
  1980. mes "[Refiner]";
  1981. mes "Do you want me to refine your dumb head?";
  1982. close;
  1983. L_equipped:
  1984. mes "[Refiner]";
  1985. mes "That's a fine hat you are wearing there...";
  1986. close;
  1987. ---------------------------------------
  1988. *getequipisenableref(<equipment slot>{,<char_id>})
  1989. Will return 1 if the item equipped on the invoking character in the specified
  1990. equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
  1991. see 'getequipid'.
  1992. if (getequipisenableref(EQI_HEAD_TOP)) goto L_Refine;
  1993. mes "[Refiner]";
  1994. mes "I can't refine this hat!...";
  1995. close;
  1996. L_Refine:
  1997. mes "[Refiner]";
  1998. mes "Ok I can refine this";
  1999. close;
  2000. ---------------------------------------
  2001. *getequiprefinerycnt(<equipment slot>{,<char_id>})
  2002. Returns the current number of pluses for the item in the specified equipment
  2003. slot. For a list of equipment slots see 'getequipid'.
  2004. Can be used to check if you have reached a maximum refine value, default for
  2005. this is +10:
  2006. if(getequiprefinerycnt(EQI_HEAD_TOP) < 10) goto L_Refine_HeadGear;
  2007. mes "Sorry, it's not possible to refine hats better than +10";
  2008. close;
  2009. L_Refine_HeadGear:
  2010. mes "I will now upgrade your "+getequipname(EQI_HEAD_TOP);
  2011. ---------------------------------------
  2012. *getequipweaponlv(<equipment slot>{,<char_id>})
  2013. This function returns the weapon level for the weapon equipped in the specified
  2014. equipment slot on the invoking character. For a list of equipment slots see
  2015. 'getequipid'.
  2016. Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons have
  2017. a weapon level. You can, however, probably, use this field for other equippable
  2018. custom items as a flag or something.
  2019. If no item is equipped in this slot, or if it doesn't have a weapon level
  2020. according to the database, 0 will be returned.
  2021. Examples:
  2022. // Right hand can only contain a weapon.
  2023. switch (getequipweaponlv(EQI_HAND_R)) {
  2024. case 1: mes "You are holding a lvl 1 weapon."; break;
  2025. case 2: mes "You are holding a lvl 2 weapon."; break;
  2026. case 3: mes "You are holding a lvl 3 weapon."; break;
  2027. case 4: mes "You are holding a lvl 4 weapon."; break;
  2028. case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
  2029. default: mes "Seems you don't have a weapon on."; break;
  2030. }
  2031. // Left hand can hold either a weapon or shield.
  2032. if (getequipid(EQI_HAND_R) == 0) {
  2033. mes "Seems you have nothing equipped here.";
  2034. close;
  2035. }
  2036. switch (getequipweaponlv(EQI_HAND_L)) {
  2037. case 0: mes "You are holding a shield, so it doesn't have a level."; break;
  2038. case 1: mes "You are holding a lvl 1 weapon."; break;
  2039. case 2: mes "You are holding a lvl 2 weapon."; break;
  2040. case 3: mes "You are holding a lvl 3 weapon."; break;
  2041. case 4: mes "You are holding a lvl 4 weapon."; break;
  2042. case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
  2043. }
  2044. ---------------------------------------
  2045. *getequippercentrefinery(<equipment slot>{,<char_id>})
  2046. This function calculates and returns the percent value chance to successfully
  2047. refine the item found in the specified equipment slot of the invoking character
  2048. by +1. There is no actual formula, the success rate for a given weapon level of
  2049. a certain refine level is found in the db/refine_db.txt file. For a list of
  2050. equipment slots see 'getequipid'.
  2051. These values can be displayed for the player to see, or used to calculate the
  2052. random change of a refine succeeding or failing and then going through with it
  2053. (which is what the official NPC refinery scripts use it for)
  2054. // This will find a random number from 0 - 99 and if that is equal to or more
  2055. // than the value recovered by this command it will go to L_Fail
  2056. if (getequippercentrefinery(EQI_HAND_L)<=rand(100)) goto L_Fail;
  2057. ---------------------------------------
  2058. *getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
  2059. This function will count all the items with the specified ID number lying on the
  2060. ground on the specified map within the x1/y1-x2/y2 square on it and return that
  2061. number.
  2062. This is the only function around where a parameter may be either a string or a
  2063. number! If it's a number, it means that only the items with that item ID number
  2064. will be counted. If it is a string, it is assumed to mean the 'english name'
  2065. field from the item database. If you give it an empty string, or something that
  2066. isn't found from the item database, it will count items number '512' (apples).
  2067. ---------------------------------------
  2068. *getequipcardcnt(<equipment slot>)
  2069. This function will return the number of cards that have been compounded onto a
  2070. specific equipped item for the invoking character. See 'getequipid' for a list
  2071. of possible equipment slots.
  2072. ---------------------------------------
  2073. *getinventorylist {<char_id>};
  2074. This command sets a bunch of arrays with a complete list of whatever the
  2075. invoking character has in their inventory, including all the data needed to
  2076. recreate these items perfectly if they are destroyed. Here's what you get:
  2077. @inventorylist_id[] - array of item ids.
  2078. @inventorylist_amount[] - their corresponding item amounts.
  2079. @inventorylist_equip[] - whether the item is equipped or not.
  2080. @inventorylist_refine[] - for how much it is refined.
  2081. @inventorylist_identify[] - whether it is identified.
  2082. @inventorylist_attribute[] - whether it is broken.
  2083. @inventorylist_card1[] - These four arrays contain card data for the items.
  2084. @inventorylist_card2[] These data slots are also used to store names
  2085. @inventorylist_card3[] inscribed on the items, so you can explicitly check
  2086. @inventorylist_card4[] if the character owns an item made by a specific
  2087. craftsman.
  2088. @inventorylist_expire[] - expire time (Unix time stamp). 0 means never expires.
  2089. @inventorylist_bound[] - whether it is bound to the character
  2090. @inventorylist_count - the number of items in these lists.
  2091. This could be handy to save/restore a character's inventory, since no other
  2092. command returns such a complete set of data, and could also be the only way to
  2093. correctly handle an NPC trader for carded and named items who could resell them
  2094. - since NPC objects cannot own items, so they have to store item data in
  2095. variables and recreate the items.
  2096. Notice that the variables this command generates are all temporary, attached to
  2097. the character, and integer.
  2098. Be sure to use @inventorylist_count to go through these arrays, and not
  2099. 'getarraysize', because the arrays are not automatically cleared between runs
  2100. of 'getinventorylist'.
  2101. ---------------------------------------
  2102. *cardscnt()
  2103. This function will return the number of cards inserted into the equipment
  2104. from which the function is called.
  2105. This function is intended for use in item scripts.
  2106. ---------------------------------------
  2107. *getrefine()
  2108. This function will return the refine count of the equipment from which the
  2109. function is called.
  2110. This function is intended for use in item scripts.
  2111. ---------------------------------------
  2112. *getnameditem(<item id>,"<name to inscribe>");
  2113. *getnameditem("<item name>","<name to inscribe>");
  2114. This function is equivalent to using 'getitem', however, it will not just give
  2115. the character an item object, but will also inscribe it with a specified
  2116. character's name. You may not inscribe items with arbitrary strings, only with
  2117. names of characters that actually exist. While this isn't said anywhere
  2118. specifically, apparently, named items may not have cards in them, slots or no -
  2119. these data slots are taken by the character ID who's name is inscribed. Only one
  2120. remains free and it's not quite clear if a card may be there.
  2121. This function will return 1 if an item was successfully created and 0 if it
  2122. wasn't for whatever reason. Like 'getitem', this function will also accept an
  2123. 'english name' from the item database as an item name and will return 0 if no
  2124. such item exists.
  2125. ---------------------------------------
  2126. *getitemslots(<item ID>)
  2127. This function will look up the item with the specified ID number in the database
  2128. and return the number of slots this kind of items has - 0 if they are not
  2129. slotted. It will also be 0 for all non-equippable items, naturally, unless
  2130. someone messed up the item database. It will return -1 if there is no such item.
  2131. Example:
  2132. //.@slots now has the amount of slots of the item with ID 1205.
  2133. .@slots = getitemslots(1205);
  2134. ---------------------------------------
  2135. *getiteminfo(<item ID>,<type>)
  2136. This function will look up the item with the specified ID number in the database
  2137. and return the info set by TYPE argument.
  2138. It will return -1 if there is no such item.
  2139. Valid types are:
  2140. 0 - Buy Price
  2141. 1 - Sell Price
  2142. 2 - Type
  2143. 3 - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
  2144. if = 0, then monsters don't drop it at all (rare or a quest item)
  2145. if = 10000, then this item is sold in NPC shops only
  2146. 4 - Gender
  2147. 5 - Loc
  2148. 6 - Weight
  2149. 7 - ATK
  2150. 8 - DEF
  2151. 9 - Range
  2152. 10 - Slot
  2153. 11 - View
  2154. 12 - eLV
  2155. 13 - wLV
  2156. 14 - SpriteID from 'db/item_avail.txt'
  2157. 15 - eLVMax
  2158. 16 - matk if RENEWAL is defined
  2159. See the sample in 'doc/sample/getiteminfo.txt'.
  2160. ---------------------------------------
  2161. *getequipcardid(<equipment slot>,<card slot>)
  2162. Returns value from equipped item slot in the indicated slot (0, 1, 2, or 3).
  2163. This function returns CARD ID, 255,254,-255 (for card 0, if the item is produced).
  2164. It's useful for when you want to check whether an item contains cards or if it's signed.
  2165. ---------------------------------------
  2166. *mergeitem({,<char_id>});
  2167. Open merge item window to merge available item can be merged.
  2168. Examples
  2169. 1. See the NPC 'npc/re/other/merge_item.txt'.
  2170. 2. Simple usage:
  2171. mes "Let's check if any item can be merged.";
  2172. close2;
  2173. mergeitem;
  2174. end;
  2175. ---------------------------------------
  2176. *mergeitem2({<item_id>{,<char_id>}});
  2177. *mergeitem2({"<item name>"{,<char_id>}});
  2178. Merge all stackable items that separated by GUID flags
  2179. (either by flag 4 item_flag.txt or GUID in item_group).
  2180. If no item ID/name given, all possible items in player's inventory will be merged.
  2181. ---------------------------------------
  2182. //
  2183. 2,1.- End of item-related commands.
  2184. //
  2185. ---------------------------------------
  2186. *getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})
  2187. This function will locate a character object, NPC object or pet's coordinates
  2188. and place their coordinates into the variables specified when calling it. It
  2189. will return 0 if the search was successful, and -1 if the parameters given were
  2190. not variables or the search was not successful.
  2191. Type is the type of object to search for:
  2192. 0 - Character object
  2193. 1 - NPC object
  2194. 2 - Pet object
  2195. 3 - Monster object -- See 'getunitdata' for monster.
  2196. 4 - Homunculus object
  2197. 5 - Mercenary object
  2198. 6 - Elemental object
  2199. While 3 is meant to look for a monster object, no searching will be done if you
  2200. specify type 3, and the function will always return -1.
  2201. The search string is optional. If it is not specified, the location of the
  2202. invoking character will always be returned for types 0 and 2, the location of
  2203. the NPC running this function for type 1.
  2204. If a search string is specified, for types 0 and 1, the character or NPC with
  2205. the specified name will be located. If type is 3, the search will locate the
  2206. current pet of the character who's name is given in the search string, it will
  2207. NOT locate a pet by name.
  2208. Example:
  2209. prontera,164,301,3%TAB%script%TAB%Meh%TAB%730,{
  2210. mes "My name is Meh. I'm here so that Nyah can find me.";
  2211. close;
  2212. }
  2213. prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
  2214. mes "My name is Nyah.";
  2215. mes "I will now search for Meh all across the world!";
  2216. if (getmapxy(@mapname$,@mapx,@mapy,1,"Meh")!=0) {
  2217. mes "I can't seem to find Meh anywhere!";
  2218. close;
  2219. }
  2220. mes "And I found him on map "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !";
  2221. close;
  2222. }
  2223. Notice that NPC objects disabled with 'disablenpc' will still be located.
  2224. ---------------------------------------
  2225. *mapid2name(<map ID>)
  2226. Returns the map name of the given map ID. Returns an empty string if given
  2227. map ID doesn't exist.
  2228. ---------------------------------------
  2229. *getgmlevel({<char_id>})
  2230. This function will return the (GM) level associated with the player group to which
  2231. the invoking character belongs. If this is somehow executed from a console command,
  2232. 99 will be returned, and 0 will be returned if the account has no GM level.
  2233. This allows you to make NPC's only accessible for certain GM levels, or behave
  2234. specially when talked to by GMs.
  2235. if (getgmlevel()) mes "What is your command, your godhood?";
  2236. ---------------------------------------
  2237. *getgroupid({<char_id>})
  2238. This function will return the group id to which the invoking player belongs.
  2239. ---------------------------------------
  2240. *gettimetick(<tick type>)
  2241. This function will return a tick depending on <tick type>:
  2242. 0: The server's tick, a measurement in milliseconds used by the server's timer
  2243. system. This tick is an unsigned int which loops every ~50 days.
  2244. 1: The time, in seconds, since the start of the current day.
  2245. 2: The system time in UNIX epoch time, or the number of seconds elapsed since
  2246. January 1st, 1970. Useful for reliably measuring time intervals.
  2247. ---------------------------------------
  2248. *gettime(<type>)
  2249. This function will return specified information about the current system time.
  2250. 1 - Seconds (of a minute)
  2251. 2 - Minutes (of an hour)
  2252. 3 - Hour (of a day)
  2253. 4 - Week day (0 for Sunday, 6 is Saturday)
  2254. 5 - Day of the month.
  2255. 6 - Number of the month.
  2256. 7 - Year.
  2257. 8 - Day of the year.
  2258. It will only return numbers.
  2259. if (gettime(4)==6) mes "It's a Saturday. I don't work on Saturdays.";
  2260. ---------------------------------------
  2261. *gettimestr(<format string>,<max length>)
  2262. This function will return a string containing time data as specified by the
  2263. format string.
  2264. This uses the C function 'strfmtime', which obeys special format characters. For
  2265. a full description see, for example, the description of 'strfmtime' at
  2266. http://www.delorie.com/gnu/docs/glibc/libc_437.html
  2267. All the format characters given in there should properly work.
  2268. Max length is the maximum length of a time string to generate.
  2269. The example given in rAthena sample scripts works like this:
  2270. mes gettimestr("%Y-%m/%d %H:%M:%S",21);
  2271. This will print a full date and time like 'YYYY-MM/DD HH:MM:SS'.
  2272. ---------------------------------------
  2273. *getusers(<type>)
  2274. This function will return a number of users on a map or the whole server. What
  2275. it returns is specified by Type.
  2276. Type can be one of the following values, which control what will be returned:
  2277. 0 - Count of all characters on the map of the invoking character.
  2278. 1 - Count of all characters in the entire server.
  2279. 8 - Count of all characters on the map of the NPC the script is
  2280. running in.
  2281. ---------------------------------------
  2282. *getmapusers("<map name>")
  2283. This function will return the number of users currently located on the specified
  2284. map.
  2285. This is used officially in PVP scripts to check whether a room is filled to capacity.
  2286. ---------------------------------------
  2287. *getareausers("<map name>",<x1>,<y1>,<x2>,<y2>)
  2288. This function will return the count of connected characters which are located
  2289. within the specified area - an x1/y1-x2/y2 square on the specified map.
  2290. This is useful for maps that are split into many buildings, such as all the
  2291. "*_in" maps, due to all the shops and houses.
  2292. ---------------------------------------
  2293. \\
  2294. 2,2.- Guild-related commands
  2295. \\
  2296. ---------------------------------------
  2297. *getguildname(<guild id>)
  2298. This function returns a guild's name given an ID number. If there is no such
  2299. guild, "null" will be returned.
  2300. Example:
  2301. mes "The guild "+getguildname(10007)+" are all nice people.";
  2302. ---------------------------------------
  2303. *getguildmember <guild id>{,<type>};
  2304. This command will find all members of a specified guild and returns their names
  2305. (or character id or account id depending on the value of "type") into an array
  2306. of temporary global variables.
  2307. Upon executing this,
  2308. $@guildmembername$[] is a global temporary string array which contains all the
  2309. names of these guild members.
  2310. (only set when type is 0 or not specified)
  2311. $@guildmembercid[] is a global temporary number array which contains the
  2312. character id of these guild members.
  2313. (only set when type is 1)
  2314. $@guildmemberaid[] is a global temporary number array which contains the
  2315. account id of these guild members.
  2316. (only set when type is 2)
  2317. $@guildmembercount is the number of guild members that were found.
  2318. The guild members will be found regardless of whether they are online or offline.
  2319. Note that the names come in no particular order.
  2320. Be sure to use $@guildmembercount to go through this array, and not
  2321. 'getarraysize', because it is not cleared between runs of 'getguildmember'.
  2322. For usage examples, see 'getpartymember'.
  2323. ---------------------------------------
  2324. *getguildmaster(<guild id>)
  2325. This function return the name of the master of the guild which has the specified
  2326. ID number. If there is no such guild, "null" will be returned.
  2327. Example 1:
  2328. // Prints the guild master of guild 10007, whoever that might be.
  2329. mes getguildmaster(10007)+" runs "+getguildname(10007);
  2330. Example 2:
  2331. // Checks if the character is the guild master of the specified guild.
  2332. .@GID = getcharid(2);
  2333. if (.@GID == 0) {
  2334. mes "Sorry, you are not in a guild.";
  2335. close;
  2336. }
  2337. if (strcharinfo(0) != getguildmaster(.@GID)) {
  2338. mes "Sorry, you don't own the guild you are in.";
  2339. close;
  2340. }
  2341. mes "Welcome, guild master of "+getguildname(.@GID);
  2342. close;
  2343. ---------------------------------------
  2344. *getguildmasterid(<guild id>)
  2345. This function will return the character ID number of the guild master of the
  2346. guild specified by the ID. 0 if the character is not a guild master of any guild.
  2347. ---------------------------------------
  2348. *getcastlename("<map name>")
  2349. This function returns the name of the castle when given the map name for that
  2350. castle. The data is read from 'db/castle_db.txt'.
  2351. ---------------------------------------
  2352. *getcastledata("<map name>",<type of data>)
  2353. *setcastledata "<map name>",<type of data>,<value>;
  2354. This function returns the castle ownership information for the castle referred
  2355. to by its map name. Castle information is stored in `guild_castle` SQL table.
  2356. Types of data correspond to `guild_castle` table columns:
  2357. 1 - `guild_id` - Guild ID.
  2358. 2 - `economy` - Castle Economy score.
  2359. 3 - `defense` - Castle Defense score.
  2360. 4 - `triggerE` - Number of times the economy was invested in today.
  2361. 5 - `triggerD` - Number of times the defense was invested in today.
  2362. 6 - `nextTime` - unused
  2363. 7 - `payTime` - unused
  2364. 8 - `createTime` - unused
  2365. 9 - `visibleC` - Is 1 if a Kafra was hired for this castle, 0 otherwise.
  2366. 10 - `visibleG0` - Is 1 if the 1st guardian is present (Soldier Guardian)
  2367. 11 - `visibleG1` - Is 1 if the 2nd guardian is present (Soldier Guardian)
  2368. 12 - `visibleG2` - Is 1 if the 3rd guardian is present (Soldier Guardian)
  2369. 13 - `visibleG3` - Is 1 if the 4th guardian is present (Archer Guardian)
  2370. 14 - `visibleG4` - Is 1 if the 5th guardian is present (Archer Guardian)
  2371. 15 - `visibleG5` - Is 1 if the 6th guardian is present (Knight Guardian)
  2372. 16 - `visibleG6` - Is 1 if the 7th guardian is present (Knight Guardian)
  2373. 17 - `visibleG7` - Is 1 if the 8th guardian is present (Knight Guardian)
  2374. All types of data have their meaning determined by War of Emperium scripts,
  2375. with exception of:
  2376. - `guild_id` that is always considered ID of the guild that owns the castle,
  2377. - `defense` that is used in Guardians & Emperium HP calculations,
  2378. - `visibleG` that is always considered to hold guardian presence bits.
  2379. The 'setcastledata' command will behave identically, but instead of returning
  2380. values for the specified types of accessible data, it will alter them and cause
  2381. them to be sent to the char-server for storage.
  2382. Changing Guild ID or Castle Defense will trigger additional actions, like
  2383. recalculating guardians' HP.
  2384. ---------------------------------------
  2385. *getgdskilllv(<guild id>,<skill id>)
  2386. *getgdskilllv(<guild id>,"<skill name>")
  2387. This function returns the level of the skill <skill id> of the guild <guild id>.
  2388. If the guild does not have that skill, 0 is returned.
  2389. If the guild does not exist, -1 is returned.
  2390. Refer to 'db/(pre-)re/skill_db.txt' for the full list of skills. (GD_* are guild skills)
  2391. ---------------------------------------
  2392. *requestguildinfo <guild id>{,"<event label>"};
  2393. This command requests the guild data from the char server and merrily continues
  2394. with the execution. Whenever the guild information becomes available (which
  2395. happens instantly if the guild information is already in memory, or later, if it
  2396. isn't and the map server has to wait for the char server to reply) it will run
  2397. the specified event as in a 'doevent' call.
  2398. ---------------------------------------
  2399. *getmapguildusers("<map name>",<guild id>)
  2400. Returns the amount of characters from the specified guild on the given map.
  2401. Example:
  2402. mes "You have "+getMapGuildUsers("prontera",getcharid(2))+" guild members in Prontera.";
  2403. ---------------------------------------
  2404. //
  2405. 2,2.- End of guild-related commands
  2406. //
  2407. ---------------------------------------
  2408. *getskilllv(<skill id>)
  2409. *getskilllv("<skill name>")
  2410. This function returns the level of the specified skill that the invoking
  2411. character has. If they don't have the skill, 0 will be returned. The full list
  2412. of character skills is available in 'db/(pre-)re/skill_db.txt'.
  2413. There are two main uses for this function, it can check whether the character
  2414. has a skill or not, and it can tell you if the level is high enough.
  2415. Example 1:
  2416. if (getskilllv(152)) goto L_HasSkillThrowStone;
  2417. mes "You don't have Throw Stone";
  2418. close;
  2419. L_HasSkillThrowStone:
  2420. mes "You have got the skill Throw Stone";
  2421. close;
  2422. Example 2:
  2423. if (getskilllv(28) >= 5) goto L_HasSkillHeallvl5orMore;
  2424. if (getskilllv(28) == 10) goto L_HasSkillHealMaxed;
  2425. mes "You heal skill is below lvl 5";
  2426. close;
  2427. L_HasSkillHeallvl6orMore:
  2428. mes "Your heal lvl is 5 or more";
  2429. close;
  2430. L_HasSkillHealMaxed:
  2431. mes "Your heal lvl has been maxed";
  2432. close;
  2433. ---------------------------------------
  2434. *getskilllist({<char_id>});
  2435. This command sets a bunch of arrays with a complete list of skills the
  2436. invoking character has. Here's what you get:
  2437. @skilllist_id[] - skill ids.
  2438. @skilllist_lv[] - skill levels.
  2439. @skilllist_flag[] - see 'skill' for the meaning of skill flags.
  2440. @skilllist_count - number of skills in the above arrays.
  2441. While 'getskillv' is probably more useful for most situations, this is the
  2442. easiest way to store all the skills and make the character something else for a
  2443. while. Advanced job for a day? :) This could also be useful to see how many
  2444. skills a character has.
  2445. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2446. ---------------------------------------
  2447. *getmonsterinfo(<mob ID>,<type>)
  2448. This function will look up the monster with the specified ID number in the
  2449. mob database and return the info set by TYPE argument.
  2450. It will return -1 if there is no such monster (or the type value is invalid),
  2451. or "null" if you requested the monster's name.
  2452. Valid types are listed in 'db/const.txt':
  2453. MOB_NAME 0
  2454. MOB_LV 1
  2455. MOB_MAXHP 2
  2456. MOB_BASEEXP 3
  2457. MOB_JOBEXP 4
  2458. MOB_ATK1 5
  2459. MOB_ATK2 6
  2460. MOB_DEF 7
  2461. MOB_MDEF 8
  2462. MOB_STR 9
  2463. MOB_AGI 10
  2464. MOB_VIT 11
  2465. MOB_INT 12
  2466. MOB_DEX 13
  2467. MOB_LUK 14
  2468. MOB_RANGE 15
  2469. MOB_RANGE2 16
  2470. MOB_RANGE3 17
  2471. MOB_SIZE 18
  2472. MOB_RACE 19
  2473. MOB_ELEMENT 20
  2474. MOB_MODE 21
  2475. MOB_MVPEXP 22
  2476. Note: MOB_ELEMENT doesn't return the element level, only the element ID.
  2477. For more details, see the sample in 'doc/sample/getmonsterinfo.txt'.
  2478. ---------------------------------------
  2479. *getmobdrops(<mob id>)
  2480. This command will find all drops of the specified mob and return the item IDs
  2481. and drop percentages into arrays of temporary global variables.
  2482. 'getmobdrops' returns 1 if successful and 0 if the mob ID doesn't exist.
  2483. Upon executing this,
  2484. $@MobDrop_item[] is a global temporary number array which contains the
  2485. item IDs of the monster's drops.
  2486. $@MobDrop_rate[] is a global temporary number array which contains the
  2487. drop percentages of each item. (1 = .01%)
  2488. $@MobDrop_count is the number of item drops found.
  2489. Be sure to use $@MobDrop_count to go through the arrays, and not
  2490. 'getarraysize', because the temporary global arrays are not cleared between
  2491. runs of 'getmobdrops'. If a mob with 7 item drops is looked up, the arrays would
  2492. have 7 elements. But if another mob is looked up and it only has 5 item drops,
  2493. the server will not clear the arrays for you, overwriting the values instead. So
  2494. in addition to returning the 5 item drops, the 6th and 7th elements from the
  2495. last call remain, and you will get 5+2 item drops, of which the last 2 don't
  2496. belong to the new mob. $@MobDrop_count will always contain the correct number
  2497. (5), unlike 'getarraysize()' which would return 7 in this case.
  2498. Example:
  2499. // get a Mob ID from the user
  2500. input .@mob_id;
  2501. if (getmobdrops(.@mob_id)) { // 'getmobdrops' returns 1 on success
  2502. // immediately copy global temporary variables into scope variables,
  2503. // since we don't know when 'getmobdrops' will get called again for
  2504. // another mob, overwriting your global temporary variables
  2505. .@count = $@MobDrop_count;
  2506. copyarray .@item[0],$@MobDrop_item[0],.@count;
  2507. copyarray .@rate[0],$@MobDrop_rate[0],.@count;
  2508. mes getmonsterinfo(.@mob_id,MOB_NAME) + " - " + .@count + " drops found:";
  2509. for( .@i = 0; .@i < .@count; .@i++ ) {
  2510. mes .@item[.@i] + " (" + getitemname(.@item[.@i]) + ") " + .@rate[.@i]/100 + ((.@rate[.@i]%100 < 10) ? ".0":".") + .@rate[.@i]%100 + "%";
  2511. }
  2512. } else {
  2513. mes "Unknown monster ID.";
  2514. }
  2515. close;
  2516. ---------------------------------------
  2517. *skillpointcount({<char_id>})
  2518. Returns the total amount of skill points a character possesses (SkillPoint+SP's used in skills)
  2519. This command can be used to check the currently attached characters total amount of skill points.
  2520. This means the skill points used in skill are counted, and added to SkillPoints (number of skill points not used).
  2521. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2522. Example 1:
  2523. .@skillPoints = skillpointcount();
  2524. mes "You have " + .@skillPoints + " skill points in total!";
  2525. Example 2:
  2526. if (skillpointcount() > 20)
  2527. mes "Wow, you have more then 20 Skill Points in total!";
  2528. ---------------------------------------
  2529. *getscrate(<effect type>,<base rate>{,<GID>})
  2530. This function will return the chance of a status effect affecting the invoking
  2531. character, in percent, modified by the their current defense against said
  2532. status. The 'base rate' is the base chance of the status effect being inflicted,
  2533. in percent.
  2534. if (rand(100) > getscrate(Eff_Blind, 50)) goto BlindHimNow;
  2535. You can see the full list of available effect types you can possibly inflict in
  2536. 'db/const.txt' under 'Eff_'.
  2537. ---------------------------------------
  2538. ========================
  2539. |3.- Checking commands.|
  2540. ========================
  2541. -------------------------
  2542. *playerattached()
  2543. Returns the ID of the player currently attached to the script. It will return
  2544. 0 if no one is attached, or if the attached player no longer exists on the map
  2545. server. It is wise to check for the attached player in script functions that
  2546. deal with timers as there's no guarantee the player will still be logged on
  2547. when the timer triggers. Note that the ID of a player is actually their
  2548. account ID.
  2549. ---------------------------------------
  2550. *getattachedrid();
  2551. Returns RID from running script. Script may not be attached to any RID like
  2552. a floating script or function and will return 0.
  2553. ---------------------------------------
  2554. *isloggedin(<account id>{,<char id>})
  2555. This function returns 1 if the specified account is logged in and 0 if they
  2556. aren't. You can also pass the char id to check for both account and char id.
  2557. ---------------------------------------
  2558. *checkweight(<item id>,<amount>{,<item id>,<amount>,<item id>,<amount>,...});
  2559. *checkweight("<item name>",<amount>{,"<item name>",<amount>,"<item name>",<amount>,...});
  2560. *checkweight2(<id_array>,<amount_array>);
  2561. These functions will compute and return 1 if the total weight of the specified
  2562. number of specific items does not exceed the invoking character's carrying
  2563. capacity, and 0 otherwise. It is important to see if a player can carry the
  2564. items you expect to give them, failing to do that may open your script up to
  2565. abuse or create some very unfair errors.
  2566. The second function will check an array of items and amounts, and also
  2567. returns 1 on success and 0 on failure.
  2568. The functions, in addition to checking to see if the player is capable of
  2569. holding a set amount of items, also ensure the player has room in their
  2570. inventory for the item(s) they will be receiving.
  2571. Like 'getitem', this function will also accept an 'english name' from the
  2572. database as an argument.
  2573. Example 1:
  2574. if (checkweight(512,10)) {
  2575. getitem 512,10;
  2576. } else {
  2577. mes "Sorry, you cannot hold this amount of apples!";
  2578. }
  2579. Example 2:
  2580. setarray .@item[0],512,513,514;
  2581. setarray .@amount[0],10,5,5;
  2582. if (!checkweight(.@item,.@amount)) {
  2583. mes "Sorry, you cannot hold this amount of fruit!";
  2584. }
  2585. ---------------------------------------
  2586. *basicskillcheck()
  2587. This function will return the state of the configuration option
  2588. 'basic_skill_check' in 'battle_athena.conf'. It returns 1 if the option is
  2589. enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which
  2590. it is by default, characters must have a certain number of basic skill levels to
  2591. sit, request a trade, use emotions, etc. Making your script behave differently
  2592. depending on whether the characters must actually have the skill to do all these
  2593. things might in some cases be required.
  2594. ---------------------------------------
  2595. *checkoption(<option number>{,<char_id>})
  2596. *checkoption1(<option number>{,<char_id>})
  2597. *checkoption2(<option number>{,<char_id>})
  2598. *setoption <option number>{,<flag>{,<char_id>}};
  2599. The 'setoption' series of functions check for a so-called option that is set on
  2600. the invoking character. 'Options' are used to store status conditions and a lot
  2601. of other non-permanent character data of the yes-no kind. For most common cases,
  2602. it is better to use 'checkcart','checkfalcon','checkriding' and other similar
  2603. functions, but there are some options which you cannot get at this way. They
  2604. return 1 if the option is set and 0 if the option is not set.
  2605. Option numbers valid for the first (option) version of this command are:
  2606. 0x1 - Sight in effect.
  2607. 0x2 - Hide in effect.
  2608. 0x4 - Cloaking in effect.
  2609. 0x8 - Cart number 1 present.
  2610. 0x10 - Falcon present.
  2611. 0x20 - Peco Peco present.
  2612. 0x40 - GM Perfect Hide in effect.
  2613. 0x80 - Cart number 2 present.
  2614. 0x100 - Cart number 3 present.
  2615. 0x200 - Cart number 4 present.
  2616. 0x400 - Cart number 5 present.
  2617. 0x800 - Orc head present.
  2618. 0x1000 - The character is wearing a wedding sprite.
  2619. 0x2000 - Ruwach is in effect.
  2620. 0x4000 - Chasewalk in effect.
  2621. 0x8000 - Flying or Xmas suit.
  2622. 0x10000 - Sighttrasher.
  2623. 0x100000 - Warg present.
  2624. 0x200000 - The character is riding a warg.
  2625. Option numbers valid for the second version (opt1) of this command are:
  2626. 1 - Petrified.
  2627. 2 - Frozen.
  2628. 3 - Stunned.
  2629. 4 - Sleeping.
  2630. 6 - Petrifying (the state where you can still walk)
  2631. Option numbers valid for the third version (opt2) of this command are:
  2632. 0x1 - Poisoned.
  2633. 0x2 - Cursed.
  2634. 0x4 - Silenced.
  2635. 0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
  2636. 0x10 - Blinded.
  2637. 0x80 - Deadly poisoned.
  2638. Option numbers (except for opt1) are bit-masks - you can add them up to check
  2639. for several states, but the functions will return true if at least one of them
  2640. is in effect.
  2641. 'setoption' will set options on the invoking character. There are no second and
  2642. third versions of this command, so you can only change the values in the first
  2643. list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted),
  2644. the option will be added to what the character currently has; if 0, the option is removed.
  2645. This is definitely not a complete list of available option flag numbers. Ask a
  2646. core developer (or read the source: src/map/status.h) for the full list.
  2647. ---------------------------------------
  2648. *setcart {<type>{,<char_id>}};
  2649. *checkcart({<char_id>});
  2650. If <type> is 0 this command will remove the cart from the character.
  2651. Otherwise it gives the invoking character a cart. The cart given will be
  2652. cart number <type> and will work regardless of whether the character is a
  2653. merchant class or not.
  2654. Note: the character needs to have the skill MC_PUSHCART to gain a cart
  2655. The accompanying function will return 1 if the invoking character has a cart
  2656. (any kind of cart) and 0 if they don't.
  2657. if (checkcart()) mes "But you already have a cart!";
  2658. ---------------------------------------
  2659. *setfalcon {<flag>{,<char_id>}};
  2660. *checkfalcon({<char_id>});
  2661. If <flag> is 0 this command will remove the falcon from the character.
  2662. Otherwise it gives the invoking character a falcon. The falcon will be there
  2663. regardless of whether the character is a hunter or not. It will (probably) not
  2664. have any useful effects for non-hunters though.
  2665. Note: the character needs to have the skill HT_FALCON to gain a falcon
  2666. The accompanying function will return 1 if the invoking character has a falcon
  2667. and 0 if they don't.
  2668. if (checkfalcon()) mes "But you already have a falcon!";
  2669. ---------------------------------------
  2670. *setriding {<flag>{,<char_id>}};
  2671. *checkriding({<char_id>});
  2672. If <flag> is 0 this command will remove the mount from the character.
  2673. Otherwise it gives the invoking character a PecoPeco (if they are a Knight
  2674. series class), a GrandPeco (if they are a Crusader series class), or
  2675. a Gryphon (if they are a Royal Guard). Unlike 'setfalcon' and 'setcart'
  2676. this will not work at all if they aren't of a class which can ride.
  2677. Note: the character needs to have the skill KN_RIDING to gain a mount
  2678. The accompanying function will return 1 if the invoking character is riding a
  2679. bird and 0 if they aren't.
  2680. if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!";
  2681. ---------------------------------------
  2682. *setdragon {<color>{,<char_id>}};
  2683. *checkdragon({<char_id>});
  2684. The 'setdragon' function toggles mounting a dragon for the invoking character.
  2685. It will return 1 if successful, 0 otherwise.
  2686. The available colors are:
  2687. 1 - Green Dragon (default)
  2688. 2 - Brown Dragon
  2689. 3 - Gray Dragon
  2690. 4 - Blue Dragon
  2691. 5 - Red Dragon
  2692. Note: the character must be a Rune Knight and have the skill RK_DRAGONTRAINING to gain a mount
  2693. The accompanying function will return 1 if the invoking character is riding a
  2694. dragon and 0 if they aren't.
  2695. ---------------------------------------
  2696. *setmadogear {<flag>{,<char_id>}};
  2697. *checkmadogear({<char_id>});
  2698. If <flag> is 0 this command will remove the mount from the character.
  2699. Otherwise it gives the invoking character a Mado (if they are a Mechanic).
  2700. The accompanying function will return 1 if the invoking character has a
  2701. Mado and 0 if they don't.
  2702. ---------------------------------------
  2703. *setmounting {<char_id>};
  2704. *ismounting({<char_id>});
  2705. The 'setmounting' function toggles cash mount for the invoking character.
  2706. It will return 1 if successful, 0 otherwise.
  2707. Note: Character must not be mounting a non-cash mount (eg. dragon, peco, wug, etc.)
  2708. The accompanying function will return 1 if the invoking character has a
  2709. cash mount and 0 if they don't.
  2710. ---------------------------------------
  2711. *checkwug({<char_id>});
  2712. This function will return 1 if the invoking character has a
  2713. warg and 0 if they don't.
  2714. ---------------------------------------
  2715. *checkvending({"<Player Name>"})
  2716. Checks if the player is vending or has has a buyingstore. Additionally
  2717. it gives you the information whether the player uses autotrade or not.
  2718. Name is optional, and defaults to the attached player if omitted.
  2719. The returned value is bitmask of.
  2720. 0 = doesn't have a vending or buyingstore (which also means he can't use autotrade)
  2721. 1 = normal vending
  2722. 2 = using @autotrade
  2723. 4 = has a buyingstore
  2724. Examples:
  2725. //This will check Aaron's state
  2726. .@state = checkvending("Aaron");
  2727. if (.@state&1)
  2728. mes "Aaron is currently vending!";
  2729. if (.@state&4)
  2730. mes "Aaron has a buying store!";
  2731. if (.@state&2)
  2732. mes "Aaron is autotrading!";
  2733. ---------------------------------------
  2734. *checkchatting({"<Player Name>"})
  2735. Checks if the player is in a chatroom.
  2736. Name is optional, and defaults to the attached player if omitted.
  2737. Returns 1 if they are in a chat room, 0 if they are not.
  2738. Examples:
  2739. //This will check if the attached player in a chat room or not.
  2740. if (checkchatting())
  2741. mes "You are currently in a chat room!";
  2742. ---------------------------------------
  2743. *checkidle({"<Player Name>"})
  2744. Returns the time, in seconds, that the specified player has been idle.
  2745. Name is optional, and defaults to the attached player if omitted.
  2746. ---------------------------------------
  2747. *agitcheck()
  2748. *agitcheck2()
  2749. These function will let you check whether the server is currently in WoE mode
  2750. (or WoE SE mode if the second function is called) and will return 1 if War of
  2751. Emperium is on and 0 if it isn't.
  2752. ---------------------------------------
  2753. *isnight()
  2754. *isday()
  2755. These functions will return 1 or 0 depending on whether the server is in night
  2756. mode or day mode. 'isnight' returns 1 if it's night and 0 if it isn't, 'isday'
  2757. the other way around. They can be used interchangeably, pick the one you like
  2758. more:
  2759. // These two are equivalent:
  2760. if (isday()) mes "I only prowl in the night.";
  2761. if (isnight()!=1) mes "I only prowl in the night.";
  2762. ---------------------------------------
  2763. *checkre(<type>)
  2764. Checks if a renewal feature is enabled or not in renewal.h, and returns 1 if
  2765. enabled and 0 for disabled.
  2766. The renewal feature to check is determined by type.
  2767. 0 - RENEWAL (game renewal server mode)
  2768. 1 - RENEWAL_CAST (renewal cast time)
  2769. 2 - RENEWAL_DROP (renewal drop rate algorithms)
  2770. 3 - RENEWAL_EXP (renewal exp rate algorithms)
  2771. 4 - RENEWAL_LVDMG (renewal level modifier on damage)
  2772. 5 - RENEWAL_ASPD (renewal ASPD)
  2773. ---------------------------------------
  2774. *is_clientver(<type>,<value>{,<char id>})
  2775. Checks a character's client version against a specified value. If no char id is
  2776. given, the command will run for the invoking character. The function will return
  2777. 1 if the player's version is greater than or equal to the value, and 0 otherwise.
  2778. Available types are:
  2779. 0 - version number (packet_db_ver)
  2780. 1 - client date (YYYYMMDD)
  2781. ---------------------------------------
  2782. \\
  2783. 3,1.- Item-related commands
  2784. \\
  2785. ---------------------------------------
  2786. *isequipped(<id>{,<id>{,<id>{,<id>}}})
  2787. This function will return 1 if the invoking character has all of the item
  2788. IDs given equipped (if card IDs are passed, then it checks if the cards are
  2789. inserted into slots in the equipment they are currently wearing). Theoretically
  2790. there is no limit to the number of items that may be tested for at the same time.
  2791. If even one of the items given is not equipped, 0 will be returned.
  2792. // (Poring,Santa Poring,Poporing,Marin)
  2793. if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
  2794. // (Poring)
  2795. if (isequipped(4001)) mes "A poring card is useful, don't you think?";
  2796. The function was meant for item scripts to support the cards released by Gravity
  2797. in February 2005, but it will work just fine in normal NPC scripts.
  2798. ---------------------------------------
  2799. *isequippedcnt(<card id>{,<card id>{,<card id>{,<card id>}}})
  2800. This function is similar to 'isequipped', but instead of 1 or 0, it will return
  2801. the number of cards in the list given that were found on the invoking character.
  2802. If a given parameter is not a card, the function returns the amount of that
  2803. item equipped on the invoking character.
  2804. if (isequippedcnt(4001,4005,4033,4196) == 4) mes "Finally got all four poring cards?";
  2805. ---------------------------------------
  2806. *checkequipedcard(<card id>)
  2807. This function will return 1 if the card specified by its item ID number is
  2808. inserted into any equipment they have in their inventory, currently equipped or
  2809. not.
  2810. ---------------------------------------
  2811. //
  2812. 3,1.- End of item-related commands
  2813. //
  2814. ---------------------------------------
  2815. ==============================
  2816. |4.- Player-related commands.|
  2817. ==============================
  2818. -------------------------
  2819. *attachrid(<account ID>)
  2820. *detachrid;
  2821. These commands allow the manipulation of the script's currently attached player.
  2822. While 'attachrid' allows attaching of a different player by using its account id
  2823. for the parameter RID, 'detachrid' makes the following commands run as if the
  2824. script was never invoked by a player.
  2825. The command returns 0 if the player cannot be attached (if the account is offline
  2826. or does not exist), and 1 upon success.
  2827. -------------------------
  2828. *addrid(<type>{,<flag>{,<parameters>}});
  2829. This command will attach other RIDs to the current script without detaching the
  2830. invoking RID. It returns 1 if successful and 0 upon failure.
  2831. <type> determines what RIDs are attached:
  2832. 0: All players in the server.
  2833. 1: All players in the map of the invoking player, or the invoking NPC if no player is attached.
  2834. 2: Party members of a specified party ID.
  2835. [ Parameters: <party id> ]
  2836. 3: Guild members of a specified guild ID.
  2837. [ Parameters: <guild id> ]
  2838. 4: All players in a specified area of the map of the invoking player (or NPC).
  2839. [ Parameters: <x0>,<y0>,<x1>,<y1> ]
  2840. Account ID: If type is Account ID, attach the specified account ID.
  2841. <flag> can prevent certain players from being attached:
  2842. 0: Players are always attached. (default)
  2843. 1: Players currently running another script will not be attached.
  2844. ---------------------------------------
  2845. *rid2name(<rid>)
  2846. Converts rid to name. Note: The player/monster/NPC must be online/enabled.
  2847. Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
  2848. Note: rid2name may not produce correct character names since rid = account id.
  2849. It will return the current online character of the account only.
  2850. ---------------------------------------
  2851. *message "<character name>","<message>";
  2852. That command will send a message to the chat window of the character specified
  2853. by name. The text will also appear above the head of that character. It will not
  2854. be seen by anyone else.
  2855. ---------------------------------------
  2856. *dispbottom "<message>"{,<color>{,<char_id>}};
  2857. This command will send the given message with color into the invoking character's chat
  2858. window. The color format is in RGB (0xRRGGBB). The color is
  2859. by default green
  2860. ---------------------------------------
  2861. *showscript "<message>"{,<GID>};
  2862. Makes attached player or GID says a message like shouting a skill name, the message
  2863. will be seen to everyone around but not in chat window.
  2864. ---------------------------------------
  2865. *warp "<map name>",<x>,<y>;
  2866. This command will take the invoking character to the specified map, and if
  2867. wanted, specified coordinates too, but these can be random.
  2868. warp "place",50,55;
  2869. This would take them to X 50 Y 55 on the map called "place". If your X and Y
  2870. coordinates land on an unwalkable map square, it will send the warped character
  2871. to a random place. Same will happen if they are both zero:
  2872. warp "place",0,0;
  2873. Notice that while warping people to coordinates 0,0 will normally get them into
  2874. a random place, it's not certain to always be so. Darned if I know where this is
  2875. actually coded, it might be that this happens because square 0,0 is unwalkable
  2876. on all official maps. If you're using custom maps, beware.
  2877. There are also three special 'map names' you can use.
  2878. "Random" will warp the player randomly on the current map.
  2879. "Save" and "SavePoint" will warp the player back to their save point.
  2880. ---------------------------------------
  2881. *areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
  2882. This command is similar to 'warp', however, it will not refer to the invoking
  2883. character, but instead, all characters within a specified area, defined by the
  2884. x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
  2885. including the activating character, if they are outside the area.
  2886. areawarp "place",10,10,120,120,"place2",150,150;
  2887. Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
  2888. shape, on the map called "place", will be affected, and warped to "place2" X 150
  2889. Y 150
  2890. areawarp "place",10,10,120,120,"place2",0,0;
  2891. By using ,0,0; as the destination coordinates it will take all the characters in
  2892. the affected area to a random set of co-ordinates on "place2".
  2893. areawarp "place",10,10,120,120,"place2",150,150,200,200;
  2894. By using the optional x4 and y4 parameters, the destination coordinates will be a
  2895. random place within the defined x3/y3-x4/y4 square.
  2896. Like 'warp', areawarp will also explicitly warp characters randomly into the
  2897. current map if you give the 'to map name' as "Random".
  2898. See also 'warp'.
  2899. ---------------------------------------
  2900. *warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>"};
  2901. Warps a party to specified map and coordinate given the party ID, which you can get with
  2902. getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
  2903. You can use the following "map names" for special warping behavior:
  2904. Random: All party members are randomly warped in their current map (as if they
  2905. all used a fly wing)
  2906. SavePointAll: All party members are warped to their respective save point.
  2907. SavePoint: All party members are warped to the save point of the currently
  2908. attached player (will fail if there's no player attached).
  2909. Leader: All party members are warped to the leader's position. The leader must
  2910. be online and in the current map-server for this to work.
  2911. If you specify a from_mapname, 'warpparty' will only affect those on that map.
  2912. Example:
  2913. mes "[Party Warper]";
  2914. mes "Here you go!";
  2915. close2;
  2916. .@party_id = getcharid(1);
  2917. warpparty "prontera",150,100,.@party_id;
  2918. close;
  2919. ---------------------------------------
  2920. *warpchar "<map name>",<x>,<y>,<char id>;
  2921. Warps another player to specified map and coordinate given the char id, which you can get with
  2922. getcharid(0,<player_name>). Obviously this is useless if you want to warp the same player that
  2923. is executing this script, unless it's some kind of "chosen" script.
  2924. Example:
  2925. warpchar "prontera",150,100,150001;
  2926. ---------------------------------------
  2927. *warpguild "<map name>",<x>,<y>,<guild_id>;
  2928. Warps a guild to specified map and coordinate given the guild id, which you can get with
  2929. getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>).
  2930. You can use the following "map names" for special warping behavior:
  2931. Random: All guild members are randomly warped in their current map (as if they
  2932. all used a fly wing)
  2933. SavePointAll: All guild members are warped to their respective save point.
  2934. SavePoint: All guild members are warped to the save point of the currently
  2935. attached player (will fail if there's no player attached).
  2936. Example:
  2937. warpguild "prontera",x,y,Guild_ID;
  2938. ---------------------------------------
  2939. *warppartner("<map name>",<x>,<y>);
  2940. This function will find the invoking character's marriage partner, if any, and
  2941. warp them to the map and coordinates given. Go kidnap that spouse. :) It will
  2942. return 1 upon success and 0 if the partner is not online, the character is not
  2943. married, or if there's no invoking character (no RID). 0,0 will, as usual,
  2944. normally translate to random coordinates.
  2945. ---------------------------------------
  2946. *savepoint "<map name>",<x>,<y>{,<char_id>};
  2947. *save "<map name>",<x>,<y>{,<char_id>};
  2948. These commands save where the invoking character will return to upon clicking
  2949. "Return to Save Point", after death and in some other cases. The two versions are
  2950. equivalent. They ignore any and all mapflags, and can make a character respawn where
  2951. no teleportation is otherwise possible.
  2952. savepoint "place",350,75;
  2953. ---------------------------------------
  2954. *heal <hp>,<sp>;
  2955. This command will heal a set amount of HP and/or SP on the invoking character.
  2956. heal 30000,0; // This will heal 30,000 HP
  2957. heal 0,30000; // This will heal 30,000 SP
  2958. heal 300,300; // This will heal 300 HP and 300 SP
  2959. This command just alters the hit points and spell points of the invoking
  2960. character and produces no other output whatsoever.
  2961. ---------------------------------------
  2962. *itemheal <hp>,<sp>;
  2963. This command heals relative amounts of HP and/or SP on the invoking character.
  2964. Unlike heal, this command is intended for use in item scripts. It applies
  2965. potion-related bonuses, such as alchemist ranking, cards, and status changes.
  2966. When used inside an NPC script, certain bonuses are omitted.
  2967. The command also applies a SP/VIT-related bonus:
  2968. heal = heal * [(100 + STATUS*2) / 100]
  2969. Example:
  2970. // If the player has 50 vit and no bonuses, this will heal
  2971. // anything from 200 to 300 HP and 5 SP
  2972. itemheal rand(100,150),5;
  2973. ---------------------------------------
  2974. *percentheal <hp>,<sp>;
  2975. This command will heal the invoking character. It heals the character, but not
  2976. by a set value - it adds percent of their maximum HP/SP.
  2977. percentheal 100,0; // This will heal 100% HP
  2978. percentheal 0,100; // This will heal 100% SP
  2979. percentheal 50,50; // This will heal 50% HP and 50% SP
  2980. So the amount that this will heal will depend on the total amount of HP or SP
  2981. you have maximum. Like 'heal', this will not call up any animations or effects.
  2982. ---------------------------------------
  2983. *recovery <type>{,<option>,<revive_flag>{,<map name>}};
  2984. This command will revive and fully restore the HP/SP of the selected characters.
  2985. It returns 1 upon successful use.
  2986. <type> is the target, and determines the <option> parameter:
  2987. 0: Player -> Character ID number
  2988. 1: Party -> Party ID number
  2989. 2: Guild -> Guild ID number
  2990. 3: Map -> Map name (a string)
  2991. 4: All -> None (takes <revive_flag> as option)
  2992. If no option is specified, the invoking player's character ID, party ID, guild ID,
  2993. or map will be used.
  2994. <revive_flag> determines the action:
  2995. 1: Revive and heal all players (default)
  2996. 2: Heal living players only
  2997. 4: Revive dead players only
  2998. <map name> can optionally be used to define a single map to execute the command on
  2999. for types 1 (party) and 2 (guild).
  3000. Examples:
  3001. // Only revive characters in invoking party on map "morocc"
  3002. recovery 1,getcharid(1),4,"morocc";
  3003. // Fully heal (don't revive) all members of invoking character's guild
  3004. recovery 2,getcharid(2),2;
  3005. // Revive and fully heal everyone in map "prontera"
  3006. recovery 3,"prontera";
  3007. // Only revive all dead characters on server
  3008. recovery 4,4;
  3009. ---------------------------------------
  3010. *jobchange <job number>{,<upper flag>};
  3011. This command will change the job class of the invoking character.
  3012. jobchange 1; // This would change your player into a Swordman
  3013. jobchange 4002; // This would change your player into a Swordman High
  3014. This command does work with numbers, but you can also use job names. The full
  3015. list of job names and the numbers they correspond to can be found in
  3016. 'db/const.txt'.
  3017. // This would change your player into a Swordman
  3018. jobchange Job_Swordman;
  3019. // This would change your player into a Swordman High
  3020. jobchange Job_Swordman_High;
  3021. 'upper flag' can alternatively be used to specify the type of job one changes
  3022. to. For example, jobchange Job_Swordman,1; will change the character to a high
  3023. swordsman. The upper values are:
  3024. -1 (or when omitted): preserves the current job type.
  3025. 0: Normal/standard classes
  3026. 1: High/Advanced classes
  3027. 2: Baby classes
  3028. This command will also set a permanent character-based variable
  3029. 'jobchange_level' which will contain the job level at the time right before
  3030. changing jobs, which can be checked for later in scripts.
  3031. ---------------------------------------
  3032. *jobname(<job number>)
  3033. This command retrieves the name of the given job using the map_msg entries 550->655.
  3034. mes "[Kid]";
  3035. mes "I never thought I'd met a "+jobname(Class)+" here of all places.";
  3036. close;
  3037. ---------------------------------------
  3038. *eaclass({<job number>})
  3039. This commands returns the "eA job-number" corresponding to the given class, and
  3040. uses the invoking player's class if none is given. The eA job-number is also a
  3041. class number system, but it's one that comes with constants which make it easy
  3042. to convert among classes. The command will return -1 if you pass it a job number
  3043. which doesn't have an eA job-number equivalent.
  3044. @eac = eaclass();
  3045. if ((@eac&EAJ_BASEMASK) == EAJ_SWORDMAN)
  3046. mes "Your base job is Swordman.";
  3047. if (@eac&EAJL_UPPER)
  3048. mes "You are a rebirth job.";
  3049. if ((@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN)
  3050. mes "You must be a Swordman, Baby Swordman or High Swordman.";
  3051. For more information on the eA Job System, see the docs/ea_job_system.txt file.
  3052. ---------------------------------------
  3053. *roclass(<job number>{,<gender>})
  3054. Does the opposite of eaclass. That is, given an eA job-number, it returns the
  3055. corresponding RO class number. A gender is required because both Bard and Dancers
  3056. share the same eA job-number (EAJ_BARDDANCER), and uses the invoking player's
  3057. gender if none is given (if no player is attached, male will be used by default).
  3058. The command will return -1 if there is no valid class to represent the specified
  3059. job (for example, if you try to get the baby version of a Taekwon class).
  3060. @eac = eaclass();
  3061. //Check if class is already rebirth
  3062. if (@eac&EAJL_UPPER) {
  3063. mes "You look strong.";
  3064. close;
  3065. }
  3066. @eac = roclass(@eac|EAJL_UPPER);
  3067. //Check if class has a rebirth version
  3068. if (@eac != -1) {
  3069. mes "Bet you can't wait to become a "+jobname(@eac)+"!";
  3070. close;
  3071. }
  3072. ---------------------------------------
  3073. *changebase <job ID number>{,<account ID>};
  3074. This command will change a character's appearance to that of the specified job
  3075. class. Nothing but appearance will change.
  3076. The command will run for the invoking character unless an account ID is given.
  3077. changebase Job_Novice; // Changes player to Novice sprite.
  3078. changebase Class; // Changes player back to default sprite.
  3079. ---------------------------------------
  3080. *classchange <view id>,<type>;
  3081. This command is very ancient, its origins are clouded in mystery.
  3082. It will send a 'display id change' packet to everyone in the immediate area of
  3083. the NPC object, which will supposedly make the NPC look like a different sprite,
  3084. an NPC sprite ID, or a monster ID. This effect is not stored anywhere and will
  3085. not persist (Which is odd, cause it would be relatively easy to make it do so)
  3086. and most importantly, will not work at all since this command was broken with
  3087. the introduction of advanced classes. The code is written with the assumption
  3088. that the lowest sprite IDs are the job sprites and the anything beyond them is
  3089. monster and NPC sprites, but since the advanced classes rolled in, they got the
  3090. ID numbers on the other end of the number pool where monster sprites float.
  3091. As a result it is currently impossible to call this command with a valid view
  3092. id. It will do nothing whatsoever if the view ID is below 4047. Getting it to
  3093. run will actually just crash the client.
  3094. It could be a real gem if it can be gotten to actually do what it's supposed to
  3095. do, but this will only happen in a later SVN revision.
  3096. ---------------------------------------
  3097. *changesex({<char_id>});
  3098. This command will change the gender for the attached character's account. If it
  3099. was male, it will become female, if it was female, it will become male. The
  3100. change will be written to the character server, the player will receive the
  3101. message: "Need disconnection to perform change-sex request..." and the player
  3102. will be immediately kicked to the login screen. When they log back in, they will
  3103. be the opposite sex.
  3104. If there are any Dancer/Gypsy or Bard/Clown characters on the account,
  3105. they will also have their skills reset upon 'changesex'.
  3106. ---------------------------------------
  3107. *changecharsex({<char_id>});
  3108. This command will change the gender of the attached character. If it
  3109. was male, it will become female, if it was female, it will become male. The
  3110. change will be written to the character server, the player will receive the
  3111. message: "Need disconnection to perform change-sex request..." and the player
  3112. will be immediately kicked to the login screen. When they log back in, they will
  3113. be the opposite sex.
  3114. If the character being changed is a Dancer/Gypsy or Bard/Clown class type,
  3115. the character will also have their skills reset upon 'changecharsex'.
  3116. ---------------------------------------
  3117. *getexp <base xp>,<job xp>{,<char_id>};
  3118. This command will give the invoking character a specified number of base and job
  3119. experience points. Can be used as a quest reward. Negative values won't work.
  3120. getexp 10000,5000;
  3121. You can also use the "set" command with the constants defined in 'db/const.txt':
  3122. // These 2 combined has the same effect as the above command
  3123. set BaseExp,BaseExp+10000;
  3124. set JobExp,JobExp+5000;
  3125. You can also reduce the amount of experience points:
  3126. set BaseExp,BaseExp-10000;
  3127. Note that 'getexp' is now subject to the 'quest_exp_rate' config option, which
  3128. adjusts the gained value. If you want to bypass this, use the 'set' method.
  3129. ---------------------------------------
  3130. *setlook <look type>,<look value>;
  3131. *changelook <look type>,<look value>;
  3132. 'setlook' will alter the look data for the invoking character. It is used
  3133. mainly for changing the palette used on hair and clothes: you specify which look
  3134. type you want to change, then the palette you want to use. Make sure you specify
  3135. a palette number that exists/is usable by the client you use.
  3136. 'changelook' works the same, but is only client side (it doesn't save the look value).
  3137. // This will change your hair(6), so that it uses palette 8, what ever your
  3138. // palette 8 is, your hair will use that color
  3139. setlook 6,8;
  3140. // This will change your clothes(7), so they are using palette 1, whatever
  3141. // your palette 1 is, your clothes will then use that set of colors.
  3142. setlook 7,1;
  3143. Here are the possible look types:
  3144. 0 - Base sprite
  3145. 1 - Hairstyle
  3146. 2 - Weapon
  3147. 3 - Head bottom
  3148. 4 - Head top
  3149. 5 - Head mid
  3150. 6 - Hair color
  3151. 7 - Clothes color
  3152. 8 - Shield
  3153. 9 - Shoes
  3154. Whatever 'shoes' means is anyone's guess, ask Gravity - the client does nothing
  3155. with this value. It still wants it from the server though, so it is kept, but
  3156. normally doesn't do a thing.
  3157. Only the look data for hairstyle, hair color and clothes color are saved to the
  3158. char server's database and will persist. The rest freely change as the character
  3159. puts on and removes equipment, changes maps, logs in and out and otherwise you
  3160. should not expect to set them. In fact, messing with them is generally
  3161. hazardous, do it at your own risk, it is not tested what will this actually do -
  3162. it won't cause database corruption and probably won't cause a server crash, but
  3163. it's easy to crash the client with just about anything unusual.
  3164. However, it might be an easy way to quickly check for empty view IDs for
  3165. sprites, which is essential for making custom headgear.
  3166. Since a lot of people have different palettes for hair and clothes, it's
  3167. impossible to tell you what all the color numbers are. If you want a serious
  3168. example, there is a Stylist script inside the default rAthena installation that
  3169. you can look at: 'npc/custom/stylist.txt'
  3170. ---------------------------------------
  3171. *pushpc <direction>,<cells>;
  3172. This command will push the currently attached player to given direction by given
  3173. amount of square cells. Direction is the same as used when declaring NPCs, and
  3174. can be specified by using one of the DIR_* constants (db/const.txt).
  3175. The knock-back is not restricted by items or map flags, only obstacles are taken
  3176. into account. If there is not enough space to perform the push (e.g. due to a
  3177. wall), the character is pushed only up to the obstacle.
  3178. // pushes the character 5 cells in 3 o'clock direction from its
  3179. // current position.
  3180. pushpc DIR_EAST, 5;
  3181. ---------------------------------------
  3182. *get_revision()
  3183. This command will return the SVN revision number that the server is currently
  3184. running on.
  3185. if ( get_revision() >= 15000 )
  3186. mes "Welcome to rAthena!";
  3187. ---------------------------------------
  3188. *get_githash()
  3189. This command will return the Git Hash that the server is currently running on.
  3190. mes "Welcome to rAthena! Git Hash: " + get_githash();
  3191. ---------------------------------------
  3192. \\
  3193. 4,1.- Item-related commands
  3194. \\
  3195. ---------------------------------------
  3196. *getitem <item id>,<amount>{,<account ID>};
  3197. *getitem "<item name>",<amount>{,<account ID>};
  3198. This command will give an amount of specified items to the invoking character.
  3199. If an optional account ID is specified, and the target character is currently
  3200. online, items will be created in their inventory instead. If they are not
  3201. online, nothing will happen.
  3202. In the first and most commonly used version of this command, items are
  3203. referred to by their database ID number found inside 'db/(pre-)re/item_db.txt'.
  3204. getitem 502,10 // The person will receive 10 apples
  3205. getitem 617,1 // The person will receive 1 Old Violet Box
  3206. This transaction is logged if the log script generated transactions option is
  3207. enabled.
  3208. You may also create an item by its name in the 'english name' field in the
  3209. item database:
  3210. getitem "RED_POTION",10;
  3211. Which will do what you'd expect. If it can't find that name in the database,
  3212. apples will be created anyway. It is often a VERY GOOD IDEA to use it like this.
  3213. This is used in pretty much all NPC scripts that have to do with items and
  3214. quite a few item scripts. For more examples check just about any official script.
  3215. ---------------------------------------
  3216. *getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3217. *getitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3218. This command will give an amount of specified items to the invoking character.
  3219. If an optional account ID is specified, and the target character is currently
  3220. online, items will be created in their inventory instead. If they are not
  3221. online, nothing will happen. It works essentially the same as 'getitem' but is
  3222. a lot more flexible.
  3223. Those parameters that are different from 'getitem' are:
  3224. identify - Whether you want the item to be identified (1) or not (0).
  3225. refine - For how many pluses will it be refined.
  3226. It will not let you refine an item higher than the max refine.
  3227. attribute - Whether the item is broken (1) or not (0).
  3228. card1,2,3,4 - If you want a card compound to it, place the card ID number into
  3229. the specific card slot.
  3230. Card1-card4 values are also used to store name information for named items, as
  3231. well as the elemental property of weapons and armor. You can create a named item
  3232. in this manner, however, if you just need a named piece of standard equipment,
  3233. it is much easier to the 'getnameditem' function instead.
  3234. You will need to keep these values if you want to destroy and then perfectly
  3235. recreate a named item, for this see 'getinventorylist'.
  3236. If you still want to try creating a named item with this command because
  3237. 'getnameditem' won't do it for you cause it's too limited, you can do it like
  3238. this. Careful, minor magic ahead.
  3239. // First, let's get an ID of a character who's name will be on the item.
  3240. // Only an existing character's name may be there.
  3241. // Let's assume our character is 'Adam' and find his ID.
  3242. @charid = getcharid(0,"Adam");
  3243. // Now we split the character ID number into two portions with a binary
  3244. // shift operation. If you don't understand what this does, just copy it.
  3245. @card3 = @charid & 65535;
  3246. @card4 = @charid >> 16;
  3247. // If you're inscribing non-equipment, @card1 must be 254.
  3248. // Arrows are also not equipment. :)
  3249. @card1 = 254;
  3250. // For named equipment, card2 means the Star Crumbs and elemental
  3251. // crystals used to make this equipment. For everything else, it's 0.
  3252. @card2 = 0;
  3253. // Now, let's give the character who invoked the script some
  3254. // Adam's Apples:
  3255. getitem2 512,1,1,0,0,@card1,@card2,@card3,@card4;
  3256. This wasn't tested with all possible items, so I can't give any promises,
  3257. experiment first before relying on it.
  3258. To create equipment, continue this example it like this:
  3259. // We've already have card3 and card4 loaded with correct
  3260. // values so we'll just set up card1 and card2 with data
  3261. // for an Ice Stiletto.
  3262. // If you're inscribing equipment, @card1 must be 255.
  3263. @card1 = 255;
  3264. // That's the number of star crumbs in a weapon.
  3265. @sc = 2;
  3266. // That's the number of elemental property of the weapon.
  3267. @ele = 1;
  3268. // And that's the wacky formula that makes them into
  3269. // a single number.
  3270. @card2 = @ele+((@sc*5)<<8);
  3271. // That will make us an Adam's +2 VVS Ice Stiletto:
  3272. getitem2 1216,1,1,2,0,@card1,@card2,@card3,@card4;
  3273. Experiment with the number of star crumbs - I'm not certain just how much will
  3274. work most and what it depends on. The valid element numbers are:
  3275. 1 - Ice, 2 - Earth 3 - Fire 4 - Wind.
  3276. You can, apparently, even create duplicates of the same pet egg with this
  3277. command, creating a pet which is the same, but simultaneously exists in two
  3278. eggs, and may hatch from either, although, I'm not sure what kind of a mess will
  3279. this really cause.
  3280. ---------------------------------------
  3281. *getitembound <item id>,<amount>,<bound type>{,<account ID>};
  3282. *getitembound "<item name>",<amount>,<bound type>{,<account ID>};
  3283. This command behaves identically to 'getitem', but the items created will be
  3284. bound to the target character as specified by the bound type. All items created
  3285. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3286. some cases cannot be traded or stored.
  3287. Valid bound types are:
  3288. Bound_Account : Account Bound item
  3289. Bound_Guild : Guild Bound item
  3290. Bound_Party : Party Bound item
  3291. Bound_Char : Character Bound item
  3292. ---------------------------------------
  3293. *getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3294. *getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3295. This command behaves identically to 'getitem2', but the items created will be
  3296. bound to the target character as specified by the bound type. All items created
  3297. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3298. some cases cannot be traded or stored.
  3299. For a list of bound types see 'getitembound'.
  3300. ---------------------------------------
  3301. *getnameditem <item id>,<character name|character ID>;
  3302. *getnameditem "<item name>",<character name|character ID>;
  3303. Create an item signed with the given character's name.
  3304. The command returns 1 when the item is created successfully, or 0 if it fails.
  3305. Failure occurs when:
  3306. - There is no player attached.
  3307. - Item name or ID is not valid.
  3308. - The given character ID/name is offline.
  3309. Example:
  3310. //This will give the currently attached player a Aaron's Apple (if Aaron is online).
  3311. getnameditem "Apple","Aaron";
  3312. //Self-explanatory (I hope).
  3313. if (getnameitem("Apple","Aaron")) {
  3314. mes "You now have a Aaron's Apple!";
  3315. }
  3316. ---------------------------------------
  3317. *rentitem <item id>,<time>{,<account_id>};
  3318. *rentitem "<item name>",<time>{,<account_id>};
  3319. Creates a rental item in the attached character's inventory. The item will expire
  3320. in <time> seconds and be automatically deleted. When receiving a rental item,
  3321. the character will receive a message in their chat window. The character will
  3322. also receive warning messages in their chat window before the item disappears.
  3323. This command can not be used to rent stackable items. Rental items cannot be
  3324. dropped, traded, sold to NPCs, or placed in guild storage. (i.e. trade mask 75)
  3325. Note: 'delitem' in an NPC script can still remove rental items.
  3326. ---------------------------------------
  3327. *rentitem2 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3328. *rentitem2 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3329. Creates a rental item in the attached character's inventory. The item will expire
  3330. in <time> seconds and be automatically deleted. See 'rentitem' for further details.
  3331. See 'getitem2' for an explanation of the expanded parameters.
  3332. ---------------------------------------
  3333. *makeitem <item id>,<amount>,"<map name>",<X>,<Y>;
  3334. *makeitem "<item name>",<amount>,"<map name>",<X>,<Y>;
  3335. This command will create an item on the specified cell of a map.
  3336. As with any dropped items, the items created with this command will disappear after
  3337. a period of time. Using an amount greater than 1 will create a single stack of the
  3338. given amount, not multiple stacks of 1.
  3339. Like 'getitem', it also accepts an 'english name' field from the database and creates
  3340. Apples if the name isn't found.
  3341. If the map name is given as "this", the map the invoking character is on will be used.
  3342. ---------------------------------------
  3343. *makeitem2 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3344. *makeitem2 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3345. This command will create an item on the specified cell of a map. See 'makeitem' for
  3346. further details.
  3347. See 'getitem2' for an explanation of the expanded parameters.
  3348. ---------------------------------------
  3349. *cleanarea "<map name>",<x1>,<y1>,<x2>,<y2>;
  3350. *cleanmap "<map name>";
  3351. These commands will clear all items lying on the ground on the specified map, either
  3352. within the x1/y1-x2/y2 rectangle or across the entire map.
  3353. ---------------------------------------
  3354. *searchitem <array name>,"<item name>";
  3355. This command will fill the given array with the ID of items whose name matches
  3356. the given one. It returns the number of items found. For performance reasons,
  3357. the results array is limited to 10 items.
  3358. mes "What item are you looking for?";
  3359. input .@name$;
  3360. .@qty = searchitem(.@matches[0],.@name$);
  3361. mes "I found " + .@qty + " items:";
  3362. for (.@i = 0; .@i < .@qty; .@i++)
  3363. // Display name (eg: "Apple[0]")
  3364. mes getitemname(.@matches[.@i]) + "[" + getitemslots(.@matches[.@i]) + "]";
  3365. ---------------------------------------
  3366. *delitem <item id>,<amount>{,<account ID>};
  3367. *delitem "<item name>",<amount>{,<account ID>};
  3368. This command will remove a specified amount of items from the invoking/target character.
  3369. Like all the item commands, it uses the item ID found inside 'db/(pre-)re/item_db.txt'.
  3370. delitem 502,10; // The person will lose 10 apples
  3371. delitem 617,1; // The person will lose 1 Old Violet Box
  3372. It is always a good idea to check if the player actually has the items before you delete them.
  3373. If you try to delete more items that the player has, the player will lose the ones he/she has
  3374. and the script will terminate with an error.
  3375. Like 'getitem', this command will also accept an 'english name' field from the
  3376. database. If the name is not found, nothing will be deleted.
  3377. ---------------------------------------
  3378. *cartdelitem <item id>,<amount>{,<account ID>};
  3379. *cartdelitem "<item name>",<amount>{,<account ID>};
  3380. *storagedelitem <item id>,<amount>{,<account ID>};
  3381. *storagedelitem "<item name>",<amount>{,<account ID>};
  3382. This command behaves identically to 'delitem', but deletes items from the player's
  3383. cart or storage. If no cart is mounted, 'cartdelitem' will fail.
  3384. ---------------------------------------
  3385. *delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3386. *delitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3387. This command will remove a specified amount of items from the invoking/target character.
  3388. See 'getitem2' for an explanation of the expanded parameters.
  3389. ---------------------------------------
  3390. *cartdelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3391. *cartdelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3392. *storagedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3393. *storagedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3394. This command behaves identically to 'delitem2', but deletes items from the player's
  3395. cart or storage. If no cart is mounted, 'cartdelitem2' will fail.
  3396. ---------------------------------------
  3397. *countitem(<item id>)
  3398. *countitem("<item name>")
  3399. This function will return the number of items for the specified item ID that the
  3400. invoking character has in the inventory.
  3401. mes "[Item Checker]";
  3402. mes "Hmmm, it seems you have "+countitem(502)+" apples";
  3403. close;
  3404. Like 'getitem', this function will also accept an 'english name' from the
  3405. database as an argument.
  3406. If you want to state the number at the end of a sentence, you can do it by
  3407. adding up strings:
  3408. mes "[Item Checker]";
  3409. mes "Hmmm, the total number of apples you are holding is "+countitem("APPLE");
  3410. close;
  3411. ---------------------------------------
  3412. *cartcountitem(<item id>)
  3413. *cartcountitem("<item name>")
  3414. *storagecountitem(<item id>)
  3415. *storagecountitem("<item name>")
  3416. This command behaves identically to 'countitem', but counts items from the player's
  3417. cart or storage. If no cart is mounted, 'cartcountitem' will return -1.
  3418. ---------------------------------------
  3419. *countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3420. *countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3421. Expanded version of 'countitem' function, used for created/carded/forged items.
  3422. This function will return the number of items for the specified item ID and
  3423. other parameters that the invoking character has in the inventory.
  3424. See 'getitem2' for an explanation of the expanded parameters.
  3425. ---------------------------------------
  3426. *cartcountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3427. *cartcountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3428. *storagecountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3429. *storagecountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3430. This command behaves identically to 'countitem2', but counts items from the player's
  3431. cart or storage. If no cart is mounted, 'cartcountitem2' will return -1.
  3432. ---------------------------------------
  3433. *countbound({<bound type>{,<char_id>}})
  3434. This function will return the number of bounded items in the character's
  3435. inventory, and sets an array @bound_items[] containing all item IDs of the
  3436. counted items. If a bound type is specified, only those items will be counted.
  3437. For a list of bound types see 'getitembound'.
  3438. Example:
  3439. mes "You currently have "+countbound()+" bounded items.";
  3440. next;
  3441. mes "The list of bounded items include:";
  3442. for(.@i = 0; .@i < getarraysize(@bound_items); .@i++)
  3443. mes getitemname(@bound_items[.@i]);
  3444. close;
  3445. ---------------------------------------
  3446. *groupranditem <group id>{,<sub_group>};
  3447. Returns the item_id of a random item picked from the group specified. The
  3448. different groups and their group number are specified in 'db/(pre-)re/item_group_db.txt'.
  3449. When used in conjunction with other functions, you can get a random item. For
  3450. example, for a random pet lure:
  3451. getitem groupranditem(IG_Taming),1;
  3452. 'sub_group' is used to get the available random items of item group from specified random
  3453. group. 0 for 'must' item group, and random item group is 1 until 5 (MAX_ITEMGROUP_RANDGROUP+1).
  3454. More info, see doc/item_group.txt.
  3455. ---------------------------------------
  3456. *getrandgroupitem <group_id>{,<quantity>{,<sub_group>}};
  3457. Similar to the above example, this command allows players to obtain the specified
  3458. quantity of a random item from the group "<group id>". The different groups and
  3459. their group number are specified in db/(pre-)re/item_group_db.txt
  3460. If 'quantity' is not defined or 0, it will uses defined amount from Item Group list.
  3461. If 'sub_group' is not defined the value will be 1 (since random group is 1 ~ 5, and 0 is
  3462. 'must' item group).
  3463. More info, see doc/item_group.txt.
  3464. ---------------------------------------
  3465. *getgroupitem <group_id>;
  3466. Gives item(s) to the attached player based on item group contents.
  3467. This is not working like 'getrandgroupitem' which only give 1 item for specified
  3468. item group & sub_group.
  3469. More info, see doc/item_group.txt.
  3470. ---------------------------------------
  3471. *enable_items;
  3472. *disable_items;
  3473. These commands toggle the ability to change equipment while interacting with
  3474. an NPC. To avoid possible exploits, the commands affect the particular script
  3475. instance only. Note that if a different script also calls enable_items, it
  3476. will override the last call (so you may want to call this command at the start
  3477. of your script without assuming it is still in effect).
  3478. The default setting, 'item_enabled_npc', is defined in 'conf/battle/items.conf'.
  3479. ---------------------------------------
  3480. *itemskill <skill id>,<skill level>;
  3481. *itemskill "<skill name>",<skill level>;
  3482. This command is meant for item scripts to replicate single-use skills in usable
  3483. items. It will not work properly if there is a visible dialog window or menu.
  3484. If the skill is self or auto-targeting, it will be used immediately; otherwise a
  3485. target cursor is shown.
  3486. // When Anodyne is used, it will cast Endure (8), Level 1, as if the actual
  3487. // skill has been used from skill tree.
  3488. 605,Anodyne,Anodyne,11,2000,0,100,,,,,10477567,2,,,,,{ itemskill 8,1; },{}
  3489. ---------------------------------------
  3490. *consumeitem <item id>{,<char_id>};
  3491. *consumeitem "<item name>"{,<char_id>};
  3492. This command will run the item script of the specified item on the invoking
  3493. character. The character does not need to possess the item, and the item will
  3494. not be deleted. While this command is intended for usable items, it will run
  3495. for any item type.
  3496. This command does not currently work with the 'itemskill' script command.
  3497. ---------------------------------------
  3498. *produce <item level>;
  3499. This command will open a crafting window on the client connected to the invoking
  3500. character. The 'item level' is a number which determines what kind of a crafting
  3501. window will pop-up.
  3502. You can see the full list of such item levels in 'db/produce_db.txt' which determines
  3503. what can actually be produced. The window will not be empty only if the invoking
  3504. character can actually produce the items of that type and has the appropriate raw
  3505. materials in their inventory.
  3506. The success rate to produce the item is the same as the success rate of the skill
  3507. associated with the item level. If there is no skill id, the success rate will be 50%.
  3508. Valid item levels are:
  3509. 1 - Level 1 Weapons
  3510. 2 - Level 2 Weapons
  3511. 3 - Level 3 Weapons
  3512. 21 - Blacksmith's Stones and Metals
  3513. 22 - Alchemist's Potions, Holy Water, Assassin Cross's Deadly Poison
  3514. 23 - Elemental Converters
  3515. ---------------------------------------
  3516. *cooking <dish level>;
  3517. This command will open a produce window on the client connected to the invoking
  3518. character. The 'dish level' is the number which determines what kind of dish
  3519. level you can produce. You can see the full list of dishes that can be produced in
  3520. 'db/produce_db.txt'.
  3521. The window will be shown empty if the invoking character does not have enough of
  3522. the required incredients to cook a dish.
  3523. Valid dish levels are:
  3524. 11 - Level 1 Dish
  3525. 12 - Level 2 Dish
  3526. 13 - Level 3 Dish
  3527. 14 - Level 4 Dish
  3528. 15 - Level 5 Dish
  3529. 16 - Level 6 Dish
  3530. 17 - Level 7 Dish
  3531. 18 - Level 8 Dish
  3532. 19 - Level 9 Dish
  3533. 20 - Level 10 Dish
  3534. Although it's required to set a dish level, it doesn't matter if you set it to 1
  3535. and you want to cook a level 10 dish, as long as you got the required incredients
  3536. to cook the dish the command works.
  3537. ---------------------------------------
  3538. *makerune <% success bonus>{,<char_id>};
  3539. This command will open a rune crafting window on the client connected to the
  3540. invoking character. Since this command is officially used in rune ores, a bonus
  3541. success rate must be specified (which adds to the base formula).
  3542. You can see the full list of runes that can be produced in 'db/produce_db.txt'.
  3543. The window will not be empty only if the invoking character can actually produce
  3544. a rune and has the appropriate raw materials in their inventory.
  3545. ---------------------------------------
  3546. *successremovecards <equipment slot>;
  3547. This command will remove all cards of the cards slots defined by item_db.txt
  3548. from the item found in the specified equipment slot of the invoking character,
  3549. create new card items and give them to the character.
  3550. If any cards were removed in this manner, it will also show a success effect.
  3551. ---------------------------------------
  3552. *failedremovecards <equipment slot>,<type>;
  3553. This command will remove all cards from the item found in the specified
  3554. equipment slot of the invoking character. 'type' determines what happens to the
  3555. item and the cards:
  3556. 0 - will destroy both the item and the cards.
  3557. 1 - will keep the item, but destroy the cards.
  3558. 2 - will keep the cards, but destroy the item.
  3559. Whatever the type is, it will also show a failure effect on screen.
  3560. ---------------------------------------
  3561. *repair <broken item number>{,<char_id>};
  3562. This command repairs a broken piece of equipment, using the same list of broken
  3563. items as available through 'getbrokenid'.
  3564. ---------------------------------------
  3565. *repairall {<char_id>};
  3566. This command repairs all broken equipment in the attached player's inventory.
  3567. A repair effect will be shown if any items are repaired, else the command will
  3568. end silently.
  3569. ---------------------------------------
  3570. *successrefitem <equipment slot>{,<count>{,<char_id>}};
  3571. This command will refine an item in the specified equipment slot of the invoking
  3572. character by +1, or a count if given. For a list of equipment slots see 'getequipid'.
  3573. This command will also display a 'refine success' effect on the character and put
  3574. appropriate messages into their chat window. It will also give the character fame
  3575. points if a weapon reached +10 this way, even though these will only take effect for
  3576. blacksmith who will later forge a weapon.
  3577. ---------------------------------------
  3578. *failedrefitem <equipment slot>{,<char_id>};
  3579. This command will fail to refine an item in the specified equipment slot of the
  3580. invoking character. The item will be destroyed. This will also display a 'refine
  3581. failure' effect on the character and put appropriate messages into their chat
  3582. window.
  3583. ---------------------------------------
  3584. *downrefitem <equipment slot>{,<count>{,<char_id>}};
  3585. This command will downgrade an item in the specified equipment slot of the invoking
  3586. character by -1, or a count if given. For a list of equipment slots see 'getequipid'.
  3587. This command will also display a 'refine failure' effect on the character and put
  3588. appropriate messages into their chat window.
  3589. ---------------------------------------
  3590. *unequip <equipment slot>{,<char_id>};
  3591. This command will unequip whatever is currently equipped in the invoking
  3592. character's specified equipment slot. For a full list of possible equipment
  3593. slots see 'getequipid'.
  3594. If an item occupies several equipment slots, it will get unequipped from all of
  3595. them.
  3596. ---------------------------------------
  3597. *delequip <equipment slot>{,<char_id>};
  3598. This command will destroy whatever is currently equipped in the invoking
  3599. character's specified equipment slot. For a full list of possible equipment
  3600. slots see 'getequipid'.
  3601. This command will return 1 if an item was deleted and 0 otherwise.
  3602. ---------------------------------------
  3603. *breakequip <equipment slot>{,<char_id>};
  3604. This command will break and unequip whatever is currently equipped in the
  3605. invoking character's specified equipment slot. For a full list of possible
  3606. equipment slots see 'getequipid'.
  3607. This command will return 1 if an item was broken and 0 otherwise.
  3608. ---------------------------------------
  3609. *clearitem {,<char_id>};
  3610. This command will destroy all items the invoking character has in their
  3611. inventory (including equipped items). It will not affect anything else, like
  3612. storage or cart.
  3613. ---------------------------------------
  3614. *equip <item id>{,<char_id>};
  3615. *autoequip <item id>,<option>;
  3616. These commands are to equip a equipment on the attached character.
  3617. The equip function will equip the item ID given when the player has
  3618. this item in his/her inventory, while the autoequip function will
  3619. equip the given item ID when this is looted. The option parameter of
  3620. the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off.
  3621. Examples:
  3622. //This will equip a 1104 (falchion) on the character if this is in the inventory.
  3623. equip 1104;
  3624. //The invoked character will now automatically equip a falchion when it's looted.
  3625. autoequip 1104,1;
  3626. //The invoked character will no longer automatically equip a falchion.
  3627. autoequip 1104,0;
  3628. ---------------------------------------
  3629. *buyingstore <slots>;
  3630. Invokes buying store preparation window like the skill 'Open Buying Store',
  3631. without the item requirement. Amount of slots is limited by the server to
  3632. a maximum of 5 slots by default.
  3633. Example:
  3634. // Gives the player opportunity to buy 4 different kinds of items.
  3635. buyingstore 4;
  3636. ---------------------------------------
  3637. *searchstores <uses>,<effect>;
  3638. Invokes the store search window, which allows to search for both vending
  3639. and buying stores. Parameter uses indicates, how many searches can be
  3640. started, before the window has to be reopened. Effect value affects,
  3641. what happens, when a result item is double-clicked and can be one of the
  3642. following:
  3643. 0 = Shows the store's position on the mini-map and highlights the
  3644. shop sign with yellow color, when the store is on same map
  3645. as the invoking player.
  3646. 1 = Directly opens the shop, regardless of distance.
  3647. Example:
  3648. // Item Universal_Catalog_Gold (10 uses, effect: open shop)
  3649. searchstores 10,1;
  3650. ---------------------------------------
  3651. *enable_command;
  3652. *disable_command;
  3653. These commands toggle the ability to use atcommand while interacting with an NPC.
  3654. The default setting, 'atcommand_enable_npc', is defined in 'conf/battle/gm.conf'.
  3655. ---------------------------------------
  3656. //
  3657. 4,1.- End of item-related commands
  3658. //
  3659. ---------------------------------------
  3660. *openstorage;
  3661. This will open character's Kafra storage window on the client connected to the
  3662. invoking character. It can be used from any kind of NPC or item script, not just
  3663. limited to Kafra Staff.
  3664. The storage window opens regardless of whether there are open NPC dialogs or
  3665. not, but it is preferred to close the dialog before displaying the storage
  3666. window, to avoid any disruption when both windows overlap.
  3667. mes "Close this window to open your storage.";
  3668. close2;
  3669. openstorage;
  3670. end;
  3671. ---------------------------------------
  3672. *openmail({<char_id>});
  3673. This will open a character's Mail window on the client connected to the
  3674. invoking character.
  3675. mes "Close this window to open your mail inbox.";
  3676. close2;
  3677. openmail;
  3678. end;
  3679. ---------------------------------------
  3680. *openauction({<char_id>});
  3681. This will open the Auction window on the client connected to the invoking character.
  3682. mes "Close this window to open the Auction window.";
  3683. close2;
  3684. openauction;
  3685. end;
  3686. ---------------------------------------
  3687. \\
  3688. 4,2.- Guild-related commands
  3689. \\
  3690. ---------------------------------------
  3691. *guildopenstorage()
  3692. This function works the same as 'openstorage' but will open a guild storage
  3693. window instead for the guild storage of the guild the invoking character belongs
  3694. to. This is a function because it returns a value - 0 if the guild storage was
  3695. opened successfully and 1 if it wasn't. (Notice, it's a ZERO upon success.)
  3696. Since guild storage is only accessible to one character at one time, it may fail
  3697. if another character is accessing the guild storage at the same time.
  3698. This will also fail and return 2 if the character does not belong to any guild.
  3699. ---------------------------------------
  3700. *guildchangegm(<guild id>,<new master's name>)
  3701. This function will change the Guild Master of a guild. The ID is the guild's
  3702. id, and the new guild master's name must be passed.
  3703. Returns 1 on success, 0 otherwise.
  3704. ---------------------------------------
  3705. *guildgetexp <amount>;
  3706. This will give the specified amount of guild experience points to the guild the
  3707. invoking character belongs to. It will silently fail if they do not belong to
  3708. any guild.
  3709. ---------------------------------------
  3710. *guildskill <skill id>,<level>
  3711. *guildskill "<skill name>",<level>
  3712. This command will bump up the specified guild skill by the specified number of
  3713. levels. This refers to the invoking character and will only work if the invoking
  3714. character is a member of a guild AND its guild master, otherwise no failure
  3715. message will be given and no error will occur, but nothing will happen - same
  3716. about the guild skill trying to exceed the possible maximum. The full list of
  3717. guild skills is available in 'db/(pre-)re/skill_db.txt', these are all the GD_ skills at
  3718. the end.
  3719. // This would give your character's guild one level of Approval (GD_APPROVAL ID
  3720. // 10000). Notice that if you try to add two levels of Approval, or add
  3721. // Approval when the guild already has it, it will only have one level of
  3722. // Approval afterwards.
  3723. guildskill 10000,1,0;
  3724. You might want to make a quest for getting a certain guild skill, make it hard
  3725. enough that all the guild needs to help or something. Doing this for the Glory
  3726. of the Guild skill, which allows your guild to use an emblem, is a good idea for
  3727. a fun quest. (Wasting a level point on that is really annoying :D)
  3728. ---------------------------------------
  3729. //
  3730. 4,2 End of guild-related commands.
  3731. //
  3732. ---------------------------------------
  3733. *resetlvl <action type>{,<char_id>};
  3734. This is a character reset command, meant mostly for rebirth script supporting
  3735. Advanced jobs, which will reset the invoking character's stats and level
  3736. depending on the action type given. Valid action types are:
  3737. 1 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp, wipes the
  3738. status effects (only the ones settable by 'setoption'), sets all stats to 1.
  3739. If the new job is 'Novice High', give 100 status points, give First Aid and
  3740. Play Dead skills.
  3741. 2 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp.
  3742. Skills and attribute values are not altered.
  3743. 3 - Base level 1, base exp 0. Nothing else is changed.
  3744. 4 - Job level 1, job exp 0. Nothing else is changed.
  3745. In all cases everything the character has on will be unequipped.
  3746. Even though it doesn't return a value, it is used as a function in the official
  3747. rebirth scripts. Ask AppleGirl why.
  3748. ---------------------------------------
  3749. *resetstatus({<char_id>});
  3750. This is a character reset command, which will reset the stats on the invoking
  3751. character and give back all the stat points used to raise them previously.
  3752. Nothing will happen to any other numbers about the character.
  3753. Used in reset NPC's (duh!)
  3754. ---------------------------------------
  3755. *resetskill({<char_id>});
  3756. This command takes off all the skill points on the invoking character, so they
  3757. only have Basic Skill blanked out (lvl 0) left, and returns the points for them
  3758. to spend again. Nothing else will change but the skills. Quest skills will also
  3759. reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If
  3760. the 'quest_skill_learn' option is set in there, the points in the quest skills
  3761. will also count towards the total.
  3762. Used in reset NPC's (duh!)
  3763. ---------------------------------------
  3764. *sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
  3765. *sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
  3766. *sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
  3767. *sc_end <effect type>{,<GID>};
  3768. These commands will bestow a status effect on a character.
  3769. The <effect type> determines which status is invoked. This can be either a number
  3770. or constant, with the common statuses (mostly negative) found in 'db/const.txt'
  3771. with the 'SC_' prefix. A full list is located in 'src/map/status.h', though
  3772. they are not currently documented.
  3773. The duration of the status is given in <ticks>, or milleseconds.
  3774. Certain status changes take an additional parameter <value 1>, which typically
  3775. modifies player stats by the given number or percentage. This differs for each
  3776. status, and is sometimes zero.
  3777. Optional value <rate> is the chance that the status will be invoked (100 = 1%).
  3778. This is used primarily in item scripts. When used in an NPC script, a flag MUST
  3779. be defined for the rate to work.
  3780. Optional value <flag> is how the status change start will be handled (a bitmask).
  3781. 1: Status change cannot be avoided.
  3782. 2: Tick cannot be reduced by stats (default).
  3783. 4: sc_data loaded, so no value will be altered.
  3784. 8: Rate cannot be reduced.
  3785. If a <GID> is given, the status change will be invoked on the specified character
  3786. instead of the one attached to the script. This can only be defined after setting
  3787. a rate and flag.
  3788. 'sc_start2' and 'sc_start4' allow extra parameters to be passed, and are used only
  3789. for effects that require them. The meaning of the extra values vary depending on the
  3790. effect type.
  3791. 'sc_end' will remove a specified status effect. If SC_ALL (-1) is given, it will
  3792. perform a complete removal of all statuses (although permanent ones will re-apply).
  3793. Examples:
  3794. // This will poison the invoking character for 10 minutes at 50% chance.
  3795. sc_start SC_POISON,600000,0,5000;
  3796. // This will bestow the effect of Level 10 Blessing.
  3797. sc_start 10,240000,10;
  3798. // Elemental armor defense takes the following four values:
  3799. // val1 is the first element, val2 is the resistance to the element val1.
  3800. // val3 is the second element, val4 is the resistance to the element val3.
  3801. sc_start4 SC_DefEle,60000,Ele_Fire,20,Ele_Water,-15;
  3802. // This will end the Freezing status for the invoking character.
  3803. sc_end SC_FREEZE;
  3804. Note: to use SC_NOCHAT you should alter Manner
  3805. set Manner, -5; // Will mute a user for 5 minutes
  3806. set Manner, 0; // Will unmute a user
  3807. set Manner, 5; // Will unmute a user and prevent the next use of 'Manner'
  3808. ---------------------------------------
  3809. *getstatus(<effect type>{,<type>{,<char_id>}})
  3810. Retrieve information about a specific status effect when called. Depending on <type>
  3811. specified the function will return different information.
  3812. Possible <type> values:
  3813. - 0 or undefined: whether the status is active
  3814. - 1: the val1 of the status
  3815. - 2: the val2 of the status
  3816. - 3: the val3 of the status
  3817. - 4: the val4 of the status
  3818. - 5: the amount of time in milliseconds that the status has remaining
  3819. If <type> is not defined or is set to 0, then the script function will either
  3820. return 1 if the status is active, or 0 if the status is not active. If the status
  3821. is not active when any of the <type> fields are provided, this script function
  3822. will always return 0.
  3823. ---------------------------------------
  3824. *skilleffect <skill id>,<number>;
  3825. *skilleffect "<skill name>",<number>;
  3826. This command displays visual and aural effects of given skill on currently
  3827. attached character. The number parameter is for skill whose visual effect
  3828. involves displaying of a number (healing or damaging). Note, that this command
  3829. will not actually use the skill, it is intended for scripts, which simulate
  3830. skill usage by the NPC, such as buffs, by setting appropriate status and
  3831. displaying the skill's effect.
  3832. mes "Be blessed!";
  3833. // Heal of 2000 HP
  3834. heal 2000,0;
  3835. skilleffect 28,2000;
  3836. // Blessing Level 10
  3837. sc_start 10,240000,10;
  3838. skilleffect 34,0;
  3839. // Increase AGI Level 5
  3840. sc_start 12,140000,5;
  3841. skilleffect 29,0;
  3842. This will heal the character with 2000 HP, buff it with Blessing Lv 10 and
  3843. Increase AGI Lv 5, and display appropriate effects.
  3844. ---------------------------------------
  3845. *npcskilleffect <skill id>,<number>,<x>,<y>;
  3846. *npcskilleffect "<skill name>",<number>,<x>,<y>;
  3847. This command behaves identically to 'skilleffect', however, the effect will not
  3848. be centered on the invoking character's sprite, nor on the NPC sprite, if any,
  3849. but will be centered at map coordinates given on the same map as the invoking
  3850. character.
  3851. ---------------------------------------
  3852. *specialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
  3853. This command will display special effect with the given number, centered on the
  3854. specified NPCs coordinates, if any. For a full list of special effect numbers
  3855. known see 'doc/effect_list.txt'. Some effect numbers are known not to work in
  3856. some client releases. (Notably, rain is absent from any client executables
  3857. released after April 2005.)
  3858. <NPC name> parameter will display <effect number> on another NPC. If the NPC
  3859. specified does not exist, the command will do nothing. When specifying an NPC,
  3860. <send_target> must be specified when specifying an <NPC Name>, specifying AREA
  3861. will retain the default behavior of the command.
  3862. // this will make the NPC "John Doe#1"
  3863. // show the effect "EF_HIT1" specified by
  3864. // Jane Doe. I wonder what John did...
  3865. mes "[Jane Doe]";
  3866. mes "Well, I never!";
  3867. specialeffect EF_HIT1,AREA,"John Doe#1";
  3868. close;
  3869. ---------------------------------------
  3870. *specialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
  3871. This command behaves identically to 'specialeffect', but the effect will be
  3872. centered on the invoking character's sprite.
  3873. <Player name> parameter will display <effect number> on another Player than the
  3874. one currently attached to the script. Like with specialeffect, when specifying
  3875. a player, <send_target> must be supplied, specifying AREA will retain the default
  3876. behavior of the command.
  3877. ---------------------------------------
  3878. *statusup <stat>{,<char_id>};
  3879. This command will bump a specified stat of the invoking character up by one
  3880. permanently. Stats are to be given as number, but you can use these constants to
  3881. replace them:
  3882. bStr - Strength
  3883. bVit - Vitality
  3884. bInt - Intelligence
  3885. bAgi - Agility
  3886. bDex - Dexterity
  3887. bLuk - Luck
  3888. ---------------------------------------
  3889. *statusup2 <stat>,<amount>{,<char_id>};
  3890. This command will bump a specified stat of the invoking character up by the
  3891. specified amount permanently. The amount can be negative. See 'statusup'.
  3892. // This will decrease a character's Vit forever.
  3893. statusup bVit,-1;
  3894. ---------------------------------------
  3895. *bonus <bonus type>,<val1>;
  3896. *bonus2 <bonus type>,<val1>,<val2>;
  3897. *bonus3 <bonus type>,<val1>,<val2>,<val3>;
  3898. *bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
  3899. *bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
  3900. These commands are meant to be used in item scripts. They will probably work
  3901. outside item scripts, but the bonus will not persist for long. They, as
  3902. expected, refer only to an invoking character.
  3903. You can find the full list of possible bonuses and which command to use for each
  3904. kind in 'doc/item_bonus.txt'.
  3905. ---------------------------------------
  3906. *autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  3907. *autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  3908. *autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
  3909. *autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
  3910. These commands are meant to be used in item scripts. They will probably work
  3911. outside item scripts, but the bonus will not persist for long. They, as
  3912. expected, refer only to an invoking character.
  3913. What these commands do is 'attach' a script to the player which will get
  3914. executed on attack (or when attacked in the case of autobonus2).
  3915. Rate is the trigger rate of the script (1000 = 100%).
  3916. Duration is the time that the bonus will last for since the script has triggered.
  3917. Skill ID/skill name the skill which will be used as trigger to start the bonus. (autobonus3)
  3918. The optional argument 'flag' is used to classify the type of attack where the script
  3919. can trigger (it shares the same flags as the bAutoSpell bonus script):
  3920. Range criteria:
  3921. BF_SHORT: Trigger on melee attack
  3922. BF_LONG: Trigger on ranged attack
  3923. Default: BF_SHORT+BF_LONG
  3924. Attack type criteria:
  3925. BF_WEAPON: Trigger on weapon skills
  3926. BF_MAGIC: Trigger on magic skills
  3927. BF_MISC: Trigger on misc skills
  3928. Default: BF_WEAPON
  3929. Skill criteria:
  3930. BF_NORMAL: Trigger on normal attacks
  3931. BF_SKILL: Trigger on skills
  3932. default: If the attack type is BF_WEAPON (only) BF_NORMAL is used,
  3933. otherwise BF_SKILL+BF_NORMAL is used.
  3934. The difference between the optional argument 'other script' and the 'bonus script' is that,
  3935. the former one triggers only when attacking(or attacked) and the latter one runs on
  3936. status calculation as well, which makes sure, within the duration, the "bonus" that get
  3937. lost on status calculation is restored. So, 'bonus script' is technically supposed to accept
  3938. "bonus" command only. And we usually use 'other script' to show visual effects.
  3939. In all cases, when the script triggers, the attached player will be the one
  3940. who holds the bonus. There is currently no way of knowing within this script
  3941. who was the other character (the attacker in autobonus2, or the target in
  3942. autobonus and autobonus3).
  3943. //Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
  3944. //using weapon or misc attacks (both melee and ranged skills) and shows a special
  3945. //effect when the bonus is active.
  3946. autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
  3947. ---------------------------------------
  3948. *bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};
  3949. This command will attach a script to a player for a given duration, in seconds.
  3950. After that time, the script will automatically expire. The same bonus cannot be
  3951. stacked. By default, this bonus will be stored on `bonus_script` table when player
  3952. logs out.
  3953. Flags (bitmask):
  3954. 1 : Remove when dead.
  3955. 2 : Removable by Dispell.
  3956. 4 : Removable by Clearance.
  3957. 8 : Remove when player logs out.
  3958. 16 : Removeable by Banishing Buster.
  3959. 32 : Removable by Refresh.
  3960. 64 : Removable by Luxanima.
  3961. 128 : Remove when Madogear is activated or deactivated.
  3962. 256 : Remove when receive damage.
  3963. 512 : Script is permanent, cannot be cleared by bonus_script_clear.
  3964. 1024: Force to replace duplicated script by expanding the duration.
  3965. 2048: Force to add duplicated script. This flag cannot be stacked with 1024,
  3966. if both are defined, 1024 will be checked first and ignore this flag.
  3967. Types:
  3968. This will be used to decide negative or positive buff for 'debuff_on_logout'.
  3969. 0: Ignore the buff type and won't be removed if the flag is not &8 (Default)
  3970. 1: Buff
  3971. 2: Debuff
  3972. Status_icon: See "Status Icon" section in 'db/const.txt'. Default is SI_BLANK (-1).
  3973. Example:
  3974. // Apple gives you +5 Str bonus for 1 minute when it's consumed.
  3975. 512,Apple,Apple,0,15,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "{ bonus bStr,5; }",60; },{},{}
  3976. ---------------------------------------
  3977. *bonus_script_clear {<flag>,{<char_id>}};
  3978. Removes attached bonus_script from player. If no 'char_id' given, it will removes
  3979. from the invoker.
  3980. If 'flag' is 1, means will clears all scripts even it's Permanent effect. By default,
  3981. it just removes non-permanent script.
  3982. ---------------------------------------
  3983. *skill <skill id>,<level>{,<flag>};
  3984. *skill "<skill name>",<level>{,<flag>};
  3985. *addtoskill <skill id>,<level>{,<flag>};
  3986. *addtoskill "<skill name>",<level>{,<flag>};
  3987. These commands will give the invoking character a specified skill. This is also
  3988. used for item scripts.
  3989. Level is obvious. Skill id is the ID number of the skill in question as per
  3990. 'db/(pre-)re/skill_db.txt'. It is not known for certain whether this can be used to give
  3991. a character a monster's skill, but you're welcome to try with the numbers given
  3992. in 'db/(pre-)re/mob_skill_db.txt'.
  3993. Flag is 0 if the skill is given permanently (will get written with the character
  3994. data) or 1 if it is temporary (will be lost eventually, this is meant for card
  3995. item scripts usage.). The flag parameter is optional, and defaults to 1 in
  3996. 'skill' and to 2 in 'addtoskill'.
  3997. Flag 2 means that the level parameter is to be interpreted as a stackable
  3998. additional bonus to the skill level. If the character did not have that skill
  3999. previously, they will now at 0+the level given.
  4000. Flag 3 is the same as flag 1 in that it saves to the database. However, these skills
  4001. are ignored when any action is taken that adjusts the skill tree (reset/job change).
  4002. Flag constants:
  4003. 0 - SKILL_PERM
  4004. 1 - SKILL_TEMP
  4005. 2 - SKILL_TEMPLEVEL
  4006. 3 - SKILL_PERM_GRANT
  4007. // This will permanently give the character Stone Throw (TF_THROWSTONE,152), at
  4008. // level 1.
  4009. skill 152,1,0;
  4010. ---------------------------------------
  4011. *nude {<char_id>};
  4012. This command will unequip anything equipped on the invoking character.
  4013. It is not required to do this when changing jobs since 'jobchange' will unequip
  4014. everything not equippable by the new job class anyway.
  4015. ---------------------------------------
  4016. *sit {"<character name>"};
  4017. *stand {"<character name>"};
  4018. These commands will make a character sit or stand.
  4019. If no character is specified, the command will run for the invoking character.
  4020. ---------------------------------------
  4021. *disguise <Monster ID>{,<char_id>};
  4022. *undisguise {<char_id>};
  4023. This command disguises the current player with a monster sprite.
  4024. The disguise lasts until 'undisguise' is issued or the player logs out.
  4025. Example:
  4026. disguise 1002; // Disguise character as a Poring.
  4027. next;
  4028. undisguise; // Return to normal character sprite.
  4029. ---------------------------------------
  4030. *transform <monster ID>,<duration>,<sc type>{,<val1>,<val2>,<val3>,<val4>};
  4031. *transform "<monster name>",<duration>,<sc type>{,<val1>,<val2>,<val3>,<val4>};
  4032. This command will turn a player into a monster for a given duration and grants an
  4033. SC attribute effect while transformed. Note that players cannot be transformed
  4034. during War of Emperium or if already disguised.
  4035. Can only be removed when you die or the duration ends.
  4036. ---------------------------------------
  4037. \\
  4038. 4,3 Marriage-related commands
  4039. \\
  4040. ---------------------------------------
  4041. *marriage("<spouse name>");
  4042. This function will marry two characters, the invoking character and the one
  4043. referred to by name given, together, setting them up as each other's marriage
  4044. partner. No second function call has to be issued (in current SVN at least) to
  4045. make sure the marriage works both ways. The function returns 1 upon success, or
  4046. 0 if the marriage could not be completed, either because the other character
  4047. wasn't found or because one of the two characters is already married.
  4048. This will do nothing else for the marriage except setting up the spouse ID for
  4049. both of these characters. No rings will be given and no effects will be shown.
  4050. ---------------------------------------
  4051. *wedding;
  4052. This command will call up wedding effects - the music and confetti - centered on
  4053. the invoking character. Example can be found in the wedding script.
  4054. ---------------------------------------
  4055. *divorce({<char_id>})
  4056. This function will "un-marry" the invoking character from whoever they were
  4057. married to. Both will no longer be each other's marriage partner, (at least in
  4058. current SVN, which prevents the cases of multi-spouse problems). It will return
  4059. 1 upon success or 0 if the character was not married at all.
  4060. This function will also destroy both wedding rings and send a message to both
  4061. players, telling them they are now divorced.
  4062. ---------------------------------------
  4063. //
  4064. 4,3.- End of marriage-related commands
  4065. //
  4066. ---------------------------------------
  4067. *pcfollow <id>,<target id>;
  4068. *pcstopfollow <id>;
  4069. Makes a character follow or stop following someone. This command does the same
  4070. as the @follow command. The main difference is that @follow can use character
  4071. names, and this commands needs the account ID for the target.
  4072. Examples:
  4073. // This will make Aaron follow Bullah, when both of these characters are online.
  4074. pcfollow getCharID(3,"Aaron"),getCharID(3,"Bullah");
  4075. // Makes Aaron stop following whoever he is following.
  4076. pcstopfollow getCharID(3,"Aaron");
  4077. ---------------------------------------
  4078. *pcblockmove <id>,<option>;
  4079. *unitblockmove <id>,<option>;
  4080. Prevents the given GID from moving when the option is 1, and enables the ID to
  4081. move again when the option is 0. This command will run for the attached unit
  4082. if the given GID is zero.
  4083. Examples:
  4084. // Prevents the current char from moving away.
  4085. pcblockmove getcharid(3),1;
  4086. // Enables the current char to move again.
  4087. pcblockmove getcharid(3),0;
  4088. ---------------------------------------
  4089. ==================================
  4090. |5.- Mob / NPC -related commands.|
  4091. ==================================
  4092. ---------------------------------------
  4093. *monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4094. *areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4095. This command will spawn a monster on the specified coordinates on the specified
  4096. map. If the script is invoked by a character, a special map name, "this", will
  4097. be recognized to mean the name of the map the invoking character is located at.
  4098. This command works fine in the item scripts.
  4099. The same command arguments mean the same things as described above in the
  4100. beginning of this document when talking about permanent monster spawns. Monsters
  4101. spawned in this manner will not respawn upon being killed.
  4102. Unlike the permanent monster spawns, if the mob id is -1, a random monster will
  4103. be picked from the entire database according to the rules configured in the
  4104. server for dead branches. This will work for all other kinds of non-permanent
  4105. monster spawns.
  4106. The only very special thing about this command is an event label, which is an
  4107. optional parameter. This label is written like '<NPC object name>::<label name>'
  4108. and upon the monster being killed, it will execute the script inside of the
  4109. specified NPC object starting from the label given. The RID of the player
  4110. attached at this execution will be the RID of the killing character.
  4111. <size> can be:
  4112. 0 = medium (default)
  4113. 1 = small
  4114. 2 = big
  4115. <ai> can be:
  4116. 0 = none (default)
  4117. 1 = attack/friendly
  4118. 2 = sphere (Alchemist skill)
  4119. 3 = flora (Alchemist skill)
  4120. 4 = zanzou (Kagerou/Oboro skill)
  4121. 5 = legion (Sera skill)
  4122. 6 = faw (Mechanic skill)
  4123. monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
  4124. The coordinates of 0,0 will spawn the monster on a random place on the map.
  4125. The 'areamonster' command works much like the 'monster' command and is not
  4126. significantly different, but spawns the monsters within a square defined by
  4127. x1/y1-x2/y2.
  4128. Returned value is an array with the game ID of the spawned monster(s) depending
  4129. on the amount spawned. Array is stored in $@mobid[].
  4130. Simple monster killing script:
  4131. <Normal NPC object definition. Let's assume you called him NPCNAME.>
  4132. mes "[Summon Man]";
  4133. mes "Want to start the Poring hunt?";
  4134. next;
  4135. if(select("Yes.:No.") == 2) {
  4136. mes "[Summon Man]";
  4137. mes "Come back later.";
  4138. close;
  4139. }
  4140. // Summon 10 Porings.
  4141. // Using coordinates 0,0 will spawn them in a random location.
  4142. monster "prontera",0,0,"Quest Poring",1002,10,"NPCNAME::OnPoringKilled";
  4143. mes "[Summon Man]";
  4144. mes "Now go and kill all the Porings I summoned.";
  4145. close;
  4146. OnPoringKilled:
  4147. $PoringKilled++;
  4148. if ($PoringKilled >= 10) goto L_AllDead;
  4149. end;
  4150. L_AllDead:
  4151. announce "Summon Man: Well done. All the Porings are dead!",3;
  4152. $PoringKilled = 0;
  4153. end;
  4154. For more good examples see just about any official 2-1 or 2-2 job quest script.
  4155. ---------------------------------------
  4156. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4157. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4158. This command will make all monsters of the specified mob ID in the specified
  4159. area use the specified skill. Map name, x, and y define the center of the area,
  4160. which extending <range> cells in each direction (ex: a range of 3 would create
  4161. a 7x7 square). The skill can be specified by skill ID or name. <cast time> is in
  4162. milliseconds (1000 = 1 second), and the rest should be self-explanatory.
  4163. <target type> can be:
  4164. 0 = self
  4165. 1 = the mob's current target
  4166. 2 = the mob's master
  4167. 3 = random target
  4168. Example:
  4169. // spawn 1 Shining Plant in the 5x5 area centered on (155,188)
  4170. areamonster "prontera",153,186,157,190,"Shining Plant",1083,1;
  4171. // make the plant cast level 10 Cold Bolt on a random target
  4172. areamobuseskill "prontera",155,188,2,1083,"MG_COLDBOLT",10,3000,1,e_gg,3;
  4173. ---------------------------------------
  4174. *killmonster "<map name>","<event label>"{,<type>};
  4175. This command will kill all monsters that were spawned with 'monster' or
  4176. 'addmonster' and have a specified event label attached to them. Commonly used to
  4177. get rid of remaining quest monsters once the quest is complete.
  4178. If the label is given as "All", all monsters which have their respawn times set
  4179. to -1 (like all the monsters summoned with 'monster' or 'areamonster' script
  4180. command, and all monsters summoned with GM commands, but no other ones - that
  4181. is, all non-permanent monsters) on the specified map will be killed regardless
  4182. of the event label value.
  4183. As of r12876 killmonster now supports an optional argument type. Using 1 for type
  4184. will make the command fire "OnMyMobDead" events from any monsters that do die
  4185. as a result of this command.
  4186. ---------------------------------------
  4187. *killmonsterall "<map name>"{,<type>};
  4188. This command will kill all monsters on a specified map name, regardless of how
  4189. they were spawned or what they are. As of r12873, The behavior has changed slightly.
  4190. In light of a label behavior fix for mob spawning commands that will now allow the label to
  4191. trigger when there is no player, killmonsterall has also been modified to support this.
  4192. Using this the normal/old way means labels don't trigger when a player didn't
  4193. attack/kill a monster. This is because it breaks compatibility with older scripts if
  4194. forced to use the new method. However, if you wish to use the new label type with this
  4195. command, simply use 1 for type. Any other number won't be recognized.
  4196. ---------------------------------------
  4197. *strmobinfo(<type>,<monster id>);
  4198. This function will return information about a monster record in the database, as
  4199. per 'db/(pre-)re/mob_db.txt'. Type is the kind of information returned. Valid types are:
  4200. It will return 0 if there is no such monster (or the type value is invalid),
  4201. or an empty string if you requested the monster's name.
  4202. 1 - 'english name' field in the database, a string.
  4203. 2 - 'japanese name' field in the database, a string.
  4204. All other returned values are numbers:
  4205. 3 - Level.
  4206. 4 - Maximum HP.
  4207. 5 - Maximum SP.
  4208. 6 - Experience reward.
  4209. 7 - Job experience reward.
  4210. ---------------------------------------
  4211. *mobcount("<map name>","<event label>")
  4212. This function will count all the monsters on the specified map that have a given
  4213. event label and return the number or 0 if it can't find any. Naturally, only
  4214. monsters spawned with 'monster' and 'areamonster' script commands can have non-empty
  4215. event label.
  4216. If you pass this function an empty string for the event label, it will return
  4217. the total count of monster without event label, including permanently spawning monsters.
  4218. With the dynamic mobs system enabled, where mobs are not kept
  4219. in memory for maps with no actual people playing on them, this will return a 0
  4220. for any such map.
  4221. If the event label is given as "all", all monsters will be counted, regardless of
  4222. having any event label attached.
  4223. If the map name is given as "this", the map the invoking character is on will
  4224. be used. If the map is not found, or the invoker is not a character while the map
  4225. is "this", it will return -1.
  4226. ---------------------------------------
  4227. *clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
  4228. This command creates a monster which is a copy of another player. The first
  4229. four arguments serve the same purpose as in the monster script command, The
  4230. <char id> is the character id of the player to clone (player must be online).
  4231. If <master id> is given, the clone will be a 'slave/minion' of it. Master_id
  4232. must be a character id of another online player.
  4233. The mode can be specified to determine the behavior of the clone. Its
  4234. values are the same as the ones used for the mode field in the mob_db. The
  4235. default mode is aggressive, assists, can move, can attack.
  4236. Flag can be either zero or one currently. If zero, the clone is a normal
  4237. monster that'll target players, if one, it is considered a summoned monster,
  4238. and as such, it'll target other monsters. Defaults to zero.
  4239. The duration specifies how long the clone will live before it is auto-removed.
  4240. Specified in seconds, defaults to no limit (zero).
  4241. Returned value is the monster ID of the spawned clone. If command fails,
  4242. returned value is zero.
  4243. ---------------------------------------
  4244. *summon "monster name",<monster id>{,<Time Out>{,"event label"}};
  4245. This command will summon a monster. (see also 'monster') Unlike monsters spawned
  4246. with other commands, this one will set up the monster to fight to protect the
  4247. invoking character. Monster name and mob id obey the same rules as the one given
  4248. at the beginning of this document for permanent monster spawns with the
  4249. exceptions mentioned when describing 'monster' command.
  4250. The effect for the skill 'Call Homunculus' will be displayed centered on the
  4251. invoking character.
  4252. Timeout is the time in milliseconds the summon lives, and is set default
  4253. to 60000 (1 minute). Note that also the value 0 will set the timer to default,
  4254. and it is not possible to create a spawn that lasts forever.
  4255. If an event label is given, upon the monster being killed, the event label will
  4256. run as if by 'donpcevent'.
  4257. Returned value is the game ID of the spawned monster.
  4258. // Will summon a dead branch-style monster to fight for the character.
  4259. summon "--ja--",-1;
  4260. ---------------------------------------
  4261. *addmonsterdrop <monster id>,<item id>,<rate>;
  4262. *addmonsterdrop "<monster name>",<item id>,<rate>;
  4263. *delmonsterdrop <monster id>,<item id>;
  4264. *delmonsterdrop "<monster name>",<item id>;
  4265. These commands will temporarily add or delete a monster drop, which will be reset
  4266. when the mob database reloads or the server shuts down. They return 1 upon success.
  4267. If the monster already drops the specified item, its drop rate will be updated with
  4268. the given rate (100 = 1%).
  4269. Examples:
  4270. // Makes Owl Baron drop Honey at an 80% rate.
  4271. addmonsterdrop 1295,518,8000;
  4272. // Deletes Executioner's Mitten from Rybio.
  4273. delmonsterdrop 1201,7017;
  4274. ---------------------------------------
  4275. *disablenpc "<NPC object name>";
  4276. *enablenpc "<NPC object name>";
  4277. These two commands will disable and enable, respectively, an NPC object
  4278. specified by name. The disabled NPC will disappear from sight and will no longer
  4279. be triggerable in the normal way. It is not clear whether it will still be
  4280. accessible through 'donpcevent' and other triggering commands, but it probably
  4281. will be. You can disable even warp NPCs if you know their object names, which is
  4282. an easy way to make a map only accessible through walking half the time. Then
  4283. you 'enablenpc' them back.
  4284. You can also use these commands to create the illusion of an NPC switching
  4285. between several locations, which is often better than actually moving the NPC -
  4286. create one NPC object with a visible and a hidden part to their name, make a few
  4287. copies, and then disable all except one.
  4288. ---------------------------------------
  4289. *hideonnpc "<NPC object name>";
  4290. *hideoffnpc "<NPC object name>";
  4291. These commands will make the NPC object specified display as hidden/visible,
  4292. even though not actually disabled per se. Hidden as in thief Hide skill, but
  4293. unfortunately, not detectable by Ruwach or Sight.
  4294. As they are now, these commands are pointless, it is suggested to use
  4295. 'disablenpc'/'enablenpc', because these two commands actually unload the NPC
  4296. sprite location and other accompanying data from memory when it is not used.
  4297. However, you can use these for some quest ideas (such as cloaking NPCs talking
  4298. while hidden then revealing.... you can wonder around =P
  4299. ---------------------------------------
  4300. *doevent "<NPC object name>::<event label>";
  4301. This command will start a new execution thread in a specified NPC object at the
  4302. specified label. The execution of the script running this command will not stop,
  4303. and the event called by the 'doevent' command will not run until the invoking
  4304. script has terminated. No parameters may be passed with a doevent call.
  4305. The script of the NPC object invoked in this manner will run as if it's been
  4306. invoked by the RID that was active in the script that issued a 'doevent'. As
  4307. such, the command will not work if an RID is not attached.
  4308. place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
  4309. mes "This is what you will see when you click me";
  4310. close;
  4311. OnLabel:
  4312. mes "This is what you will see if the doevent is activated";
  4313. close;
  4314. }
  4315. ....
  4316. doevent "NPC::OnLabel";
  4317. ---------------------------------------
  4318. *donpcevent "<NPC object name>::<event label>";
  4319. This command invokes the event label code within an another NPC or NPCs. It
  4320. starts a separate instance of execution, and the invoking NPC will resume
  4321. execution its immediately.
  4322. If the supplied event label has the form "NpcName::OnLabel", then only given
  4323. NPC's event label will be invoked (much like 'goto' into another NPC). If the
  4324. form is "::OnLabel" (NPC name omitted), the event code of all NPCs with given
  4325. label will be invoked, one after another. In both cases the invoked script
  4326. will run without an attached RID, whether or not the invoking script was
  4327. attached to a player. The event label name is required to start with "On".
  4328. This command can be used to make other NPCs act, as if they were responding to
  4329. the invoking NPC's actions, such as using an emotion or talking.
  4330. place,100,100,1%TAB%script%TAB%NPC1%TAB%53,{
  4331. mes "NPC2 copies my actions!";
  4332. close2;
  4333. donpcevent "NPC2::OnEmote";
  4334. OnEmote:
  4335. emotion rand(1,30);
  4336. end;
  4337. }
  4338. place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{
  4339. mes "NPC1 copies my actions!";
  4340. close2;
  4341. donpcevent "NPC1::OnEmote";
  4342. OnEmote:
  4343. emotion rand(1,30);
  4344. end;
  4345. }
  4346. Whichever of the both NPCs is talked to, both will show a random emotion at the
  4347. same time.
  4348. As of r16564, command now returns 1 or 0 on success and failure.
  4349. A debug message also shows on the console when no events are triggered.
  4350. ---------------------------------------
  4351. *cmdothernpc "<npc name>","<command>";
  4352. This is simply "donpcevent <npc name>::OnCommand<command>".
  4353. It is an approximation of official server script language's 'cmdothernpc'.
  4354. ---------------------------------------
  4355. *npctalk "<message>";
  4356. This command will display a message to the surrounding area as if the NPC object
  4357. running it was a player talking - that is, above their head and in the chat
  4358. window. The display name of the NPC will get appended in front of the message to
  4359. complete the effect.
  4360. // This will make everyone in the area see the NPC greet the character
  4361. // who just invoked it.
  4362. npctalk "Hello "+strcharinfo(0)+", how are you?";
  4363. ---------------------------------------
  4364. *setnpcdisplay("<npc name>", "<display name>", <class id>, <size>)
  4365. *setnpcdisplay("<npc name>", "<display name>", <class id>)
  4366. *setnpcdisplay("<npc name>", "<display name>")
  4367. *setnpcdisplay("<npc name>", <class id>)
  4368. Changes the display name and/or display class of the target NPC.
  4369. Returns 0 is successful, 1 if the NPC does not exist.
  4370. Size is 0 = normal 1 = small 2 = big.
  4371. ---------------------------------------
  4372. \\
  4373. 5,1.- Time-related commands
  4374. \\
  4375. ---------------------------------------
  4376. *addtimer <ticks>,"NPC::OnLabel";
  4377. *deltimer "NPC::OnLabel";
  4378. *addtimercount <ticks>,"NPC::OnLabel";
  4379. These commands will create, destroy, and delay a countdown timer - 'addtimer' to
  4380. create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified
  4381. number of ticks. For all three cases, the event label given is the identifier of
  4382. that timer. The timer runs on the character object that is attached to the script,
  4383. and can have multiple instances. When the label is run, it is run as if the player that
  4384. the timer runs on has clicked the NPC.
  4385. When this timer runs out, a new execution thread will start in the specified NPC
  4386. object at the specified label.
  4387. The ticks are given in 1/1000ths of a second.
  4388. One more thing. These timers are stored as part of player data. If the player
  4389. logs out, all of these get immediately deleted, without executing the script.
  4390. If this behavior is undesirable, use some other timer mechanism (like 'sleep').
  4391. Example:
  4392. <NPC Header> {
  4393. dispbottom "Starting a 5 second timer...";
  4394. addtimer 5000, strnpcinfo(3)+"::On5secs";
  4395. end;
  4396. On5secs:
  4397. dispbottom "5 seconds have passed!";
  4398. end;
  4399. }
  4400. ---------------------------------------
  4401. *initnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  4402. { "<NPC name>" | <Attach Flag> };
  4403. *stopnpctimer{ "<NPC name>" {, <Detach Flag>} } |
  4404. { "<NPC name>" | <Detach Flag> };
  4405. *startnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  4406. { "<NPC name>" | <Attach Flag> };
  4407. *setnpctimer <tick>{,"<NPC name>"};
  4408. *getnpctimer(<type of information>{,"<NPC name>"})
  4409. *attachnpctimer {"<character name>"};
  4410. *detachnpctimer {"<NPC name>"};
  4411. This set of commands and functions will create and manage an NPC-based timer.
  4412. The NPC name may be omitted, in which case the calling NPC is used as target.
  4413. Contrary to addtimer/deltimer commands which let you have many different timers
  4414. referencing different labels in the same NPC, each with their own countdown,
  4415. 'initnpctimer' can only have one per NPC object. But it can trigger many labels
  4416. and let you know how many were triggered already and how many still remain.
  4417. This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon
  4418. creating this timer, the execution will not stop, but will happily continue
  4419. onward. The timer will then invoke new execution threads at labels
  4420. "OnTimer<time>:" in the NPC object it is attached to.
  4421. To create the timer, use the 'initnpctimer', which will start it running.
  4422. 'stopnpctimer' will pause the timer, without clearing the current tick, while
  4423. 'startnpctimer' will let the paused timer continue.
  4424. By default timers do not have a RID attached, which lets them continue even
  4425. if the player that started them logs off. To attach a RID to a timer, you can
  4426. either use the optional "attach flag" when using 'initnpctimer/startnpctimer',
  4427. or do it manually by using 'attachnpctimer'. Likewise, the optional flag of
  4428. stopnpctimer lets you detach any RID after stopping the timer, and by using
  4429. 'detachnpctimer' you can detach a RID at any time.
  4430. Normally there is only a single timer per NPC, but as an exception, as long as
  4431. you attach a player to the timer, you can have multiple timers running at once,
  4432. because these will get stored on the players instead of the NPC.
  4433. NOTE: You need to attach the RID before the timer _before_ you start it to
  4434. get a player-attached timer. Otherwise it'll stay a NPC timer (no effect).
  4435. If the player that is attached to the npctimer logs out, the "OnTimerQuit:"
  4436. event label of that NPC will be triggered, so you can do the appropriate
  4437. cleanup (the player is still attached when this event is triggered).
  4438. The 'setnpctimer' command will explicitly set the timer to a given tick.
  4439. 'getnpctimer' provides timer information. Its parameter defines what type:
  4440. 0 - Will return the current tick count of the timer.
  4441. 1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the
  4442. specified NPC waiting for execution.
  4443. 2 - Will return the number of times the timer has triggered and will trigger
  4444. an "OnTimer<tick>:" label in the specified NPC.
  4445. Example 1:
  4446. <NPC Header> {
  4447. // We need to use attachnpctimer because the mes command below needs RID attach
  4448. attachnpctimer;
  4449. initnpctimer;
  4450. npctalk "I cant talk right now, give me 10 seconds";
  4451. end;
  4452. OnTimer5000:
  4453. npctalk "Ok 5 seconds more";
  4454. end;
  4455. OnTimer6000:
  4456. npctalk "4";
  4457. end;
  4458. OnTimer7000:
  4459. npctalk "3";
  4460. end;
  4461. OnTimer8000:
  4462. npctalk "2";
  4463. end;
  4464. OnTimer9000:
  4465. npctalk "1";
  4466. end;
  4467. OnTimer10000:
  4468. stopnpctimer;
  4469. mes "[Man]";
  4470. mes "Ok we can talk now";
  4471. detachnpctimer;
  4472. // and remember attachnpctimer and detachnpctimer can only use while the NPC timer is not running !
  4473. }
  4474. Example 2:
  4475. OnTimer15000:
  4476. npctalk "Another 15 seconds have passed.";
  4477. // You have to use 'initnpctimer' instead of 'setnpctimer 0'.
  4478. // This is equal to 'setnpctimer 0' + 'startnpctimer'.
  4479. // Alternatively, you can also insert another 'OnTimer15001' label so that the timer won't stop. */
  4480. initnpctimer;
  4481. end;
  4482. // This OnInit label will run when the script is loaded, so that the timer
  4483. // is initialized immediately as the server starts. It is dropped back to 0
  4484. // every time the NPC says something, so it will cycle continuously.
  4485. OnInit:
  4486. initnpctimer;
  4487. end;
  4488. Example 3:
  4489. mes "[Man]";
  4490. mes "I have been waiting "+(getnpctimer(0)/1000)+" seconds for you.";
  4491. // We divide the timer returned by 1000 to convert milliseconds to seconds.
  4492. close;
  4493. Example 4:
  4494. mes "[Man]";
  4495. mes "Ok, I will let you have 30 more seconds...";
  4496. close2;
  4497. setnpctimer (getnpctimer(0)-30000);
  4498. // Notice the 'close2'. If there were a 'next' there the timer would be
  4499. // changed only after the player pressed the 'next' button.
  4500. end;
  4501. ---------------------------------------
  4502. *sleep {<milliseconds>};
  4503. *sleep2 {<milliseconds>};
  4504. *awake "<NPC name>";
  4505. These commands are used to control the pause of a NPC.
  4506. sleep and sleep2 will pause the script for the given amount of milliseconds.
  4507. Awake is used to cancel a sleep. When awake is called on a NPC it will run as
  4508. if the sleep timer ran out, and thus making the script continue. Sleep and sleep2
  4509. basically do the same, but the main difference is that sleep will not keep the rid,
  4510. while sleep2 does.
  4511. Examples:
  4512. sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore)
  4513. sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached.
  4514. awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'.
  4515. ---------------------------------------
  4516. *progressbar "<color>",<seconds>;
  4517. This command works almost like sleep2, but displays a progress bar
  4518. above the head of the currently attached character (like cast bar).
  4519. Once the given amount of seconds passes, the script resumes. If the
  4520. character moves while the progress bar progresses, it is aborted and
  4521. the script ends. The color format is in RGB (0xRRGGBB). The color is
  4522. currently ignored by the client and appears always green.
  4523. ---------------------------------------
  4524. //
  4525. 5,1.- End of time-related commands
  4526. //
  4527. ---------------------------------------
  4528. *announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  4529. This command will broadcast a message to all or most players, similar to
  4530. @kami/@kamib GM commands.
  4531. announce "This will be shown to everyone at all in yellow.",0;
  4532. The region the broadcast is heard in (target), source of the broadcast
  4533. and the color the message will come up as is determined by the flags.
  4534. The flag values are coded as constants in 'db/const.txt' to make them easier to use.
  4535. Target flags:
  4536. - bc_all: Broadcast message is sent server-wide (default).
  4537. - bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below).
  4538. - bc_area: Message is sent to players in the vicinity of the source.
  4539. - bc_self: Message is sent only to current player.
  4540. You cannot use more than one target flag.
  4541. Source flags:
  4542. - bc_pc: Broadcast source is the attached player (default).
  4543. - bc_npc: Broadcast source is the NPC, not the player attached to the script
  4544. (useful when a player is not attached or the message should be sent to those
  4545. nearby the NPC).
  4546. You cannot use more than one source flag.
  4547. Special flags:
  4548. - bc_yellow: Broadcast will be displayed in yellow color (default).
  4549. - bc_blue: Broadcast will be displayed in blue color.
  4550. - bc_woe: Indicates that this broadcast is 'WoE Information' that can be disabled client-side.
  4551. Due to the way client handles broadcasts, it is impossible to set both bc_blue and bc_woe.
  4552. The optional parameters allow usage of broadcasts in custom colors, font-weights, sizes etc.
  4553. If any of the optional parameters is used, special flag is ignored.
  4554. Optional parameters may not work well (or at all) depending on a game client used.
  4555. The color parameter is a single number which can be in hexadecimal notation.
  4556. For example:
  4557. announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
  4558. Will display a global announce in green. The color format is in RGB (0xRRGGBB).
  4559. In official scripts only two font-weights (types) are used:
  4560. - normal (FW_NORMAL = 400, default),
  4561. - bold (FW_BOLD = 700).
  4562. Default font size is 12.
  4563. Using this for private messages to players is probably not that good an idea,
  4564. but it can be used instead in NPCs to "preview" an announce.
  4565. // This will be a private message to the player using the NPC that made the
  4566. // announcement
  4567. announce "This is my message just for you",bc_blue|bc_self;
  4568. // This will be shown on everyones screen that is in sight of the NPC.
  4569. announce "This is my message just for you people here",bc_npc|bc_area;
  4570. ---------------------------------------
  4571. *mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  4572. This command will work like 'announce' but will only broadcast to characters
  4573. currently residing on the specified map. The flag and optional parameters
  4574. parameters are the same as in 'announce', but target and source flags are ignored.
  4575. ---------------------------------------
  4576. *areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  4577. This command works like 'announce' but will only broadcast to characters
  4578. residing in the specified x1/y1-x2/y2 rectangle on the map given. The flags and
  4579. optional parameters are the same as in 'announce', but target and source flags are ignored.
  4580. areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0;
  4581. ---------------------------------------
  4582. *callshop "<name>",<option>;
  4583. These are a series of commands used to create dynamic shops.
  4584. The 'callshop' function calls an invisible shop (view -1) as if the player clicked on it.
  4585. The options are:
  4586. 0 = The normal window (buy, sell and cancel)
  4587. 1 = The buy window
  4588. 2 = The sell window
  4589. A shop called with this command will trigger the labels "OnBuyItem" and "OnSellItem"
  4590. (as long as an npcshop* command is executed from that NPC, see note below). These
  4591. labels, if used, will replace how the shop handles the buying and selling of items,
  4592. allowing for the creation of dynamic shops.
  4593. The label "OnBuyItem" sets the following arrays:
  4594. @bought_nameid - item ID bought
  4595. @bought_quantity - amount bought
  4596. The label "OnSellItem" sets the following arrays:
  4597. @sold_nameid - item ID sold
  4598. @sold_quantity - amount sold
  4599. @sold_refine - refine count
  4600. @sold_attribute - if the item is broken (1) or not (0)
  4601. @sold_identify - if the item is identified (1) or not (0)
  4602. @sold_card1 - card slot 1
  4603. @sold_card2 - card slot 2
  4604. @sold_card3 - card slot 3
  4605. @sold_card4 - card slot 4
  4606. Note: These labels will only be triggered if an npcshop* command is executed because these
  4607. commands set a special data on the shop NPC, named master_nd in the source. The above labels
  4608. are triggered in the NPC whose master_nd is given in the shop.
  4609. A full example of a dynamic shop can be found in doc/sample/npc_dynamic_shop.txt.
  4610. ---------------------------------------
  4611. *npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  4612. This command lets you override the contents of an existing NPC shop or cashshop. The
  4613. current sell list will be wiped, and only the items specified with the price
  4614. specified will be for sale.
  4615. The function returns 1 if shop was updated successfully, or 0 if not found.
  4616. NOTES:
  4617. - That you cannot use -1 to specify default selling price!
  4618. - If attached shop type is market shop, need an extra param after price, it's <qty>
  4619. and make sure don't add duplication item!
  4620. ---------------------------------------
  4621. *npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  4622. This command will add more items at the end of the selling list for the
  4623. specified NPC shop or cashshop. If you specify an item already for sell, that item will
  4624. appear twice on the sell list.
  4625. The function returns 1 if shop was updated successfully, or 0 if not found.
  4626. NOTES:
  4627. - That you cannot use -1 to specify default selling price!
  4628. - If attached shop type is market shop, need an extra param after price, it's <qty>
  4629. and make sure don't add duplication item!
  4630. ---------------------------------------
  4631. *npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}};
  4632. This command will remove items from the specified NPC shop or cashshop.
  4633. If the item to remove exists more than once on the shop, all instances will be
  4634. removed.
  4635. Note that the function returns 1 even if no items were removed. The return
  4636. value is only to confirm that the shop was indeed found.
  4637. ---------------------------------------
  4638. *npcshopattach "<name>"{,<flag>};
  4639. This command will attach the current script to the given NPC shop.
  4640. When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem"
  4641. of your script will be executed whenever a player buys/sells from the shop.
  4642. Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[]
  4643. and @sold_quantity[] will be filled up with the items and quantities
  4644. bought/sold.
  4645. The optional parameter specifies whether to attach ("1") or detach ("0") from
  4646. the shop (the default is to attach). Note that detaching will detach any NPC
  4647. attached to the shop, even if it's from another script, while attaching will
  4648. override any other script that may be already attached.
  4649. The function returns 0 if the shop was not found, 1 otherwise.
  4650. NOTES:
  4651. - If attached shop type is market shop, will be default to call the 'buy' window.
  4652. ---------------------------------------
  4653. *npcshopupdate "<name>",<item_id>,<price>{,<stock>}
  4654. Update an entry from shop. If price is 0 means don't change the price, maybe used for
  4655. marketshop to update the stock quantity. Except marketshop type, 'stock' value means
  4656. nothing.
  4657. ---------------------------------------
  4658. *waitingroom "<chatroom name>",<limit>{,"<event label>"{,<trigger>{,<required zeny>{,<min lvl>{,<max lvl>}}}}};
  4659. This command will create a chat room, owned by the NPC object running this
  4660. script and displayed above the NPC sprite.
  4661. The maximum length of a chat room name is 60 letters.
  4662. The limit is the maximum number of people allowed to enter the chat room.
  4663. The attached NPC is included in this count. If the optional event and trigger
  4664. parameters are given, the event label ("<NPC object name>::<label name>")
  4665. will be invoked as if with a 'doevent' upon the number of people in the chat
  4666. room reaching the given triggering amount.
  4667. // The NPC will just show a box above its head that says "Hello World", clicking
  4668. // it will do nothing, since the limit is zero.
  4669. waitingroom "Hello World",0;
  4670. // The NPC will have a box above its head, it will say "Disco - Waiting Room"
  4671. // and will have 8 waiting slots. Clicking this will enter the chat room, where
  4672. // the player will be able to wait until 7 players accumulate. Once this happens,
  4673. // it will cause the NPC "Bouncer" run the label "OnStart".
  4674. waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",7;
  4675. // The NPC will have a box above its head, it will say "Party - Waiting Room"
  4676. // and will have 8 waiting slots. Clicking this will allow a player who has
  4677. // 5000 zeny and lvl 50~99 to enter the chat room, where the player will be
  4678. // able to wait until 7 players accumulate. Once this happens, it will cause
  4679. // the NPC "Bouncer" run the label "OnStart".
  4680. waitingroom "Party - Waiting Room",8,"Bouncer::OnStart",7,5000,50,99;
  4681. Creating a waiting room does not stop the execution of the script and it will
  4682. continue to the next line.
  4683. For more examples see the 2-1 and 2-2 job quest scripts which make extensive use
  4684. of waiting rooms.
  4685. ---------------------------------------
  4686. *delwaitingroom {"<NPC object name"};
  4687. This command will delete a waiting room. If no parameter is given, it will
  4688. delete a waiting room attached to the NPC object running this command, if it is,
  4689. it will delete a waiting room owned by another NPC object. This is the only way
  4690. to get rid of a waiting room, nothing else will cause it to disappear.
  4691. It's not clear what happens to a waiting room if the NPC is disabled with
  4692. 'disablenpc', by the way.
  4693. ---------------------------------------
  4694. *enablewaitingroomevent {"<NPC object name>"};
  4695. *disablewaitingroomevent {"<NPC object name>"};
  4696. *enablearena;
  4697. *disablearena;
  4698. This will enable and disable triggering the waiting room event (see
  4699. 'waitingroom') respectively. Optionally giving an NPC object name will do that
  4700. for a specified NPC object. The chat room will not disappear when triggering is
  4701. disabled and enabled in this manner and players will not be kicked out of it.
  4702. Enabling a chat room event will also cause it to immediately check whether the
  4703. number of users in it exceeded the trigger amount and trigger the event
  4704. accordingly.
  4705. Normally, whenever a waiting room was created to make sure that only one
  4706. character is, for example, trying to pass a job quest trial, and no other
  4707. characters are present in the room to mess up the script.
  4708. The 'enablearena'/'disablearena' commands are just aliases with no parameter.
  4709. These are supposedly left here for compatibility with official server scripts,
  4710. but no rAthena script uses these at the moment.
  4711. ---------------------------------------
  4712. *getwaitingroomstate(<information type>{,"<NPC object name>"})
  4713. This function will return information about the waiting room state for the
  4714. attached waiting room or for a waiting room attached to the specified NPC if
  4715. any.
  4716. The valid information types are:
  4717. 0 - Number of users currently chatting.
  4718. 1 - Maximum number of users allowed.
  4719. 2 - Will return 1 if the waiting room has a trigger set.
  4720. 0 otherwise.
  4721. 3 - Will return 1 if the waiting room is currently disabled.
  4722. 0 otherwise.
  4723. 4 - The Title of the waiting room (string)
  4724. 5 - Password of the waiting room, if any. Pointless, since there is no way to
  4725. set a password on a waiting room right now.
  4726. 16 - Event name of the waiting room (string)
  4727. 32 - Whether or not the waiting room is full.
  4728. 33 - Whether the amount of users in the waiting room is higher than the trigger
  4729. number.
  4730. ---------------------------------------
  4731. *warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
  4732. This command will warp the amount of characters equal to the trigger number of
  4733. the waiting room chat attached to the NPC object running this command to the
  4734. specified map and coordinates, kicking them out of the chat. Those waiting the
  4735. longest will get warped first. It can also do a random warp on the same map
  4736. ("Random" instead of map name) and warp to the save point ("SavePoint").
  4737. The list of characters to warp is taken from the list of the chat room members.
  4738. Those not in the chat room will not be considered even if they are talking to
  4739. the NPC in question. If the number of people is given, exactly this much people
  4740. will be warped.
  4741. This command can also keep track of who just got warped. It does this by setting
  4742. special variables:
  4743. $@warpwaitingpc[] is an array containing the account_id numbers of the
  4744. characters who were just warped.
  4745. $@warpwaitingpcnum contains the number of the character it just warped.
  4746. See also 'getpartymember' for advice on what to do with those variables.
  4747. The obvious way of using this effectively would be to set up a waiting room for
  4748. two characters to be warped onto a random PVP map for a one-on-one duel, for
  4749. example.
  4750. ---------------------------------------
  4751. *waitingroomkick "<NPC object name>" , "<character name>";
  4752. This command kicks the given character from the waiting room attached to the given NPC.
  4753. ---------------------------------------
  4754. *getwaitingroomusers "<NPC object name>";
  4755. This command get all the characters in the waiting room of the given NPC and stores
  4756. their gids in the array .@waitingroom_users[]. Also, stores the the number of characters
  4757. in the variable .@waitingroom_usercount
  4758. ---------------------------------------
  4759. *kickwaitingroomall {"<NPC object name>"};
  4760. This command kicks everybody out of a specified waiting room chat.
  4761. ---------------------------------------
  4762. *setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
  4763. This command sets the 'nosave' flag for the specified map and also gives an
  4764. alternate respawn-upon-relogin point.
  4765. It does not make a map impossible to make a save point on as you would normally
  4766. think, 'savepoint' will still work. It will, however, make the specified map
  4767. kick the reconnecting players off to the alternate map given to the coordinates
  4768. specified.
  4769. ---------------------------------------
  4770. *setmapflag "<map name>",<flag>{,<zone>{,<type>}};
  4771. This command marks a specified map with the given map flag, which will alter the
  4772. behavior of the map. A full list of mapflags is located in 'db/const.txt' with
  4773. the 'mf_' prefix, and documentation can be found in 'doc/mapflags.txt'.
  4774. The map flags alter the behavior of the map regarding teleporting (mf_nomemo,
  4775. mf_noteleport, mf_nowarp, mf_nogo), storing location when disconnected
  4776. (mf_nosave), dead branch usage (mf_nobranch), penalties upon death
  4777. (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty,
  4778. mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use
  4779. skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall),
  4780. current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds,
  4781. mf_fireworks) and whether night will be in effect on this map (mf_nightenabled).
  4782. The optional parameter 'zone' is used to set the zone for restricted mapflags.
  4783. For the 'skill_damage' mapflag, 'zone' functions as 'value' (-100 to 100000) and
  4784. 'type' can be:
  4785. 1: damage against players
  4786. 2: damage against mobs
  4787. 3: damage against bosses
  4788. 4: damage against other
  4789. 5: caster type
  4790. ---------------------------------------
  4791. *removemapflag "<map name>",<flag>{,<zone>};
  4792. This command removes a mapflag from a specified map.
  4793. See 'setmapflag' for a list of mapflags.
  4794. The optional parameter 'zone' is used to remove the zone from restricted mapflags.
  4795. ---------------------------------------
  4796. *getmapflag("<map name>",<flag>{,<type>})
  4797. This command checks the status of a given mapflag and returns the mapflag's state.
  4798. 0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.
  4799. The optional parameter 'type' is used in the 'skill_damage' mapflag:
  4800. 0: if mapflag is set (default)
  4801. 1: damage against players
  4802. 2: damage against mobs
  4803. 3: damage against bosses
  4804. 4: damage against other
  4805. 5: caster type
  4806. ---------------------------------------
  4807. *setbattleflag "<battle flag>",<value>;
  4808. *getbattleflag("<battle flag>")
  4809. Sets or gets the value of the given battle flag.
  4810. Battle flags are the flags found in the battle/*.conf files and is also used in Lupus' variable rates script.
  4811. Examples:
  4812. // Will set the base experience rate to 20x (2000%)
  4813. setBattleFlag "base_exp_rate",2000;
  4814. // Will return the value of the base experience rate (when used after the above example, it would print 2000).
  4815. mes getBattleFlag("base_exp_rate");
  4816. ---------------------------------------
  4817. *warpportal <source x>,<source y>,"<map name>",<target x>,<target y>;
  4818. Creates a warp portal identical to the Acolyte "Warp Portal" skill.
  4819. The source coordinates specify the portal's location on the map of the invoking NPC.
  4820. The target map and coordinates determine the destination of the portal.
  4821. Examples:
  4822. // Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180.
  4823. warpportal 150,150,"prontera",150,180;
  4824. ---------------------------------------
  4825. *mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
  4826. This command will collect all characters located on the From map and warp them
  4827. wholesale to the same point on the To map, or randomly distribute them there if
  4828. the coordinates are zero. "Random" is understood as a special To map name and
  4829. will mean randomly shuffling everyone on the same map.
  4830. Optionally, a type and ID can be specified. Available types are:
  4831. 0 - Everyone
  4832. 1 - Guild
  4833. 2 - Party
  4834. Example:
  4835. // Will warp all members of guild with ID 63 on map prontera to map alberta.
  4836. mapwarp "prontera","alberta",150,150,1,63;
  4837. ---------------------------------------
  4838. \\
  4839. 5,2.- Guild-related commands
  4840. \\
  4841. ---------------------------------------
  4842. *maprespawnguildid "<map name>",<guild id>,<flag>;
  4843. This command goes through the specified map and for each player and monster
  4844. found there does stuff.
  4845. Flag is a bit-mask (add up numbers to get effects you want)
  4846. 1 - warp all guild members to their save points.
  4847. 2 - warp all non-guild members (including guildless players) to their save points.
  4848. 4 - remove all monsters which are not guardian or Emperium.
  4849. Flag 7 will, therefore, mean 'wipe all mobs but guardians and the Emperium and
  4850. kick all characters out', which is what the official scripts do upon castle
  4851. surrender. Upon start of WoE, the scripts do 2 (warp all intruders out).
  4852. For examples, check the WoE scripts in the distribution.
  4853. ---------------------------------------
  4854. *agitstart;
  4855. *agitend;
  4856. *agitstart2;
  4857. *agitend2;
  4858. These four commands will start and end War of Emperium or War of Emperium SE.
  4859. This is a bit more complex than it sounds, since the commands themselves won't
  4860. actually do anything interesting, except causing all 'OnAgitStart:' and
  4861. 'OnAgitEnd:', or 'OnAgitStart2:' and 'OnAgitEnd2:' in the case of latter two
  4862. commands, events to run everywhere, respectively. They are used as simple
  4863. triggers to run a lot of complex scripts all across the server, and they,
  4864. in turn, are triggered by clock with an 'OnClock<time>:' time-triggering label.
  4865. ---------------------------------------
  4866. *gvgon "<map name>";
  4867. *gvgoff "<map name>";
  4868. These commands will turn GVG mode for the specified maps on and off, setting up
  4869. appropriate map flags. In GVG mode, maps behave as if during the time of WoE,
  4870. even though WoE itself may or may not actually be in effect.
  4871. ---------------------------------------
  4872. *flagemblem <guild id>;
  4873. This command only works when run by the NPC objects which have sprite id 722,
  4874. which is a 3D guild flag sprite. If it isn't, the data will change, but nothing
  4875. will be seen by anyone. If it is invoked in that manner, the emblem of the
  4876. specified guild will appear on the flag, though, if any players are watching it
  4877. at this moment, they will not see the emblem change until they move out of sight
  4878. of the flag and return.
  4879. This is commonly used in official guildwar scripts with a function call which
  4880. returns a guild id:
  4881. // This will change the emblem on the flag to that of the guild that owns
  4882. // "guildcastle"
  4883. flagemblem GetCastleData("guildcastle",1);
  4884. ---------------------------------------
  4885. *guardian "<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"{,<guardian index>}};
  4886. This command is roughly equivalent to 'monster', but is meant to be used with
  4887. castle guardian monsters and will only work with them. It will set the guardian
  4888. characteristics up according to the castle's investment values and otherwise
  4889. set the things up that only castle guardians need.
  4890. Since trunk r12524:
  4891. Returns the id of the mob or 0 if an error occurred.
  4892. When 'guardian index' isn't supplied it produces a temporary guardian.
  4893. Temporary guardians are not saved with the castle and can't be accessed by guardianinfo.
  4894. ---------------------------------------
  4895. *guardianinfo("<map name>", <guardian number>, <type>);
  4896. This function will return various info about the specified guardian, or -1
  4897. if it fails for some reason. It is primarily used in the castle manager NPC.
  4898. Map name and guardian number (value between 0 and 7) define the target.
  4899. Type indicates what information to return:
  4900. 0 - visibility (whether the guardian is installed or not)
  4901. 1 - max. hp
  4902. 2 - current hp
  4903. ---------------------------------------
  4904. //
  4905. 5,2.- End of guild-related commands
  4906. //
  4907. ---------------------------------------
  4908. *npcspeed <speed value>;
  4909. *npcwalkto <x>,<y>;
  4910. *npcstop;
  4911. These commands will make the NPC object in question move around the map. As they
  4912. currently are, they are a bit buggy and are not useful for much more than making
  4913. an NPC move randomly around the map.
  4914. 'npcspeed' will set the NPCs walking speed to a specified value. As in the
  4915. @speed GM command, 200 is the slowest possible speed while 0 is the fastest
  4916. possible (instant motion). 100 is the default character walking speed.
  4917. 'npcwalkto' will start the NPC sprite moving towards the specified coordinates
  4918. on the same map it is currently on. The script proceeds immediately after the
  4919. NPC begins moving.
  4920. 'npcstop' will stop the motion.
  4921. While in transit, the NPC will be clickable, but invoking it will cause it to
  4922. stop moving, which will make its coordinates different from what the client
  4923. computed based on the speed and motion coordinates. The effect is rather
  4924. unnerving.
  4925. Only a few NPC sprites have walking animations, and those that do, do not get
  4926. the animation invoked when moving the NPC, due to the problem in the NPC walking
  4927. code, which looks a bit silly. You might have better success by defining a job-
  4928. sprite based sprite id in 'db/mob_avail.txt' with this.
  4929. ---------------------------------------
  4930. *movenpc "<NPC name>",<x>,<y>{,<dir>};
  4931. This command looks like the NPCWalkToxy function,but is a little different.
  4932. While NPCWalkToXY just makes the NPC 'walk' to the coordinates given (which
  4933. sometimes gives problems if the path isn't a straight line without objects),
  4934. this command just moves the NPC. It basically warps out and in on the current
  4935. and given spot. Direction can be used to change the NPC's facing direction.
  4936. Example:
  4937. // This will move Bugga from it's old coordinates to the new coordinates at 100,20 (if those coordinates are legit).
  4938. moveNPC "Bugga",100,20;
  4939. ---------------------------------------
  4940. =====================
  4941. |6.- Other commands.|
  4942. =====================
  4943. ---------------------------------------
  4944. *debugmes "<message>";
  4945. This command will send the message to the server console (map-server window). It
  4946. will not be displayed anywhere else.
  4947. // Displays "NAME has clicked me!" in the map-server window.
  4948. debugmes strcharinfo(0)+" has clicked me!";
  4949. ---------------------------------------
  4950. *logmes "<message>";
  4951. This command will write the message given to the map server NPC log file, as
  4952. specified in 'conf/log_athena.conf'. In the TXT version of the server, the log
  4953. file is 'log/npclog.log' by default. In the SQL version, if SQL logging is
  4954. enabled, the message will go to the 'npclog' table, otherwise, it will go to the
  4955. same log file.
  4956. If logs are not enabled, nothing will happen.
  4957. ---------------------------------------
  4958. *globalmes "<message>"{,"<NPC name>"};
  4959. This command will send a message to the chat window of all currently connected
  4960. characters.
  4961. If NPC name is specified, the message will be sent as if the sender would be
  4962. the NPC with the said name.
  4963. ---------------------------------------
  4964. *rand(<number>{,<number>});
  4965. This function returns a number ...
  4966. (if you specify one) ... randomly positioned between 0 and the number you specify -1.
  4967. (if you specify two) ... randomly positioned between the two numbers you specify.
  4968. rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9
  4969. rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
  4970. rand(2,5) would result in 2,3,4 or 5
  4971. ---------------------------------------
  4972. *viewpoint <action>,<x>,<y>,<point number>,<color>;
  4973. This command will mark places on the mini map in the client connected to the
  4974. invoking character. It uses the normal X and Y coordinates from the main map.
  4975. The colors of the marks are defined using a hexadecimal number, same as the ones
  4976. used to color text in 'mes' output, but are written as hexadecimal numbers in C.
  4977. (They look like 0x<six numbers>.)
  4978. Action is what you want to do with a point, 1 will set it, while 2 will clear
  4979. it. 0 will also set it, but automatically removes the point after 15 seconds.
  4980. Point number is the number of the point - you can have several. If more than
  4981. one point is drawn at the same coordinates, they will cycle, which can be used
  4982. to create flashing marks.
  4983. // This command will show a mark at coordinates X 30 Y 40, is mark number 1,
  4984. // and will be red.
  4985. viewpoint 1,30,40,1,0xFF0000;
  4986. This will create three points:
  4987. viewpoint 1,30,40,1,0xFF0000;
  4988. viewpoint 1,35,45,2,0xFF0000;
  4989. viewpoint 1,40,50,3,0xFF0000;
  4990. And this is how you remove them:
  4991. viewpoint 2,30,40,1,0xFF0000;
  4992. viewpoint 2,35,45,2,0xFF0000;
  4993. viewpoint 2,40,50,3,0xFF0000;
  4994. The client determines what it does with the points entirely, the server keeps no
  4995. memory of where the points are set whatsoever.
  4996. ---------------------------------------
  4997. *cutin "<filename>",<position>;
  4998. This command will display a picture, usually an NPC illustration, also called
  4999. cutin, for the currently attached client. The position parameter determines the
  5000. placement of the illustration and takes following values:
  5001. 0 - bottom left corner
  5002. 1 - bottom middle
  5003. 2 - bottom right corner
  5004. 3 - middle of screen in a movable window with an empty title bar
  5005. 4 - middle of screen without the window header, but still movable
  5006. The picture is read from data\texture\유저인터페이스\illust, from both the GRF archive
  5007. and data folder, and is required to be a bitmap. The file extension .bmp can be
  5008. omitted. Magenta color (#ff00ff) is considered transparent. There is no limit
  5009. placed on the size of the illustrations by the client, although loading of large
  5010. pictures (about 700x700 and larger) causes the client to freeze shortly (lag).
  5011. Typically the size is about 320x480. New illustrations can be added by just
  5012. putting the new file into the location above.
  5013. The client is able to display only one cutin at the same time and each new one
  5014. will cause the old one to disappear. To delete the currently displayed
  5015. illustration without displaying a new one, an empty file name and position 255
  5016. must be used.
  5017. // Displays the Comodo Kafra illustration in lower right corner.
  5018. cutin "kafra_07",2;
  5019. // Typical way to end a script, which displayed an illustration during a
  5020. // dialog with a player.
  5021. mes "See you.";
  5022. close2;
  5023. cutin "",255;
  5024. end;
  5025. ---------------------------------------
  5026. *emotion <emotion number>{,<target>{,"<target name>"}};
  5027. This command makes an object display an emotion sprite above their own as
  5028. if they were doing that emotion. For a full list of emotion numbers,
  5029. see 'db/const.txt' under 'e_'. The not so obvious ones are 'e_what' (a question mark)
  5030. and 'e_gasp' (the exclamation mark).
  5031. The optional target parameter specifies who will get the emotion on top of
  5032. their head. If 0 (the default if omitted), the NPC in current use will show
  5033. the emotion, if 1, the player that is running the script will display it.
  5034. Target name parameter allows to display emotion on top of other NPC/PC without
  5035. event labels. If specified name is not found, command does nothing.
  5036. ---------------------------------------
  5037. *misceffect <effect number>;
  5038. This command, if run from an NPC object that has a sprite, will call up a
  5039. specified effect number, centered on the NPC sprite. If the running code does
  5040. not have an object ID (a 'floating' NPC) or is not running from an NPC object at
  5041. all (an item script) the effect will be centered on the character who's RID got
  5042. attached to the script, if any. For usable item scripts, this command will
  5043. create an effect centered on the player using the item.
  5044. A full list of known effects is found in 'doc/effect_list.txt'. The list of
  5045. those that actually work may differ greatly between client versions.
  5046. ---------------------------------------
  5047. *soundeffect "<effect filename>",<type>;
  5048. *soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
  5049. These two commands will play a sound effect to either the invoking character
  5050. only ('soundeffect') or multiple characters ('soundeffectall'). If the running
  5051. code does not have an object ID (a 'floating' NPC) or is not running from an NPC
  5052. object at all (an item script) the sound will be centered on the character who's
  5053. RID got attached to the script, if any. If it does, it will be centered on that
  5054. object. (an NPC sprite)
  5055. Effect filename is the filename in a GRF. It must have the .wav extension.
  5056. It's not quite certain what the 'type' actually does, it is sent to the client
  5057. directly. It probably determines which directory to play the effect from.
  5058. It's certain that giving 0 for the number will play sound files from '\data\wav\',
  5059. but where the other numbers will read from is unclear.
  5060. The sound files themselves must be in the PCM format, and file names should also
  5061. have a maximum length of 23 characters including the .wav extension:
  5062. soundeffect "1234567890123456789.wav", 0; // this will play the soundeffect
  5063. soundeffect "12345678901234567890.wav", 0; // throw gravity error
  5064. You can add your own effects this way, naturally.
  5065. ---------------------------------------
  5066. *playBGM "<BGM filename>";
  5067. *playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
  5068. These two commands will play a Background Music to either the invoking character
  5069. only ('playBGM') or multiple characters ('playBGMall').
  5070. BGM filename is the filename in /BGM/ folder. It has to be in .mp3 extension.
  5071. It's not required to specify the extension inside the script.
  5072. If coordinates are omitted, BGM will be broadcasted on the entire map. If the map name
  5073. is omitted as well the BGM will be played for the entire server.
  5074. You can add your own BGMs this way, naturally.
  5075. ---------------------------------------
  5076. *pvpon "<map name>";
  5077. *pvpoff "<map name>";
  5078. These commands will turn PVP mode for the specified maps on and off. Beside
  5079. setting the flags referred to in 'setmapflag', 'pvpon' will also create a PVP
  5080. timer and ranking as will @pvpon GM command do.
  5081. ---------------------------------------
  5082. *atcommand "<command>";
  5083. This command will run the given command line exactly as if it was typed in from
  5084. the keyboard by the player connected to the invoking character, and that
  5085. character belonged to an account which had GM level 99.
  5086. // This will ask the invoker for a character name and then use the '@nuke'
  5087. // GM command on them, killing them mercilessly.
  5088. input @player$;
  5089. atcommand "@nuke "+@player$;
  5090. Note that for atcommands bound using 'bindatcmd', this command will execute the
  5091. original atcommand, not the script-bound atcommand.
  5092. ---------------------------------------
  5093. *charcommand "<command>";
  5094. This command will run the given command line exactly as if it was typed in from
  5095. the keyboard from a character that belonged to an account which had GM level 99.
  5096. The commands can also run without an attached rid.
  5097. // This would do the same as above, but now
  5098. // it doesn't need a player attached by default.
  5099. charcommand "#option 0 0 0 Roy";
  5100. ---------------------------------------
  5101. *bindatcmd "<command>","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};
  5102. This command will bind a NPC event label to an atcommand. Upon execution of the
  5103. atcommand, the user will invoke the NPC event label. Each atcommand is only allowed
  5104. one binding. If you rebind, it will override the original binding.
  5105. The following variables are set upon execution:
  5106. .@atcmd_command$ = The name of the @command used.
  5107. .@atcmd_parameters$[] = Array containing the given parameters, starting from an index of 0.
  5108. .@atcmd_numparameters = The number of parameters defined.
  5109. Example:
  5110. When a user types the command "@test", an angel effect will be shown.
  5111. - script atcmd_example -1,{
  5112. OnInit:
  5113. bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
  5114. end;
  5115. OnAtcommand:
  5116. specialeffect2 338;
  5117. end;
  5118. }
  5119. ---------------------------------------
  5120. *unbindatcmd "<command>";
  5121. This command will unbind a NPC event label from an atcommand.
  5122. ---------------------------------------
  5123. *useatcmd "<command>";
  5124. This command will execute a script-bound atcommand for the attached RID. If the
  5125. supplied command is not bound to any script, this command will act like 'atcommand'
  5126. and attempt to execute a source-defined command.
  5127. The three .@atcmd_***** variables will NOT be set when invoking script-bound atcommands
  5128. in this way.
  5129. ---------------------------------------
  5130. \\
  5131. 6,1.- Unit-related commands
  5132. \\
  5133. ---------------------------------------
  5134. *unitwalk <GID>,<x>,<y>{,"<event label>"};
  5135. *unitwalkto <GID>,<Target GID>{,"<event label>"};
  5136. This command will tell a <GID> to walk to a position, defined either as a set of
  5137. coordinates or another object. The command returns a 1 for success and 0 upon failure.
  5138. If coordinates are passed, the <GID> will walk to the given x,y coordinates on the
  5139. unit's current map. While there is no way to move across an entire map with 1 command
  5140. use, this could be used in a loop to move long distances.
  5141. If an object ID is passed, the initial <GID> will walk to the <Target GID> (similar to
  5142. walking to attack). This is based on the distance from <GID> to <Target ID>. This command
  5143. uses a hard walk check, so it will calculate a walk path with obstacles. Sending a bad
  5144. target ID will result in an error.
  5145. An optional Event Label can be passed as well which will execute when the <GID> has reached
  5146. the given coordinates or <Target GID>.
  5147. Examples:
  5148. // Makes player walk to the coordinates (150,150).
  5149. unitwalk getcharid(3),150,150;
  5150. // Performs a conditional check with the command and reports success or failure to the player.
  5151. if(unitwalk(getcharid(3),150,150))
  5152. dispbottom "Walking you there...";
  5153. else
  5154. dispbottom "That's too far away, man.";
  5155. // Makes player walk to another character named "WalkToMe".
  5156. unitwalkto getcharid(3),getcharid(3,"WalkToMe");
  5157. ---------------------------------------
  5158. *unitattack <GID>,<Target ID>{,<action type>};
  5159. *unitattack <GID>,"<Target Name>"{,<action type>};
  5160. This command will make a <GID> attack the specified target. It returns 1 upon
  5161. success and 0 for all failures.
  5162. If <GID> is a player and a non-zero <action type> is given, the unit will perform a
  5163. continuous attack instead of a single attack.
  5164. ---------------------------------------
  5165. *unitkill <GID>;
  5166. This command will kill a <GID>.
  5167. ---------------------------------------
  5168. *unitwarp <GID>,"<map name>",<x>,<y>;
  5169. This command will warp a <GID> to the specified map and coordinates.
  5170. If <GID> is zero, the command runs for the unit that invoked the script. This can be
  5171. used with "OnTouch" to warp monsters:
  5172. OnTouch:
  5173. unitwarp 0,"this",-1,-1;
  5174. ---------------------------------------
  5175. *unitstopattack <GID>;
  5176. This command will make a <GID> stop attacking.
  5177. ---------------------------------------
  5178. *unitstopwalk <GID>;
  5179. This command will make a <GID> stop moving.
  5180. Note: If this is called from OnTouch, then the walktimer attached to the unit is
  5181. removed from OnTouch which causes this command to not stop the unit from walking.
  5182. Suggest to use 'unitblockmove' to forcefully stop the unit with OnTouch.
  5183. ---------------------------------------
  5184. *unittalk <GID>,"<text>";
  5185. This command will make a <GID> say a message.
  5186. ---------------------------------------
  5187. *unitemote <GID>,<emotion number>;
  5188. This command will make a <GID> display an emotion sprite.
  5189. For a full list of emotion numbers, see 'db/const.txt' under 'e_'.
  5190. ---------------------------------------
  5191. *unitskilluseid <GID>,<skill id>,<skill lvl>{,<target id>,<casttime>};
  5192. *unitskilluseid <GID>,"<skill name>",<skill lvl>{,<target id>,<casttime>};
  5193. *unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>{,<casttime>};
  5194. *unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>{,<casttime>};
  5195. This is the replacement of the older commands, these use the same values for
  5196. GID as the other unit* commands (See 'GID').
  5197. Skill ID is the ID of the skill, skill level is the level of the skill.
  5198. Cast time is the amount of seconds to add or remove from the skill. Use a positive value to
  5199. add and negative value to subtract. Using 0 or no value will use the default skill cast time.
  5200. For the position, the x and y are given in the UnitSkillUsePos.
  5201. ---------------------------------------
  5202. *getunittype <GID>;
  5203. Returns the type of object from the given Game ID. Returns -1 if the given <GID> does not
  5204. exist.
  5205. 0 - Monster
  5206. 1 - Homunculus
  5207. 2 - Pet
  5208. 3 - Mercenary
  5209. 4 - Elemental
  5210. 5 - NPC
  5211. ---------------------------------------
  5212. *getunitname <GID>;
  5213. Gets the name of the given unit. Supported types are monster, homunculus, pet, and NPC.
  5214. Mercenary and Elemental don't support custom names.
  5215. Returns "Unknown" if unit is not found.
  5216. ---------------------------------------
  5217. *setunitname <GID>,"<new name>";
  5218. Changes the name of the given unit to the new name given. Supported types are monster,
  5219. homunculus, and pet. To change an NPC's name, see 'setnpcdisplay'. Mercenary and
  5220. Elemental don't support custom names.
  5221. Changing a homunculus or pet name will be permanent.
  5222. ---------------------------------------
  5223. *getunitdata <GID>,<arrayname>;
  5224. *setunitdata <GID>,<parameter>,<new value>;
  5225. This is used to get and set special data related to the unit.
  5226. With getunitdata, the array given will be filled with the current data. In setunitdata
  5227. the indexes in the array would be used to set that data on the unit.
  5228. Parameters (indexes) for monsters are:
  5229. 0 - size (big, small, normal) 7 - y 14 - hair style 21 - weapon 28 - LUK
  5230. 1 - level 8 - speed 15 - hair color 22 - looking dir 29 - for slave to copy master's mode
  5231. 2 - HP 9 - mode 16 - head gear bottom 23 - STR 30 - immune from attacks state
  5232. 3 - max HP 10 - special AI state 17 - head gear middle 24 - AGI
  5233. 4 - master AID 11 - SC option 18 - head gear top 25 - VIT
  5234. 5 - map ID 12 - sex 19 - cloth color 26 - INT
  5235. 6 - x 13 - class (Monster ID, Job ID) 20 - shield 27 - DEX
  5236. Parameter (indexes) for homunculi are:
  5237. 0 - size (big, small, normal) 7 - map ID 14 - canmove_tick 21 - immune from attacks state
  5238. 1 - level 8 - x 15 - STR
  5239. 2 - HP 9 - y 16 - AGI
  5240. 3 - max HP 10 - hunger 17 - VIT
  5241. 4 - SP 11 - intimacy 18 - INT
  5242. 5 - max SP 12 - speed 19 - DEX
  5243. 6 - master Character ID 13 - looking dir 20 - LUK
  5244. Parameter (indexes) for pets are:
  5245. 0 - size (big, small, normal) 7 - y 14 - AGI
  5246. 1 - level 8 - hunger 15 - VIT
  5247. 2 - HP 9 - intimacy 16 - INT
  5248. 3 - max HP 10 - speed 17 - DEX
  5249. 4 - master AID 11 - looking dir 18 - LUK
  5250. 5 - map ID 12 - canmove_tick 19 - immune from attacks state
  5251. 6 - x 13 - STR
  5252. Parameter (indexes) for mercenaries are:
  5253. 0 - size (big, small, normal) 7 - kill count 14 - VIT
  5254. 1 - HP 8 - life time 15 - INT
  5255. 2 - max HP 9 - speed 16 - DEX
  5256. 3 - master Character ID 10 - looking dir 17 - LUK
  5257. 4 - map ID 11 - canmove_tick 18 - immune from attacks state
  5258. 5 - x 12 - STR
  5259. 6 - y 13 - AGI
  5260. Parameter (indexes) for elementals are:
  5261. 0 - size (big, small, normal) 7 - x 14 - STR
  5262. 1 - HP 8 - y 15 - AGI
  5263. 2 - max HP 9 - life time 16 - VIT
  5264. 3 - SP 10 - mode 17 - INT
  5265. 4 - max SP 11 - speed 18 - DEX
  5266. 5 - master Character ID 12 - looking dir 19 - LUK
  5267. 6 - map ID 13 - canmove_tick 20 - immune from attacks state
  5268. Parameter (indexes) for NPCs are:
  5269. 0 - display 7 - looking dir
  5270. 1 - level 8 - STR
  5271. 2 - HP 9 - AGI
  5272. 3 - max HP 10 - VIT
  5273. 4 - map ID 11 - INT
  5274. 5 - x 12 - DEX
  5275. 6 - y 13 - LUK
  5276. *Notes: For mode, see doc/mob_db_mode_list.txt
  5277. For map ID, this refers to the map_data index (from src/map/map.c), not the mapindex_db index (from src/common/mapindex.c)
  5278. For 'setunitdata', map name can also be passed in as a valid value instead of map ID
  5279. Example:
  5280. // Spawn some Porings and save the Game ID.
  5281. // - Keep in mind, when the 'monster' script command is used,
  5282. // - all the spawned monster GID's are stored in an array
  5283. // - called $@mobid[].
  5284. monster "prontera",149,190,"Poring",1002,10;
  5285. .GID = $@mobid[9]; // Store and modify the 10th Poring spawned to make him stronger!
  5286. // Save the strong Poring's mob data in the @por_arr[] variable. (@por_arr[1] being level, @por_arr[13] being class, etc.)
  5287. // With this data we can have the NPC display or manipulate it how we want. This does not have to be ran before 'setunitdata'.
  5288. getunitdata .GID,@por_arr;
  5289. // Set the max HP of the Poring to 1000 (current HP will also get updated to 1000).
  5290. setunitdata .GID,3,1000;
  5291. ---------------------------------------
  5292. \\
  5293. 6,1.- End of unit-related commands
  5294. \\
  5295. ---------------------------------------
  5296. *npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;
  5297. *npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;
  5298. This command causes the attached NPC object to cast a skill on the attached
  5299. player. The skill will have no cast time or cooldown. The player must be
  5300. within the default skill range or the command will fail silently.
  5301. The "stat point" parameter temporarily sets all NPC stats to the given value,
  5302. and "NPC level" is the temporary level of the NPC (used in some skills).
  5303. Neither value can be greater than the max level defined in config, and will
  5304. not work properly if the NPC has a mob sprite.
  5305. // Casts Level 10 Heal on the attached player, calculated with
  5306. // all stats 99 and base level 60.
  5307. npcskill "AL_HEAL",10,99,60;
  5308. ---------------------------------------
  5309. *day;
  5310. *night;
  5311. These two commands will switch the entire server between day and night mode
  5312. respectively. If your server is set to cycle between day and night by
  5313. configuration, it will eventually return to that cycle.
  5314. Example:
  5315. - script DayNight -1,{
  5316. OnClock0600:
  5317. day;
  5318. end;
  5319. OnInit:
  5320. // setting correct mode upon server start-up
  5321. if(gettime(3)>=6 && gettime(3)<18) end;
  5322. OnClock1800:
  5323. night;
  5324. end;
  5325. }
  5326. This script allows to emulate the day/night cycle as the server does, but also
  5327. allows triggering additional effects upon change, like announces, gifts, etc.
  5328. The day/night cycle set by configuration should be disabled when this script is used.
  5329. ---------------------------------------
  5330. *defpattern <set number>,"<regular expression pattern>","<event label>";
  5331. *activatepset <set number>;
  5332. *deactivatepset <set number>;
  5333. *deletepset <set number>;
  5334. This set of commands is only available if the server is compiled with regular
  5335. expressions library enabled. Default compilation and most binary distributions
  5336. aren't, which is probably bad, since these, while complex to use, are quite
  5337. fascinating.
  5338. They will make the NPC object listen for text spoken publicly by players and
  5339. match it against regular expression patterns, then trigger labels associated
  5340. with these regular expression patterns.
  5341. Patterns are organized into sets, which are referred to by a set number. You can
  5342. have multiple sets patterns, and multiple patterns may be active at once.
  5343. Numbers for pattern sets start at 1.
  5344. 'defpattern' will associate a given regular expression pattern with an event
  5345. label. This event will be triggered whenever something a player says is matched
  5346. by this regular expression pattern, if the pattern is currently active.
  5347. 'activatepset' will make the pattern set specified active. An active pattern
  5348. will enable triggering labels defined with 'defpattern', which will not happen
  5349. by default.
  5350. 'deactivatepset' will deactivate a specified pattern set. Giving -1 as a pattern
  5351. set number in this case will deactivate all pattern sets defined.
  5352. 'deletepset' will delete a pattern set from memory, so you can create a new
  5353. pattern set in its place.
  5354. Using regular expressions is high wizardry. But with this high wizardry comes
  5355. unparalleled power of text manipulation. For an explanation of what a regular
  5356. expression pattern is, see a few web pages:
  5357. http://www.regular-expressions.info/
  5358. http://www.weitz.de/regex-coach/
  5359. For an example of this in use, see doc/sample/npc_test_pcre.txt
  5360. With this you could, for example, automatically punish players for asking for
  5361. Zeny in public places, or alternatively, automatically give them Zeny instead if
  5362. they want it so much.
  5363. ---------------------------------------
  5364. *pow(<number>,<power>)
  5365. Returns the result of the calculation.
  5366. Example:
  5367. .@i = pow(2,3); // .@i will be 8
  5368. ---------------------------------------
  5369. *sqrt(<number>)
  5370. Returns the square-root of a number.
  5371. Example:
  5372. .@i = sqrt(25); // .@i will be 5
  5373. ---------------------------------------
  5374. *distance(<x0>,<y0>,<x1>,<y1>)
  5375. Returns distance between 2 points.
  5376. Example:
  5377. .@i = distance(100,200,101,202);
  5378. ---------------------------------------
  5379. *md5("<string>")
  5380. Returns the md5 checksum of a number or string.
  5381. Example:
  5382. mes md5(12345);
  5383. mes md5("12345"); // Will both display 827ccb0eea8a706c4c34a16891f84e7b
  5384. mes md5("qwerty"); // Will display d8578edf8458ce06fbc5bb76a58c5ca4
  5385. ---------------------------------------
  5386. *query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  5387. *query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  5388. Executes an SQL query. A 'select' query can fill array variables with up to 128 rows of values,
  5389. and will return the number of rows (i.e. array size) or -1 on failure/empty array.
  5390. Note that 'query_sql' runs on the main database while 'query_logsql' runs on the log database.
  5391. Example:
  5392. .@nb = query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
  5393. mes "Hall Of Fame: TOP5";
  5394. mes "1."+.@name$[0]+"("+.@fame[0]+")"; // largest fame value.
  5395. mes "2."+.@name$[1]+"("+.@fame[1]+")";
  5396. mes "3."+.@name$[2]+"("+.@fame[2]+")";
  5397. mes "4."+.@name$[3]+"("+.@fame[3]+")";
  5398. mes "5."+.@name$[4]+"("+.@fame[4]+")";
  5399. ---------------------------------------
  5400. *escape_sql(<value>)
  5401. Converts the value to a string and escapes special characters so that it is safe to
  5402. use in query_sql(). Returns the escaped form of the given value.
  5403. Example:
  5404. .@name$ = "John's Laptop";
  5405. .@esc_str$ = escape_sql(.@name$); // Escaped string: John\'s Laptop
  5406. ---------------------------------------
  5407. *setiteminfo(<item id>,<type>,<value>)
  5408. This function will set some value of an item.
  5409. Returns the new value on success, or -1 on fail (item_id not found or invalid type).
  5410. Valid types are:
  5411. 0 - Buy Price; 1 - Sell Price; 2 - Item Type;
  5412. 3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc..
  5413. if = 0, then monsters don't drop it at all (rare or a quest item)
  5414. if = 10000, then this item is sold in NPC shops only
  5415. 4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
  5416. 10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id
  5417. Example:
  5418. setiteminfo 7049,6,9990; // Stone now weighs 999.0
  5419. ---------------------------------------
  5420. *setitemscript(<item id>,<"{ new item script }">{,<type>});
  5421. Set a new script bonus to the Item. Very useful for game events.
  5422. You can remove an item's itemscript by leaving the itemscript argument empty.
  5423. Returns 1 on success, or 0 on fail (item_id not found or new item script is invalid).
  5424. Type can optionally be used indicates which script to set (default is 0):
  5425. 0 - Script
  5426. 1 - OnEquip_Script
  5427. 2 - OnUnequip_Script
  5428. Example:
  5429. setitemscript 2637,"{ if(isequipped(2236)==0)end; if(getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
  5430. setitemscript 2637,"";
  5431. ---------------------------------------
  5432. *atoi("<string>")
  5433. *axtoi("<string>")
  5434. *strtol("<string>", base)
  5435. These commands are used to convert strings to numbers. 'atoi' will interpret
  5436. given string as a decimal number (base 10), while 'axtoi' interprets strings as
  5437. hexadecimal numbers (base 16). 'strtol' lets the user specify a base (valid range
  5438. is between 2 and 36 inclusive, or the special value0, which means auto-detection).
  5439. The 'atoi' and 'strtol' functions conform to the C functions with the same names,
  5440. and 'axtoi' is the same as strtol, with a base of 16. Results are clamped to signed
  5441. 32 bit int range (INT_MIN ~ INT_MAX).
  5442. Examples:
  5443. .@var = atoi("11"); // Sets .@var to 11
  5444. .@var = axtoi("FF"); // Sets .@var to 255
  5445. mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16)
  5446. .@var = strtol("11", 10); // Sets .@var to 11 (11 base 10)
  5447. .@var = strtol("11", 16); // Sets .@var to 17 (11 base 16)
  5448. .@var = strtol("11", 0); // Sets .@var to 11 (11 base 10, auto-detected)
  5449. .@var = strtol("0x11", 0); // Sets .@var to 17 (11 base 16, auto-detected because of the "0x" prefix)
  5450. .@var = strtol("011", 0); // Sets .@var to 9 (11 base 8, auto-detected because of the "0" prefix)
  5451. .@var = strtol("11", 2); // Sets .@var to 3 (binary 11)
  5452. ---------------------------------------
  5453. *compare("<string>","<substring>")
  5454. This command returns 1 or 0 when the substring is in the main string (1) or not (0).
  5455. This command is not case sensitive.
  5456. Examples:
  5457. //dothis; will be executed ('Bloody Murderer' contains 'Blood').
  5458. if (compare("Bloody Murderer","Blood"))
  5459. dothis;
  5460. //dothat; will not be executed ('Blood butterfly' does not contain 'Bloody').
  5461. if (compare("Blood Butterfly","Bloody"))
  5462. dothat;
  5463. ---------------------------------------
  5464. *strcmp("<string>","<string>")
  5465. This command compares two strings are returns a value:
  5466. 1: string 1 > string 2
  5467. 0: strings are equal
  5468. -1: string 1 < string 2
  5469. ---------------------------------------
  5470. *getstrlen("<string>")
  5471. This function will return the length of the string given as an argument. It is
  5472. useful to check if anything input by the player exceeds name length limits and
  5473. other length limits and asking them to try to input something else.
  5474. ---------------------------------------
  5475. *charisalpha("<string>",<position>)
  5476. This function will return 1 if the character number Position in the given string
  5477. is a letter, 0 if it isn't a letter but a digit or a space.
  5478. The first letter is position 0.
  5479. ---------------------------------------
  5480. *charat(<string>,<index>)
  5481. Returns char at specified index. If index is out of range, returns empty string.
  5482. The first letter of a string is index 0.
  5483. Example:
  5484. charat("This is a string", 10); //returns "s"
  5485. ---------------------------------------
  5486. *setchar(<string>,<char>,<index>)
  5487. Returns the original string with the char at the specified index set to the
  5488. specified char. If index out of range, the original string will be returned.
  5489. Only the 1st char in the <char> parameter will be used.
  5490. Example:
  5491. setchar("Cat", "B", 0); //returns "Bat"
  5492. ---------------------------------------
  5493. *insertchar(<string>,<char>,<index>)
  5494. Returns the original string with the specified char inserted at the specified
  5495. index. If index is out of range, the char will be inserted on the end of the
  5496. string that it is closest. Only the 1st char in the <char> parameter will be used.
  5497. Example:
  5498. insertchar("laughter", "s", 0); //returns "slaughter"
  5499. ---------------------------------------
  5500. *delchar(<string>,<index>)
  5501. Returns the original string with the char at the specified index removed.
  5502. If index is out of range, original string will be returned.
  5503. Example:
  5504. delchar("Diet", 3); //returns "Die"
  5505. ---------------------------------------
  5506. *strtoupper(<string>)
  5507. *strtolower(<string>)
  5508. Returns the specified string in its uppercase/lowercase form.
  5509. All non-alpha characters will be preserved.
  5510. Example:
  5511. strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!"
  5512. ---------------------------------------
  5513. *charisupper(<string>,<index>)
  5514. *charislower(<string>,<index>)
  5515. Returns 1 if character at specified index of specified string is
  5516. uppercase/lowercase. Otherwise, 0. Characters not of the alphabet will return 0.
  5517. Example:
  5518. charisupper("rAthena", 1); //returns 1
  5519. ---------------------------------------
  5520. *substr(<string>,<start_index>,<end_index>)
  5521. Returns the sub-string of the specified string inclusively between the set
  5522. indexes. If indexes are out of range, or the start index is after the end
  5523. index, an empty string will be returned.
  5524. Example:
  5525. substr("foobar", 3, 5); //returns "bar"
  5526. ---------------------------------------
  5527. *explode(<dest_array>,<string>,<delimiter>)
  5528. Breaks a string up into substrings based on the specified delimiter. Substrings
  5529. will be stored within the specified string array. Only the 1st char of the
  5530. delimiter parameter will be used. If an empty string is passed as a delimiter,
  5531. the string will be placed in the array in its original form.
  5532. Example:
  5533. explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
  5534. //.@my_array$ contents will be...
  5535. //.@my_array$[0]: "Explode"
  5536. //.@my_array$[1]: "Test"
  5537. //.@my_array$[2]: "1965"
  5538. //.@my_array$[3]: "red"
  5539. //.@my_array$[4]: "PIE"
  5540. ---------------------------------------
  5541. *implode(<string_array>{,<glue>})
  5542. Combines all substrings within the specified string array into a single string.
  5543. If the glue parameter is specified, it will be inserted inbetween each substring.
  5544. Example:
  5545. setarray .@my_array$[0], "This", "is", "a", "test";
  5546. implode(.@my_array$, " "); //returns "This is a test"
  5547. ---------------------------------------
  5548. *sprintf(<format>[,param[,param[,...]]])
  5549. C style sprintf. The resulting string is returned same as in PHP. All C format
  5550. specifiers are supported except %n. More info: sprintf @ www.cplusplus.com.
  5551. The number of params is only limited by rA's script engine.
  5552. Example:
  5553. .@format$ = "The %s contains %d monkeys";
  5554. dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys"
  5555. dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys"
  5556. ---------------------------------------
  5557. *sscanf(<string>,<format>[,param[,param[,...]]])
  5558. C style sscanf. All C format specifiers are supported.
  5559. More info: sscanf @ www.cplusplus.com. The number of params is only limited
  5560. by rA's script engine.
  5561. Example:
  5562. sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$);
  5563. dispbottom(.@num + " " + .@str$); //prints "42 foobar"
  5564. ---------------------------------------
  5565. *strpos(<haystack>,<needle>{,<offset>})
  5566. PHP style strpos. Finds a substring (needle) within a string (haystack).
  5567. The offset parameter indicates the index of the string to start searching.
  5568. Returns index of substring on successful search, else -1.
  5569. Comparison is case sensitive.
  5570. Example:
  5571. strpos("foobar", "bar", 0); //returns 3
  5572. strpos("foobarfoo", "foo", 0); //returns 0
  5573. strpos("foobarfoo", "foo", 1); //returns 6
  5574. ---------------------------------------
  5575. *replacestr(<input>, <search>, <replace>{, <usecase>{, <count>}})
  5576. Replaces all instances of a search string in the input with the specified
  5577. replacement string. By default is case sensitive unless <usecase> is set
  5578. to 0. If specified it will only replace as many instances as specified
  5579. in the count parameter.
  5580. Example:
  5581. replacestr("testing tester", "test", "dash"); //returns "dashing dasher"
  5582. replacestr("Donkey", "don", "mon", 0); //returns "monkey"
  5583. replacestr("test test test test test", "test", "yay", 0, 3); //returns "yay yay yay test test"
  5584. ---------------------------------------
  5585. *countstr(<input>, <search>{, <usecase>})
  5586. Counts all instances of a search string in the input. By default is case
  5587. sensitive unless <usecase> is set to 0.
  5588. Example:
  5589. countstr("test test test Test", "test"); //returns 3
  5590. countstr("cake Cake", "Cake", 0); //returns 2
  5591. ---------------------------------------
  5592. *preg_match(<regular expression pattern>,<string>{,<offset>})
  5593. Searches a string for a match to the regular expression provided. The
  5594. offset parameter indicates the index of the string to start searching.
  5595. Returns offsets to captured substrings, or 0 if no match is found.
  5596. This command is only available if the server is compiled with the regular
  5597. expressions library enabled.
  5598. ---------------------------------------
  5599. *setfont <font>;
  5600. This command sets the current RO client interface font to one of the
  5601. fonts stored in data\*.eot by using an ID of the font. When the ID
  5602. of the currently used font is used, default interface font is used
  5603. again.
  5604. 0 - Default
  5605. 1 - RixLoveangel
  5606. 2 - RixSquirrel
  5607. 3 - NHCgogo
  5608. 4 - RixDiary
  5609. 5 - RixMiniHeart
  5610. 6 - RixFreshman
  5611. 7 - RixKid
  5612. 8 - RixMagic
  5613. 9 - RixJJangu
  5614. ---------------------------------------
  5615. *showdigit <value>{,<type>};
  5616. Displays given numeric 'value' in large digital clock font on top of
  5617. the screen. The optional parameter 'type' specifies visual aspects
  5618. of the "clock" and can be one of the following values:
  5619. 0 - Displays the value for 5 seconds (default).
  5620. 1 - Incremental counter (1 tick/second).
  5621. 2 - Decremental counter (1 tick/second). Does not stop at zero,
  5622. but overflows.
  5623. 3 - Decremental counter (1 tick/second). Two digits only, stops
  5624. at zero.
  5625. For type 1 and 2 the start value is set by using negative number of
  5626. the one intended to set (ex. -10 starts the counter at 10 seconds).
  5627. Except for type 3 the value is interpreted as seconds and formatted
  5628. as time in days, hours, minutes and seconds. Note, that the official
  5629. script command does not have the optional parameter.
  5630. // displays 23:59:59 for 5 seconds
  5631. showdigit 86399;
  5632. // counter that starts at 60 and runs for 60 seconds
  5633. showdigit 60,3;
  5634. ---------------------------------------
  5635. *setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
  5636. Each map cell has several 'flags' that specify the properties of that cell.
  5637. These include terrain properties (walkability, shootability, presence of water),
  5638. skills (basilica, land protector, ...) and other (NPC nearby, no vending, ...).
  5639. Each of these can be 'on' or 'off'. Together they define a cell's behavior.
  5640. This command lets you alter these flags for all map cells in the specified
  5641. (x1,y1)-(x2,y2) rectangle. The 'flag' can be 0 or 1 (0:clear flag, 1:set flag).
  5642. The 'type' defines which flag to modify. Possible options see 'db/const.txt'.
  5643. Example:
  5644. setcell "arena",0,0,300,300,cell_basilica,1;
  5645. setcell "arena",140,140,160,160,cell_basilica,0;
  5646. setcell "arena",135,135,165,165,cell_walkable,0;
  5647. setcell "arena",140,140,160,160,cell_walkable,1;
  5648. This will add a makeshift ring into the center of the map. The ring will be
  5649. surrounded by a 5-cell wide 'gap' to prevent interference from outside, and
  5650. the rest of the map will be marked as 'basilica', preventing observers from
  5651. casting any offensive skills or fighting among themselves. Note that the wall
  5652. will not be shown nor known client-side, which may cause movement problems.
  5653. Another example:
  5654. OnBarricadeDeploy:
  5655. setcell "schg_cas05",114,51,125,51,cell_walkable,0;
  5656. end;
  5657. OnBarricadeBreak:
  5658. setcell "schg_cas05",114,51,125,51,cell_walkable,1;
  5659. end;
  5660. This could be a part of the WoE:SE script, where attackers are not allowed
  5661. to proceed until all barricades are destroyed. This script would place and
  5662. remove a nonwalkable row of cells after the barricade mobs.
  5663. ---------------------------------------
  5664. *checkcell ("<map name>",<x>,<y>,<type>);
  5665. This command will return 1 or 0, depending on whether the specified cell has
  5666. the 'type' flag set or not. There are various types to check, all mimicking
  5667. the server's cell_chk enumeration. The types can be found in 'db/const.txt'.
  5668. The meaning of the individual types can be confusing, so here's an overview:
  5669. - cell_chkwall/water/cliff
  5670. these check directly for the 'terrain component' of the specified cell
  5671. - cell_chkpass/reach/nopass/noreach
  5672. passable = not wall & not cliff, reachable = passable wrt. no-stacking mod
  5673. - cell_chknpc/basilica/landprotector/novending/nochat
  5674. these check for specific dynamic flags (their name indicates what they do)
  5675. Example:
  5676. mes "Pick a destination map.";
  5677. input .@map$;
  5678. mes "Alright, now give me the coordinates.";
  5679. input .@x;
  5680. input .@y;
  5681. if( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) {
  5682. mes "Can't warp you there, sorry!";
  5683. close;
  5684. } else {
  5685. mes "Ok, get ready...";
  5686. close2;
  5687. warp .@map$, .@x, .@y;
  5688. end;
  5689. }
  5690. ---------------------------------------
  5691. *setwall "<map name>",<x>,<y>,<size>,<dir>,<shootable>,"<name>";
  5692. *delwall "<name>";
  5693. Creates an invisible wall, an array of "setcell" starting from x,y and doing a
  5694. line of the given size in the given direction. The difference with setcell is
  5695. this one update client part too to avoid the glitch problem. Directions are the
  5696. same as NPC sprite facing directions: 0=north, 1=northwest, 2=west, etc.
  5697. ---------------------------------------
  5698. *readbook <book id>,<page>;
  5699. This command will open a book item at the specified page.
  5700. ---------------------------------------
  5701. ========================
  5702. |7.- Instance commands.|
  5703. ========================
  5704. ---------------------------------------
  5705. *instance_create("<instance name>");
  5706. Creates an instance for the party of the attached player. The instance name,
  5707. along with all other instance data, is read from 'db/(pre-)re/instance_db.txt'.
  5708. Upon success, the command generates a unique instance ID, duplicates all listed
  5709. maps and NPCs, sets the alive time, and triggers the "OnInstanceInit" label in
  5710. all NPCs inside the instance.
  5711. The command returns the instance ID upon success, and these values upon failure:
  5712. -1: Invalid type.
  5713. -2: Party not found.
  5714. -3: Instance already exists.
  5715. -4: No free instances (MAX_INSTANCE exceeded).
  5716. ---------------------------------------
  5717. *instance_destroy {<instance id>};
  5718. Destroys instance with the ID <instance id>. If no ID is specified, the instance
  5719. the script is attached to is used. If the script is not attached to an instance,
  5720. the instance of the currently attached player's party is used. If that fails,
  5721. the script will come to a halt.
  5722. ---------------------------------------
  5723. *instance_enter("<instance name>"{,<x>,<y>});
  5724. Warps player to the specified instance after the script terminates. The map and
  5725. coordinates are located in 'db/(pre-)re/instance_db.txt'.
  5726. The command returns 0 upon success, and these values upon failure:
  5727. 1: Party not found.
  5728. 2: Party does not have an instance.
  5729. 3: Other errors (invalid instance name, instance doesn't match with party).
  5730. ---------------------------------------
  5731. *instance_npcname("<npc name>"{,<instance id>})
  5732. Returns the unique name of the instanced script. If no ID is specified,
  5733. the instance the script is attached to is used. If the script is not attached to
  5734. an instance, the instance of the currently attached player's party is used. If
  5735. that fails, the script will come to a halt.
  5736. ---------------------------------------
  5737. *instance_mapname("<map name>"{,<instance id>})
  5738. Returns the unique name of the instanced map. If no instance ID is specified,
  5739. the instance the script is attached to is used. If the script is not attached to
  5740. an instance, the instance of the currently attached player's party is used. If
  5741. that fails, the command returns an empty string instead.
  5742. ---------------------------------------
  5743. *instance_id()
  5744. Returns the unique instance id of the attached script. If the script is not
  5745. attached to an instance, the instance of the currently attached player's party is
  5746. used. If that fails, the function will return 0.
  5747. ---------------------------------------
  5748. *instance_warpall "<map name>",<x>,<y>{,<instance id>};
  5749. Warps all players in the instance <instance id> to <map name> at given
  5750. coordinates. If no ID is specified, the instance the script is attached to
  5751. is used. If the script is not attached to an instance, the instance of the
  5752. currently attached player's party is used. If that fails, the script will
  5753. come to a halt.
  5754. ---------------------------------------
  5755. *instance_announce <instance id>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  5756. Broadcasts a message to all players in the instance <instance id> currently
  5757. residing on an instance map. If -1 is specified for <instance id>, the instance
  5758. the script is attached to is used. If the script is not attached to an instance,
  5759. the instance of the currently attached player's party is used.
  5760. For details on the other parameters, see 'announce'.
  5761. ---------------------------------------
  5762. *instance_check_party(<party id>{,<amount>{,<min>{,<max>}}})
  5763. This function checks if a party meets certain requirements, returning 1 if all
  5764. conditions are met and 0 otherwise. It will only check online characters.
  5765. amount - number of online party members (default is 1).
  5766. min - minimum level of all characters in the party (default is 1).
  5767. max - maximum level of all characters in the party (default is max level in conf).
  5768. Example:
  5769. if (instance_check_party(getcharid(1),2,2,149)) {
  5770. mes "Your party meets the Memorial Dungeon requirements.",
  5771. mes "All online members are between levels 1-150 and at least two are online.";
  5772. close;
  5773. } else {
  5774. mes "Sorry, your party does not meet requirements.";
  5775. close;
  5776. }
  5777. ---------------------------------------
  5778. =========================
  5779. |8.- Quest Log commands.|
  5780. =========================
  5781. ---------------------------------------
  5782. *questinfo <Quest ID>,<Icon>{,<Map Mark Color>{,<Job Class>}};
  5783. This is esentially a combination of checkquest and showevent. Use this only
  5784. in an OnInit label. For the Quest ID, specify the quest ID that you want
  5785. checked if it has been started yet.
  5786. For Icon, use one of the following:
  5787. No Icon : QTYPE_NONE
  5788. ! Quest Icon : QTYPE_QUEST
  5789. ? Quest Icon : QTYPE_QUEST2
  5790. ! Job Icon : QTYPE_JOB
  5791. ? Job Icon : QTYPE_JOB2
  5792. ! Event Icon : QTYPE_EVENT
  5793. ? Event Icon : QTYPE_EVENT2
  5794. Warg : QTYPE_WARG
  5795. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410)
  5796. Map Mark Color, when used, creates a mark in the user's mini map on the position of the NPC,
  5797. the available color values are:
  5798. 0 - No Marker
  5799. 1 - Yellow Marker
  5800. 2 - Green Marker
  5801. 3 - Purple Marker
  5802. When a user shows up on a map, each NPC is checked for questinfo that has been set.
  5803. If questinfo is present, it will check if the quest has been started, if it has not, the bubble will appear.
  5804. Optionally, you can also specify a Job Class if the quest bubble should only appear for a certain class.
  5805. Example
  5806. izlude,100,100,4 script Test 844,{
  5807. mes "[Test]";
  5808. mes "Hello World.";
  5809. close;
  5810. OnInit:
  5811. questinfo 1001, QTYPE_QUEST, 0, Job_Novice;
  5812. end;
  5813. }
  5814. ---------------------------------------
  5815. *setquest <ID>{,<char_id>};
  5816. Place quest of <ID> in the users quest log, the state of which is "active".
  5817. If *questinfo is set, and the same ID is specified here, the icon will be cleared when the quest is set.
  5818. ---------------------------------------
  5819. *completequest <ID>{,<char_id>};
  5820. Change the state for the given quest <ID> to "complete" and remove from the users quest log.
  5821. ---------------------------------------
  5822. *erasequest <ID>{,<char_id>};
  5823. Remove the quest of the given <ID> from the user's quest log.
  5824. ---------------------------------------
  5825. *changequest <ID>,<ID2>{,<char_id>};
  5826. Remove quest of the given <ID> from the user's quest log.
  5827. Add quest of the <ID2> to the the quest log, and the state is "active".
  5828. ---------------------------------------
  5829. *checkquest(<ID>{,PLAYTIME|HUNTING{,<char_id>}})
  5830. If no additional argument supplied, return the state of the quest:
  5831. -1 = Quest not started (not in quest log)
  5832. 0 = Quest has been given, but the state is "inactive"
  5833. 1 = Quest has been given, and the state is "active"
  5834. 2 = Quest completed
  5835. If parameter "PLAYTIME" is supplied:
  5836. -1 = Quest not started (not in quest log)
  5837. 0 = the time limit has not yet been reached
  5838. 1 = the time limit has not been reached but the quest is marked as complete
  5839. 2 = the time limit has been reached
  5840. If parameter "HUNTING" is supplied:
  5841. -1 = Quest not started (not in quest log)
  5842. 0 = you haven't killed all of the target monsters and the time limit has not been reached.
  5843. 1 = you haven't killed all of the target monsters but the time limit has been reached.
  5844. 2 = you've killed all of the target monsters
  5845. ---------------------------------------
  5846. *isbegin_quest(<ID>{,<char_id>})
  5847. Return the state of the quest:
  5848. 0 = Quest not started (not in quest log)
  5849. 1 = Quest has been given (state is either "inactive" or "active")
  5850. 2 = Quest completed
  5851. ---------------------------------------
  5852. *showevent <icon>{,<mark color>{,<char_id>}}
  5853. Show an emotion on top of a NPC, and optionally,
  5854. a colored mark in the mini-map like "viewpoint".
  5855. This is used to indicate that a NPC has a quest or an event to
  5856. a certain player.
  5857. Available Icons:
  5858. Remove Icon : QTYPE_NONE
  5859. ! Quest Icon : QTYPE_QUEST
  5860. ? Quest Icon : QTYPE_QUEST2
  5861. ! Job Icon : QTYPE_JOB
  5862. ? Job Icon : QTYPE_JOB2
  5863. ! Event Icon : QTYPE_EVENT
  5864. ? Event Icon : QTYPE_EVENT2
  5865. Warg : QTYPE_WARG
  5866. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410)
  5867. Mark Color:
  5868. 0 - No Mark
  5869. 1 - Yellow Mark
  5870. 2 - Green Mark
  5871. 3 - Purple Mark
  5872. ---------------------------------------
  5873. ============================
  5874. |9.- Battleground commands.|
  5875. ============================
  5876. ---------------------------------------
  5877. *waitingroom2bg_single(<battle group>,"<map name>",<x>,<y>,"<npc name>");
  5878. Adds the first waiting player from the chat room of the given NPC to an
  5879. existing battleground group and warps it to the specified coordinates on
  5880. the given map.
  5881. ---------------------------------------
  5882. *waitingroom2bg("<map name>",<x>,<y>,"<On Quit Event>","<On Death Event>"{,"<NPC Name>"});
  5883. <map name>,<x>,<y> refer to where the "respawn" base is, where the player group will respawn when they die.
  5884. <On Quit Event> refers to an NPC label that attaches to the character and is run when they relog.
  5885. <On Death Event> refers to an NPC label that attaches to the character and is run when they die. Can be "" for empty.
  5886. Unlike the prior command, the latter will attach a GROUP in a waiting room to the battleground, and
  5887. sets the array $@arenamembers[0] where 0 holds the IDs of the first group, and 1 holds the IDs of the second.
  5888. If the optional NPC Name parameter is left out, the waiting room of the current NPC is used.
  5889. Example:
  5890. // Battle Group will be referred to as $@KvM01BG_id1, and when they die, respawn at bat_c01,52,129.
  5891. set $@KvM01BG_id1, waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
  5892. end;
  5893. ---------------------------------------
  5894. *bg_team_setxy <Battle Group ID>,<x>,<y>;
  5895. 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).
  5896. Example:
  5897. bg_team_setxy getcharid(4),56,212;
  5898. mapannounce "bat_a01", "Group [1] has taken the work shop, and will now respawn there.",bc_map,"0xFFCE00";
  5899. end;
  5900. ---------------------------------------
  5901. *bg_warp <Battle Group>,"<map name>",<x>,<y>;
  5902. Similar to the 'warp' command.
  5903. Places all members of <Battle Group> at the specified map and coordinates.
  5904. Example:
  5905. //place the battle group one for Tierra Gorge at starting position.
  5906. bg_warp $@TierraBG1_id1,"bat_a01",352,342;
  5907. end;
  5908. ---------------------------------------
  5909. *bg_monster <Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>";
  5910. *bg_monster(<Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>");
  5911. Similar to the 'monster' command.
  5912. Spawns a monster with allegiance to the given Battle Group.
  5913. Does not allow for the summoning of multiple monsters.
  5914. Monsters are similar to those in War of Emperium, in that the specified Battle Group is considered friendly.
  5915. Example:
  5916. // It can be used in two different ways.
  5917. bg_monster $@TierraBG1_id2,"bat_a01",167,50,"Food Depot",1910,"Feed Depot#1::OnMyMobDead";
  5918. end;
  5919. // Alternatively, you can set an ID for the monster using "set".
  5920. // This becomes useful when used with the command below.
  5921. set $@Guardian_3, bg_monster($@TierraBG1_id2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  5922. end;
  5923. ---------------------------------------
  5924. *bg_monster_set_team <GID>,<Battle Group>;
  5925. This command will change the allegiance if a monster in a battle ground.
  5926. GID can be set when spawning the monster via the 'bg_monster' command.
  5927. Example:
  5928. end;
  5929. OnEnable:
  5930. mapannounce "A guardian has been summoned for Battle Group 2!",bc_map,"0xFFCE00";
  5931. set $@Guardian, bg_monster($@BG_2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  5932. initnpctimer;
  5933. end;
  5934. OnTimer1000:
  5935. stopnpctimer;
  5936. mapannounce "Erm, sorry about that! This monster was meant for Battle Group 1.",bc_map,"0xFFCE00";
  5937. bg_monster_set_team $@Guardian, $@BG_1;
  5938. end;
  5939. ---------------------------------------
  5940. *bg_leave;
  5941. Removes attached player from their Battle Group.
  5942. ---------------------------------------
  5943. *bg_destroy <Batte Group>;
  5944. Destroys the Battle Group created for that battle ground.
  5945. ---------------------------------------
  5946. *areapercentheal "<map name>",<x1>,<y1>,<x2>,<y2>,<hp>,<sp>;
  5947. Restores a percentage of the maximum HP/SP of players within a defined area.
  5948. This is primarily used in battleground scripts, but is not limited to them.
  5949. Example:
  5950. areapercentheal "bat_a01",52,208,61,217,100,100;
  5951. end;
  5952. ---------------------------------------
  5953. *bg_get_data(<Battle Group>,<type>);
  5954. Retrieves data related to given Battle Group. Type can be one of the following:
  5955. 0 - Amount of players currently belonging to the group.
  5956. ---------------------------------------
  5957. *bg_getareausers(<Battle Group>,"<map name>",<x0>,<y0>,<x1>,<y1>);
  5958. Retrieves the amount of players belonging to the given Battle Group on the given
  5959. map within the specified rectangular area.
  5960. ---------------------------------------
  5961. *bg_updatescore "<map name>",<Guillaume Score>,<Croix Score>;
  5962. This command will force the update of the displayed scoreboard.
  5963. It is only usable when the map is defined as a Type 2 Battleground:
  5964. mapflag <map name> battleground 2
  5965. ---------------------------------------
  5966. ====================
  5967. |10.- Pet commands.|
  5968. ====================
  5969. ---------------------------------------
  5970. *bpet;
  5971. This command opens up a pet hatching window on the client connected to the
  5972. invoking character. It is used in item script for the pet incubators and will
  5973. let the player hatch an owned egg. If the character has no eggs, it will just
  5974. open up an empty incubator window.
  5975. This is still usable outside item scripts.
  5976. ---------------------------------------
  5977. *pet <pet id>;
  5978. This command is used in all the item scripts for taming items. Running this
  5979. command will make the pet catching cursor appear on the client connected to the
  5980. invoking character, usable on the monsters with the specified pet ID number. It
  5981. will still work outside an item script.
  5982. A full list of pet IDs can be found inside 'db/pet_db.txt'.
  5983. ---------------------------------------
  5984. *makepet <pet id>;
  5985. This command will create a pet egg and put it in the invoking character's
  5986. inventory. The kind of pet is specified by pet ID numbers listed in
  5987. 'db/pet_db.txt'. The egg is created exactly as if the character just successfully
  5988. caught a pet in the normal way.
  5989. // This will make you a poring:
  5990. makepet 1002;
  5991. Notice that you absolutely have to create pet eggs with this command. If you try
  5992. to give a pet egg with 'getitem', pet data will not be created by the char
  5993. server and the egg will disappear when anyone tries to hatch it.
  5994. ---------------------------------------
  5995. *getpetinfo(<type>)
  5996. This function will return pet information for the pet the invoking character
  5997. currently has active. Valid types are:
  5998. 0 - Pet Game ID
  5999. 1 - Pet class number as per 'db/pet_db.txt' - will tell you what kind of a pet it
  6000. is.
  6001. 2 - Pet name. Will return "null" if there's no pet.
  6002. 3 - Pet friendly level (intimacy score). 1000 is full loyalty.
  6003. 4 - Pet hungry level. 100 is completely full.
  6004. 5 - Pet rename flag. 0 means this pet has not been named yet.
  6005. 6 - Pet level
  6006. ---------------------------------------
  6007. =============================
  6008. |10.1.- The Pet AI commands.|
  6009. =============================
  6010. ---------------------------------------
  6011. These commands will only work if the invoking character has a pet, and are meant
  6012. to be executed from pet scripts. They will modify the pet AI decision-making for
  6013. the current pet of the invoking character, and will NOT have any independent
  6014. effect by themselves, which is why only one of them each may be in effect at any
  6015. time for a specific pet. A pet may have 'petloot', 'petskillbonus',
  6016. 'petskillattack' OR 'petpetskillattack2' and 'petskillsupport' OR 'petheal' at
  6017. the same time. 'petheal' is deprecated and is no longer used in the default pet
  6018. scripts.
  6019. All commands with delays and durations will only make the behavior active for
  6020. the specified duration of seconds, with a delay of the specified number of
  6021. seconds between activations. Rates are a chance of the effect occurring and are
  6022. given in percent. 'bonusrate' is added to the normal rate if the pet intimacy is
  6023. at the maximum possible.
  6024. The behavior modified with the below mentioned commands will only be exhibited if
  6025. the pet is loyal and appropriate configuration options are set in
  6026. 'battle_athena.conf'.
  6027. Pet scripts in the database normally run whenever a pet of that type hatches
  6028. from the egg. Other commands usable in item scripts (see 'bonus') will also
  6029. happily run from pet scripts. Apparently, the pet-specific commands will also
  6030. work in NPC scripts and modify the behavior of the current pet up until the pet
  6031. is hatched again. (Which will also occur when the character is logged in again
  6032. with the pet still out of the egg.) It is not certain for how long the effect of
  6033. such command running from an NPC script will eventually persist, but apparently,
  6034. it is possible to usefully employ them in usable item scripts to create pet
  6035. buffing items.
  6036. Nobody tried this before, so you're essentially on your own here.
  6037. ---------------------------------------
  6038. *petskillbonus <bonus type>,<value>,<duration>,<delay>;
  6039. This command will make the pet give a bonus to the owner's stat in certain
  6040. duration in seconds and will be repeated for certain delay in seconds.
  6041. For a full bonus list, see 'doc/item_bonus.txt'
  6042. NOTE: Currently ONLY supported for bonuses that used by 'bonus' script.
  6043. ---------------------------------------
  6044. *petrecovery <status type>,<delay>;
  6045. This command will make the pet cure a specified status condition. The curing
  6046. actions will occur once every Delay seconds. For a full list of status
  6047. conditions that can be cured, see the list of 'SC_' status condition constants
  6048. in 'db/const.txt'.
  6049. ---------------------------------------
  6050. *petloot <max items>;
  6051. This command will turn on pet looting, with a maximum number of items to loot
  6052. specified. Pet will store items and return them when the maximum is reached or
  6053. when pet performance is activated.
  6054. ---------------------------------------
  6055. *petskillsupport <skill id>,<skill level>,<delay>,<percent hp>,<percent sp>;
  6056. *petskillsupport "<skill name>",<skill level>,<delay>,<percent hp>,<percent sp>;
  6057. *petheal <level>,<delay>,<percent hp>,<percent sp>;
  6058. This will make the pet use a specified support skill on the owner whenever the
  6059. HP and SP are below the given percent values, with a specified delay time
  6060. between activations. The skill numbers are as per 'db/(pre-)re/skill_db.txt'.
  6061. 'petheal' works the same as 'petskillsupport' but has the skill ID hard-coded to
  6062. AL_HEAL (ID:28). This command is deprecated.
  6063. It's not quite certain who's stats will be used for the skills cast, the
  6064. character's or the pets. Probably, Skotlex can answer that question.
  6065. ---------------------------------------
  6066. *petskillattack <skill id>,<skill level>,<rate>,<bonusrate>;
  6067. *petskillattack "<skill name>",<skill level>,<rate>,<bonusrate>;
  6068. *petskillattack2 <skill id>,<damage>,<number of attacks>,<rate>,<bonusrate>;
  6069. *petskillattack2 "<skill name>",<damage>,<number of attacks>,<rate>,<bonusrate>;
  6070. These two commands will make the pet cast an attack skill on the enemy the pet's
  6071. owner is currently fighting. Skill IDs and levels are as per 'petskillsupport'.
  6072. 'petskillattack2' will make the pet cast the skill with a fixed amount of damage
  6073. inflicted and the specified number of attacks.
  6074. Value of 'rate' is between 1 and 100. 100 = 100%
  6075. ---------------------------------------
  6076. ===========================
  6077. |11.- Homunculus commands.|
  6078. ===========================
  6079. ---------------------------------------
  6080. *homevolution;
  6081. This command will try to evolve the current player's homunculus.
  6082. If it doesn't work, the /swt emotion is shown.
  6083. To evolve a homunculus, the invoking player must have a homunculus,
  6084. the homunculus must not be the last evolution and
  6085. the homunculus must have above 91000 intimacy with its owner.
  6086. ---------------------------------------
  6087. *morphembryo;
  6088. This command will try to put the invoking player's Homunculus in an
  6089. uncallable state, required for mutation into a Homunculus S. The player
  6090. will also receive a Strange Embryo (ID 6415) in their inventory if
  6091. successful, which is deleted upon mutation.
  6092. The command will fail if the invoking player does not have an evolved
  6093. Homunculus at level 99 or above. The /swt emotion is shown upon failure.
  6094. Returns 1 upon success and 0 for all failures.
  6095. ---------------------------------------
  6096. *hommutate {<ID>};
  6097. This command will try to mutate the invoking player's Homunculus into
  6098. a Homunculus S. The Strange Embryo (ID 6415) is deleted upon success.
  6099. The command will fail if the invoking player does not have an evolved
  6100. Homunculus at level 99 or above, if it is not in the embryo state
  6101. (from the 'morphembryo' command), or if the invoking player does not
  6102. possess a Strange Embryo. The /swt emotion is shown upon failure.
  6103. If the optional parameter <ID> is set, the invoking player's Homunculus
  6104. will change into the specified Homunculus ID. Otherwise, a random Homunculus S
  6105. will be chosen. See 'db/homunculus_db.txt' for a full list of IDs.
  6106. Returns 1 upon success and 0 for all failures.
  6107. ---------------------------------------
  6108. *checkhomcall()
  6109. This function checks if the attached player's Homunculus is active,
  6110. and will return the following values:
  6111. -1: The player has no Homunculus.
  6112. 0: The player's Homunculus is active.
  6113. 1: The player's Homunculus is vaporized.
  6114. 2: The player's Homunculus is in morph state.
  6115. ---------------------------------------
  6116. *gethominfo(<type>)
  6117. This function will return Homunculus information for the Homunculus of the
  6118. invoking character, regardless of its vaporize state. It returns zero or
  6119. "null" if the player does not own a Homunculus.
  6120. Valid types are:
  6121. 0 - Homunculus Game ID
  6122. 1 - Homunculus Class
  6123. 2 - Homunculus Name
  6124. 3 - Homunculus friendly level (intimacy score). 100000 is full loyalty.
  6125. 4 - Homunculus hungry level. 100 is completely full.
  6126. 5 - Homunculus rename flag. 0 means this homunculus has not been named yet.
  6127. 6 - Homunculus level
  6128. ---------------------------------------
  6129. *homshuffle;
  6130. This will recalculate the homunculus stats according to its level, of the
  6131. current invoking character.
  6132. ---------------------------------------
  6133. ==========================
  6134. |12.- Mercenary commands.|
  6135. ==========================
  6136. ---------------------------------------
  6137. *mercenary_create <class>,<contract time>;
  6138. This command summons a mercenary for a given time (in milliseconds). For a
  6139. list of all available classes, see 'db/mercenary_db.txt'.
  6140. This command is typically used in item scripts of mercenary scrolls.
  6141. ---------------------------------------
  6142. *mercenary_heal <hp>,<sp>;
  6143. This command works like 'heal', but affects the mercenary of the
  6144. currently attached character.
  6145. ---------------------------------------
  6146. *mercenary_sc_start <type>,<tick>,<val1>;
  6147. This command works like 'sc_start', but affects the mercenary of the
  6148. currently attached character.
  6149. ---------------------------------------
  6150. *mercenary_get_calls(<guild>);
  6151. *mercenary_set_calls <guild>,<value>;
  6152. Sets or gets the mercenary calls value for given guild for currently
  6153. attached character. Guild can be one or the following constants:
  6154. ARCH_MERC_GUILD
  6155. SPEAR_MERC_GUILD
  6156. SWORD_MERC_GUILD
  6157. ---------------------------------------
  6158. *mercenary_get_faith(<guild>);
  6159. *mercenary_set_faith <guild>,<value>;
  6160. Sets or gets the mercenary faith value for given guild for currently
  6161. attached character. Guild can be one or the following constants:
  6162. ARCH_MERC_GUILD
  6163. SPEAR_MERC_GUILD
  6164. SWORD_MERC_GUILD
  6165. ---------------------------------------
  6166. *getmercinfo(<type>{,<char id>});
  6167. Retrieves information about mercenary of the currently attached
  6168. character. If char id is given, the information of that character is
  6169. retrieved instead. Type specifies what information to retrieve and
  6170. can be one of the following:
  6171. 0 - Mercenary Game ID
  6172. 1 - Mercenary Class
  6173. 2 - Mercenary Name
  6174. 3 - Mercenary faith value for this mercenary's guild, if any
  6175. 4 - Mercenary calls value for this mercenary's guild, if any
  6176. 5 - Mercenary kill count
  6177. 6 - Mercenary remaining life time in msec
  6178. 7 - Mercenary level
  6179. If the character does not have a mercenary, the command returns ""
  6180. for name and 0 for all other types.
  6181. ---------------------------------------
  6182. ======================
  6183. |13.- Party commands.|
  6184. ======================
  6185. ---------------------------------------
  6186. *getpartyname(<party id>)
  6187. This function will return the name of a party that has the specified ID number.
  6188. If there is no such party ID, "null" will be returned.
  6189. Lets say the ID of a party was saved as a global variable:
  6190. // This would return the name of the party from the ID stored in a variable
  6191. mes "You're in the '"+getpartyname($@var)+"' party, I know!";
  6192. ---------------------------------------
  6193. *getpartymember <party id>{,<type>};
  6194. This command will find all members of a specified party and returns their names
  6195. (or character id or account id depending on the value of "type") into an array
  6196. of temporary global variables. There's actually quite a few commands like this
  6197. which will fill a special variable with data upon execution and not do anything
  6198. else.
  6199. Upon executing this,
  6200. $@partymembername$[] is a global temporary string array which contains all the
  6201. names of these party members
  6202. (only set when type is 0 or not specified)
  6203. $@partymembercid[] is a global temporary number array which contains the
  6204. character id of these party members.
  6205. (only set when type is 1)
  6206. $@partymemberaid[] is a global temporary number array which contains the
  6207. account id of these party members.
  6208. (only set when type is 2)
  6209. $@partymembercount is the number of party members that were found.
  6210. The party members will (apparently) be found regardless of whether they are
  6211. online or offline. Note that the names come in no particular order.
  6212. Be sure to use $@partymembercount to go through this array, and not
  6213. 'getarraysize', because it is not cleared between runs of 'getpartymember'. If
  6214. someone with 7 party members invokes this script, the array would have 7
  6215. elements. But if another person calls up the NPC, and he has a party of 5, the
  6216. server will not clear the array for you, overwriting the values instead. So in
  6217. addition to returning the 5 member names, the 6th and 7th elements from the last
  6218. call remain, and you will get 5+2 members, of which the last 2 don't belong to
  6219. the new guy's party. $@partymembercount will always contain the correct number,
  6220. (5) unlike 'getarraysize()' which will return 7 in this case.
  6221. Example 1: list party member names
  6222. // get the party member names
  6223. getpartymember getcharid(1),0;
  6224. // It's a good idea to copy the global temporary $@partymember*****
  6225. // variables to your own scope variables because if you have pauses in this
  6226. // script (sleep, sleep2, next, close2, input, menu, select, or prompt),
  6227. // another player could click this NPC, trigger 'getpartymember', and
  6228. // overwrite the $@partymember***** variables.
  6229. .@count = $@partymembercount;
  6230. copyarray .@name$[0], $@partymembername$[0], $@partymembercount;
  6231. // list the party member names
  6232. for (.@i = 0; .@i < .@count; .@i++)
  6233. mes (.@i +1) + ". ^0000FF" + .@name$[.@i] + "^000000";
  6234. close;
  6235. Example 2: check party count (with a 'next' pause), before warping to event
  6236. .register_num = 5; // How many party members are required?
  6237. // get the charID and accountID of character's party members
  6238. getpartymember getcharid(1), 1;
  6239. getpartymember getcharid(1), 2;
  6240. if ( $@partymembercount != .register_num ) {
  6241. mes "Please form a party of "+ .register_num +" to continue";
  6242. close;
  6243. }
  6244. // loop through both and use 'isloggedin' to count online party members
  6245. for ( .@i = 0; .@i < $@partymembercount; .@i++ )
  6246. if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
  6247. .@count_online++;
  6248. // We search accountID & charID because a single party can have multiple
  6249. // characters from the same account. Without searching through the charID,
  6250. // if a player has 2 characters from the same account inside the party but
  6251. // only 1 char online, it would count their online char twice.
  6252. if ( .@count_online != .register_num ) {
  6253. mes "All your party members must be online to continue";
  6254. close;
  6255. }
  6256. // copy the array to prevent players cheating the system
  6257. copyarray .@partymembercid, $@partymembercid, .register_num;
  6258. mes "Are you ready ?";
  6259. next; // careful here
  6260. select("Yes");
  6261. // When a script hits a next, menu, sleep or input that pauses the script,
  6262. // players can invite or /leave and make changes in their party. To prevent
  6263. // this, we call getpartymember again and compare with the original values.
  6264. getpartymember getcharid(1), 1;
  6265. if ( $@partymembercount != .register_num ) {
  6266. mes "You've made changes to your party !";
  6267. close;
  6268. }
  6269. for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
  6270. if ( .@partymembercid[.@i] != $@partymembercid[.@i] ) {
  6271. mes "You've made changes to your party !";
  6272. close;
  6273. }
  6274. }
  6275. // Finally, it's safe to start the event!
  6276. warpparty "event_map", 0,0, getcharid(1);
  6277. ---------------------------------------
  6278. *getpartyleader(<party id>{,<type>})
  6279. This function returns some information about the given party-id's leader.
  6280. When type is omitted, the default information retrieved is the leader's name.
  6281. Possible types are:
  6282. 1: Leader account id
  6283. 2: Leader character id
  6284. 3: Leader's class
  6285. 4: Leader's current map name
  6286. 5: Leader's current level as stored on the party structure (may not be
  6287. current level if leader leveled up recently).
  6288. If retrieval fails (leader not found or party does not exist), this function
  6289. returns "null" instead of the character name, and -1 for the other types.
  6290. ---------------------------------------
  6291. *party_create("<party name>"{,<character id>{,<item share>,<item share type>}});
  6292. Organizes a party with the attached or specified character as leader. If
  6293. successful, the command returns 1 and sets the global temporary variable
  6294. "$@party_create_id" to the ID of the party created.
  6295. Additionally, item sharing options can be provided:
  6296. - Item Share: 0-Each Take (default), 1-Party Share
  6297. - Item Share Type: 0-Each Take (default), 1-Even Share
  6298. These values are returned upon failure:
  6299. 0: Unknown error.
  6300. -1: Player not found.
  6301. -2: Player already has a party.
  6302. -3: Party name exists.
  6303. ---------------------------------------
  6304. *party_destroy(<party id>);
  6305. Disbands a party. The command returns 1 upon success and 0 upon failure.
  6306. ---------------------------------------
  6307. *party_addmember(<party id>,<character id>);
  6308. Adds a player to an existing party.
  6309. The command returns 1 upon success, and these values upon failure:
  6310. 0: Unknown error.
  6311. -1: Player not found.
  6312. -2: Player already has a party.
  6313. -3: Party not found.
  6314. -4: Party is full.
  6315. ---------------------------------------
  6316. *party_delmember({<character id>,<party id>});
  6317. Removes a player from his/her party. If no player is specified, the command
  6318. will run for the invoking player. If that player is the only party member
  6319. remaining, the party will be disbanded.
  6320. The command returns 1 upon success, and these values upon failure:
  6321. 0: Unknown error.
  6322. -1: Player not found.
  6323. -2: Party not found.
  6324. -3: Player is not in the party.
  6325. ---------------------------------------
  6326. *party_changeleader(<party id>,<character id>);
  6327. Transfers leadership of a party to the specified character.
  6328. The command returns 1 upon success, and these values upon failure:
  6329. 0: Unknown error.
  6330. -1: Party not found.
  6331. -2: Player not found.
  6332. -3: Player is not in the party.
  6333. -4: Player is already party leader.
  6334. ---------------------------------------
  6335. *party_changeoption(<party id>,<option>,<flag>);
  6336. Changes a party option.
  6337. Valid options are:
  6338. 0 - Exp Share (flags: 0-Each Take, 1-Even Share)
  6339. 1 - Item Share (flags: 0-Each Take, 1-Party Share)
  6340. 2 - Item Share Type (flags: 0-Each Take, 1-Even Share)
  6341. The command returns 1 upon success, and these values upon failure:
  6342. 0: Invalid option.
  6343. -1: Party not found.
  6344. ---------------------------------------
  6345. Whew.
  6346. That's about all of them.