script_commands.txt 224 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996
  1. //===== Athena Script =====================================
  2. //= eAthena Script Commands
  3. //===== By ================================================
  4. //= Fredzilla
  5. //===== Helped By =========================================
  6. //= Terminal Vertex & Z3R0 - Helped define getmapxy
  7. //= HappyDenn - Gave everything to do with getpartymember
  8. //= a great help
  9. //= Maeki Rika - A section on general concepts and lots of
  10. //= other updates and additions.
  11. //===== Version ===========================================
  12. //= 3.02.20070209
  13. //=========================================================
  14. //= 1.0 - First release, filled will as much info as I could
  15. //= remember or figure out, most likely there are errors,
  16. //= and things I have missed out
  17. //= 1.1 - Added better discription for "getmapxy"
  18. //= 1.2b- Added a description for getpartymember
  19. //= (+few spelling mistakes corrected)
  20. //= 2.0 - +79kb extra stuff and numerous corrections by
  21. //= Maeki Rika.
  22. //= 2.1 - Small but important corrections, more proofreading.
  23. //= Some important discoveries in item functions, the
  24. //= secret of making VVS weapons with 'getitem2' and
  25. //= other news. (Rika again) +10kb :)
  26. //= 2.2 - added getItemInfo description [Lupus]
  27. //= 2.3 - added plenty of info for recent (and not so) script commands I added
  28. //= [Skotlex]
  29. //= 2.4 - Explained the upper parameter of jobchange. [Skotlex]
  30. //= 2.5 - Added pow, sqrt and distance. [Lance]
  31. //= 2.6 - Added setd and getd. [Lance]
  32. //= 2.7 - petstat command. [Lance]
  33. //= 2.7a- delitem2, countitems2 commands [Lupus]
  34. //= 2.7b- clone command [Skotlex]
  35. //= 2.7c- disguise / undisguise, query_sql commands [Lupus]
  36. //= 2.8 - Deleted a copy of the nude command. Added axtoi command (needing a
  37. //= clearer explanation of atoi.Gave a better explanation of OnLabels
  38. //= and modified monster explanation due that L_Label isn't working with
  39. //= monster.
  40. //= 2.9.20061230 - Updated getitem and guardian. [FlavioJS]
  41. //= 2.10.20070101 - added sleep,sleep2,awake and updated the variables section.
  42. //= [FlavioJS]
  43. //= 2.11.20070109 - removed the unused flag argument in guildskill, added an
  44. //= optional argument to setcart,setfalcon,setriding and other cleanups
  45. //= [FlavioJS]
  46. //= 2.12.20070201 - Added npcshopitem, npcshopadditem, npcshopdelitem and
  47. //= npcshopattach [Skotlex]
  48. //= 3.00.20070208
  49. //= - Explained Logical Bitwise Operators.
  50. //= Dj-Yhn contributed to AND (&) operator, rest by myself. [erKURITA]
  51. //= - Added a resume of allowed variable and arrays scopes. [erKURITA]
  52. //= - Re-organized the script commands, and grouped them depending
  53. //= on what they do. [erKURITA]
  54. //= - Added a packload of commands that were missing,
  55. //= and corrected some of the wrong ones [Dj-Yhn, erKURITA & Trancid]
  56. //= 3.01.20070209
  57. //= Updated 'cutin' (removed lies, removed outdated bmp list) [ultramage]
  58. //= Removed 'cutincard' since eA no longer implements it
  59. //= 3.02.20070209
  60. //= Corrected/updated info on Xor/setd/getd/callfunc/callsub/return and
  61. //= updated some examples to use "better" code. [FlavioJS]
  62. //= 3.03.20070216
  63. //= Expanded/clarified information on npc timers, added info about the
  64. //= new attach flag for script commands startnpctimer/ stopnpctimer/
  65. //= initnpctimer [Skotlex]
  66. //===== Compatible With ===================================
  67. //= LOL, can be used by anyone hopefully
  68. //===== Description =======================================
  69. //= A reference manual for the eAthena scripting language,
  70. //= sorted out depending on their functionality.
  71. //=========================================================
  72. This document is a reference manual for all the scripting commands and functions
  73. available in current eAthena SVN. It is not a simple tutorial. When people tell
  74. you to "Read The F***ing Manual", they mean this.
  75. The information was mostly acquired through looking up how things actually work
  76. in the source code of the server, which was written by many people over time,
  77. and lots of them don't speak English and never left any notes - or are otherwise
  78. not available for comments. As such, anything written in here might not be
  79. correct, it is only correct to the best of our knowledge, which is limited.
  80. This is not a place to teach you basic programming. This document will not teach
  81. you basic programming by itself. It's more of a reference for those who have at
  82. least a vague idea of what they want to do and want to know what tools they have
  83. available to do it. We've tried to keep it as simple as feasible, but if you
  84. don't understand it, getting a clear book on programming in general will help
  85. better than yelling around the forum for help.
  86. A little learning never caused anyone's head to explode.
  87. Structure
  88. ---------
  89. The commands and functions are listed in no particular order:
  90. *Name of the command and how to call it.
  91. Descriptive text
  92. Small example if possible. Will usually be incomplete, it's there just to
  93. give you an idea of how it works in practice.
  94. To find a specific command, use Ctrl+F, (or whatever keys call up a search
  95. function in whatever you're reading this with) put an * followed by the command
  96. name, and it should find the command description for you.
  97. If you find anything omitted, please respond. :)
  98. Syntax
  99. ------
  100. Throughout this document, wherever a command wants an argument, it is given in
  101. <angle brackets>. This doesn't mean you should type the angle brackets. :) If an
  102. argument of a command is optional, it is given in {curly brackets}. You've
  103. doubtlessly seen this convention somewhere, if you didn't, get used to it,
  104. that's how big boys do it. If a command can optionally take an unspecified
  105. number of arguments, you'll see a list like this:
  106. command <argument>{,<argument>...<argument>}
  107. This still means they will want to be separated by commas.
  108. Where a command wants a string, it will be given in "quotes", if it's a number,
  109. it will be given without them. Normally, you can put an expression, like a bunch
  110. of functions or operators returning a value, in (round brackets) instead of most
  111. numbers. Round brackets will not always be required, but they're often a good
  112. idea.
  113. Wherever you refer to a map name, it's always 'mapname.gat' or 'mapname.afm' if
  114. you are using AFM maps, (if you don't know what they are, you aren't using them)
  115. and not just 'mapname'. While some commands do know that if you didn't give
  116. '.gat', it should add it, it's pretty tricky to tell which ones they are.
  117. Script loading structure
  118. ------------------------
  119. Scripts are loaded by the map server as referenced in the 'conf/map_athena.conf'
  120. configuration file, but in the default configuration, it doesn't load any script
  121. files itself. Instead, it loads the file 'npc/scripts_main.conf' which itself
  122. contains references to other files. The actual scripts are loaded from txt
  123. files, which are linked up like this:
  124. npc: <path to a filename>
  125. Any line like this, invoked, ultimately, by 'map_athena.conf' will load up the
  126. script contained in this file, which will make the script available. No file
  127. will get loaded twice, to prevent possible errors.
  128. Another configuration file option of relevance is:
  129. delnpc: <path to a filename>
  130. This will unload a specifiled script filename from memory, which, while
  131. seemingly useless, may sometimes be required.
  132. Whenever '//' is encountered in a line upon reading, everything beyond this on
  133. that line is considered to be a comment and is ignored. This works wherever you
  134. place it.
  135. Upon loading all the files, the server will execute all the top-level commands
  136. in them. No variables exist yet at this point, no commands can be called other
  137. than those given in this section. These commands set up the basic server script
  138. structure - create NPC objects, spawn monster objects, set map flags, etc. No
  139. code is actually executed at this point except them. The top-level commands the
  140. scripting are pretty confusing, since they aren't structured like you would
  141. expect commands, command name first, but rather, normally start with a map name.
  142. What's more confusing about the top-level commands is that most of them use a
  143. tab symbol to divide their arguments.
  144. To prevent problems and confusion, the tab symbols are written as '%TAB%'
  145. throughout this document, even though this makes the text a bit less readable.
  146. Using an invisible symbol to denote arguments is one of the bad things about
  147. this language, but we're stuck with it for now. :)
  148. Here is a list of valid top-level commands:
  149. ** Set a map flag:
  150. <map name>%TAB%mapflag%TAB%<flag>
  151. This will, upon loading, set a specified map flag on a map you like. These are
  152. normally in files inside 'conf/mapflag' and are loaded first, so by the time the
  153. server's up, all the maps have the flags they should have. Map flags determine
  154. the behavior of the map regarding various common problems, for a better
  155. explanation, see 'setmapflag'.
  156. ** Create a permanent monster spawn:
  157. <map name>,<x>,<y>,<xs>,<ys>%TAB%monster%TAB%<monster name>%TAB%<mob id>,<amount>,<delay1>,<delay2>,<event>
  158. Map name is the name of the map the monsters will spawn on. x,y are the
  159. coordinates where the mob should spawn. If xs and ys are non-zero, they
  160. specify the diameters of a spawn-rectangle area who's center is x,y.
  161. Putting zeros instead of these coordinates will spawn the monsters randomly.
  162. Note this is only the initial spawn zone, as mobs random-walk, they are free
  163. to move away from their specified spawn region.
  164. Monster name is the name the monsters will have on screen, and has no relation
  165. whatsoever to their names anywhere else. It's the mob id that counts, which
  166. identifies monster record in 'mob_db.txt' database of monsters. If the mob name
  167. is given as "--ja--", the 'japanese name' field from the monster database is
  168. used, (which, in eAthena, actually contains an english name) if it's "--en--",
  169. it's the 'english name' from the monster database (which contains an uppercase
  170. name used to summon the monster with a GM command).
  171. If you add 20000 to the monster ID, the monster will be spawned in a 'big
  172. version', (monster size class will increase) and if you add 10000, the 'tiny
  173. version' of the monster will be created. However, this method is deprecated
  174. and not recommended, as the values to add can change at a later time (20000
  175. and 10000 actually stand for 2*MAX_MOB_DB and MAX_MOB_DB respectively, which
  176. is defined on mob.h, and can change in the future as more mobs are created).
  177. The recommended way to change a mob's size is to use the event-field (see
  178. below).
  179. Amount is the amount of monsters that will be spawned when this command is
  180. executed, it is affected by spawn rates in 'battle_athena.conf'.
  181. Delay1 and delay2 are the monster respawn delays - the first one counts the time
  182. since a monster defined in this spawn was last respawned and the second one
  183. counts the time since the monster of this spawn was last killed. Whichever turns
  184. out to be higher will be used. If the resulting number is smaller than a random
  185. value between 5 and 10 seconds, this value will be used instead. (Which is
  186. normally the case if both delay values are zero.) The times are given in
  187. 1/1000ths of a second.
  188. You can specify a custom level to use for the mob different from the one of
  189. the database by adjoining the level after the name with a comma. eg:
  190. "Poring,50" for a name will spawn a monster with name Poring and level 50.
  191. Event is a script event to be executed when the mob is killed. The event must
  192. be in the form "NPCName::OnEventName" to execute, and the event name label
  193. should start with "On". As with all events, if the NPC is an on-touch npc, the
  194. player who triggers the script must be within 'trigger' range for the event to
  195. work.
  196. The Event field can be used alternatively to specify other mob properties. Use
  197. 2 to specify that the mob should be small, 4 for big monsters, and 8 for
  198. special ai mobs (which by default attack other monsters instead of players).
  199. You can add these, so using 10 will spawn small monsters that attack other
  200. mobs (if you specify both 2 and 4, the small version takes priority).
  201. ** Define a warp point
  202. <from map name>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to map name>,<toX>,<toY>
  203. This will define a warp NPC that will warp a player between maps, and while most
  204. arguments of that are obvious, some deserve special mention.
  205. SpanX and SpanY will make the warp sensitive to a character who didn't step
  206. directly on it, but walked into a zone which is centered on the warp from
  207. coordinates and is SpanX in each direction across the X axis and SpanY in each
  208. direction across the Y axis.
  209. Warp NPC objects also have a name, because you can use it to refer to them later
  210. with 'enablenpc'/'disablenpc'
  211. Facing of a warp object is irrelevant, it is not used in the code and all
  212. current scripts have a zero in there.
  213. ** Define an NPC object.
  214. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
  215. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
  216. This will place an NPC object on a specified map at the specified location, and
  217. is a top-level command you will use the most in your custom scripting. The NPCs
  218. are triggered by clicking on them, and/or by walking in their trigger area, if
  219. defined, see that below.
  220. Facing is a direction the NPC sprite will face in. Not all NPC sprites have
  221. different images depending on the direction you look from, so for some facing
  222. will be meaningless. Facings are counted counterclockwise in increments of 45
  223. degrees, where 0 means facing towards the top of the map. (So to turn the sprite
  224. towards the bottom of the map, you use facing 4, and to make it look southeast
  225. it's facing 5.)
  226. Sprite id is the sprite number used to display this particular NPC. For a full
  227. list of sprite id numbers see http://kalen.s79.xrea.com/npc/npce.shtml You may
  228. also use a monster's ID number instead to display a monster sprite for this NPC.
  229. It is possible to use a job sprite as well, but you must first define it as a
  230. monster sprite in 'mob_avail.txt', a full description on how to do this is for
  231. another manual. A '-1' sprite id will make the NPC invisible (and unclickable).
  232. A '111' sprite id will make an NPC which does not have a sprite, but is still
  233. clickable, which is useful if you want to make a clickable object of the 3D
  234. terrain.
  235. TriggerX and triggerY, if given, will define an area, centered on NPC and
  236. spanning triggerX cells in every direction across X and triggerY in every
  237. direction across Y. Walking into that area will trigger the NPC. If no
  238. 'OnTouch:' special label is present in the NPC code, the execution will start
  239. from the beginning of the script, otherwise, it will start from the 'OnTouch:'
  240. label.
  241. NPC name is kinda special, because it's not only the name of NPC you will see on
  242. screen. It's formatted this way:
  243. <Screen name>{#<Extra name identifier>}{::<Label name>}
  244. The extra identifier is there that you can make an npc with an invisible name
  245. (just omit the screen name, but keep the identifier name) and so that you can
  246. refer to several NPCs which have the same name on screen, which is useful to
  247. make an NPC that relocates depending on special conditions, for example - you
  248. define several NPC objects and hide all except one.
  249. ('Hunter#hunter1','Hunter#hunter2'...) The extra name identifiers will let your
  250. code tell them apart.
  251. Label name is used to duplicate NPC objects (more on that below).
  252. The complete NPC name (Screen name + extra identifier) may not exceed 24
  253. characters. The label name is counted separately but also limited to 24
  254. characters.
  255. The code part is the script code that will execute whenever the NPC is
  256. triggered. It may contain commands and function calls, descriptions of which
  257. compose most of this document. It has to be in curly brackets, unlike elsewhere
  258. where we use curly brackets, these do NOT signify an optional parameter.
  259. ** Define an NPC duplicate.
  260. <map name>,<x>,<y>,<facing>%TAB%duplicate(<NPC label>)%TAB%<sprite id>
  261. <map name>,<x>,<y>,<facing>%TAB%duplicate(<NPC label>)%TAB%<sprite id>,<triggerX>,<triggerY>
  262. This will duplicate an NPC referred to by the label. The duplicate runs the same
  263. code as the NPC it refers to, but may have different location, facing and sprite
  264. ID. Whether it may actually have it's own size of trigger area is unclear at the
  265. moment - if you need that, try it and tell us of the results.
  266. ** Define a 'floating' NPC object.
  267. -%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>}
  268. This will define an NPC object not triggerable by normal means. This would
  269. normally mean it's pointless since it can't do anything, but there are
  270. exceptions, mostly related to running scripts at specified time, which is what
  271. these floating NPC objects are for. More on that below.
  272. ** Define a shop NPC.
  273. <map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  274. This will define a shop NPC, which, when triggered (which can only be done by
  275. clicking) will cause a shop window to come up. No code whatsoever runs in shop
  276. NPCs and you can't change the prices otherwise than by editing the script
  277. itself. (No variables even exist at this point of scripting, so don't even
  278. bother trying to use them.)
  279. The item id is the number of item in the 'item_db.txt' database. If Price is set
  280. to -1, the 'buy price' given in the item database will be used. Otherwise, the
  281. price you gave will be used for this item, which is how you create differing
  282. prices for items in different shops.
  283. ** Define a function object
  284. function%TAB%script%TAB%<function name>%TAB%{<code>}
  285. This will define a function object, callable with the 'callfunc' command (see
  286. below). This object will load on every map server separately, so you can get at
  287. it from anywhere. It's not possible to call the code in this object by
  288. anything other than the 'callfunc' script command.
  289. The code part is the script code that will execute whenever the function is
  290. called with 'callfunc'. It has to be in curly brackets, unlike elsewhere where
  291. we use curly brackets, these do NOT signify an optional parameter.
  292. ** Alter a map cell
  293. <map name>%TAB%setcell%TAB%<type>,<x1>,<y1>,<x2>,<y2>
  294. This is sneaky, and isn't used in any official scripts, but it will let you
  295. define an area (x1/y1-x2/y2 square) of a map as having cell type 'type', where
  296. type is a number, which, among other things, defines whether the area is
  297. walkable or not, whether it has Basilica working in it or not, and some other
  298. things. This is a solution just itching for a problem and there's a number of
  299. interesting things you could use it for. Further investigation on what types are
  300. valid and mean what exactly is pending.
  301. Once an object is defined which has a 'code' field to it's definition, it
  302. contains script commands which can actually be triggered and executed.
  303. ~ RID? GID? ~
  304. What a RID is and why do you need to know
  305. -----------------------------------------
  306. Most scripting commands and functions will want to request data about a
  307. character, store variables referenced to that character, send stuff to the
  308. client connected to that specific character. Whenever a script is invoked by a
  309. character, it is passed a so-called RID - this is the character ID number of a
  310. character that caused the code to execute by clicking on it, walking into it's
  311. OnTouch zone, or otherwise.
  312. If you are only writing common NPCs, you don't need to bother with it. However,
  313. if you use functions, if you use timers, if you use clock-based script
  314. activation, you need to be aware of all cases when a script execution can be
  315. triggered without a RID attached. This will make a lot of commands and functions
  316. unusable, since they want data from a specific character, want to send stuff to
  317. a specific client, want to store variables specific to that character, and they
  318. would not know what character to work on if there's no RID.
  319. Unless you use 'attachrid' to explicitly attach a character to the script first.
  320. Whenever we say 'invoking character', we mean 'the character who's RID is
  321. attached to the running script. The script function "playerattached" can be
  322. used to check which is the currently attached player to the script (it will
  323. return 0 if the there is no player attached or the attached player no longer
  324. is logged on to the map-server).
  325. But what about GID?
  326. --- ---- ----- ----
  327. GID stands for the Game ID of something, this can either be the GID obtained
  328. through mobspawn (mob control commands) or the account ID of a character.
  329. Another way would be to right click on a mob,
  330. NPC or char as GM sprited char to view the GID.
  331. This is mostly used for the new version of skill and the mob control commmands
  332. implemented (but NEVER documented by Lance. Shame on you...).
  333. Item and pet scripts
  334. --------------------
  335. Each item in the item database has two special fields - EquipScript and
  336. UseScript. The first is script code run every time a character equips the item,
  337. with the RID of the equipping character. Every time they unequip an item, all
  338. temporary bonuses given by the script commands are cleared, and all the scripts
  339. are executed once again to rebuild them. This also happens in several other
  340. situations (like upon login) but the full list is currently unknown.
  341. UseScript is a piece of script code run whenever the item is used by a character
  342. by doubleclicking on it.
  343. Not all script commands work properly in the item scripts. Where commands and
  344. functions are known to be meant specifically for use in item scripts, they are
  345. described as such.
  346. Every pet in the pet database has a PetScript field, which determines pet
  347. behavior. It is invoked wherever a pet of the specified type is spawned.
  348. (hatched from an egg, or loaded from the char server when a character who had
  349. that pet following them connects) This may occur in some other situations as
  350. well. Don't expect anything other than commands definitely marked as usable in
  351. pet scripts to work in there reliably.
  352. Numbers
  353. -------
  354. Beside the common decimal numbers, which are nothing special whatsoever (though
  355. do not expect to use fractions, since ALL numbers are integer in this language),
  356. the script engine also handles hexadecimal numbers, which are otherwise
  357. identical. Writing a number like '0x<hex digits>' will make it recognised as a
  358. hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try
  359. to 'mes 0x10' it will print '16'.
  360. This is not used much, but it pays to know about it.
  361. Variables
  362. ---------
  363. The meat of every programming language is variables - places where you store
  364. data.
  365. Variables are divided into and uniquely identified by the combination of:
  366. prefix - determines the scope and extent (or lifetime) of the variable
  367. name - an identifier consisting of '_' and alfanumeric characters
  368. postfix - determines the type of the variable: integer or string
  369. Scope can be:
  370. global - global to all servers
  371. local - local to the server
  372. account - attached to the account of the character identified by RID
  373. character - attached to the character identified by RID
  374. npc - attached to the NPC
  375. Extent can be:
  376. permanent - Permanent NPC variables exist while the server is running.
  377. Others still exist when the server resets.
  378. temporary - Temporary NPC variables exist while the script instance is running.
  379. Others cease to exist when the server resets.
  380. Prefix: scope and extent
  381. nothing - A permanent variable attached to the character, the default
  382. variable type.
  383. "@" - A temporary variable attached to the character.
  384. SVN versions before 2094 revision and RC5 version will also treat
  385. 'l' as a temporary variable prefix, so beware of having variable
  386. names starting with 'l' if you want full backward compatibility.
  387. "$" - A global permanent variable.
  388. They are stored in "save\mapreg.txt" file and are the only kind of
  389. variables stored in a text file in the SQL version.
  390. "$@" - A global temporary variable.
  391. This is important for scripts which are called with no RID
  392. attached, that is, not triggered by a specific character object.
  393. "." - A variable that exists on the NPC as long as the server is running.
  394. They are only accessible from inside the NPC or by calling
  395. 'getvariableofnpc'.
  396. ".@" - A temporary variable that exists until the script instance ends.
  397. They are only accessible in that NPC instance.
  398. "#" - A permanent local account variable.
  399. They are stored with all the account data in "save\accreg.txt" in
  400. TXT versions and in the SQL versions in the 'global_reg_value'
  401. table using type 2.
  402. "##" - A permanent global account variable stored by the login server.
  403. They are stored in "save\account.txt" and in the SQL versions in the
  404. 'global_reg_value' table, using type 1. The only difference you will
  405. note from normal # variables is when you have multiple char-servers
  406. connected to the same login server. The # variables are unique to
  407. each char-server, while the ## variables are shared by all these
  408. char-servers.
  409. Postfix: integer or string
  410. nothing - integer variable, can store positive and negative numbers, but only
  411. whole numbers (so don't expect to do any fractional math)
  412. '$' - string variable, can store text
  413. Examples:
  414. name - permanent character integer variable
  415. name$ - permanent character string variable
  416. @name - temporary character integer variable
  417. @name$ - temporary character string variable
  418. $name - permanent global integer variable
  419. $name$ - permanent global string variable
  420. $@name - temporary global integer variable
  421. $@name$ - temporary global string variable
  422. .name - permanent npc integer variable
  423. .name$ - permanent npc string variable
  424. .@name - temporary npc integer variable
  425. .@name$ - temporary npc string variable
  426. #name - permanent local account integer variable
  427. #name$ - permanent local account string variable
  428. ##name - permanent global account integer variable
  429. ##name$ - permanent global account string variable
  430. If a variable was never set, it is considered to equal zero for integer
  431. variables or an empty string ("", nothing between the quotes) for string
  432. variables. Once you set it to that, the variable is as good as forgotten
  433. forever, and no trace remains of it even if it was stored with character or
  434. account data.
  435. Some variables are special, that is, they are already defined for you by the
  436. scripting engine. You can see the full list somewhere in 'db/const.txt', which
  437. is a file you should read, since it also allows you to replace lots of numbered
  438. arguments for many commands with easier to read text. The special variables most
  439. commonly used are all permanent character-based variables:
  440. StatusPoint - Amount of status points remaining.
  441. BaseLevel - Current base level
  442. SkillPoint - Amount of skill points remaining
  443. Class - Current job
  444. Upper - 1 if the character is an advanced job class.
  445. Zeny - Current amount of zeny
  446. Sex - Character's gender, 0 if female, 1 if male.
  447. Weight - The weight the character currently carries.
  448. MaxWeight - The maximum weight the character can carry.
  449. JobLevel - Character's job level
  450. BaseExp - The amount of base experience points the character has.
  451. Notice that it's zero (or close) if the character just got a level.
  452. JobExp - Same for job levels
  453. NextBaseExp - Amount of experience points needed to reach the next base level.
  454. NextJobExp - Same for job levels.
  455. Hp - Current amount of hit points.
  456. MaxHp - Maximum amount of hit points.
  457. Sp - Current spell points.
  458. MaxSp - Maximum amount of spell points.
  459. BaseJob - This is sneaky, apparently meant for baby class support.
  460. This will supposedly equal Job_Acolyte regardless of whether the
  461. character is an acolyte or a baby acolyte, for example.
  462. Karma - The character's karma. Karma system is not fully functional, but
  463. this doesn't mean this doesn't work at all. Not tested.
  464. Manner - The character's manner rating. Becomes negative if the player
  465. utters words forbidden through the use of 'manner.txt' client-side
  466. file.
  467. While these behave as variables, do not always expect to just set them - it is
  468. not certain whether this will work for all of them. Whenever there is a command
  469. or a function to set something, it's usually preferable to use that instead. The
  470. notable exception is Zeny, which you can and often will address directly -
  471. setting it will make the character own this number of zeny.
  472. Arrays
  473. ------
  474. Arrays (in eAthena at least) are essentially a set of variables going under the
  475. same name. You can tell between the specific variables of an array with an
  476. 'array index', a number of a variable in that array:
  477. <variable name>[<array index>]
  478. Variables stored in this way, inside an array, are also called 'array elements'.
  479. Arrays are specifically useful for storing a set of similar data (like several
  480. item IDs for example) and then looping through it. You can address any array
  481. variable as if it was a normal variable:
  482. set @arrayofnumbers[0],1;
  483. You can also do sneaky things like using a variable (or an expression, or even a
  484. value from an another array) to get at an array value:
  485. set @x,100;
  486. set @arrayofnumbers[@x],10;
  487. This will make @arrayofnumbers[100] equal to 10.
  488. Notice that index numbering always starts with 0. Arrays cannot hold more than
  489. 128 variables. (So the last one can't have a number higher than 127)
  490. And array indices probably can't be negative. Nobody tested what happens when
  491. you try to get a negatively numbered variable from an array, but it's not going
  492. to be pretty. :)
  493. Arrays can naturaly store strings:
  494. @menulines$[0] is the 0th element of the @menulines$ array of strings. Notice
  495. the '$', normally denoting a string variable, before the square brackets that
  496. denotes an array index.
  497. Resume of the allowed variable and array scopes
  498. ------ -- --- ------- -------- --- ----- ------
  499. +==========+======+=======+
  500. |VarType | Norm | Array |
  501. +==========+======+=======+
  502. |$Str$ | OK! | OK! |
  503. +----------+------+-------+
  504. |$@Str$ | OK! | OK! |
  505. +----------+------+-------+
  506. |@Str$ | OK! | OK! |
  507. +----------+------+-------+
  508. |#Str$ | OK! | FAIL! |
  509. +----------+------+-------+
  510. |Str$ | OK! | FAIL! |
  511. +----------+------+-------+
  512. |$Int | OK! | OK! |
  513. +----------+------+-------+
  514. |$@Int | OK! | OK! |
  515. +----------+------+-------+
  516. |@Int | OK! | OK! |
  517. +----------+------+-------+
  518. |#Int | OK! | FAIL! |
  519. +----------+------+-------+
  520. |Int | OK! | FAIL! |
  521. +----------+------+-------+
  522. |.Str$ | OK! | OK! |
  523. +----------+------+-------+
  524. |.Int | OK! | OK! |
  525. +----------+------+-------+
  526. |.@Str$ | OK! | OK! |
  527. +----------+------+-------+
  528. |.@Int | OK! | OK! |
  529. +----------+------+-------+
  530. Variable References
  531. -------------------
  532. //##TODO
  533. Operators
  534. ---------
  535. Operators are things you can do to variables and numbers. They are either the
  536. common mathematical operations or conditional operators
  537. + - will add two numbers. If you try to add two strings, the result will be a
  538. string glued together at the +. You can add a number to a string, and the
  539. result will be a string. No other math operators work with strings.
  540. - - will subtract two numbers.
  541. * - will multiply two numbers.
  542. / - will divide two numbers. Note that this is an integer division, i.e.
  543. 7/2 is not equal 3.5, it's equal 3.
  544. % - will give you the remainder of the division. 7%2 is equal to 1.
  545. There are also conditional operators. This has to do with the conditional
  546. command 'if' and they are meant to return either 1 if the condition is satisfied
  547. and 0 if it isn't. (That's what they call 'boolean' variables. 0 means 'False'.
  548. Anything except the zero is 'True' Odd as it is, -1 and -5 and anything below
  549. zero will also be True.)
  550. You can compare numbers to each other and you compare strings to each other, but
  551. you can not compare numbers to strings.
  552. == - Is true if both sides are equal. For strings, it means they are the same.
  553. >= - True if the first value is equal to, or greater than, the second value.
  554. <= - True if the first value is equal to, or less than, the second value
  555. > - True if the first value greater than the second value
  556. < - True if the first value is less than the second value
  557. != - True if the first value IS NOT equal to the second one
  558. Examples:
  559. 1==1 is True.
  560. 1<2 is True while 1>2 is False.
  561. @x>2 is True if @x is equal to 3. But it isn't true if @x is 2.
  562. Only '==' and '!=' have been tested for comparing strings. Since there's no way
  563. to code a seriously complex data structure in this language, trying to sort
  564. strings by alphabet would be pointless anyway.
  565. Comparisons can be stacked in the same condition:
  566. && - Is True if and only if BOTH sides are true.
  567. ('1==1 && 2==2' is true. '2==1 && 1==1' is false.)
  568. || - Is True if either side of this expression is True.
  569. 1==1 && 2==2 is True.
  570. 1==1 && 2==1 is False.
  571. 1==1 || 2==1 is True.
  572. Logical bitwise operators work only on numbers, and they are the following:
  573. << - Left shift.
  574. >> - Right shift.
  575. Left shift moves the binary 1(s) of a number n positions to the left,
  576. which is the same as multiplying by 2, n times.
  577. In the other hand, Right shift moves the binary 1(s) of a number n positions
  578. to the right, which is the same as dividing by 2, n times.
  579. Example:
  580. set b,2;
  581. set a, b << 3;
  582. mes a;
  583. set a, a >> 2;
  584. mes a;
  585. The first mes command would display 16, which is the same as 2 x (2 x 2 x 2) = 16.
  586. The second mes command would display 4, which is the same as 16 / 2 = 8. 8 / 2 = 4.
  587. & - And.
  588. | - Or.
  589. The bitwise operator AND (&) is used to test two values against eachother,
  590. and results in setting bits which are active in both arguments. This can
  591. be used for a few things, but in eAthena this operator is usually used to
  592. create bitmasks in scripts.
  593. The bitwise operator OR (|)sets to 1 a binary position if the binary position
  594. of one of the numbers is 1. This way a variable can hold several values we can check,
  595. known as bitmaks. A variable currently can hold up to 32 bitmasks (from position 0
  596. to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks
  597. that a player can have.
  598. A bitmask basically is (ab)using the variables bits to set various options in
  599. one variable. With the current limit if variables it is possible to store 32
  600. different options in one variable (by using the bits on position 0 to 31).
  601. Example(s):
  602. - Basic example of the & operator, bit example:
  603. 10 & 2 = 2
  604. Why? :
  605. 10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010
  606. 2 = 2^1 (2), so in bits (same size) it would be 0010
  607. The & (AND) operator sets bits which are active (1) in both arguments, so in the
  608. example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit
  609. 0010, which is 2.
  610. - Basic example of creating and using a bit mask:
  611. set @options,2|4|16; //(note: this is the same as 2+4+16, or 22)
  612. if (@options & 1) mes "Option 1 is activated";
  613. if (@options & 2) mes "Option 2 is activated";
  614. if (@options & 4) mes "Option 3 is activated";
  615. if (@options & 8) mes "Option 4 is activated";
  616. if (@options & 16) mes "Options 5 is activated";
  617. This would return the messages about option 2, 3 and 5 being shown (since we've set
  618. the 2,4 and 16 bit to 1).
  619. ^ - Xor.
  620. The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if both
  621. numbers have the same value in the said position. On the other hand, it
  622. sets to 1 if they have different values in the said binary position.
  623. This is another way of setting and unsetting bits in bitmasks.
  624. Example:
  625. - First let's set the quests that are currently in progress:
  626. set inProgress,1|8|16; // quest 1,8 and 16 are in progress
  627. - After playing for a bit, the player starts another quest:
  628. if( inProgress&2 == 0 ){
  629. // this will set the bit for quest 2 (inProgress has that bit set to 0)
  630. set inProgress,inProgress^2;
  631. mes "Quest 2: find a newbie and be helpfull to him for an hour.";
  632. close;
  633. }
  634. - After spending some time reading info on Xor's, the player finally completes quest 1:
  635. if( inProgress&1 && isComplete ){
  636. // this will unset the bit for quest 1 (inProgress has that bit set to 1)
  637. set inProgress,inProgress^1;
  638. mes "Quest 1 complete!! You unlocked the secrets of the Xor dinasty, use them wisely.";
  639. close;
  640. }
  641. Labels
  642. ------
  643. Within executable script code, some lines can be labels:
  644. <label name>:
  645. Labels are points of reference in your script, which can be used to route
  646. execution with 'goto', 'menu' and 'jump_zero' commands, invoked with 'doevent'
  647. and 'donpcevent' commands and are otherwise essential. A label's name may not be
  648. longer than 22 characters. (23rd is the ':'.) There is some confusion in the
  649. source about whether it's 22, 23 or 24 all over the place, so keeping labels
  650. under 22 characters could be wise. In addition to labels you name yourself,
  651. there are also some special labels which the script engine will start execution
  652. from if a special event happens:
  653. OnClock<hour><minute>:
  654. OnHour<hour>:
  655. On<weekday><hour><minute>:
  656. OnDay<month><day>:
  657. This will execute when the server clock hits the specified date or time. Hours
  658. and minutes are given in military time. ('0105' will mean 01:05 AM). Weekdays
  659. are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01 to 31.
  660. Remember the zero. :)
  661. OnInit:
  662. OnInterIfInit:
  663. OnInterIfInitOnce:
  664. OnInit will execute every time the scripts loading is complete, including when
  665. they are reloaded with @reloadscript command. OnInterIfInit will execute when
  666. the map server connects to a char server, OnInterIfInitOnce will only execute
  667. once and will not execute if the map server reconnects to the char server later.
  668. OnAgitStart:
  669. OnAgitEnd:
  670. OnAgitInit:
  671. OnAgitStart will run whenever the server shifts into WoE mode, whether it is
  672. done with @agitstart GM command or with 'AgitStart' script command. OnAgitEnd
  673. will do likewise for the end of WoE. OnAgitInit will run when castle data is
  674. loaded from the char-server by the map server.
  675. No RID will be attached while any of the abovementioned labels are triggered, so
  676. no character or account-based variables will be accessible, until you attach a
  677. RID with 'attachrid' (see below).
  678. OnTouch:
  679. This label will be executed if a trigger area is defined for the NPC object it's
  680. in. If it isn't present, the execution will start from the beginning of the NPC
  681. code. The RID of the triggering character object will be attached.
  682. OnPCDieEvent:
  683. OnPCKillEvent:
  684. OnPCLogoutEvent:
  685. OnPCLoginEvent:
  686. These four special labels will be invoked if you have set 'event_script_type'
  687. value in your 'script_athena.conf' to 1, and you can change their names by
  688. altering the configuration options in 'script_athena.conf'. It's pretty obvious
  689. when those will get triggered. For more information, see
  690. 'npc/sample/PCLoginEvent.txt'
  691. OnPCLoadMapEvent:
  692. This special label will trigger once a player steps in a map marked with the
  693. 'loadmap' mapflag and attach its RID. The fact that this label requires a
  694. mapflag for it to work is because, otherwise, it'd be server-wide and trigger
  695. everytime a player would change maps. Imagine the server load with 1,000 players
  696. (oh the pain...)
  697. Only the special labels which are not associated with any script command are
  698. listed here. There are other kinds of labels which may be triggered in a similar
  699. manner, but they are described with their associated commands.
  700. On<label name>:
  701. These special labels are used with Mob scripts mostly, and script commands
  702. that requires you to point/link a command to a mob or another npc, giving a label
  703. name to start from. The label name can be any of your liking, but must be
  704. Example:
  705. monster "prontera.gat",123,42,"Poringz0rd",2341,23,"Master::OnThisMobDeath";
  706. amatsu.gat,13,152,4 script Master 767,{
  707. mes "Hi there";
  708. close;
  709. OnThisMobDeath:
  710. announce "Hey, "+strcharinfo(0)+" just killed a Poringz0rd!",bc_blue|bc_all;
  711. end;
  712. }
  713. Each time you kill one, that announce will appear in blue to everyone.
  714. Scripting commands and functions
  715. --------------------------------
  716. The commands and functions are listed here in no particular order. There's a
  717. difference between commands and functions - commands leave no 'return value'
  718. which might be used in a conditional statement, as a command argument, or stored
  719. in a variable. Calling commands as if they were functions will sometimes work,
  720. but is not advised, as this can lead to some hard to track errors. Calling
  721. functions as if they were commands will mess up the stack, so 'return' command
  722. will not return correctly after this happens in a particular script.
  723. All commands must end with a ';'. Actually, you may expect to have multiple
  724. commands on one line if you properly terminate them with a ';', but it's better
  725. if you don't, since it is not certain just whether the scripting engine will
  726. behave nicely if you do.
  727. -------------------------
  728. From here on, we will have the commands sorted as follow:
  729. 1.- Basic commands.
  730. 2.- Information-retrieving commands.
  731. 3.- Checking commands.
  732. 4.- Player-related commands.
  733. 5.- Mob / NPC -related commands.
  734. 6.- Other commands.
  735. =====================
  736. |1.- Basic commands.|
  737. =====================
  738. ---------------------------------------
  739. *mes "<string>";
  740. This command will displays a box on the screen for the invoking character, if no
  741. such box is displayed already, and will print the string specified into that
  742. box. There is normally no 'close' or 'next' button on this box, unless you
  743. create one with 'close' or 'next', and while it's open the player can't do much
  744. else, so it's important to create a button later. If the string is empty, it
  745. will show up as an empty line.
  746. mes "Text that will appear in the box";
  747. Inside the string you may put color codes, which will alter the color of the
  748. text printed after them. The color codes are all '^<R><G><B>' and contain three
  749. hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is
  750. bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.
  751. ^FF00FF is a pure magenta, but it's also a color that is considered transparent
  752. whenever the client is drawing windows on screen, so printing text in that color
  753. will have kind of a weird effect. Once you've set a text's color to something,
  754. you have to set it back to black unless you want all the rest of the text be in
  755. that color:
  756. mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";
  757. Notice that the text coloring is handled purely by the client. If you use non-
  758. english characters, the color codes might get screwed if they stick to letters
  759. with no intervening space. Separating them with spaces from the letters on
  760. either side solves the problem.
  761. ---------------------------------------
  762. *next;
  763. This command will create a 'next' button in the message window for the invoking
  764. character. If no window is currently on screen, it will be created. Used to
  765. segment NPC talking, this command is used A LOT. See 'mes'.
  766. mes "[Woman]";
  767. mes "This would appear on the page";
  768. next;
  769. // This is needed cause it is a new page and the top will now be blank
  770. mes "[Woman]";
  771. mes "This would appear on the 2nd page";
  772. ---------------------------------------
  773. *close;
  774. This command will create a 'close' button in the message window for the invoking
  775. character. If no window is currently on screen, it will be created. This is one
  776. of the ways to end a speech from an NPC. Once the button is clicked, the NPC
  777. script execution will end, and the message box will disappear.
  778. mes "[Woman]";
  779. mes "I am finished talking to you, click the close button";
  780. close;
  781. mes "This command will not run at all, cause the script has ended.";
  782. ---------------------------------------
  783. *close2;
  784. This command will create a 'close' button in the message window for the invoking
  785. character. If no window is currently on screen, it will be created. See 'close'.
  786. There is one important difference, though - even though the message box will
  787. have closed, the script execution will not stop, and commands after 'close2'
  788. will still run, meaning an 'end' has to be used to stop the script, unless you
  789. make it stop in some other manner.
  790. mes "[Woman]";
  791. mes "I will warp you now";
  792. close2;
  793. warp "place.gat",50,50;
  794. end;
  795. Don't expect things to run smoothly if you don't make your scripts 'end'.
  796. ---------------------------------------
  797. *end;
  798. This command will stop the execution for this particular script. The two
  799. versions are prefectly equivalent. It is the normal way to end a script which
  800. does not use 'mes'.
  801. if (BaseLevel<=10) goto L_Lvl10;
  802. if (BaseLevel<=20) goto L_Lvl20;
  803. if (BaseLevel<=30) goto L_Lvl30;
  804. if (BaseLevel<=40) goto L_Lvl40;
  805. if (BaseLevel<=50) goto L_Lvl50;
  806. if (BaseLevel<=60) goto L_Lvl60;
  807. if (BaseLevel<=70) goto L_Lvl70;
  808. L_Lvl10:
  809. npctalk "Look at that you are still a n00b";
  810. end;
  811. L_Lvl20:
  812. npctalk "Look at that you are getting better, but still a n00b";
  813. end;
  814. L_Lvl30:
  815. npctalk "Look at that you are getting there, you are almost 2nd profession now right???";
  816. end;
  817. L_Lvl40:
  818. npctalk "Look at that you are almost 2nd profession";
  819. end;
  820. Without the use if 'end' it would travel through the labels until the end of the
  821. script. If you were lvl 10 or less, you would see all the speech lines, the use
  822. of 'end' stops this, and ends the script.
  823. ---------------------------------------
  824. *set <variable>,<expression>;
  825. This command will set a variable to the value that the expression results in.
  826. This is the only way to set a variable directly.
  827. This is the most basic script command and is used a lot whenever you try to do
  828. anything more advanced than just printing text into a messagebox.
  829. set @x,100;
  830. will make @x equal 100.
  831. set @x,1+5/8+9;
  832. will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are
  833. integer in this language) and make @x equal it.
  834. ---------------------------------------
  835. *setd "<variable name>",<value>;
  836. Works almost identical as set, just that the variable name is identified as a string,
  837. thus can be constructed dynamically.
  838. This command is equivalent to:
  839. set getd("variable name"),<value>;
  840. Example:
  841. set $var$, "Poring";
  842. setd "$var$", "Poporing";
  843. mes $var$; // Will return Poporing
  844. setd "$" + $var$ + "123$", "Poporing is cool";
  845. mes $Poporing123$; // Will return Poporing is cool.
  846. ---------------------------------------
  847. *getd("<variable name>")
  848. Returns a reference to a variable, the name can be constructed dynamically.
  849. Refer to setd for usage.
  850. Example:
  851. set getd("$varRefence"), 1;
  852. set @i, getd("$pikachu");
  853. ---------------------------------------
  854. *getvariableofnpc(<variable>,"<npc name>")
  855. Returns a reference to a NPC variable (. prefix) from the target NPC.
  856. This can only be used to get . variables.
  857. Example(s):
  858. //This will return the value of .var, note that this can't be used, since the value isn't catched.
  859. getvariableofnpc(.var,"TargetNPC");
  860. //This will set the .v variable to the value of the TargetNPC's .var variable.
  861. set .v,getvariableofnpc(.var,"TargetNPC");
  862. //This will set the .var variable of TargetNPC to 1.
  863. set getvariableofnpc(.var,"TargetNPC"),1;
  864. ---------------------------------------
  865. *goto <label>;
  866. This command will make the script jump to a label, usually used in conjunction
  867. with other command, such as "if", but often used on it's own.
  868. ...
  869. goto Label;
  870. mes "This will not be seen";
  871. Label:
  872. mes "This will be seen";
  873. Note by FlavioJS: goto's are "evil" and should be avoided if possible (ò_ó)
  874. ---------------------------------------
  875. *menu "<menu option>",<label>{,"<menu option>",<label>,...};
  876. This command will create a selectable menu for the invoking character. Only one
  877. menu can be on screen at the same time.
  878. Depending on what the player picks from the menu, the script execution will
  879. continue from the corresponding label. (it's string-label pairs, not label-
  880. string)
  881. It also sets a special temporary character variable @menu, which contains the
  882. number of option the player picked. (Numbering of options starts at 1.)
  883. menu "I want to Start",L_Start,"I want to end",L_End;
  884. L_Start:
  885. //If they click "I want to Start" they will end up here
  886. L_End:
  887. //If they click "I want to end" they will end up here
  888. If a label is '-', the script execution will continue right after the menu
  889. command if that option is selected, this can be used to save you time, and
  890. optimize big scripts.
  891. menu "I want to Start",-,"I want to end",L_End;
  892. //If they click "I want to Start" they will end up here
  893. L_End:
  894. //If they click "I want to end" they will end up here
  895. Both these examples will perform the same task.
  896. If you give an empty string as a menu item, the item will not display. This
  897. can effectively be used to script dynamic menus by using empty string for
  898. entries that should be unavailable at that time.
  899. You can do it by using arrays, but watch carefully - this trick isn't high
  900. wizardry, but minor magic at least. You can't expect to easily duplicate it
  901. until you understand how it works.
  902. Create a temporary array of strings to contain your menu items, and populate it
  903. with the strings that should go into the menu at this execution, making sure not
  904. to leave any gaps. Normally, you do it with a loop and an extra counter, like
  905. this:
  906. setarray @possiblemenuitems$[0],<list of potential menu items>;
  907. set @j,0; // That's the menu lines counter.
  908. // We loop through the list of possible menu items.
  909. // @i is our loop counter.
  910. for( set @i,0; @i<getarraysize(@possiblemenuitems$) ; set @i,@i+1 )
  911. {
  912. // That 'condition' is whatever condition that determines whether
  913. // a menu item number @i actually goes into the menu or not.
  914. if (<condition>)
  915. {
  916. // We record the option into the list of options actually available.
  917. set @menulist$[@j],@possiblemenuitems$[@i];
  918. // We just copied the string, we do need it's number for later
  919. // though, so we record it as well.
  920. set @menureference[@j],@i;
  921. // Since we've just added a menu item into the list, we increment
  922. // the menu lines counter.
  923. set @j,@j+1;
  924. }
  925. // We go on to the next possible menu item.
  926. }
  927. This will create you an array @menulist$ which contains the text of all items
  928. that should actually go into the menu based on your condition, and an array
  929. @menureference, which contains their numbers in the list of possible menu items.
  930. (Remember, arrays start with 0.) There's less of them than the possible menu
  931. items you've defined, but the menu command can handle the empty lines - only if
  932. they are last in the list, and if it's made this way, they are. Now comes a
  933. dirty trick:
  934. // X is whatever the most menu items you expect to handle.
  935. menu @menulist$[0],-,@menulist$[1],-,....@menulist$[<X>],-;
  936. This calls up a menu of all your items. Since you didn't copy some of the
  937. possible menu items into the list, it's end is empty and so no menu items will
  938. show up past the end. But this menu call doesn't jump anywhere, it just
  939. continues execution right after the menu command. (And it's a good thing it
  940. doesn't, cause you can only explicitly define labels to jump to, and how do you
  941. know which ones to define if you don't know beforehand which options will end up
  942. where in your menu?)
  943. But how do you figure out which option the user picked? Enter the @menu.
  944. @menu contains the number of option that the user selected from the list,
  945. starting with 1 for the first option. You know now which option the user picked
  946. and which number in your real list of possible menu items it translated to:
  947. mes "You selected "+@possiblemenuitems$[@menureference[@menu-1]]+"!";
  948. @menu is the number of option the user picked.
  949. @menu-1 is the array index for the list of actually used menu items that we
  950. made.
  951. @menureference[@menu-1] is the number of the item in the array of possible menu
  952. items that we've saved just for this purpose.
  953. And @possiblemenuitems$[@menureference[@menu-1]] is the string that we used to
  954. display the menu line the user picked. (Yes, it's a handful, but it works.)
  955. You can set up a bunch of 'if (@menureference[@menu-1]==X) goto Y' statements to
  956. route your execution based on the line selected and still generate a different
  957. menu every time, which is handy when you want to, for example, make users select
  958. items in any specific order before proceeding, or make a randomly shuffled menu.
  959. Kafra code bundled with the standard distribution uses a similar array-based
  960. menu technique for teleport lists, but it's much simpler and doesn't use @menu,
  961. probably since that wasn't documented anywhere.
  962. See also 'select', which is probably better in this particular case. Instead of
  963. menu, you could use 'select' like this:
  964. set @dummy,select(@menulist$[0],@menulist$[1],....@menulist$[<X>]);
  965. For the purposes of the technique described above these two statements are
  966. perfectly equivalent.
  967. ---------------------------------------
  968. *select("<option>"{,"<option>"..."<option>"})
  969. *prompt("<option>"{,"<option>"..."<option>"})
  970. This function is a handy replacement for 'menu' for some specific cases where
  971. you don't want a complex label structure - like, for example, asking simple yes-
  972. no questions. It will return the number of menu option picked, starting with 1.
  973. Like 'menu', it will also set the variable @menu to contain the option the user
  974. picked.
  975. if (select("Yes","No")==1) mes "You said yes, I know.";
  976. And like 'menu', this command has a problem with empty strings - if some of the
  977. option strings given to it are empty, you won't be able to tell which one the
  978. user really picked. The number it returns will only make sense if all the empty
  979. strings are last in the list of options.
  980. prompt works almost the same as select, except that when a character clicks
  981. the Cancel button, this function will return 255 instead.
  982. ---------------------------------------
  983. *input <variable>;
  984. This command will make an input box pop up on the client connected to the
  985. invoking character, to allow entering of a number or a string. This has many
  986. uses, one example would be a guessing game, also making use of the 'rand'
  987. function:
  988. mes "[Woman]";
  989. mes "Try and guess the number I am thinking of.";
  990. mes "The number will be between 1 and 10.";
  991. next;
  992. set @number, rand(1,10);
  993. input @guess;
  994. if(@guess==@number)
  995. {
  996. mes "[Woman]";
  997. mes "Well done that was the number I was thinking of";
  998. close;
  999. }
  1000. else
  1001. {
  1002. mes "[Woman]";
  1003. mes "Sorry, that wasn't the number I was thinking of.";
  1004. close;
  1005. }
  1006. If you give the input command a string variable to put the input in, it will
  1007. allow the player to enter text. Otherwise, only numbers will be allowed.
  1008. mes "[Woman]";
  1009. mes "Please say HELLO";
  1010. next;
  1011. input @var$;
  1012. if(@var$=="HELLO")
  1013. {
  1014. mes "[Woman]";
  1015. mes "Well done you typed it correctly";
  1016. close;
  1017. }
  1018. else
  1019. {
  1020. mes "[Woman]";
  1021. mes "Sorry you got it wrong";
  1022. close;
  1023. }
  1024. Notice that in current SVN, you may not input a negative number with this
  1025. command. This was done to prevent exploits in badly written scripts, which would
  1026. let people, for example, put negative amounts of zeny into a bank script and
  1027. recieve free zeny as a result. Unfortunately it limits the uses of the 'input'
  1028. command quite a bit.
  1029. ---------------------------------------
  1030. *callfunc "<function>"{,<argument>,...<argument>};
  1031. *callfunc("<function>"{,<argument>,...<argument>})
  1032. This command lets you call up a function NPC. A function NPC can be called from
  1033. any script on any map server. Using the 'return' command it will come back to
  1034. the place that called it.
  1035. place.gat,50,50,6%TAB%script%TAB%Woman%TAB%115,{
  1036. mes "[Woman]"
  1037. mes "Lets see if you win";
  1038. callfunc "funcNPC";
  1039. mes "Well done you have won";
  1040. close;
  1041. }
  1042. function%TAB%script%TAB%funcNPC%TAB%{
  1043. set @win, rand(2);
  1044. if(@win==0) return;
  1045. mes "Sorry you lost";
  1046. end;
  1047. }
  1048. You can pass arguments to your function - values telling it what exactly to do -
  1049. which will be available there with getarg() (see 'getarg')
  1050. Notice that returning is not mandatory, you can end execution right there.
  1051. If you want to return a real value from inside your function NPC, it is better
  1052. to write it in the function form, which will also work and will make the script
  1053. generally cleaner:
  1054. place.gat,50,50,6%TAB%script%TAB%Man%TAB%115,{
  1055. mes "[Man]"
  1056. mes "Gimme a number!";
  1057. next;
  1058. input @number;
  1059. if (callfunc("OddFunc",@number)) mes "It's Odd!";
  1060. close;
  1061. }
  1062. function%TAB%script%TAB%OddFunc%TAB%{
  1063. if (getarg(0)%2==0) return 0;// it's even
  1064. return 1;// it's odd
  1065. }
  1066. ---------------------------------------
  1067. *callsub <label>{,<argument>,...<argument>};
  1068. This command will go to a specified label within the current script (do NOT use
  1069. quotes around it) coming in as if it were a 'callfunc' call, and pass it
  1070. arguments given, if any, which can be recovered there with 'getarg'. When done
  1071. there, you should use the 'return' command to go back to the point from where
  1072. this label was called. This is used when there is a specific thing the script
  1073. will do over and over, this lets you use the same bit of code as many times as
  1074. you like, to save space and time, without creating extra NPC objects which are
  1075. needed with 'callfunc'. A label is not callable in this manner from another
  1076. script.
  1077. mes "[Woman]"
  1078. mes "Lets see if you win";
  1079. callsub Check;
  1080. mes "Well done you have won";
  1081. close;
  1082. Check:
  1083. set @win, rand(2);
  1084. if(@win==0) return;
  1085. mes "Sorry you lost";
  1086. close;
  1087. ---------------------------------------
  1088. *getarg(<number>)
  1089. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1090. call you can specify variables that will make that call different from another
  1091. one. This function will return an argument the function or subroutine was
  1092. called with, and is the normal way to get them.
  1093. This is another thing that can let you use the same code more than once.
  1094. Argument numbering starts with 0, i.e. the first argument you gave is number 0.
  1095. If no such argument was given, a zero is returned.
  1096. place.gat,50,50,6%TAB%script%TAB%Woman1%TAB%115,{
  1097. mes "[Woman]";
  1098. mes "Lets see if you win";
  1099. callfunc "funcNPC",2;
  1100. mes "Well done you have won";
  1101. ...
  1102. place.gat,52,50,6%TAB%script%TAB%Woman2%TAB%115,{
  1103. mes "[Woman]";
  1104. mes "Lets see if you win";
  1105. callfunc "funcNPC",5;
  1106. mes "Well done you have won";
  1107. ...
  1108. function%TAB%script%TAB%funcNPC%TAB%{
  1109. set @win, rand(getarg(0));
  1110. if(@win==0) return;
  1111. mes "Sorry you lost";
  1112. "woman1" NPC object calls the funcNPC. The argument it gives in this call is
  1113. stated as 2, so when the random number is generated by the 'rand' function, it
  1114. can only be 0 or 1. Whereas "woman2" gives 5 as the argument number 0 when
  1115. calling the function, so the random number could be 0, 1, 2, 3 or 4, this makes
  1116. "woman2" less likely to say the player won.
  1117. You can pass multiple arguments in a function call:
  1118. callfunc "funcNPC",5,4,3;
  1119. getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3.
  1120. ---------------------------------------
  1121. *return {<value>};
  1122. When you use callsub or callfunc, this command allows you to go back to the
  1123. calling script. You can optionally return with a value telling the calling
  1124. program what exactly happened.
  1125. callfunc "<your function>";// when nothing is returned
  1126. set <variable>,callfunc("<your function>");// when a value is being returned
  1127. ---------------------------------------
  1128. *function <function name>;
  1129. *<function name>;
  1130. *function <function name> {
  1131. <code>
  1132. }
  1133. (Skotlex stop being so selfish and give us all the commands T~T! J/k lol :P)
  1134. This works like callfunc, but doesn't support arguments like callfunc. It's used for cleaner
  1135. and fast script that doesn't require arguments for it to work. Also they must be inside a script.
  1136. They're not separated scripts and they work more like labels.
  1137. Note it looks like the normal declaration
  1138. Usage:
  1139. You first Declare the function with function <function name>;.
  1140. Put the rest of your code. You can use then <function name>; to call the function. If it returns a value is unsure,
  1141. test it if you want and give us some comments ;3
  1142. And at least, but inside the script itself, put the function <function name> {<code>}.
  1143. Example:
  1144. prontera.gat,154,189,4 script Item seller 767,{
  1145. function SF_Selling;
  1146. mes "I'll open this now if you have more than 50z and you are level 50 or bigger";
  1147. next;
  1148. if (Zeny > 50) && (BaseLevel > 50) {
  1149. mes "Welcome";
  1150. next;
  1151. SF_Selling;
  1152. close;
  1153. } else
  1154. set @needed,50-BaseLevel;
  1155. mes "You either are Level "+BaseLevel+", thus you need "+@needed+" more levels";
  1156. mes "to be able to use this npc; or you don't have enough zeny, so get some please";
  1157. close;
  1158. function SF_Selling {
  1159. mes "Would you like to buy a phracon for 50z?";
  1160. switch(select("Yes","No, thanks")) {
  1161. case 1:
  1162. mes "Ok, how many?";
  1163. input @quantity;
  1164. set @check,Zeny/50;
  1165. if (@quantity > @check) {
  1166. mes "Sorry but you can only have "+@check+" Phracons with "+Zeny;
  1167. close;
  1168. } else
  1169. next;
  1170. mes "here you have";
  1171. set Zeny,Zeny-@quantity*50;
  1172. getitem 1010,@quantity;
  1173. close;
  1174. case 2:
  1175. mes "Good bye then";
  1176. close;
  1177. }
  1178. }
  1179. return;
  1180. }
  1181. ---------------------------------------
  1182. *if (<condition>) <statement>;
  1183. This is the basic conditional statement command, and just about the only one
  1184. available in this scripting language.
  1185. The condition can be any expression. All expressions resulting in a non-zero
  1186. value will be considered True, including negative values. All expressions
  1187. resulting in a zero are false.
  1188. If the expression results in True, the statement will be executed. If it isn't
  1189. true, nothing happens and we move on to the next line of the script.
  1190. if (1) mes "This will always print.";
  1191. if (0) mes "And this will never print.";
  1192. if (5) mes "This will also always print.";
  1193. if (-1) mes "Funny as it is, this will also print just fine.";
  1194. For more information on conditional operators see the operators section above.
  1195. Anything that is returned by a function can be used in a condition check without
  1196. bothering to store it in a specific variable:
  1197. if (strcharinfo(0)=="Daniel Jackson") mes "It is true, you are Daniel!";
  1198. More examples of using the 'if' command in the real world:
  1199. Example 1:
  1200. set @var1,1;
  1201. input @var2;
  1202. if(@var1==@var2) goto L_Same;
  1203. mes "Sorry that is wrong";
  1204. close;
  1205. L_Same:
  1206. close;
  1207. Example 2:
  1208. set @var1,1;
  1209. input @var2;
  1210. if(@var1!=@var2) mes "Sorry that is wrong";
  1211. close;
  1212. (Notice examples 1 and 2 have the same effect.)
  1213. Example 3:
  1214. set @var1,@var1+1;
  1215. mes "[Forgetfull Man]";
  1216. if (@var==1) mes "This is the first time you have talked to me";
  1217. if (@var==2) mes "This is the second time you have talked to me";
  1218. if (@var==3) mes "This is the third time you have talked to me";
  1219. if (@var==4) mes "This is the forth time you have talked to me, but I think I am getting amnesia, I have forgoten about you";
  1220. if (@var==4) set @var,0;
  1221. close;
  1222. Example 4:
  1223. mes "[Quest Person]";
  1224. if(countitem(512)>=1) goto L_GiveApple;
  1225. // The number 512 was found from item_db, it is the item number for the Apple.
  1226. mes "Can you please bring me an apple?";
  1227. close;
  1228. L_GiveApple:
  1229. mes "Oh an apple, I didnt want it, I just wanted to see one";
  1230. close;
  1231. Example 5:
  1232. mes "[Person Checker]";
  1233. if($name$!=null) goto L_Check;
  1234. mes "Please tell me someones name";
  1235. next;
  1236. input $name$;
  1237. set $name2$,strcharinfo(0);
  1238. mes "[Person Checker]";
  1239. mes "Thank you";
  1240. L_Check:
  1241. if($name$==strcharinfo(0) ) goto L_SameName;
  1242. mes "[Person Checker]";
  1243. mes "You are not the person that " +$name2$+ " mentioned";
  1244. L_End:
  1245. set $name$,null;
  1246. set $name2$,null;
  1247. close;
  1248. L_SameName:
  1249. mes "[Person Checker]";
  1250. mes "You are the person that " +$name2$+ " just mentioned";
  1251. mes "nice to meet you";
  1252. goto L_End;
  1253. See 'strcharinfo' for explanation of what this function does.
  1254. Example 6: Using complex conditions.
  1255. mes "[Multi Checker]";
  1256. if( (@queststarted==1) && (countitem(512)>=5) ) goto L_MultiCheck;
  1257. // Only if the quest has been started AND You have 5 apples will it goto "L_MultiCheck"
  1258. mes "Please get me 5 apples";
  1259. set @queststarted,1;
  1260. close;
  1261. L_MultiCheck:
  1262. mes "[Multi Checker]";
  1263. mes "Well done you have started the quest of got me 5 apples";
  1264. mes "Thank you";
  1265. set @queststarted,0;
  1266. delitem 512,5;
  1267. close;
  1268. With the Advanced scripting engine, we got nested if's. That is:
  1269. if (<condition>)
  1270. dothis;
  1271. else
  1272. dothat;
  1273. If the condition doesn't meet, it'll do the action following the else.
  1274. We can also group several actions depending on a condition, the following way:
  1275. if (<condition)
  1276. {
  1277. dothis1;
  1278. dothis2;
  1279. dothis3;
  1280. } else {
  1281. dothat1;
  1282. dothat2;
  1283. dothat3;
  1284. dothat4;
  1285. }
  1286. Remember that if you plan to do several actions upon the condition being false, and
  1287. you forget to use the curlies (the { } ), the second action will be executed regardless
  1288. the output of the condition, unless of course, you stop the execution of the script if the
  1289. condition is true (that is, in the first grouping using a return; , and end; or a close; )
  1290. Also, you can have multiple conditions nested or chained, and don't worry about limits as to
  1291. how many nested if you can have, there is no spoon ;)
  1292. ...
  1293. if (<condition 1>)
  1294. dothis;
  1295. else if (<condition 2>)
  1296. {
  1297. dotheother;
  1298. do that;
  1299. end;
  1300. } else
  1301. do this;
  1302. ...
  1303. ---------------------------------------
  1304. *jump_zero (<condition>),<label>;
  1305. This command works kinda like an 'if'+'goto' combination in one go. (See 'if').
  1306. If the condition is false (equal to zero) this command will immediately jump to
  1307. the specified label like in 'goto'.
  1308. While 'if' is more generally useful, for some cases this could be an
  1309. optimisation.
  1310. ---------------------------------------
  1311. *setarray <array name>[<first value>],<value>{,<value>...<value>};
  1312. This command will allow you to quickly fill up an array in one go. Check the
  1313. Kafra scripts in the distribution to see this used a lot.
  1314. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1315. First value is the index of the first element of the array to alter. For
  1316. example:
  1317. setarray @array[0],200,200,200;
  1318. setarray @array[1],300,150;
  1319. will produce:
  1320. @array[0]=200
  1321. @array[1]=300
  1322. @array[2]=150
  1323. ---------------------------------------
  1324. *cleararray <array name>[<first value to alter>],<value>,<number of values to set>;
  1325. This command will change many array values at the same time to the same value.
  1326. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1327. // This will make all 6 values 0
  1328. cleararray @array[0],0,6;
  1329. // This will make array element 0 change to 245
  1330. cleararray @array[0],245,1;
  1331. // This will make elements 1 and 2 change to 345
  1332. cleararray @array[1],345,2;
  1333. See 'setarray'.
  1334. ---------------------------------------
  1335. *copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>;
  1336. This command lets you quickly shuffle a lot of data between arrays, which is in
  1337. some cases invaluable.
  1338. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1339. // So we have made @array[]
  1340. copyarray @array2[0],@array[2],2;
  1341. // Now, @array2[0] will be equal to @array[2] (300) and
  1342. // @array2[1] will be equal to @array[3].
  1343. So using the examples above:
  1344. @array[0] = 100
  1345. @array[1] = 200
  1346. @array[2] = 300
  1347. @array[3] = 400
  1348. @array[4] = 500
  1349. @array[5] = 600
  1350. New Array:
  1351. @array2[0] = 300
  1352. @array2[1] = 400
  1353. @array2[2] = 0
  1354. @array2[3] = 0
  1355. Notice that @array[4] and @array[5] won't be copied to the second array, and it will return a
  1356. 0.
  1357. ---------------------------------------
  1358. *deletearray <array name>[<first value>],<how much to delete>
  1359. This command will delete a specified number of array elements totally from an
  1360. array, shifting all the elements beyond this towards the beginning.
  1361. // This will delete array element 0, and move all the other array elements
  1362. // up one place.
  1363. deletearray @array[0],1
  1364. // This would delete array elements numbered 1, 2 and 3, leave element 0 in its
  1365. // place, and move the other elements ups, so there are no gaps.
  1366. deletearray @array[1],3
  1367. IMPORTANT: deletarray is horribly broken since the earliest days of jAthena. It
  1368. tends to merrily remove much more variables than it's told to remove, which
  1369. makes it pretty much useless for anything other than removing an array from
  1370. memory entirely. This would be very handy, if it always worked.
  1371. ---------------------------------------
  1372. ======================================
  1373. |2.- Information-retrieving commands.|
  1374. ======================================
  1375. ---------------------------------------
  1376. *strcharinfo(<type>)
  1377. This function will return either the name, party name or guild name for the
  1378. invoking character. Whatever it returns is determined by type.
  1379. 0 - Character's name.
  1380. 1 - The name of the party they're in if any.
  1381. 2 - The name of the guild they're in if any.
  1382. If a character is not a member of any party or guild, an empty string will be
  1383. returned when requesting that information.
  1384. ---------------------------------------
  1385. *getarraysize(<array name>)
  1386. This function returns the number of values that are contained inside the
  1387. specified array. Notice that zeros and empty strings at the end of this array
  1388. are not counted towards this number.
  1389. For example:
  1390. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1391. set @arraysize,getarraysize(@array);
  1392. This will make @arraysize == 6. But if you try this:
  1393. setarray @array[0], 100, 200, 300, 400, 500, 600, 0;
  1394. set @arraysize,getarraysize(@array);
  1395. @arraysize will still equal 6, even though you've set 7 values.
  1396. ---------------------------------------
  1397. *getelementofarray(<array name>,<index>)
  1398. This function will return an array's element when given an index.
  1399. // This will find the 2nd array value
  1400. getelementofarray(@array,1)
  1401. Pretty pointless now when we have
  1402. @array[1]
  1403. which has the same effect.
  1404. ---------------------------------------
  1405. *readparam(<parameter number>)
  1406. This function will return the basic stats of an invoking character, referred to
  1407. by the parameter number. Instead of a number, you can use a parameter name if it
  1408. is defined in "db/const.txt".
  1409. For reference, in there these things are defined:
  1410. StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight, MaxWeight,
  1411. JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp, Sp, MaxSp,
  1412. BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk
  1413. All of these also behave as variables, but don't expect to be able to just 'set'
  1414. all of them - some will not work for various internal reasons.
  1415. // This would return how many status points you haven't spent yet
  1416. readparam(9)
  1417. Using this particular information as a function call is not required. Just
  1418. putting
  1419. StatusPoint
  1420. will give you the same result, and some of these parameters work just like
  1421. variables (i.e. you can 'set Zeny,100' to make the character have 100 zeny,
  1422. destroying whatever zeny they had before, or 'set Zeny,Zeny+100' to give them
  1423. 100 zeny)
  1424. You can also use this command to get stat values:
  1425. readparam(bVit)
  1426. if(readparam(bVit)<=77) goto L_End;
  1427. mes "Only people with over 77 Vit are reading this";
  1428. L_End:
  1429. close;
  1430. ---------------------------------------
  1431. *getcharid(<type>{,"<character name>"})
  1432. This function will return a unique ID number of the invoking character, or, if a
  1433. character name is specified, of that character.
  1434. Type is the kind of associated ID number required:
  1435. 0 - Character ID number.
  1436. 1 - Party ID number.
  1437. 2 - Guild ID number.
  1438. 3 - Account ID number.
  1439. For most purposes other than printing it, a number is better to have than a name
  1440. (people do horrifying things to their character names).
  1441. If the character is not in a party or not in a guild, the function will return 0
  1442. if guild or party number is requested. If a name is specified and the character
  1443. is not found, 0 is returned.
  1444. If getcharid(0) returns a zero, the script got called not by a character and
  1445. doesn't have an attached RID. Note that this will cause the map server to
  1446. print "player not attached!" error messages, so it is preferred to use
  1447. "playerattached" to check for the character attached to the script.
  1448. if (getcharid(2)) mes "Only members of a guild are allowed beyond this point!";
  1449. ---------------------------------------
  1450. *getchildid()
  1451. *getmotherid()
  1452. *getfatherid()
  1453. These functions return the characters (shild/mother/father) ID
  1454. if (getmotherid()) mes "Oh... I know your mother's ID:"+getmotherid();
  1455. ---------------------------------------
  1456. *ispartneron()
  1457. This function returns 1 if the invoking character's marriage partner is
  1458. currently online and 0 if they are not or if the character has no partner.
  1459. ---------------------------------------
  1460. *getpartnerid()
  1461. This function returns the character ID of the invoking character's marriage
  1462. partner, if any. If the invoking character is not married, it will return 0,
  1463. which is a quick way to see if they are married:
  1464. if (getpartnerid()) mes "I'm not going to be your girlfriend!";
  1465. if (getpartnerid()) mes "You're married already!";
  1466. ---------------------------------------
  1467. *getpartyname(<party id>)
  1468. This function will return the name of a party that has the specified ID number.
  1469. If there is no such party ID, "null" will be returned.
  1470. Lets say the ID of a party was saved as a global variable:
  1471. // This would return the name of the party from the ID stored in a variable
  1472. mes "You're in the '"+getpartyname($@var)"' party, I know!";
  1473. ---------------------------------------
  1474. *getpartymember <party id>,{<type>};
  1475. Thank you to HappyDenn for all this information.
  1476. This command will finds all members of a specified party and returns their names
  1477. (or character id or account id depending on the value of "type") into an array
  1478. of temporary global variables. There's actually quite a few commands like this
  1479. which will fill a special variable with data upon execution and not do anything
  1480. else.
  1481. Upon executing this,
  1482. $@partymembername$[] is a global temporary stringarray which contains all the
  1483. names of these party members
  1484. (only set when type is 0 or not specified)
  1485. $@partymembercid[] is a global temporary number array which contains the
  1486. character id of these party members.
  1487. (only set when type is 1)
  1488. $@partymemberaid[] is a global temporary number array which contains the
  1489. account id of these party members.
  1490. (only set when type is 2)
  1491. $@partymembercount is the number of party members that were found.
  1492. The party members will (apparently) be found regardless of whether they are
  1493. online or offline. Note that the names come in no particular order.
  1494. Be sure to use $@partymembercount to go through this array, and not
  1495. 'getarraysize', because it is not cleared between runs of 'getpartymember'. If
  1496. someone with 7 party members invokes this script, the array would have 7
  1497. elements. But if another person calls up the NPC, and he has a party of 5, the
  1498. server will not clear the array for you, overwriting the values instead. So in
  1499. addition to returning the 5 member names, the 6th and 7th elements from the last
  1500. call remain, and you will get 5+2 members, of which the last 2 don't belong to
  1501. the new guy's party. $@partymembercount will always contain the correct number,
  1502. (5) unlike 'getarraysize()' which will return 7 in this case.
  1503. Example:
  1504. // get the character's party ID
  1505. getpartymember(getcharid(1));
  1506. // immediately copy $@partymembercount value to a new variable, since
  1507. // you don't know when 'getpartymember' will get called again for someone
  1508. // else's party, overwriting your global array.
  1509. set @partymembercount,$@partymembercount;
  1510. // copy $@partymembername array to a new array
  1511. copyarray @partymembername$[0],$@partymembername$[0],@partymembercount;
  1512. //list the party members in NPC dialog
  1513. set @count,0;
  1514. L_DisplayMember:
  1515. if(@count == @partymembercount) goto L_DisplayMemberEnd;
  1516. mes (@count + 1) + ". ^0000FF" + @partymembername$[@count] + "^000000";
  1517. set @count,@count+1;
  1518. goto L_DisplayMember;
  1519. L_DisplayMemberEnd:
  1520. close;
  1521. ---------------------------------------
  1522. *getpartyleader <party id>,{<type>};
  1523. This function returns some information about the given party-id's leader.
  1524. When type is ommitted, the default information retrieved is the leader's name.
  1525. Possible types are:
  1526. 1: Leader account id
  1527. 2: Leader character id
  1528. 3: Leader's class
  1529. 4: Leader's current map name
  1530. 5: Leader's current level as stored on the party structure (may not be
  1531. current level if leader leveled up recently).
  1532. If retrieval fails (leader not found or party does not exist), this function
  1533. returns "null" instead of the character name, and -1 is for the other types.
  1534. ---------------------------------------
  1535. *getlook(<type>)
  1536. This function will return the number for the currentcharacter look value
  1537. specified by type. See 'setlook' for valid look types.
  1538. This can be used to make a certain script behave differently for characters
  1539. dressed in black. :)
  1540. ---------------------------------------
  1541. *getsavepoint(<information type>)
  1542. This function will return information about the invoking character's save point.
  1543. You can use it to let a character swap between several recorded savepoints.
  1544. Available information types are:
  1545. 0 - Map name (a string)
  1546. 1 - X coordinate
  1547. 2 - Y coordinate
  1548. ---------------------------------------
  1549. \\
  1550. 2,2 Item-related commands
  1551. \\
  1552. ---------------------------------------
  1553. *getequipid(<equipment slot>)
  1554. This function returns the item ID of the item equipped in the equipment slot
  1555. specified on the invoking character. If nothing is equpped there, it returns -1.
  1556. Valid equipment slots are:
  1557. 1 - Upper head gear
  1558. 2 - Armor (Where you keep your Jackets and Robes)
  1559. 3 - What is in your Left hand.
  1560. 4 - What is in your Right hand.
  1561. 5 - The garment slot (Mufflers, Hoods, Manteaus)
  1562. 6 - What foot gear the player has on.
  1563. 7 - Accessory 1.
  1564. 8 - Accessory 2.
  1565. 9 - Middle Headgear (masks and glasses)
  1566. 10 - Lower Headgear (beards, some masks)
  1567. Notice that a few items occupy several equipment slots, and if the character is
  1568. wearing such an item, 'getequipid' will return it's ID number for either slot.
  1569. Can be used to check if you have something equiped, or if you haven't got
  1570. something equiped:
  1571. if(getequipid(1)==2234) goto L_WearingTiara;
  1572. mes "Come back when you have a Tiara on";
  1573. close;
  1574. L_WearingTiara:
  1575. mes "What a lovely Tiara you have on";
  1576. close;
  1577. You can also use it to make sure people don't pass a point before removing an
  1578. item totally from them. Let's say you don't want people to wear Legion Plate
  1579. armor, but also don't want them to equip if after the check, you would do this:
  1580. if ((getequipid(2) == 2341) || (getequipid(2) == 2342) goto L_EquipedLegionPlate;
  1581. // the || is used as an or argument, there is 2341 and 2342 cause there are
  1582. // two different legion plate armors, one with a slot one without.
  1583. if ((countitem(2341) > 0) || (countitem(2432) > 0) goto L_InventoryLegionPlate;
  1584. mes "I will lets you pass";
  1585. close2;
  1586. warp "place.gat",50,50;
  1587. end;
  1588. L_EquipedLegionPlate:
  1589. mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
  1590. close;
  1591. L_InventoryLegionPlate:
  1592. mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
  1593. close;
  1594. ---------------------------------------
  1595. *getequipname(<equpment slot>)
  1596. This function will return the name of the item equipped in the specified
  1597. equipment slot on the invoking character. Almost identical to 'getequipid', good
  1598. for an NPC to state what your are wearing, or maybe saving as a string variable.
  1599. See 'getequipid' for a full list of valid equipment slots.
  1600. if (getequipname(1)==0) goto L_No_HeadGear;
  1601. mes "So you are wearing a "+getequipname(1)+" on your head";
  1602. close;
  1603. L_No_HeadGear:
  1604. mes "You are not wearing any head gear";
  1605. close;
  1606. ---------------------------------------
  1607. *getitemname(<item id>)
  1608. Given the database ID number of an item, this function will return the text
  1609. stored in the 'japanese name' field (which, in eAthena, stores an english name
  1610. the players would normally see on screen.)
  1611. ---------------------------------------
  1612. *getbrokenid(<number>)
  1613. This function will search the invoking character's inventory for any broken
  1614. items, and will return their item ID numbers. Since the character may have
  1615. several broken items, 0 given as an argument will return the first one found, 1
  1616. will return the second one, etc. Will return 0 if no such item is found.
  1617. // Let's see if they have anything broken:
  1618. if (getbrokenid(0)==0) goto Skip;
  1619. // They do, so let's print the name of the first broken item:
  1620. mes "Oh, I see you have a broken "+getitemname(getbrokenid(0))+" here!";
  1621. Skip:
  1622. mes "You don't have anything broken, quit bothering me.";
  1623. ---------------------------------------
  1624. *getequipisequiped(<equipment slot>)
  1625. This functions will return 1 if there is an equipment placed on the specified
  1626. equipment slot and 0 otherwise. For a list of equipment slots
  1627. see 'getequipid'. Function originally used by the refining NPCs:
  1628. if (getequipisequiped(1)) goto L_equipped;
  1629. mes "[Refiner]";
  1630. mes "Do you want me to refine your dumb head?";
  1631. close;
  1632. L_equipped:
  1633. mes "[Refiner]";
  1634. mes "That's a fine hat you are wearing there...";
  1635. close;
  1636. ---------------------------------------
  1637. *getequipisenableref(<equipment slot>)
  1638. Will return 1 if the item equipped on the invoking character in the specified
  1639. equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
  1640. see 'getequipid'.
  1641. if (getequipisenableref(1)) goto L_Refine;
  1642. mes "[Refiner]";
  1643. mes "I can't refine this hat!...";
  1644. close;
  1645. L_Refine:
  1646. mes "[Refiner]";
  1647. mes "Ok I can refine this";
  1648. close;
  1649. ---------------------------------------
  1650. *getequiprefinerycnt(<equipment slot>)
  1651. Returns the current number of plusses for the item in the specified equipment
  1652. slot. For a list of equipment slots see 'getequipid'.
  1653. Can be used to check if you have reached a maximum refine value, default for
  1654. this is +10:
  1655. if(getequiprefinerycnt(1) < 10) goto L_Refine_HeadGear;
  1656. mes "Sorry, it's not possible to refine hats better than +10";
  1657. close;
  1658. L_Refine_HeadGear:
  1659. mes "I will now upgrade your "+getequipname(1);
  1660. ---------------------------------------
  1661. *getequipweaponlv(<equipment slot>)
  1662. This function returns the weapon level for the weapon equipped in the specified
  1663. equipment slot on the invoking character. For a list of equipment slots see
  1664. 'getequipid'.
  1665. Only 3 (Left hand) and 4 (Right hand) normally make sense, since only weapons
  1666. have a weapon level. You can, however, probably, use this field for other
  1667. equippable custom items as a flag or something.
  1668. If no item is equipped in this slot, or if it doesn't have a weapon level
  1669. according to the database, 0 will be returned.
  1670. if(getequipweaponlv(4)==0) mes "Seems you don't have a weapon on";
  1671. if(getequipweaponlv(4)==1) mes "You are holding a lvl 1 weapon";
  1672. if(getequipweaponlv(4)==2) mes "You are holding a lvl 2 weapon";
  1673. if(getequipweaponlv(4)==3) mes "You are holding a lvl 3 weapon";
  1674. if(getequipweaponlv(4)==4) mes "You are holding a lvl 4 weapon";
  1675. if(getequipweaponlv(4)==5) mes "You are holding a lvl 5 weapon, hm, must be a custom design";
  1676. Or for the left hand, cause it can hold a weapon or a shield:
  1677. if(getequipid(3)==0) goto L_NothingEquiped;
  1678. if(getequipweaponlv(3)==0) mes "You are holding a shield, so it doesnt have a level";
  1679. if(getequipweaponlv(3)==1) mes "You are holding a lvl 1 weapon";
  1680. if(getequipweaponlv(3)==2) mes "You are holding a lvl 2 weapon";
  1681. if(getequipweaponlv(3)==3) mes "You are holding a lvl 3 weapon";
  1682. if(getequipweaponlv(3)==4) mes "You are holding a lvl 4 weapon";
  1683. if(getequipweaponlv(3)==5) mes "You are holding a lvl 5 weapon, hm, must be a custom design";
  1684. close;
  1685. L_NothingEquiped:
  1686. mes "Seems you have nothing equiped";
  1687. close;
  1688. ---------------------------------------
  1689. *getequippercentrefinery(<equipment slot>)
  1690. This function calculates and returns the percent value chance to successfully
  1691. refine the item found in the specified equipment slot of the invoking character
  1692. by +1. The actual formula is beyond the scope of this document, however, it is
  1693. calculated as if the character was a blacksmith trying to refine this particular
  1694. weapon, and depends on lots and lots of stuff. For a list of equipment slots see
  1695. 'getequipid'.
  1696. These values can be displayed for the player to see, or used to calculate the
  1697. random change of a refine succeeding or failing and then going through with it
  1698. (which is what the official NPC refinery scripts use it for)
  1699. // This will find a random number from 0 - 99 and if that is equal to or more
  1700. // than the value recoverd by this command it will go to L_Fail
  1701. if (getequippercentrefinery(3)<=rand(100)) goto L_Fail;
  1702. ---------------------------------------
  1703. *getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
  1704. This function will count all the items with the specified ID number lying on the
  1705. ground on the specified map within the x1/y1-x2/y2 square on it and return that
  1706. number.
  1707. This is the only function around where a parameter may be either a string or a
  1708. number! If it's a number, it means that only the items with that item ID number
  1709. will be counted. If it is a string, it is assumed to mean the 'english name'
  1710. field from the item database. If you give it an empty string, or something that
  1711. isn't found from the item database, it will count items number '512' (apples).
  1712. ---------------------------------------
  1713. *getequipcardcnt(<equipment slot>)
  1714. This function will return the number of cards that have been compounded onto a
  1715. specific equipped item for the invoking character. See 'getequipid' for a list
  1716. of possible equipment slots.
  1717. ---------------------------------------
  1718. *getinventorylist;
  1719. This command sets a bunch of arrays with a complete list of whatever the
  1720. invoking character has in their inventory, including all the data needed to
  1721. recreate these items perfectly if they are destroyed. Here's what you get:
  1722. @inventorylist_id[] - array of item ids.
  1723. @inventorylist_amount[] - their corresponding item amounts.
  1724. @inventorylist_equip[] - whether the item is equipped or not.
  1725. @inventorylist_refine[] - for how much it is refined.
  1726. @inventorylist_identify[] - whether it's refined.
  1727. @inventorylist_attribute[] - whether it is broken.
  1728. @inventorylist_card1[] - These four arrays contain card data for the items.
  1729. @inventorylist_card2[] These data slots are also used to store names
  1730. @inventorylist_card3[] inscribed on the items, so you can explicitly check
  1731. @inventorylist_card4[] if the character owns an item made by a specific
  1732. craftsman.
  1733. @inventorylist_count - the number of items in these lists.
  1734. This could be handy to save/restore a character's inventory, since no other
  1735. command returns such a complete set of data, and could also be the only way to
  1736. correctly handle an NPC trader for carded and named items who could resell them
  1737. - since NPC objects cannot own items, so they have to store item data in
  1738. variables and recreate the items.
  1739. Notice that the variables this command generates are all local and numeric.
  1740. ---------------------------------------
  1741. *cardscnt()
  1742. This function will return the number of cards inserted into the weapon currently
  1743. equipped on the invoking character.
  1744. While this function was meant for item scripts, it will work outside them:
  1745. if (cardscnt()==4) mes "So you've stuck four cards into that weapon, think you're cool now?";
  1746. ---------------------------------------
  1747. *getrefine()
  1748. This function will return the number of plusses the weapon currently equipped on
  1749. the invoking character has been refined for.
  1750. While this function was meant for item scripts, it will work outside them:
  1751. if (getrefine()==10) mes "Wow. That's a murder weapon.";
  1752. ---------------------------------------
  1753. *getnameditem(<item id>,"<name to inscribe>");
  1754. *getnameditem("<item name>","<name to inscribe>");
  1755. This function is equivalent to using 'getitem', however, it will not just give
  1756. the character an item object, but will also inscribe it with a specified
  1757. character's name. You may not inscribe items with arbitrary strings, only with
  1758. names of characters that actually exist. While this isn't said anywhere
  1759. specifically, apparently, named items may not have cards in them, slots or no -
  1760. these data slots are taken by the character ID who's name is inscribed. Only one
  1761. remains free and it's not quite clear if a card may be there.
  1762. This function will return 1 if an item was successfully created and 0 if it
  1763. wasn't for whatever reason. Like 'getitem', this function will also accept an
  1764. 'english name' from the item database as an item name and will return 0 if no
  1765. such item exists.
  1766. ---------------------------------------
  1767. *getitemslots(<item ID>)
  1768. This function will look up the item with the specified ID number in the database
  1769. and return the number of slots this kind of items has - 0 if they are not
  1770. slotted. It will also be 0 for all non-equippable items, naturally, unless
  1771. someone messed up the item database. It will return -1 if there is no such item.
  1772. ---------------------------------------
  1773. *getiteminfo(<item ID>,<type>)
  1774. This function will look up the item with the specified ID number in the database
  1775. and return the info set by TYPE argument.
  1776. It will return -1 if there is no such item.
  1777. Valid types are:
  1778. 0 - Buy Price; 1 - Sell Price; 2 - Item Type;
  1779. 3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc..
  1780. if = 0, then monsters don't drop it at all (rare or a quest item)
  1781. if = 10000, then this item is sold in NPC shops only
  1782. 4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
  1783. 10 - slot; 11 - look; 12 - elv; 13 - wlv;
  1784. Check sample in nps\sample\getiteminfo.txt
  1785. ---------------------------------------
  1786. *getequipcardid (<equipment slot>,<card slot>);
  1787. Returns value from equipped item slot in the indicated slot:
  1788. getequipcardid(num,slot)
  1789. where:
  1790. num = eqip position slot
  1791. slot = 0,1,2,3 (Card Slot N)
  1792. This func returns CARD ID, 255,254,-255 (for card 0, if the item is produced) it's useful
  1793. when you want to check item cards or if it's signed. Useful for such quests as
  1794. "Sign this refined item with players name" etc;
  1795. Hat[0] +4 -> Player's Hat[0] +4
  1796. --------------------------------------
  1797. * getitemslots (<item id>);
  1798. Returns the amount of slots the item has.
  1799. Example(s):
  1800. //@slots now has the amount of slots of the item with ID 1205.
  1801. set @slots, getItemSlots(1205);
  1802. --------------------------------------
  1803. //
  1804. 2,1.- End of item-related commands.
  1805. //
  1806. ---------------------------------------
  1807. *getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})
  1808. This function will locate a character object, NPC object or pet's coordinates
  1809. and place their coordinates into the variables specified when calling it. It
  1810. will return 0 if the search was successful, and -1 if the parameters given were
  1811. not variables or the search was not successful.
  1812. Type is the type of object to search for:
  1813. 0 - Character object
  1814. 1 - NPC object
  1815. 2 - Pet object
  1816. 3 - Monster object.
  1817. While 3 is meant to look for a monster object, no searching will be done if you
  1818. specify type 3, and the function will always return -1.
  1819. The search string is optional. If it is not specified, the location of the
  1820. invoking character will always be returned for types 0 and 2, the location of
  1821. the NPC running this function for type 1.
  1822. If a search string is specified, for types 0 and 1, the character or NPC with
  1823. the specified name will be located. If type is 3, the search will locate the
  1824. current pet of the character who's name is given in the search string, it will
  1825. NOT locate a pet by name.
  1826. What a mess. Example, a working and tested one now:
  1827. prontera.gat,164,301,3%TAB%script%TAB%Meh%TAB%730,{
  1828. mes "My name is Meh. I'm here so that Nyah can find me.";
  1829. close;
  1830. }
  1831. prontera.gat,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
  1832. mes "My name is Nyah.";
  1833. mes "I will now search for Meh all across the world!";
  1834. if (getmapxy(@mapname$,@mapx,@mapy,1,"Meh")!=0) goto Notfound;
  1835. mes "And I found him on map "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !";
  1836. close;
  1837. Notfound:
  1838. mes "I can't seem to find Meh anywhere!";
  1839. close;
  1840. }
  1841. Notice that NPC objects disabled with 'disablenpc' will still be located.
  1842. ---------------------------------------
  1843. *getgmlevel()
  1844. This function will return the GM level of the account to which the invoking
  1845. character belongs. If this is somehow executed from a console command, 99 will
  1846. be returned, and 0 will be returned if the account has no GM level.
  1847. This allows you to make NPC's only accessable for certain GM levels, or behave
  1848. specially when talked to by GMs.
  1849. if (getgmlevel()) mes "What is your command, your godhood?";
  1850. if (getgmlevel()) goto Wherever;
  1851. ---------------------------------------
  1852. *gettimetick(<tick type>)
  1853. This function will return the system time in UNIX epoch time (if tick type is 2)
  1854. or the time since the start of the current day in seconds if tick type is 1.
  1855. Passing 0 will make it return the server's tick, which is a measurement in
  1856. milliseconds used by the server's timer system. The server's tick is an
  1857. unsigned int which loops every ~50 days.
  1858. Just in case you don't know, UNIX epoch time is the number of seconds elapsed
  1859. since 1st of January 1970, and is useful to see, for example, for how long the
  1860. character has been online with OnPCLoginEvent and OnPCLogoutEvent, which could allow
  1861. you to make an 'online time counted for conviction only' jail script.
  1862. ---------------------------------------
  1863. *gettime(<type>)
  1864. This function will return specified information about the current system time.
  1865. 1 - Seconds (of a minute)
  1866. 2 - Minutes (of an hour)
  1867. 3 - Hour (of a day)
  1868. 4 - Week day (0 for Sunday, 6 is Saturday)
  1869. 5 - Day of the month.
  1870. 6 - Number of the month.
  1871. 7 - Year.
  1872. 8 - Day of the year.
  1873. It will only return numbers.
  1874. if (gettime(4)==6) mes "It's a Saturday. I don't work on Saturdays.";
  1875. ---------------------------------------
  1876. *gettimestr(<format string>,<max length>)
  1877. This function will return a string containing time data as specified by the
  1878. format string.
  1879. This uses the C function 'strfmtime', which obeys special format characters. For
  1880. a full description see, for example, the description of 'strfmtime' at
  1881. http://www.delorie.com/gnu/docs/glibc/libc_437.html
  1882. All the format characters given in there should properly work.
  1883. Max length is the maximum length of a time string to generate.
  1884. The example given in eAthena sample scripts works like this:
  1885. mes gettimestr("%Y-%m/%d %H:%M:%S",21);
  1886. This will print a full date and time like 'YYYY-MM/DD HH:MM:SS'.
  1887. ---------------------------------------
  1888. *getusers(<type>)
  1889. This function will return a number of users on a map or the whole server. What
  1890. it returns is specified by Type.
  1891. Type is a bitmask, add up to get the effects you want:
  1892. 8 - This will count all characters on the same map as the current NPC.
  1893. (By default, it will count people on the same map as the character)
  1894. 7 - Return the amount of players for the entire server.
  1895. (By default, only the players on the map will be counted.)
  1896. So 'getusers(0)' will return the number of characters on the same map as the
  1897. invoking character, while 'getusers(7)' will give the count for entire server.
  1898. ---------------------------------------
  1899. *getmapusers("<map name>")
  1900. This function will return the number of users currently located on the specified
  1901. map.
  1902. Currently being used in the PVP scripts to check if a PVP room is full of not,
  1903. if the number returned it equal to the maximum allowed it will not let you
  1904. enter.
  1905. ---------------------------------------
  1906. *getareausers("<map name>",<x1>,<y1>,<x2>,<y2>)
  1907. This function will return the count of connected characters which are located
  1908. within the specified area - an x1/y1-x2/y2 square on the specified map.
  1909. This is useful for maps that are split into many buildings, such as all the
  1910. "*_in.gat" maps, due to all the shops and houses.
  1911. ---------------------------------------
  1912. *getusersname;
  1913. This command will give the invoking character a list of names of the connected
  1914. characters (including themselves) into an NPC script message window (see 'mes')
  1915. paging it by 10 names as if with the 'next' command.
  1916. You need to put a 'close' after that yourself.
  1917. ---------------------------------------
  1918. \\
  1919. 2,2.- Guild-related commands
  1920. \\
  1921. ---------------------------------------
  1922. *getguildname(<guild id>)
  1923. This function returns a guild's name given an ID number. If there is no such
  1924. guild, "null" will be returned;
  1925. // Would print what ever guild 10007 is, in my case this would return "AlcoROhics"
  1926. mes "The guild "+GetGuildName(10007)+" are all nice people.";
  1927. // This will do the same as above:
  1928. set @var,10007;
  1929. mes "We have some friends in "+GetGuildName(@var)+", you know.";
  1930. This is used all over the WoE controlling scripts. You could also use it for a
  1931. guild-based event.
  1932. ---------------------------------------
  1933. *getguildmaster(<guild id>)
  1934. This function return the name of the master of the guild which has the specified
  1935. ID number. If there is no such guild, "null" will be returned.
  1936. // Would return the guild master of guild 10007, whatever that might be.
  1937. // In this example it would return "MissDjax" cause she owns "AlcoROhics" (10007)
  1938. mes getguildmaster(10007)+" runs "+getguildname(10007);
  1939. Can be used to check if the character is the guildmaster of the specified guild.
  1940. Maybe you want to make a room only guildmasters can enter:
  1941. set @GID,getcharid(2);
  1942. if(@GID==0) goto L_NoGuild;
  1943. if(strcharinfo(0)==getguildmaster(@GID)) goto L_GuildMaster;
  1944. mes "Sorry you don't own the guild you are in";
  1945. close;
  1946. L_NoGuild:
  1947. mes "Sorry you are not in a guild";
  1948. close;
  1949. L_GuildMaster:
  1950. mes "Welcome guild master of "+GetGuildName(@GID);
  1951. close;
  1952. ---------------------------------------
  1953. *getguildmasterid(<guild id>)
  1954. This function will return the character ID number of the guildmaster of the
  1955. guild specified by the ID. 0 if the character is not a guildmaster of any guild.
  1956. ---------------------------------------
  1957. *getcastlename("<map name>")
  1958. This function returns the name of the castle when given the map name for that
  1959. castle. The data is read from 'db/castle_db.txt'.
  1960. ---------------------------------------
  1961. *getcastledata("<map name>",<type of data>)
  1962. *setcastledata "<map name>",<type of data>,<value>;
  1963. This function returns the castle ownership information for the castle referred
  1964. to by it's map name. Castle information stored in 'save\castle.txt' for the TXT
  1965. version of the server and in 'guild_castle' table for the SQL version.
  1966. Valid types of data are:
  1967. 0 - Will make the map server request the castle data from the char server, and
  1968. always return 0. This, apparently, will also cause indirectly the execution
  1969. of an 'OnAgitInit:' event mentioned at the beginning of this document.
  1970. 1 - Guild ID
  1971. 2 - Castle Economy score.
  1972. 3 - Castle Defence score.
  1973. 4 - Number of times the economy was invested in today.
  1974. 5 - Number of times the defence was invested in today.
  1975. 9 - Will return 1 if a Kafra was hired for this castle, 0 otherwise.
  1976. 10 - Is 1 if the 1st guardian is present (Soldier Guardian)
  1977. 11 - Is 1 if the 2nd guardian is present (Soldier Guardian)
  1978. 12 - Is 1 if the 3rd guardian is present (Soldier Guardian)
  1979. 13 - Is 1 if the 4th guardian is present (Archer Guardian)
  1980. 14 - Is 1 if the 5th guardian is present (Archer Guardian)
  1981. 15 - Is 1 if the 6th guardian is present (Knight Guardian)
  1982. 16 - Is 1 if the 7th guardian is present (Knight Guardian)
  1983. 17 - Is 1 if the 8th guardian is present (Knight Guardian)
  1984. 18-25 types of data will return current hit point values for guardians 1-8
  1985. respectively.
  1986. The 'setcastledata' command will behave identically, but instead of returning
  1987. values for the specified types of accessible data, it will alter them and cause
  1988. them to be sent to the char server for storage. Data type of 0 won't do
  1989. anything, obviously.
  1990. ---------------------------------------
  1991. *getgdskilllv(<guild id>,<skill id>)
  1992. This function returns the level of the skill <skill id> of the guild <guild id>.
  1993. If the guild does not have that skill, 0 is returned.
  1994. If the guild does not exist, -1 is returned.
  1995. Refer to 'db/skill_db.txt' for the full list of skills. (GD_* are guild skills)
  1996. ---------------------------------------
  1997. *requestguildinfo <guild id>,"<event label>";
  1998. This command requests the guild data from the char server and merrily continues
  1999. with the execution. Whenever the guild information becomes available (which
  2000. happens instantly if the guild information is already in memory, or later, if it
  2001. isn't and the map server has to wait for the char server to reply) it will run
  2002. the specified event as in a 'doevent' call.
  2003. ---------------------------------------
  2004. *getmapguildusers <mapname>,<guild id>;
  2005. Returns the amount of persons from the given guild that are on the given map.
  2006. Example(s):
  2007. //Will set the @persons variable to the amount of persons from the guild
  2008. //which ID's = 10 and are at prontera.
  2009. set @persons,getMapGuildUsers "prontera.gat",10;
  2010. ---------------------------------------
  2011. //
  2012. 2,2.- End of guild-related commands
  2013. //
  2014. ---------------------------------------
  2015. *getskilllv(<skill id>)
  2016. This function returns the level of the specified skill that the invoking
  2017. character has. If they don't have the skill, 0 will be returned. The full list
  2018. of character skills is available in 'db/skill_db.txt'.
  2019. There are two main uses for this function, it can check whether the character
  2020. has a skill or not, and it can tell you if the level is high enough.
  2021. Example 1:
  2022. f (getskilllv(152)) goto L_HasSkillThrowStone;
  2023. mes "You don't have Throw Stone";
  2024. close;
  2025. L_HasSkillThrowStone:
  2026. mes "You have got the skill Throw Stone";
  2027. close;
  2028. Example 2:
  2029. if (getskilllv(28) >= 5) goto L_HasSkillHeallvl5orMore;
  2030. if (getskilllv(28) == 10) goto L_HasSkillHealMaxed;
  2031. mes "You heal skill is below lvl 5";
  2032. close;
  2033. L_HasSkillHeallvl6orMore:
  2034. mes "Your heal lvl is 5 or more";
  2035. close;
  2036. L_HasSkillHealMaxed:
  2037. mes "Your heal lvl has been maxed";
  2038. close;
  2039. ---------------------------------------
  2040. *getskilllist;
  2041. This command sets a bunch of arrays with a complete list of skills the
  2042. invoking character has. Here's what you get:
  2043. @skilllist_id[] - skill ids.
  2044. @skilllist_lv[] - skill levels.
  2045. @skilllist_flag[] - see 'skill' for the meaning of skill flags.
  2046. @skilllist_count - number of skills in the above arrays.
  2047. While 'getskillv' is probably more useful for most situations, this is the
  2048. easiest way to store all the skills and make the character something else for a
  2049. while. Advanced job for a day? :) This could also be useful to see how many
  2050. skills a character has.
  2051. ---------------------------------------
  2052. *getpetinfo(<type>)
  2053. This function will return pet information for the pet the invoking character
  2054. currently has active. Valid types are:
  2055. 0 - Unique pet ID number as stored by the char server and distinguishing it
  2056. from all other pets the characters actually have. This value is currently
  2057. useless, at most you can use it to tell pets apart reliably.
  2058. 1 - Pet ID number as per 'db/pet_db.txt' - will tell you what kind of a pet it
  2059. is.
  2060. 2 - Pet name. Will return "null" if there's no pet.
  2061. 3 - Pet friendly level (intimacy score). 1000 is full loyalty.
  2062. 4 - Pet hungry level. 100 is completely full.
  2063. ---------------------------------------
  2064. *petstat(<flag>)
  2065. Returns current pet status, all are integers except name.
  2066. Returns 0 or "" if the player doesn't have pets.
  2067. Flags usable >>
  2068. PET_CLASS
  2069. PET_NAME
  2070. PET_LEVEL
  2071. PET_HUNGRY
  2072. PET_INTIMATE
  2073. Example:
  2074. set @i, petstat(PET_CLASS);
  2075. ---------------------------------------
  2076. *getmonsterinfo(<item ID>,<type>)
  2077. This function will look up the monster with the specified ID number in the database
  2078. and return the info set by TYPE argument.
  2079. It will return -1 if there is no such item. Due to specific of MOB DB routines,
  2080. it's better to check monster name. It'd return "Dummy" for a non-existing monster.
  2081. Valid types are listed in const.txt:
  2082. MOB_NAME 0 MOB_LV 1
  2083. MOB_MAXHP 2 MOB_BASEEXP 3
  2084. MOB_JOBEXP 4 MOB_ATK1 5
  2085. MOB_ATK2 6 MOB_DEF 7
  2086. MOB_MDEF 8 MOB_STR 9
  2087. MOB_AGI 10 MOB_VIT 11
  2088. MOB_INT 12 JOB_DEX 13
  2089. MOB_LUK 14 MOB_RANGE 15
  2090. MOB_RANGE2 16 MOB_RANGE3 17
  2091. MOB_SIZE 18 MOB_RACE 19
  2092. MOB_ELEMENT 20 MOB_MODE 21
  2093. Check sample in nps\sample\getmonsterinfo.txt
  2094. ---------------------------------------
  2095. *getmapmobs("<map name>")
  2096. This function will return the total count of monsters currently located on the
  2097. specified map. If the map name is given as "this", the map the invoking
  2098. character is on will be used. If the map is not found, or the invoker is not a
  2099. character while the map is "this", it will return -1.
  2100. ---------------------------------------
  2101. *getstrlen("<string>")
  2102. This function will return the length of the string given as an argument. It is
  2103. useful to check if anything input by the player exceeds name length limits and
  2104. other length limits and asking them to try to input something else.
  2105. ---------------------------------------
  2106. *skillpointcount;
  2107. Returns the total amount of skill points a character posesses (SkillPoint+SP's used in skills)
  2108. This command can be used to check the currently attached characters total amount of skillpoints.
  2109. This means the skillpoints used in skill are counted, and added to SkillPoints (number of skill points not used).
  2110. Example:
  2111. //This will set the temp character variable @skillPoints to the amount of skillpoints,
  2112. //and then tell the player the value.
  2113. set @skillPoints, skillPointCount();
  2114. mes "You have "+@skillPoints+" skillpoints in total!";
  2115. //Self-explanatory... :P
  2116. if (skillPointCount() > 20)
  2117. mes "Wow, you have more then 20 Skill Points in total!";
  2118. ---------------------------------------
  2119. *getscrate(<effect type>,<base rate>{,<target ID number>})
  2120. This function will return the chance of a status effect affecting the invoking
  2121. character, in percent, modified by the their current defense against said
  2122. status. The 'base rate' is the base chance of the status effect being inflicted,
  2123. in percent.
  2124. if (rand(100) > getscrate(Eff_Blind, 50)) goto BlindHimNow;
  2125. You can see the full list of available effect types you can possibly inflict in
  2126. 'db/const.txt' under 'Eff_'.
  2127. It is pretty certain that addressing the target by an ID number will not
  2128. currently work due to a bug.
  2129. ---------------------------------------
  2130. ========================
  2131. |3.- Checking commands.|
  2132. ========================
  2133. -------------------------
  2134. *playerattached;
  2135. Returns the ID of the player currently attached to the script. It will return
  2136. 0 if noone is attached, or if the attached player no longer exists on the map
  2137. server. It is wise to check for the attached player in script functions that
  2138. deal with timers as there's no guarantee the player will still be logged on
  2139. when the timer triggers. Note that the ID of a player is actually their
  2140. account ID.
  2141. -------------------------
  2142. *isloggedin(<account id>)
  2143. This function returns 1 if the specified account is logged in and 0 if they
  2144. aren't.
  2145. ---------------------------------------
  2146. *checkweight(<item id>,<amount>)
  2147. *checkweight("<item name>",<amount>)
  2148. This function will compute and return 1 if the total weight of a specified
  2149. number of specific items does not exceed the invoking character's carrying
  2150. capacity, and 0 otherwise. It is important to see if a player can carry the
  2151. items you expect to give them, failing to do that may open your script up to
  2152. abuse or create some very unfair errors.
  2153. Like 'getitem', this function will also accept an 'english name' from the
  2154. database as an argument.
  2155. checkweight(502,10) // 10 apples
  2156. if (checkweight(502,10) == 0 ) goto L_OverWeight;
  2157. getitem 502,10;
  2158. close;
  2159. L_OverWeight:
  2160. mes "Sorry you cannot hold this ammount of apples";
  2161. close;
  2162. Or to put this another way:
  2163. if (checkweight("APPLE",10)) goto L_Getapples;
  2164. mes "Sorry you cannot hold this ammount of apples";
  2165. close;
  2166. L_Getapples:
  2167. getitem 502,10;
  2168. close;
  2169. Both these examples have the same effect.
  2170. ---------------------------------------
  2171. *basicskillcheck()
  2172. This function will return the state of the configuration option
  2173. 'basic_skill_check' in 'battle_athena.conf'. It returns 1 if the option is
  2174. enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which
  2175. it is by default, characters must have a certain number of basic skill levels to
  2176. sit, request a trade, use emoticons, etc. Making your script behave differently
  2177. depending on whether the characters must actually have the skill to do all these
  2178. things might in some cases be required.
  2179. ---------------------------------------
  2180. *checkoption(<option number>)
  2181. *checkoption1(<option number>)
  2182. *checkoption2(<option number>)
  2183. *setoption <option number>{,<flag>};
  2184. The 'setoption' series of functions check for a so-called option that is set on
  2185. the invoking character. 'Options' are used to store status conditions and a lot
  2186. of other non-permanent character data of the yes-no kind. For most common cases,
  2187. it is better to use 'checkcart','checkfalcon','checkpeco' and other similar
  2188. functions, but there are some options which you cannot get at this way. They
  2189. return 1 if the option is set and 0 if the option is not set.
  2190. Option numbers valid for the first (option) version of this command are:
  2191. 0x1 - Sight in effect.
  2192. 0x2 - Hide in effect.
  2193. 0x4 - Cloaking in effect.
  2194. 0x8 - Cart number 1 present.
  2195. 0x10 - Falcon present.
  2196. 0x20 - Peco Peco present.
  2197. 0x40 - GM Perfect Hide in effect.
  2198. 0x80 - Cart number 2 present.
  2199. 0x100 - Cart number 3 present.
  2200. 0x200 - Cart number 4 present.
  2201. 0x400 - Cart number 5 present.
  2202. 0x800 - Orc head present.
  2203. 0x1000 - The character is wearing a wedding sprite.
  2204. 0x2000 - Ruwach is in effect.
  2205. 0x4000 - Chasewalk in effect.
  2206. 0x8000 - Flying or Xmas suit.
  2207. 0x10000 - Sighttrasher.
  2208. Option numbers valid for the second version (opt1) of this command are:
  2209. 1 - Petrified.
  2210. 2 - Frozen.
  2211. 3 - Stunned.
  2212. 4 - Sleeping.
  2213. 6 - Petrifying (the state where you can still walk)
  2214. Option numbers valid for the third version (opt2) of this command are:
  2215. 0x1 - Poisoned.
  2216. 0x2 - Cursed.
  2217. 0x4 - Silenced.
  2218. 0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
  2219. 0x10 - Blinded.
  2220. 0x80 - Deadly poisoned.
  2221. Option numbers (except for opt1) are bitmasks - you can add them up to check
  2222. for several states, but the functions will return true if at least one of them
  2223. is in effect.
  2224. 'setoption' will set options on the invoking character. There are no second and
  2225. third versions of this command, so you can only change the values in the first
  2226. list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted),
  2227. the option will be added to what the character currently has; if 0, the option is removed.
  2228. This is definitely not a complete list of available option flag numbers. Ask a
  2229. core developer (or read the source: src/map/status.h) for the full list.
  2230. ---------------------------------------
  2231. *setcart {<type>};
  2232. *checkcart()
  2233. If <type> is 0 this command will remove the cart from the character.
  2234. Otherwise it gives the invoking character a cart. The cart given will be
  2235. cart number <type> and will work regardless of whether the character is a
  2236. merchant class or not.
  2237. Note: the character needs to have the skill MC_PUSHCART to gain a cart
  2238. The accompanying function will return 1 if the invoking character has a cart
  2239. (any kind of cart) and 0 if they don't.
  2240. if (checkcart()) mes "But you already have a cart!";
  2241. ---------------------------------------
  2242. *setfalcon {<flag>};
  2243. *checkfalcon()
  2244. If <flag> is 0 this command will remove the falcon from the character.
  2245. Otherwise it gives the invoking character a falcon. The falcon will be there
  2246. regardless of whether the character is a hunter or not. It will (probably) not
  2247. have any useful effects for non-hunters though.
  2248. Note: the character needs to have the skill HT_FALCON to gain a falcon
  2249. The accompanying function will return 1 if the invoking character has a falcon
  2250. and 0 if they don't.
  2251. if (checkfalcon()) mes "But you already have a falcon!";
  2252. ---------------------------------------
  2253. *setriding {<flag>};
  2254. *checkriding()
  2255. If <flag> is 0 this command will remove the mount from the character.
  2256. Otherwise it give the invoking character a PecoPeco (if they are a Knight
  2257. series class) or a GrandPeco (if they are a Crusader seriesclass). Unlike
  2258. 'setfalcon' and 'setcart' this will not work at all if they aren't of a class
  2259. which can ride.
  2260. Note: the character needs to have the skill KN_RIDING to gain a mount
  2261. The accompanying function will return 1 if the invoking character is riding a
  2262. bird and 0 if they don't.
  2263. if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!";
  2264. ---------------------------------------
  2265. *checkvending ({"<player name>"})
  2266. *checkchatting ({"<Player Name>"})
  2267. If the player's name is given, this command checks for that player
  2268. to be online and wether he/she is chatting or vending.
  2269. When no name is given, the attached player is used for checking.
  2270. Returns true or false (1 or 0) when the player is chatting/vending or not.
  2271. Example(s):
  2272. if (checkVending("Aaron")) mes "Aaron is currently vending!";
  2273. //This will check if Aaron is vending, and if so, put a message in front
  2274. //of the attached player saying Aaron is vending.
  2275. if (checkChatting()) mes "You are currently chatting!";
  2276. //This will check if you're in a chat room or not
  2277. ---------------------------------------
  2278. *agitcheck()
  2279. This function will let you check whether the server is currently in WoE mode.
  2280. It will return 1 if the War of Emperium is on and 0 if it isn't.
  2281. ---------------------------------------
  2282. *isnight()
  2283. *isday()
  2284. These functions will return 1 or 0 depending on whether the server is in night
  2285. mode or day mode. 'isnight' returns 1 if it's night and 0 if it isn't, 'isday'
  2286. the other way around. They can be used interchangeably, pick the one you like
  2287. more:
  2288. // These two are equivalent:
  2289. if (isday()) mes "I only prowl in the night.";
  2290. if (isnight()!=1) mes "I only prowl in the night.";
  2291. ---------------------------------------
  2292. \\
  2293. 3,1.- Item-related commands
  2294. \\
  2295. ---------------------------------------
  2296. *isequipped(<id>{,<id>{,<id>{,<id>}}})
  2297. This function will return 1 if the invoking character has all of the item
  2298. IDs given equipped (if card IDs are passed, then it checks if the cards are
  2299. inserted into slots in the equipment they are currently wearing). Theorically
  2300. there is no limit to the number of items that may be tested for at the same time.
  2301. If even one of the items given is not equipped, 0 will be returned.
  2302. // (Poring,Santa Poring,Poporing,Marin)
  2303. if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
  2304. // (Poring)
  2305. if (isequipped(4001)) mes "A poring card is useful, don't you think?";
  2306. The function was meant for item scripts to support the cards released by Gravity
  2307. in February 2005, but it will work just fine in normal NPC scripts.
  2308. ---------------------------------------
  2309. *isequippedcnt(<card id>{,<card id>{,<card id>{,<card id>}}})
  2310. This function is similar to 'isequipped', but instead of 1 or 0, it will return
  2311. the number of cards in the list given that were found on the invoking character.
  2312. if (isequippedcnt(4001,4005,4033,4196)=4) mes "Finally got all four poring cards?";
  2313. ---------------------------------------
  2314. *checkequipedcard(<card id>)
  2315. This function will return 1 if the card specified by it's item ID number is
  2316. inserted into any equipment they have in their inventory, currently equipped or
  2317. not.
  2318. ---------------------------------------
  2319. *hasitems(0)
  2320. This function will return 1 if the invoking character has anything at all in
  2321. their inventory and 0 if they do not. Even though the argument is not used for
  2322. anything, it is required.
  2323. ---------------------------------------
  2324. *getequipisidentify(<equipment slot>)
  2325. This function will return 1 if an item in the specified equipment slot is
  2326. identified and 0 if it isn't. Since you can't even equip unidentified equipment,
  2327. there's a question of whether it can actually end up there, and it will normally
  2328. return 1 all the time if there is an item in this equipment slot.
  2329. Which is kinda pointless.
  2330. For a list of equipment slots see 'getequipid'.
  2331. ---------------------------------------
  2332. //
  2333. 3,1.- End of item-related commands
  2334. //
  2335. ---------------------------------------
  2336. ==============================
  2337. |4.- Player-related commands.|
  2338. ==============================
  2339. -------------------------
  2340. *attachrid(<character ID>)
  2341. *detachrid;
  2342. A 'RID' is an ID of a character who caused the NPC script to run, as has been
  2343. explained above in the introduction section. Quite a bit of commands want a RID
  2344. to work, since they wouldn't know where to send information otherwise. And in
  2345. quite a few cases the script gets invoked with a RID of zero (like through
  2346. OnTime special labels). If an NPC script needs this, it can attach a specified
  2347. character's id to itself. by calling the 'attachrid' function.
  2348. 'attachrid' returns 1 if the character was found online and 0 if it wasn't.
  2349. This could also be used, while running in a script invoked by a character
  2350. through talking to an NPC, to mess with other characters.
  2351. Detaching the RID will make the RID of the script zero.
  2352. ---------------------------------------
  2353. *rid2name(<rid>)
  2354. Converts rid to name. Note: The player/monster/NPC must be online/enabled.
  2355. Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
  2356. Note: rid2name may not produce correct character names since rid = account id.
  2357. It will return the current online character of the account only.
  2358. ---------------------------------------
  2359. *message "<character name>","<message>";
  2360. That command will send a message to the chat window of the character specified
  2361. by name. The text will also appear above the head of that character. It will not
  2362. be seen by anyone else.
  2363. ---------------------------------------
  2364. *dispbottom "<message>";
  2365. This command will send the given message into the invoking character's chat
  2366. window.
  2367. ---------------------------------------
  2368. *warp "<map name>",<x>,<y>;
  2369. This command will take the invoking character to the specifed map, and if
  2370. wanted, specified coordinates too, but these can be random.
  2371. warp "place.gat",50,55;
  2372. This would take them to X 50 Y 55 on the map called "place". If your X and Y
  2373. coordinates land on an unwalkable map square, it will send the warped character
  2374. to a random place. Same will happen if they are both zero:
  2375. warp "place.gat",0,0;
  2376. Notice that while warping people to coordinates 0,0 will normally get them into
  2377. a random place, it's not certain to always be so. Darned if I know where this is
  2378. actually coded, it might be that this happens because square 0,0 is unwalkable
  2379. on all official maps. If you're using custom maps, beware.
  2380. There are also three special 'map names' you can use.
  2381. "Random" will warp the player randomly on the current map.
  2382. "Save" and "SavePoint" will warp the player back to their savepoint.
  2383. ---------------------------------------
  2384. *areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>;
  2385. This command is similar to 'warp', however, it will not refer to the invoking
  2386. character, but instead, all characters within a specified area, defined by the
  2387. x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
  2388. including the activating character, if they are outside the area.
  2389. areawarp "place.gat",10,10,120,120,"place2.gat",150,150;
  2390. Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
  2391. shape, on the map called "place", will be affected, and warped to "place2" X 150
  2392. Y 150
  2393. areawarp "place.gat",10,10,120,120,"place2.gat",0,0;
  2394. By using ,0,0; as the destination coordinates it will take all the characters in
  2395. the affected area to a random set of co-ordinates on "place2".
  2396. Like 'warp', areawarp will also explicitly warp characters randomly into the
  2397. current map if you give the 'to map name' as "Random".
  2398. See also 'warp'.
  2399. ---------------------------------------
  2400. *warpparty "<mapname.gat>",<x>,<y>,<party_id>;
  2401. Warps a party to specified map and coordinate given the party ID, which you can get with
  2402. getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
  2403. Example:
  2404. mes "[Party Warper]";
  2405. mes "Here you go!";
  2406. close2;
  2407. set @id,getcharid(1);
  2408. warpparty "prontera.gat",150,100,@id;
  2409. close;
  2410. ---------------------------------------
  2411. *warpchar "<mapname.gat>",<x>,<y>,<char_id>;
  2412. Warps another player to specified map and coordinate given the char id, which you can get with
  2413. getcharid(0,<player_name>). Obviously this is useless if you want to warp the same player that
  2414. is executing this script, unless it's some kind of "chosen" script.
  2415. Example:
  2416. warpchar "prontera.gat",150,100,20000001;
  2417. ---------------------------------------
  2418. *warpguild "<mapname.gat>",<x>,<y>,<guild_id>;
  2419. Warps a guild to specified map and coordinate given the guild id, which you can get with
  2420. getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>).
  2421. Example:
  2422. warpguild "prontera.gat",x,y,Guild_ID;
  2423. ---------------------------------------
  2424. *warppartner("<map name>",<x>,<y>);
  2425. This function will find the invoking character's marriage partner, if any, and
  2426. warp them to the map and coordinates given. Go kidnap that spouse. :) It will
  2427. return 1 upon success and 0 if the partner is not online, the character is not
  2428. married, or if there's no invoking character (no RID). 0,0 will, as usual,
  2429. normally translate to random coordinates.
  2430. ---------------------------------------
  2431. *savepoint "<map name>",<x>,<y>;
  2432. *save "<map name>",<x>,<y>;
  2433. This command saves where the invoking character will return to upon
  2434. 'return to save point', if dead or in some other cases. The two versions are
  2435. equivalent. Map name, X coordinate and Y coordinate should be perfectly obvious.
  2436. This ignores any and all map flags, and can make a character respawn where no
  2437. teleportation is otherwise possible.
  2438. savepoint "place.gat",350,75;
  2439. ---------------------------------------
  2440. *heal <hp>,<sp>;
  2441. This command will heal a set amount of HP and/or SP on the invoking character.
  2442. heal 30000,0; // This will heal 30,000 HP
  2443. heal 0,30000; // This will heal 30,000 SP
  2444. heal 300,300; // This will heal 300 HP and 300 SP
  2445. This command just alters the hit points and spell points of the invoking
  2446. character and produces no other output whatsoever.
  2447. ---------------------------------------
  2448. *itemheal <hp>,<sp>;
  2449. This command works on the invoking character like 'heal', however, it is not
  2450. normally used in NPC scripts and will not work as expected there, but is used
  2451. all over in item scripts.
  2452. Unlike 'heal', which just alters hp/sp and doesn't do anything else at all, this
  2453. command also shows healing animations for potions and other stuff, checks
  2454. whether the potion was made by a famous alchemist and alters the amount healed,
  2455. etc, etc. Since which kind of effect is shown depends on what item was used,
  2456. using it in an NPC script will not have a desired effect.
  2457. There is also a nice example on using this with the 'rand' function, to give you
  2458. a random ammount of healing.
  2459. // This will heal anything thing from 100 to 150 HP and no SP
  2460. itemheal rand(100,150),0;
  2461. ---------------------------------------
  2462. *percentheal <hp>,<sp>;
  2463. This command will heal the invoking character. It heals the character, but not
  2464. by a set value - it adds percent of their maximum HP/SP.
  2465. percentheal 100,0; // This will heal 100% HP
  2466. percentheal 0,100; // This will heal 100% SP
  2467. percentheal 50,50; // This will heal 50% HP and 50% SP
  2468. So the amount that this will heal will depend on the total ammount of HP or SP
  2469. you have maximum. Like 'heal', this will not call up any animations or effects.
  2470. ---------------------------------------
  2471. *recovery;
  2472. This command will revive and restore full HP and SP to all characters currently
  2473. connected to the server.
  2474. ---------------------------------------
  2475. *jobchange <job number>{,<upper flag>};
  2476. This command will change the job class of the invoking character.
  2477. jobchange 1; // This would change your player into a Swordman
  2478. jobchange 4002; // This would change your player into a Swordman High
  2479. This command does work with numbers, but you can also use job names. The full
  2480. list of job names and the numbers they correspond to can be found in
  2481. 'db/const.txt'.
  2482. // This would change your player into a Swordman
  2483. jobchange Job_Swordman;
  2484. // This would change your player into a Swordman High
  2485. jobchange Job_Swordman_High;
  2486. 'upper flag' can alternatively be used to specify the type of job one changes
  2487. to. For example, jobchange Job_Swordman,1; will change the character to a high
  2488. swordsman. The upper values are:
  2489. -1 (or when omitted): preserves the current job type.
  2490. 0: Normal/standard classes
  2491. 1: High/Advanced classes
  2492. 2: Baby classes
  2493. This command will also set a permanent character-based variable
  2494. 'jobchange_level' which will contain the job level at the time right before
  2495. changing jobs, which can be checked for later in scripts.
  2496. ---------------------------------------
  2497. *jobname (<job number>)
  2498. This command retrieves the name of the given job using the msg_athena entries 550->650.
  2499. mes "[Kid]";
  2500. mes "I never thought I'd met a "+jobname(Class)+" here of all places.";
  2501. close;
  2502. ---------------------------------------
  2503. *eaclass ({<job number>})
  2504. This commands returns the "eA job-number" corresponding to the given class (if none is given, it returns uses
  2505. the invoking player's class as argument). The eA job-number is also a class number system, but it's one that
  2506. comes with constants which make it easy to convert among classes. The command will return -1 if you pass it a
  2507. job number which doesn't has a eA Job value equivalent.
  2508. set @eac, eaclass();
  2509. if ((@eac&EAJ_BASEMASK) == EAJ_SWORDMAN)
  2510. mes "You must be a swordman, knight, crusader, paladin, high swordman, lord knight, baby swordman,";
  2511. mes "baby knight or baby crusader.";
  2512. if (@eac&EAJL_UPPER)
  2513. mes "You are a rebirth job.";
  2514. if ((@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN)
  2515. mes "You must be a Swordman, Baby Swordman or High Swordman.";
  2516. For more information on the eA Job System, see the docs/ea_job_system.txt file.
  2517. ---------------------------------------
  2518. *roclass <job number> {,<gender>}
  2519. Does the opposite of eaclass. That is, given a eA Job class, it returns which is the corresponding RO class number.
  2520. A gender is required because both Bard and Dancers share the same eA Job value (EAJ_BARDDANCER), if it isn't given, the
  2521. gender of the executing player is taken (if there's no player running the script, male will be used by default).
  2522. The command returns -1 when there isn't a valid class to represent the required job (for example, if you try to get the
  2523. baby version of a Taekwon class).
  2524. set @eac, eaclass();
  2525. //Check if class is already rebirth
  2526. if (@eac&EAJL_UPPER) {
  2527. mes "You look strong.";
  2528. close;
  2529. }
  2530. set @eac, roclass(@eac|EAJL_UPPER);
  2531. //Check if class has a rebirth version
  2532. if (@eac != -1) {
  2533. mes "Bet you can't wait to become a "+jobname(@eac)+"!";
  2534. close;
  2535. }
  2536. ---------------------------------------
  2537. *changebase <job ID number>;
  2538. This will change the appearance of the invoking character to that of a specified
  2539. job class. Nothing but appearance will change. This command is used in item
  2540. scripts for "Wedding Dress" and "Tuxedo" so the character like job 22, which is
  2541. the job number of the wedding sprites.
  2542. It would be entered in the equip bonus section of an item
  2543. 2338,Wedding_Dress,Wedding Dress,5,43000,,500,,0,,0,119529470,7,0,16,,0,1,0,{ bonus bMdef,15; changebase 22; }
  2544. This command only works when inside item scripts.
  2545. ---------------------------------------
  2546. *classchange <view id>,<type>;
  2547. This command is very ancient, it's origins are clouded in mystery.
  2548. It will send a 'display id change' packet to everyone in the immediate area of
  2549. the NPC object, which will supposedly make the NPC look like a different sprite,
  2550. an NPC sprite ID, or a monster ID. This effect is not stored anywhere and will
  2551. not persist (Which is odd, cause it would be relatively easy to make it do so)
  2552. and most importantly, will not work at all since this command was broken with
  2553. the introduction of advanced classes. The code is written with the assumption
  2554. that the lowest sprite IDs are the job sprites and the anything beyond them is
  2555. monster and NPC sprites, but since the advanced classes rolled in, they got the
  2556. ID numbers on the other end of the number pool where monster sprites float.
  2557. As a result it is currently impossible to call this command with a valid view
  2558. id. It will do nothing whatsoever if the view ID is below 4047. Getting it to
  2559. run will actually just crash the client.
  2560. It could be a real gem if it can be gotten to actually do what it's supposed to
  2561. do, but this will only happen in a later SVN revision.
  2562. ---------------------------------------
  2563. *changesex;
  2564. This command will change the gender for the attached character's account. If it
  2565. was male, it will become female, if it was female, it will become male. The
  2566. change will be written to the character server, but there is no way to send this
  2567. information to the client, so the player will continue to see their character as
  2568. the gender it previously was. What the other players will see before the
  2569. relogin is not clear.
  2570. If the character currently connected when this command was invoked was a
  2571. Dancer/Gypsy or Bard/Clown, they will become a Swordman upon 'changesex'.
  2572. Whatever happens to their skills is not clear. Whatever happens if another
  2573. character on the same account was a gender-specific class is not clear either,
  2574. but it's likely that the client will have serious issues with that, since no
  2575. other characters on the same account will get altered.
  2576. There's good reasons to be very careful when using this command.
  2577. ---------------------------------------
  2578. *getexp <base xp>,<job xp>;
  2579. This command will give the invoking character a specified number of base and job
  2580. experience points. Can be used as a quest reward. Negative amounts of experience
  2581. were not tested but should work.
  2582. getexp 10000,5000;
  2583. You can also use the "set" command with the constants defined in 'db/const.txt':
  2584. // These 2 combined has the same effect as the above command
  2585. set BaseExp,BaseExp+10000;
  2586. set JobExp,JobExp+5000;
  2587. You can also reduce the ammount of experience points:
  2588. set BaseExp,BaseExp-10000;
  2589. ---------------------------------------
  2590. *setlook <look type>,<look value>;
  2591. This command will alter the look data for the invoking character. It is used
  2592. mainly for changing the palette used on hair and clothes, you specify which look
  2593. type you want to change, then the palette you want to use. Make sure you specify
  2594. a palette number that exists/is usable by the client you use.
  2595. // This will change your hair(6), so that it uses palette 8, what ever your
  2596. // palette 8 is your hair will use that colour
  2597. setlook 6,8;
  2598. // This will change your clothes(7), so they are using palette 1, whatever
  2599. // your palette 1 is, your clothes will then use that set of colours.
  2600. setlook 7,1;
  2601. Here are the possible look types:
  2602. 0 - Base sprite
  2603. 1 - Hairstyle
  2604. 2 - Weapon
  2605. 3 - Head bottom
  2606. 4 - Head top
  2607. 5 - Head mid
  2608. 6 - Hair color
  2609. 7 - Clothes color
  2610. 8 - Shield
  2611. 9 - Shoes
  2612. Whatever 'shoes' means is anybody's guess, ask Gravity - the client does nothing
  2613. with this value. It still wants it from the server though, so it is kept, but
  2614. normally doesn't do a thing.
  2615. Only the look data for hairstyle, hair color and clothes color are saved to the
  2616. char server's database and will persist. The rest freely change as the character
  2617. puts on and removes equipment, changes maps, logs in and out and otherwise you
  2618. should not expect to set them. In fact, messing with them is generally
  2619. hazardous, do it at your own risk, it is not tested what will this actually do -
  2620. it won't cause database corruption and probably won't cause a server crash, but
  2621. it's easy to crash the client with just about anything unusual.
  2622. However, it might be an easy way to quickly check for empty view IDs for
  2623. sprites, which is essential for making custom headgear.
  2624. Since a lot of people have different palettes for hair and clothes, it's
  2625. impossible to tell you what all the colour numbers are. If you want a serious
  2626. example, there is a Stylist script inside the default eAthena installation that
  2627. you can look at, this may help you create a Stylist of your own:
  2628. 'custom\dye.txt'
  2629. ---------------------------------------
  2630. \\
  2631. 4,1.- Item-related commands
  2632. \\
  2633. ---------------------------------------
  2634. *getitem <item id>,<amount>{,<character ID>};
  2635. *getitem "<item name>",<amount>{,<character ID>};
  2636. This command will give a specific amount of specified items to the target
  2637. character. If the character is not online, nothing will happen.
  2638. If <character ID> is not specified, items will be created in the invoking
  2639. character inventory instead.
  2640. In the first and most commonly used version of this command, items are
  2641. referred to by their database ID number found inside 'db/item_db.txt'.
  2642. getitem 502,10 // The person will receive 10 apples
  2643. getitem 617,1 // The person will receive 1 Old Violet Box
  2644. Giving an item ID of -1 will give a specified number of random items from the
  2645. list of those that fall out of Old Blue Box. Unlike in all other cases, these
  2646. will be unidentified, if they turn out to be equipment. This is exactly what's
  2647. written in the Old Blue Box's item script.
  2648. Other negative IDs also correspond to other random item generating item tables:
  2649. Giving an item ID of -2 will produce the effects of Old Violet Box.
  2650. Giving an item ID of -3 will produce the effects of Old Card Album.
  2651. Giving an item ID of -4 will produce the effects of Gift Box.
  2652. Giving an item ID of -5 will produce the effects of Worn Out Scroll, which, in
  2653. current SVN, drops only Jellopies anyway.
  2654. This transaction is logged if the log script generated transactions option is
  2655. enabled.
  2656. You may also create an item by it's name in the 'english name' field in the
  2657. item database:
  2658. getitem "RED_POTION",10;
  2659. Which will do what you'd expect. If it can't find that name in the database,
  2660. apples will be created anyway. It is often a VERY GOOD IDEA to use it like this.
  2661. This is used in pretty much all NPC scripts that have to do with items and
  2662. quite a few item scripts. For more examples check just about any official script.
  2663. ---------------------------------------
  2664. *getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<character ID>};
  2665. *getitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<character ID>};
  2666. This command will give an amount of specified items to the invoking character.
  2667. If an optional character ID is specified, and that character is currently
  2668. online, items will be created in their inventory instead. If they are not
  2669. online, nothing will happen. It works essentially the same as 'getitem' (it even
  2670. works for negative ID numbers the same way, which is kinda silly) but is a lot
  2671. more flexible, since it allows you to give the player an item altered with it's
  2672. specific properties.
  2673. Those parameters that are different from 'getitem' are:
  2674. identify - Whether you want the item to be identified or not, 0 unidentified,
  2675. 1 identified.
  2676. refine - For how many plusses will it be refined.
  2677. It will not let you refine an item higher than +10, if you
  2678. specify more it'll still be 10.
  2679. attribute - Whether the item is broken (1) or not (0) and NOT an elemental
  2680. attribute.
  2681. card1,2,3,4 - If you want a card compound to it, place the card ID number into
  2682. the specific card slot. Card ID numbers also found in
  2683. 'db/item_db.txt'
  2684. Card1-card4 values are also used to store name information for named items, as
  2685. well as the elemental property of weapons and armor. You can create a named item
  2686. in this manner, however, if you just need a named piece of standard equipment,
  2687. it is much easier to the 'getnameditem' function instead.
  2688. You will need to keep these values if you want to destroy and then perfectly
  2689. recreate a named item, for this see 'getinventorylist'.
  2690. If you still want to try creating a named item with this command because
  2691. 'getnameditem' won't do it for you cause it's too limited, you can do it like
  2692. this. Careful, minor magic ahead.
  2693. // First, let's get an ID of a character who's name will be on the item.
  2694. // Only an existing character's name may be there.
  2695. // Let's assume our character is 'Adam' and find his ID.
  2696. set @charid,getcharid(0,"Adam");
  2697. // Now we split the character ID number into two portions with a binary
  2698. // shift operation. If you don't understand what this does, just copy it.
  2699. set @card3, @charid & 65535;
  2700. set @card4, @charid >> 16;
  2701. // If you're inscribing non-equipment, @card1 must be 254.
  2702. // Arrows are also not equipment. :)
  2703. set @card1,254;
  2704. // For named equipment, card2 means the Star Crumbs and elemental
  2705. // crystals used to make this equipment. For everything else, it's 0.
  2706. set @card2,0;
  2707. // Now, let's give the character who invoked the script some
  2708. // Adam's Apples:
  2709. getitem2 512,1,1,0,0,@card1,@card2,@card3,@card4;
  2710. This wasn't tested with all possible items, so I can't give any promises,
  2711. experiment first before relying on it.
  2712. To create equipment, continue this example it like this:
  2713. // We've already have card3 and card4 loaded with correct
  2714. // values so we'll just set up card1 and card2 with data
  2715. // for an Ice Stiletto.
  2716. // If you're inscribing equipment, @card1 must be 255.
  2717. set @card1,255;
  2718. // That's the number of star crumbs in a weapon.
  2719. set @sc,2;
  2720. // That's the number of elemental property of the weapon.
  2721. set @ele,1;
  2722. // And that's the wacky formula that makes them into
  2723. // a single number.
  2724. set @card2,@ele+((@sc*5)<<8);
  2725. // That will make us an Adam's +2 VVS Ice Stiletto:
  2726. getitem2 1216,1,1,2,0,@card1,@card2,@card3,@card4;
  2727. Experiment with the number of star crumbs - I'm not certain just how much will
  2728. work most and what it depends on. The valid element numbers are:
  2729. 1 - Ice, 2 - Earth 3 - Fire 4 - Wind.
  2730. You can, apparently, even create duplicates of the same pet egg with this
  2731. command, creating a pet which is the same, but simultaneously exists in two
  2732. eggs, and may hatch from either, although, I'm not sure what kind of a mess will
  2733. this really cause.
  2734. ---------------------------------------
  2735. * getnameditem <item name|item id>,<Character name|character ID>;
  2736. -Note: there's a total of 4 possible combinations of this command.
  2737. E.g: item name and character name, or with character id, etc...
  2738. Create a item signed with the given character's name.
  2739. This is the same as using the hard(ly) explained way with getitem2.
  2740. The command returns 1 when the item is created succesfully, or 0 when failed.
  2741. Failure occurs when there is:
  2742. - no player attached
  2743. - Item name or ID is not valid
  2744. - The given character ID/name is offline.
  2745. Example:
  2746. //This will give the currently attached player a Aaron's Apple (if Aaron is online).
  2747. getnameditem "Apple","Aaron";
  2748. //Self-explanatory (I hope).
  2749. if (getnameitem("Apple,"Aaron")) {
  2750. mes "You now have a Aaron's Apple!";
  2751. }
  2752. ---------------------------------------
  2753. *makeitem <item id>,<amount>,<X>,<Y>,"<map name>";
  2754. *makeitem "<item name>",<amount>,<X>,<Y>,"<map name>";
  2755. This command will create an item lying around on a specified map in the
  2756. specified location.
  2757. itemid - Found in 'db/item_db.txt'
  2758. amount - Amount you want produced
  2759. X - The X coordinate
  2760. Y - The Y coordinate
  2761. map name - The map name.
  2762. This item will still disappear just like any other dropped item. Like 'getitem',
  2763. it also accepts an 'english name' field from the database and creates apples if
  2764. the name isn't found.
  2765. ---------------------------------------
  2766. *delitem <item id>,<amount>;
  2767. *delitem "<item name>",<amount>;
  2768. This command will take a specified amount of items from the invoking character.
  2769. As all the item commands, this one uses the ID of the item found inside
  2770. 'db/item_db.txt'. The items are destroyed - there is no way an NPC can simply
  2771. own items and have an inventory of them, other as by destroying and recreating
  2772. them when needed.
  2773. delitem 502,10 // The person will lose 10 apples
  2774. delitem 617,1 // The person will lose 1 Old Violet Box
  2775. It is always a good idea to to check if the player actually has the item before
  2776. you take it from them, Otherwise, you could try to delete items which the
  2777. players don't actually have, which won't fail and won't give an error message,
  2778. but might open up ways to exploit your script.
  2779. Like 'getitem' this command will also accept an 'english name' field from the
  2780. database. If the name is not found, nothing will be deleted.
  2781. ---------------------------------------
  2782. *delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<character ID>};
  2783. *delitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<character ID>};
  2784. This command will take a specified amount of items from the invoking character.
  2785. Check 'getitem2' to understand its expanded parameters.
  2786. ---------------------------------------
  2787. *countitem(<item id>)
  2788. *countitem("<item name>")
  2789. This function will return the number of items for the specified item ID that the
  2790. invoking character has in the inventory.
  2791. mes "[Item Checker]";
  2792. mes "Hmmm, it seems you have "+countitem(502)+" apples";
  2793. close;
  2794. Like 'getitem', this function will also accept an 'english name' from the
  2795. database as an argument.
  2796. If you want to state the number at the end of a sentence, you can do it by
  2797. adding up strings:
  2798. mes "[Item Checker]";
  2799. mes "Hmmm, the total number of apples you are holding is "+countitem("APPLE");
  2800. close;
  2801. ---------------------------------------
  2802. *countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  2803. *countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  2804. Expanded version of 'countitem' function, used for created/carded/forged items.
  2805. This function will return the number of items for the specified item ID and
  2806. other parameters that the invoking character has in the inventory.
  2807. Check 'getitem2' to understand the arguments of the function.
  2808. ---------------------------------------
  2809. *groupranditem <group id>;
  2810. Returns the item_id of a random item picked from the group specified. The
  2811. different groups and their group number are specified in db/item_group_db.txt
  2812. When used in conjunction with other functions, you can get a random item. For
  2813. example, for a random pet lure:
  2814. getitem groupranditem(15),1;
  2815. ---------------------------------------
  2816. *enable_items;
  2817. *disable_items;
  2818. These commands enable item usage while an npc is running. When enable_items is
  2819. run, items can be used during scripts until disable_items is called.
  2820. To avoid possible exploits, when enable_items is invoked, it will only enable
  2821. item usage while running that script in particular. Note that if a different
  2822. script also calls enable_items, it will override the last call (so you may
  2823. want to call this command at the start of your script without assuming the
  2824. effect is still in effect).
  2825. ---------------------------------------
  2826. *itemskill <skill id>,<skill level>,"<skill name to show>";
  2827. This is a command meant for item scripts to replicate single-use skills. It will
  2828. not work properly in NPC scripts a lot of the time because casting a skill is
  2829. not allowed when there is a message window or menu on screen. If there isn't one
  2830. cause you've made sure to run this when they already closed it, it should work
  2831. just fine and even show a targeting pointer if this is a targeting skill.
  2832. // When you use Anodyne, you will cast Endure(8) level 1,
  2833. // and "Endure" will appear above your head as you use it.
  2834. 605,Anodyne,Anodyne,11,2000,0,100,,,,,10477567,2,,,,,{ itemskill 8,1,"Endure"; },{}
  2835. ---------------------------------------
  2836. *produce <item level>;
  2837. This command will open a crafting window on the client connected to the invoking
  2838. character. The 'item level' is a number which determines what kind of a crafting
  2839. window will pop-up. You can see the full list of such item levels in
  2840. 'db/produce_db.txt' which determines what can actually be produced.
  2841. The window will not be empty only if the invoking character can actually produce
  2842. the items of that type and has the appropriate raw materials in their inventory.
  2843. Valid item levels are:
  2844. 1 - Level 1 Weapons
  2845. 2 - Level 2 Weapons
  2846. 3 - Level 3 Weapons
  2847. 16 - Blacksmith's Stones and Metals
  2848. 32 - Alchemist's Potions
  2849. 64 - Whitesmith's Coins
  2850. 123 - Whitesmith's Nuggets
  2851. 256 - Assassin Cross's Deadly Poison
  2852. ---------------------------------------
  2853. *successremovecards <equipment slot>;
  2854. This command will remove all cards from the item found in the specified
  2855. equipment slot of the invoking character, create new card items and give them to
  2856. the character. If any cards were removed in this manner, it will also show a
  2857. success effect.
  2858. ---------------------------------------
  2859. *failedremovecards <equipment slot>,<type>;
  2860. This command will remove all cards from the item found in the specified
  2861. equipment slot of the invoking character. 'type' determines what happens to the
  2862. item and the cards:
  2863. 0 - will destroy both the item and the cards.
  2864. 1 - will keep the item, but destroy the cards.
  2865. 2 - will keep the cards, but destroy the item.
  2866. Whatever the type is, it will also show a failure effect on screen.
  2867. ---------------------------------------
  2868. *repair <broken item number>;
  2869. This command repairs a broken peice of equipment, using the same list of broken
  2870. items as available through 'getbrokenid'.
  2871. The official scripts seem to use the repair command as a function instead:
  2872. 'repair(<number>)' but it returns nothing on the stack. Probably only Valaris,
  2873. who made it, can answer why is it so.
  2874. ---------------------------------------
  2875. *successrefitem <equipment slot>;
  2876. This command will refine an item in the specified equipment slot of the invoking
  2877. character by +1. For a list of equipment slots see 'getequipid'. This command
  2878. will not only add the +1, but also display a 'refine success' effect on the
  2879. character and put appropriate messages into their chat window. It will also give
  2880. the character fame points if a weapon reached +10 this way, even though these
  2881. will only take effect for blacksmith who will later forge a weapon.
  2882. The official scripts seem to use the 'successrefitem' command as a function
  2883. instead: 'successrefitem(<number>)' but it returns nothing on the stack.
  2884. This is since jAthena, so probably nobody knows for sure why is it so.
  2885. ---------------------------------------
  2886. *failedrefitem <equipment slot>;
  2887. This command will fail to refine an item in the specified equipment slot of the
  2888. invoking character. The item will be destroyed. This will also display a 'refine
  2889. failure' effect on the character and put appropriate messages into their chat
  2890. window.
  2891. The official scripts seem to use the 'failedrefitem' command as a function
  2892. instead: 'failedrefitem(<number>)' but it returns nothing on the stack. This is
  2893. since jAthena, so probably nobody knows for sure why is it so.
  2894. ---------------------------------------
  2895. *unequip <equipment slot>;
  2896. This command will unequip whatever is currently equipped in the invoking
  2897. character's specified equipment slot. For a full list of possible equipment
  2898. slots see 'getequipid'.
  2899. If an item occupies several equipment slots, it will get unequipped from all of
  2900. them. (Which is a good thing.)
  2901. ---------------------------------------
  2902. *clearitem;
  2903. This command will destroy all items the invoking character has in their
  2904. inventory. (that includes equipped items) It will not affect anything else, like
  2905. storage or cart.
  2906. ---------------------------------------
  2907. *equip <item id>;
  2908. *autoEquip <item id>,<option>;
  2909. These commands are to equip a equipment on the attached character.
  2910. The equip function will equip the item ID given when the player has
  2911. this item in his/her inventory, while the autoequip function will
  2912. equip the given item ID when this is looted. The option parameter of
  2913. the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off.
  2914. Example(s):
  2915. //This will equip a 1104 (falchion) on the character if this is in the inventory.
  2916. equip 1104;
  2917. //The invoked character will now automatically equip a falchion when it's looted.
  2918. autoequip 1104,1;
  2919. //The invoked character will no longer automatically equip a falchion.
  2920. autoequip 1104,0;
  2921. ---------------------------------------
  2922. //
  2923. 4,1.- End of item-related commands
  2924. //
  2925. ---------------------------------------
  2926. *openstorage;
  2927. This will open a character's Kafra storage window on the client connected to the
  2928. invoking character. It does not check wherever it is run from, so you can allow
  2929. any feasible NPC to open a kafra storage. (It's not certain whether this works
  2930. in item scripts, but if it does, it could be interesting.)
  2931. The storage window might not open if a message box or a trade deal is present on
  2932. screen already, so you should at least make sure the message box is closed
  2933. before you open storage.
  2934. mes "I will now open your stash for you";
  2935. close2;
  2936. openstorage;
  2937. end;
  2938. ---------------------------------------
  2939. \\
  2940. 4,2.- Guild-related commands
  2941. \\
  2942. ---------------------------------------
  2943. *guildopenstorage()
  2944. This function works the same as 'openstorage' but will open a guild storage
  2945. window instead for the guild storage of the guild the invoking character belongs
  2946. to. This is a function because it returns a value - 0 if the guild storage was
  2947. opened successfully and 1 if it wasn't. (Notice, it's a ZERO upon success.)
  2948. Since guild storage is only accessible to one character at one time, it may fail
  2949. if another character is accessing the guild storage at the same time.
  2950. This will also fail and return 2 if the character does not belong to any guild.
  2951. ---------------------------------------
  2952. *guildchangegm(<guild id>,<new master's name>)
  2953. This function will change the Guild Master of a guild. The ID is the guild's
  2954. id, and the new guildmaster's name must be passed.
  2955. Returns 1 on success, 0 otherwise.
  2956. ---------------------------------------
  2957. *guildgetexp <amount>;
  2958. This will give the specified amount of guild experience points to the guild the
  2959. invoking character belongs to. It will silently fail if they do not belong to
  2960. any guild.
  2961. ---------------------------------------
  2962. *guildskill <skill id>,<level>
  2963. This command will bump up the specified guild skill by the specified number of
  2964. levels. This refers to the invoking character and will only work if the invoking
  2965. character is a member of a guild AND it's guildmaster, otherwise no failure
  2966. message will be given and no error will occur, but nothing will happen - same
  2967. about the guild skill trying to exceed the possible maximum. The full list of
  2968. guild skills is available in 'db/skill_db.txt', these are all the GD_ skills at
  2969. the end.
  2970. The flag parameter is currently not functional and it's a mystery of what it
  2971. would actually do. (Though probably, like for character skills, it would allow
  2972. temporary bumping.) Using this command will bump the guild skill up permanently.
  2973. // This would give your character's guild one level of Approval (GD_APPROVAL ID
  2974. // 10000). Notice that if you try to add two levels of Approval, or add
  2975. // Approval when the guild already has it, it will only have one level of
  2976. // Approval afterwards.
  2977. guildskill 10000,1,0;
  2978. You might want to make a quest for getting a certain guild skill, make it hard
  2979. enough that all the guild needs to help or something. Doing this for the Glory
  2980. of the Guild skill, which allows your guild to use an emblem, is a good idea for
  2981. a fun quest. (Wasting a level point on that is really annoying :D)
  2982. ---------------------------------------
  2983. //
  2984. 4,2 End of guild-related commands.
  2985. //
  2986. ---------------------------------------
  2987. *resetlvl <action type>;
  2988. This is a character reset command, meant mostly for rebirth script supporting
  2989. Advanced jobs, which will reset the invoking character's stats and level
  2990. depending on the action type given. Valid action types are:
  2991. 1 - Base level 1, Job level 1, 0 skill points, 0 base xp, 0 job xp, wipes the
  2992. status effects, sets all stats to 1. If the new job is 'Novice High', give
  2993. 100 status points, give First Aid and Play Dead skills.
  2994. 2 - Base level 1, Job level 1, 0 skill points, 0 XP/JXP. Skills and attribute
  2995. values are not altered.
  2996. 3 - Base level 1, base xp 0. Nothing else is changed.
  2997. 4 - Job level 1, job xp 0. Nothing else is changed.
  2998. In all cases it will also unequip everything the character has on.
  2999. Even though it doesn't return a value, it is used as a function in the official
  3000. rebirth scripts. Ask AppleGirl why.
  3001. ---------------------------------------
  3002. *resetstatus;
  3003. This is a character reset command, which will reset the stats on the invoking
  3004. character and give back all the stat points used to raise them previously.
  3005. Nothing will happen to any other numbers about the character.
  3006. Used in reset NPC's (duh!)
  3007. ---------------------------------------
  3008. *resetskill;
  3009. This command takes off all the skill points on the invoking character, so they
  3010. only have Basic Skill blanked out (lvl 0) left, and returns the points for them
  3011. to spend again. Nothing else will change but the skills. Quest skills will also
  3012. reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If
  3013. the 'quest_skill_learn' option is set in there, the points in the quest skills
  3014. will also count towards the total.
  3015. Used in reset NPC's (duh!)
  3016. ---------------------------------------
  3017. *sc_start <effect type>,<ticks>,<extra argument>{,<target ID number>};
  3018. *sc_start2 <effect type>,<ticks>,<extra argument>,<percent chance>{,<target ID number>};
  3019. *sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<target ID number>};
  3020. *sc_end <effect type>{,<target ID number>};
  3021. These command bestow a status effect on the invoking character. This command is
  3022. used a lot in the item scripts.
  3023. // This would poison them for 10 min
  3024. sc_start SC_Poison,600000,0;
  3025. Effect type is a number of effect, 'db/const.txt' lists the common (mostly
  3026. negative) status effect types as constants, starting with 'SC_'. You can also
  3027. use this to give someone an effect of a player-cast spell:
  3028. // This will bless someone as if with Bless 10:
  3029. sc_start 10,240000,10;
  3030. Extra argument's meaning differs depending on the effect type, for most effects
  3031. caused by a player skill the extra argument means the level of the skill that
  3032. would have been used to create that effect, for others it might have no meaning
  3033. whatsoever. You can actually bless someone with a 0 bless spell level this way,
  3034. which is fun, but weird.
  3035. The target ID number, if given, will cause the status effect to appear on a
  3036. specified character, instead of the one attached to the running script. This has
  3037. not been properly tested.
  3038. 'sc_start2' is perfectly equivalent, but unlike 'sc_start', a status change
  3039. effect will only occur with a specified percentage chance. 10000 given as the
  3040. chance is equivalent to a 100% chance, 0 is a zero.
  3041. 'sc_start4' is just like sc_start, however it takes four parameters for the
  3042. status change instead of one. What these values are depends on the status
  3043. change in question. For example, elemental armor defense takes the following
  3044. four values:
  3045. - val1 is the first element, val2 is the resistance to the element val1.
  3046. - val3 is the second element, val4 is the resistance to said element.
  3047. eg: sc_start4 SC_DefEle,60000,Ele_Fire,20,Ele_Water,-15;
  3048. 'sc_end' will remove a specified status effect. If SC_All is used (-1), it will
  3049. do a complete removal of all statuses (although permanent ones will re-apply).
  3050. You can see the full list of status effects caused by skills in
  3051. 'src/map/status.h' - they are currently not fully documented, but most of that
  3052. should be rather obvious.
  3053. ---------------------------------------
  3054. *skilleffect <skill id>,<number>;
  3055. This command will display the visual and sound effects of a specified skill (see
  3056. 'db/skill_db.txt' for a full list of skills) on the invoking character's sprite.
  3057. Nothing but the special effects and animation will happen. If the skill's normal
  3058. effect displays a floating number, the number given will float up.
  3059. // This will heal the character with 2000 hp, buff with
  3060. // Bless 10 and Increase AGI 5, and display appropriate
  3061. // effects.
  3062. mes "Blessed be!";
  3063. skilleffect 28,2000;
  3064. heal 2000,0;
  3065. skilleffect 34,0;
  3066. // That's bless 10.
  3067. sc_start 10,240000,10;
  3068. skilleffect 29,0;
  3069. // That's agi 5
  3070. sc_start 12,140000,5;
  3071. ---------------------------------------
  3072. *npcskilleffect <skill id>,<number>,<x>,<y>;
  3073. This command behaves identically to 'skilleffect', however, the effect will not
  3074. be centered on the invoking character's sprite, nor on the NPC sprite, if any,
  3075. but will be centered at map coordinates given on the same map as the invoking
  3076. character.
  3077. ---------------------------------------
  3078. *specialeffect <effect number>;
  3079. This command will display special effect with the given number, centered on the
  3080. specified NPCs coordinates, if any. For a full list of special effect numbers
  3081. known see 'doc/effect_list.txt'. Some effect numbers are known not to work in
  3082. some client releases. (Notably, rain is absent from any client executables
  3083. released after April 2005.)
  3084. ---------------------------------------
  3085. *specialeffect2 <effect number>;
  3086. This command behaves identically to the 'specialeffect', but the effect will be
  3087. centered on the invoking character's sprite.
  3088. ---------------------------------------
  3089. *statusup <stat>;
  3090. This command will bump a specified stat of the invoking character up by one
  3091. permanently. Stats are to be given as number, but you can use these constants to
  3092. replace them:
  3093. bStr - Strength
  3094. bVit - Vitality
  3095. bInt - Intelligence
  3096. bAgi - Agility
  3097. bDex - Dexterity
  3098. bLuk - Luck
  3099. ---------------------------------------
  3100. *statusup2 <stat>,<amount>;
  3101. This command will bump a specified stat of the invoking character up by the
  3102. specified amount permanently. The amount can be negative. See 'statusup'.
  3103. // This will decrease a character's Vit forever.
  3104. statusup bVit,-1;
  3105. ---------------------------------------
  3106. *bonus <bonus type>,<val1>;
  3107. *bonus2 <bonus type>,<val1>,<val2>;
  3108. *bonus3 <bonus type>,<val1>,<val2>,<val3>;
  3109. *bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
  3110. These commands are meant to be used in item scripts. They will probably work
  3111. outside item scripts, but the bonus will not persist for long. They, as
  3112. expected, refer only to an invoking character.
  3113. You can find the full list of possible bonuses and which command to use for each
  3114. kind in 'doc/item_bonus.txt'.
  3115. ---------------------------------------
  3116. *skill <skill id>,<level>{,<flag>};
  3117. *addtoskill <skill id>,<level>{,<flag>}
  3118. These commands will give the invoking character a specified skill. This is also
  3119. used for item scripts.
  3120. Level is obvious. Skill id is the ID number of the skill in question as per
  3121. 'db/skill_db.txt'. It is not known for certain whether this can be used to give
  3122. a character a monster's skill, but you're welcome to try with the numbers given
  3123. in 'db/mob_skill_db.txt'.
  3124. Flag is 0 if the skill is given permanently (will get written with the character
  3125. data) or 1 if it is temporary (will be lost eventually, this is meant for card
  3126. item scripts usage.). The flag parameter is optional, and defaults to 1 in
  3127. 'skill' and to 2 in 'addtoskill'.
  3128. Flag 2 means that the level parameter is to be interpreted as a stackable
  3129. additional bonus to the skill level. If the character did not have that skill
  3130. previously, they will now at 0+the level given.
  3131. // This will permanently give the character Stone Throw (TF_THROWSTONE,152), at
  3132. // level 1.
  3133. skill 152,1,0;
  3134. ---------------------------------------
  3135. *nude;
  3136. This command will unequip anything equipped on the invoking character.
  3137. It is not required to do this when changing jobs since 'jobchange' will unequip
  3138. everything not equippable by the new job class anyway.
  3139. ---------------------------------------
  3140. *disguise <Monster ID>;
  3141. *undisguise;
  3142. This command disgueses current player with a monster sprite.
  3143. The disguise is disappearing on re-login or on 'undisguise' command.
  3144. Note: It doesn't work with "Pets with equipment on"
  3145. Note: If u're a Sniper, u'd get an old Falcon over your head
  3146. Note: You can kill yourself with some skills
  3147. Note: Monsters of your type could heal you
  3148. Example:
  3149. disquise 1002; //Yay! You're a Poring!!!
  3150. next;
  3151. undisquise; //Yay!!!! You're a human again!!
  3152. ---------------------------------------
  3153. \\
  3154. 4,3 Marriage-related commands
  3155. \\
  3156. ---------------------------------------
  3157. *marriage("<spouse name>");
  3158. This function will marry two characters, the invoking character and the one
  3159. referred to by name given, together, setting them up as each other's marriage
  3160. partner. No second function call has to be issued (in current SVN at least) to
  3161. make sure the marriage works both ways. The function returns 1 upon success, or
  3162. 0 if the marriage could not be completed, either because the other character
  3163. wasn't found or because one of the two characters is already married.
  3164. This will do nothing else for the marriage except setting up the spouse ID for
  3165. both of these characters. No rings will be given and no effects will be shown.
  3166. ---------------------------------------
  3167. *wedding;
  3168. This command will call up wedding effects - the music and confetti - centered on
  3169. the invoking character.
  3170. ---------------------------------------
  3171. *divorce()
  3172. This function will un-marry the invoking character from whoever they were
  3173. married to. Both will no longer be each other's marriage partner, (at least in
  3174. current SVN, which prevents the cases of multi-spouse problems). It will return
  3175. 1 upon success or 0 if the character was not married at all.
  3176. This function will also destroy both wedding rings and send a message to both
  3177. players, telling them they are now divorced.
  3178. ---------------------------------------
  3179. *adopt "<parent name>","<parent name>","<novice name>";
  3180. *adopt("<parent name>","<parent name>","<novice name>")
  3181. This command will set up a novice as a baby of a married couple. All three are
  3182. referred to by character name. The correct variables are set on all three
  3183. characters in the same call. The command will unequip anything the novice has
  3184. equipped and make them a Job_Baby class, as well as send them a 'your job has
  3185. been changed' message.
  3186. Beware of calling this from inside a 'callfunc' function, cause upon successful
  3187. adoption, this command returns a zero, as if it were a function. This is likely
  3188. to screw up execution of a 'return' command. You may try to call it as a
  3189. function instead, but it doesn't return anything upon an error, which may also
  3190. cause script execution to throw up errors.
  3191. Nothing will happen (and nothing will be returned either) if either future
  3192. parent is below base level 70 and/or if any of the three characters is not found
  3193. online.
  3194. ---------------------------------------
  3195. //
  3196. 4,3.- End of marriage-related commands
  3197. //
  3198. ---------------------------------------
  3199. *pcfollow <id>,<target id>;
  3200. *pcstopfollow <id>;
  3201. Makes a character follow or stop following someone. This command does the same as the @follow command.
  3202. The main difference is that @follow can use character names, and this commands needs the Account ID for the target.
  3203. Example(s):
  3204. //This will make Aaron follow Bullah, when both of these characters are online.
  3205. PCFollow getCharID(3,"Aaron"),getCharID(3,"Bullah");
  3206. //Makes Aaron stop following whoever he is following.
  3207. PCStopFollow getCharID(3,"Aaron");
  3208. ---------------------------------------
  3209. * pcblockmove <id>,<option>;
  3210. Prevents the given ID from moving when the option != 0, 0 enables the ID to move again.
  3211. ID should be able to be GID of a monster/npc or AID from a character.
  3212. Example(s):
  3213. //prevents the current char from moving away;
  3214. pcblockmove getcharid(3),1;
  3215. //enables the current char to move again.
  3216. pcblockmove getcharid(3),0;
  3217. ---------------------------------------
  3218. ==================================
  3219. |5.- Mob / NPC -related commands.|
  3220. ==================================
  3221. ---------------------------------------
  3222. *monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>"};
  3223. *areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<monster name>",<amount>{,"<event label>"};
  3224. This command will spawn a monster on the specified coordinates on the specified
  3225. map. If the script is invoked by a character, a special map name, "this", will
  3226. be recognised to mean the name of the map the invoking character is located at.
  3227. This command works fine in the item scripts.
  3228. The same command arguments mean the same things as described above in the
  3229. beginning of this document when talking about permanent monster spawns. Monsters
  3230. spawned in this manner will not respawn upon being killed.
  3231. Unlike the permanent monster spawns, if the mob id is -1, a random monster will
  3232. be picked from the entire database according to the rules configured in the
  3233. server for dead branches. This will work for all other kinds of non-permanent
  3234. monster spawns.
  3235. The only very special thing about this command is an event label, which is an
  3236. optional parameter. This label is written like '<NPC object name>::<label name>'
  3237. and upon the monster being killed, it will execute the script inside of the
  3238. specified NPC object starting from the label given. The RID of the player
  3239. attached at this execution will be the RID of the killing character.
  3240. monster "place.gat",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
  3241. If you do not specify any event label, a label in the NPC object that ran this
  3242. command, called 'OnMyMobDead:' will execute anyway, if present.
  3243. The coordinates of 0,0 will spawn the monster on a random place on the map.
  3244. The 'areamonster' command works much like the 'monster' command and is not
  3245. significantly different, but spawns the monsters within a square defined by
  3246. x1/y1-x2/y2.
  3247. Simple monster killing script:
  3248. <Normal NPC object definition. Let's assume you called him NPCNAME.>
  3249. mes "[Summon Man]";
  3250. mes "Want to start the kill?";
  3251. next;
  3252. menu "Yes",L_Yes,"No",-;
  3253. mes "[Summon Man]";
  3254. mes "Come back later";
  3255. close;
  3256. L_Yes:
  3257. monster "prontera.gat",0,0,"Quest Poring",1002,10,"NPCNAME::OnPoringKilled";
  3258. // By using 0,0 it will spawn them in a random place.
  3259. mes "[Summon Man]";
  3260. mes "Now go and kill all the Poring I summoned";
  3261. // He summoned ten.
  3262. close;
  3263. L_PoringKilled:
  3264. set $PoringKilled,$PoringKilled+1;
  3265. if ($PoringKilled==10) goto L_AllDead;
  3266. end;
  3267. L_AllDead:
  3268. announce "Summon Man: Well done all the poring are dead",3;
  3269. set $PoringKilled,0;
  3270. end;
  3271. For more good examples see just about any official 2-1 or 2-2 job quest script.
  3272. ---------------------------------------
  3273. *killmonster "<map name>","<event label>";
  3274. This command will kill all monsters that were spawned with 'monster' or
  3275. 'addmonster' and have a specified event label attached to them. Commonly used to
  3276. get rid of remaining quest monsters once the quest is complete.
  3277. If the label is given as "All", all monsters which have their respawn times set
  3278. to -1 (like all the monsters summoned with 'monster' or 'areamonster' script
  3279. command, and all monsters summoned with GM commands, but no other ones - that
  3280. is, all non-permanent monsters) on the specified map will be killed regardless
  3281. of the event label value.
  3282. ---------------------------------------
  3283. *killmonsterall "<map name>";
  3284. This command will kill all monsters on a specified map name, regardless of how
  3285. they were spawned or what they are.
  3286. ---------------------------------------
  3287. *strmobinfo(<type>,<monster id>);
  3288. This function will return information about a monster record in the database, as
  3289. per 'db/mob_db.txt'. Type is the kind of information returned. Valid types are:
  3290. 1 - 'english name' field in the database, a string.
  3291. 2 - 'japanese name' field in the database, a string.
  3292. All other returned values are numbers:
  3293. 3 - Level.
  3294. 4 - Maximum HP.
  3295. 5 - Maximum SP.
  3296. 6 - Experience reward.
  3297. 7 - Job experience reward.
  3298. ---------------------------------------
  3299. *mobcount("<map name>","<event label>")
  3300. This function will count all the monsters on the specified map that have a given
  3301. event label and return the number or 0 if it can't find any. Naturally, only
  3302. monsters spawned with 'monster' and 'areamonster' script commands can be like
  3303. this.
  3304. However, apparently, if you pass this function an empty string for the event
  3305. label, it should return the total count of normal permanently respawning
  3306. monsters instead. With the current dynamic mobs system, where mobs are not kept
  3307. in memory for maps with no actual people playing on them, this will return a 0
  3308. for any such map.
  3309. ---------------------------------------
  3310. *clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
  3311. This command creates a monster which is a copy of another player. The first
  3312. four arguments serve the same purpose as in the monster script command, The
  3313. <char id> is the character id of the player to clone (player must be online).
  3314. If <master id> is given, the clone will be a 'slave/minion' of it. Master_id
  3315. must be a character id of another online player.
  3316. The mode can be specified to determine the behaviour of the clone, it's
  3317. values are the same as the ones used for the mode field in the mob_db. The
  3318. default mode is aggressive, assists, can move, can attack.
  3319. Flag can be either zero or one currently. If zero, the clone is a normal
  3320. monster that'll target players, if one, it is considered a summoned monster,
  3321. and as such, it'll target other monsters. Defaults to zero.
  3322. The duration specifies how long the clone will live before it is auto-removed.
  3323. Specified in seconds, defaults to no limit (zero).
  3324. Returned value is the monster ID of the spawned clone. If command fails,
  3325. returned value is zero.
  3326. ---------------------------------------
  3327. *summon "Monster name",<monster id>{,<Time Out>{,"event label"}};
  3328. This command will summon a monster. (see also 'monster') Unlike monsters spawned
  3329. with other commands, this one will set up the monster to fight to protect the
  3330. invoking character. Monster name and mob id obey the same rules as the one given
  3331. at the beginning of this document for permanent monster spawns with the
  3332. exceptions mentioned when describing 'monster' command.
  3333. The effect for the skill 'Call Homonuculus' will be displayed centered on the
  3334. invoking character.
  3335. Timeout is the time in milliseconds the summon lives, and is set default
  3336. to 60000 (1 minute). Note that also the value 0 will set the timer to default,
  3337. and it is not possible to create a spawn that lastst forever.
  3338. If an event label is given, upon the monster being killed, the event label will
  3339. run as if by 'donpcevent'.
  3340. // Will summon a dead branch-style monster to fight for the character.
  3341. summon "--ja--",-1;
  3342. ---------------------------------------
  3343. * homunculus_evolution;
  3344. This command will try to evolve the current player's homunculus.
  3345. If it doesn't work, the /swt emoticon is shown.
  3346. To evolve a homunculus, the invoking player must have a homunculus,
  3347. the homunculus must not be the last evolution and
  3348. the homunculus must be on at least 91000/100000 intimacy with it's owner.
  3349. ---------------------------------------
  3350. ------------------------------------------------
  3351. //===========================================\\
  3352. || Mob Control Suit Commands ||
  3353. \\===========================================//
  3354. ------------------------------------------------
  3355. ---------------------------------------
  3356. * mobspawn (<monster name>,<monster ID>,<mapname>,<x>,<y>)
  3357. * mobRemove <GID>;
  3358. This is used to spawn a monster and return it's Game ID, to be used
  3359. in the unit/mobcontrol commands.
  3360. Note, I will use the stuff here in the examples for the unitcontrol.
  3361. Example(s):
  3362. //Spawns a poring named poi poi and put's it's GID in .GID.
  3363. set .GID,mobspawn("Poi Poi",1002,"prontera.gat",160,180);
  3364. //would kill our poring.
  3365. mobRemove .GID;
  3366. ---------------------------------------
  3367. * getmobdata (<GID>,<arrayname>)
  3368. * setmobdata <GID>,<parameter>,<new value>;
  3369. This is used to get and set special data related to the monster.
  3370. With getmobdata, the array given will be filled with the current data. In setmobdata
  3371. the indexes in the array would be used to set that data on the monster.
  3372. Parameters (indexes) are:
  3373. 0 = class (big, small, normal) 7 = y 14 = hair style 21 = weapon
  3374. 1 = level 8 = speed 15 = hair color 22 = shield (again)
  3375. 2 = HP 9 = mode (see doc/mob_db_mode_list.txt) 16 = head gear bottom 23 = looking dir
  3376. 3 = max HP 10 = special AI state (?) 17 = head gear middle 24 = killer state (1 or 0)
  3377. 4 = master ID (aid of the master, summon) 11 = SC option 18 = head gear top 25 = callback flag
  3378. 5 = map index 12 = sex 19 = cloth color 26 = no random walk (1 or 0)
  3379. 6 = x 13 = class (Monster ID, Job ID) 20 = shield
  3380. Example(s):
  3381. //this will set all the mobdata in the @array variable. (@array[1] being level, @array[13] class etc)
  3382. getmobdata .GID,@array;
  3383. //set the max hp of our poring to 1000.
  3384. setmobdata .GID,3,1000;
  3385. ---------------------------------------
  3386. * mobassist <GID>,<target id>;
  3387. This will make the monster assist the Target ID as if it was a summon of it.
  3388. Example(s):
  3389. /this will make our poring assist the current attached player! >:3
  3390. mobassist .GID,getcharid(3);
  3391. ---------------------------------------
  3392. * mobattach <GID>{,"<NPC Name>"};
  3393. GID is the GID of a monster, NPC or account id. The NPC running or
  3394. he NPC name given is used to attach the monster.
  3395. By attaching a monster, the NPC to which it is attached is ran on special actions by the monster.
  3396. The system will set specific data in the .ai_action variable array on the NPC invoked.
  3397. The special AI actions types are set in the .ai_action at place AI_ACTION_TAR_TYPE
  3398. More AI_ vars are set in const.txt, and you can also look at sample/monstercontroller.cpp:
  3399. ---------------------------------------
  3400. * unitwalk <GID>,<x>,<y>;
  3401. * unitwalk <GID>,<mapid>;
  3402. This is one command, but can be used in two ways. If only the first argument is given,
  3403. the unit whose GID is given will start walking towards the map with the given mapid
  3404. (we believe these are the mapindexes found in db/map_index.txt).
  3405. When 2 arguments are passed, the given unit will walk to the given x,y coordinates on
  3406. the map where the unit currently is.
  3407. Example(s):
  3408. //Will move/walk the poring we made to the coordinates 150,150
  3409. unitwalk .GID,150,150;
  3410. //Will move the poring towards alberta (if my assumed mapindexes are correct).
  3411. unitwalk .GID,3;
  3412. ---------------------------------------
  3413. * unitkill <GID>;
  3414. * unitwarp <GID>,<Mapname>,<x>,<y>;
  3415. * unitattack <GID>,<Target ID>;
  3416. * unitstop <GID>;
  3417. * unittalk <GID>,<Text>;
  3418. * unitemote <GID>,<Emote>;
  3419. * unitdeadsit <GID>,<Action?>;
  3420. Okay, these commands should be fairly self explaining.
  3421. For the emotions, you can look in db/const.txt for prefixes with e_
  3422. The unitdeadsit uses an action, not exactly sure why it's named unitdeadsit...
  3423. Anyhoo: actions are
  3424. 0: normal attack
  3425. 1: pick stone like
  3426. 2: normal sit
  3427. 3: nothing?
  3428. ---------------------------------------
  3429. ------------------------------------------------
  3430. //===========================================\\
  3431. || End of Mob Control Suit Commands ||
  3432. \\===========================================//
  3433. ------------------------------------------------
  3434. ---------------------------------------
  3435. *disablenpc "<NPC object name>";
  3436. *enablenpc "<NPC object name>";
  3437. These two commands will disable and enable, respectively, an NPC object
  3438. specified by name. The disabled NPC will disappear from sight and will no longer
  3439. be triggerable in the normal way. It is not clear whether it will still be
  3440. accessible through 'donpcevent' and other triggering commands, but it probably
  3441. will be. You can disable even warp NPCs if you know their object names, which is
  3442. an easy way to make a map only accessible through walking half the time. Then
  3443. you 'enablenpc' them back.
  3444. You can also use these commands to create the illusion of an NPC switching
  3445. between several locations, which is often better than actually moving the NPC -
  3446. create one NPC object with a visible and a hidden part to their name, make a few
  3447. copies, and then disable all except one.
  3448. ---------------------------------------
  3449. *hideonnpc "<NPC object name>";
  3450. *hideoffnpc "<NPC object name>";
  3451. These commands will make the NPC object specified display as hidden/visible,
  3452. even though not actually disabled per se. Hidden as in thief Hide skill, but
  3453. unfortunately, not detectable by Ruwach or Sight.
  3454. As they are now, these commands are pointless, it is suggested to use
  3455. 'disablenpc'/'enablenpc', because these two commands actually unload the NPC
  3456. sprite location and other accompanying data from memory when it is not used.
  3457. However, you can use these for some quest ideas (such as cloaking npcs talking
  3458. while hidden then revealing.... you can wonder around =P
  3459. ---------------------------------------
  3460. *doevent "<NPC object name>::<event label>";
  3461. This command will start a new execution thread in a specified NPC object at the
  3462. specified label. The execution of the script running this command will not stop.
  3463. No parameters may be passed with a doevent call.
  3464. The script of the NPC object invoked in this manner will run as if it's been
  3465. invoked by the RID that was active in the script that issued a 'doevent'.
  3466. place.gat,100,100,1%TAB%script%TAB%NPC%TAB%53,{
  3467. mes "This is what you will see when you click me";
  3468. close;
  3469. Label:
  3470. mes "This is what you will see if the doevent is activated";
  3471. close;
  3472. }
  3473. ....
  3474. doevent "NPC::Label";
  3475. ---------------------------------------
  3476. *donpcevent "{NPC NAME}::<event label>";
  3477. This command is kinda confusing cause it performs in two completely different
  3478. ways.
  3479. If the event label is phrased like "::<label name>", all NPC objects that have a
  3480. specified label in them will be invoked as if by a 'doevent', but no RID
  3481. whatsoever will be attached while they execute.
  3482. Otherwise, if the label is given as "<NPC name>::<label name>", a label within
  3483. the NPC object that runs this command will be called, but as if it was running
  3484. inside another, specified NPC object. No RID will be attached to it in this case
  3485. either.
  3486. This can be used for making another NPC react to an action that you have done
  3487. with the NPC that has this command in it, i.e. show an emotion, or say
  3488. something.
  3489. place.gat,100,100,1%TAB%script%TAB%NPC%TAB%53,{
  3490. mes "Hey NPC2 copy what I do";
  3491. close2;
  3492. set @emo, rand(1,30);
  3493. donpcevent "NPC2::Emo";
  3494. Emo:
  3495. emotion @emo;
  3496. end;
  3497. }
  3498. place.gat,102,100,1%TAB%script%TAB%NPC2%TAB%53,{
  3499. mes "Hey NPC copy what I do";
  3500. close2;
  3501. set @emo, rand(1,30);
  3502. donpcevent "NPC::Emo";
  3503. Emo:
  3504. emotion @emo;
  3505. end;
  3506. }
  3507. This will make both NPC perform the same random emotion from 1 to 30, and the
  3508. emotion will appear above each of their heads.
  3509. ---------------------------------------
  3510. *npctalk "<message>";
  3511. This command will display a message to the surrounding area as if the NPC object
  3512. running it was a player talking - that is, above their head and in the chat
  3513. window. The display name of the NPC will get appended in front of the message to
  3514. complete the effect.
  3515. // This will make everyone in the area see the NPC greet the character
  3516. // who just invoked it.
  3517. npctalk "Hello "+strcharinfo(0)+" how are you";
  3518. ---------------------------------------
  3519. \\
  3520. 5,1.- Time-related commands
  3521. \\
  3522. ---------------------------------------
  3523. *addtimer <ticks>,"<NPC object name>::<label>";
  3524. *deltimer "<NPC object name>::<event label>";
  3525. *addtimercount <ticks>,"<NPC object name>::<event label>";
  3526. These commands will create, destroy, and delay a countdown timer - 'addtimer' to
  3527. create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified
  3528. number of ticks. For all three cases, the event label given is the identifier of
  3529. that timer.
  3530. When this timer runs out, a new execution thread will start in the specified NPC
  3531. object at the specified label. If no such label is found in the NPC object, it
  3532. will run as if clicked. In either case, no RID will be attached during
  3533. execution.
  3534. The ticks are given in 1/1000ths of a second.
  3535. ---------------------------------------
  3536. *stoptimer;
  3537. *inittimer;
  3538. *enablearena;
  3539. *disablearena;
  3540. *cmdothernpc "<npc name?>","<command?>";
  3541. This set of commands is marked as added by someone going under the nickname
  3542. 'RoVeRT', as mentioned the source code comments, and has to do with timers and
  3543. scheduling working entirely unlike any other timing commands. It is not certain
  3544. that they actually even work properly anymore, and most of these read no
  3545. arguments, though the 'inittimer'/'stoptimer' pair of commands has to do
  3546. something with an 'OnTimer' label and will probably invoke it and 'cmdothernpc'
  3547. will execute starting with the label 'OnCommand'. Whatever they actually do, the
  3548. other commands can most likely do it better. The two arena commands definitely
  3549. do not do anything useful at all.
  3550. None of these commands are used in any scripts bundled with eAthena. Most
  3551. probably they are deprecated and left in by mistake.
  3552. Unless RoVeRT can be found and asked to clarify what these were made for, that
  3553. is.
  3554. ---------------------------------------
  3555. *initnpctimer{ "<NPC object name>" {, <Attach Flag>} } |
  3556. {"<NPC object name>" | <Attach Flag> };
  3557. *stopnpctimer{ "<NPC object name>" {, <Detach Flag>} } |
  3558. { "<NPC object name>" | <Detach Flag> };
  3559. *startnpctimer{ "<NPC object name>" {, <Attach Flag>} } |
  3560. { "<NPC object name>" | <Attach Flag> };
  3561. *setnpctimer <tick>{,"<NPC object name>"};
  3562. *getnpctimer(<type of information>{,"<NPC object name>"});
  3563. *attachnpctimer {"<character name>"};
  3564. *detachnpctimer {"<NPC object name>"};
  3565. This set of commands and functions will create and manage an NPC-object based
  3566. timer. The NPC object may be declared by name, or the name in all cases may be
  3567. omitted, in that case this timer will be based in the object the current script
  3568. is running in.
  3569. Why is it actually part of an NPCs structure we aren't sure, but it is, and
  3570. while 'addtimer'/'deltimer' commands will let you have many different timers
  3571. referencing different labels in the same NPC, one each and each with their own
  3572. countdown, 'initnpctimer' can only have one per NPC object. But it can trigger
  3573. many labels and it can let you know how many were triggered already and how many
  3574. still remain.
  3575. This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon
  3576. creating this timer, the execution will not stop, but will happily continue
  3577. onward. The timer will then invoke new execution threads at labels
  3578. "OnTimer<time>:" in the NPC object it is attached to.
  3579. To create the timer, use the 'initnpctimer', which will start it running.
  3580. 'stopnpctimer' will pause the timer, without clearing the current tick, while
  3581. 'startnpctimer' will let the paused timer continue.
  3582. By default timers do not have a RID attached, which lets the timers continue even
  3583. if the player that started them logs off. To attach a RID to a timer, you can
  3584. either use the "attach flag" optional value when using initnpctimer/startnpctimer,
  3585. likewise, the optional flag of stopnpctimer detaches any RID after stopping
  3586. the timer. Once a player is attached to a timer, it stays attached to all
  3587. timers from that script until detached manually. You can have multiple
  3588. npctimers going on at the same time as long as each one has a different player
  3589. attached (think of each RID being used as an independant timer).
  3590. The other method to attach/detach a RID is through the script commands
  3591. 'attachnpctimer' and 'detachnpctimer'. Once attached, that will make the
  3592. character the target for all character-referencing commands and functions,
  3593. not to mention variables.
  3594. 'setnpctimer' will explicitly set the timer to a given tick. To make it useful,
  3595. you will need the 'getnpctimer' function, which the type of information argument
  3596. means:
  3597. 0 - Will return the current tick count of the timer.
  3598. 1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the
  3599. specified NPC waiting for execution.
  3600. 2 - Will return the number of times the timer has triggered an "OnTimer<tick>:"
  3601. label in the specified NPC.
  3602. Example 1:
  3603. <NPC Header> {
  3604. initnpctimer;
  3605. npctalk "I cant talk right now, give me 10 seconds";
  3606. end;
  3607. OnTimer5000:
  3608. npctalk "Ok 5 seconds more";
  3609. end;
  3610. OnTimer6000:
  3611. npctalk "4";
  3612. end;
  3613. OnTimer7000:
  3614. npctalk "3";
  3615. end;
  3616. OnTimer8000:
  3617. npctalk "2";
  3618. end;
  3619. OnTimer9000:
  3620. npctalk "1";
  3621. end;
  3622. OnTimer10000:
  3623. stopnpctimer;
  3624. mes "[Man]";
  3625. mes "Ok we can talk now";
  3626. }
  3627. Example 2:
  3628. OnTimer15000:
  3629. set $quote,rand(5);
  3630. if($quote == 0) goto Lquote0;
  3631. if($quote == 1) goto Lquote1;
  3632. if($quote == 2) goto Lquote2;
  3633. if($quote == 3) goto Lquote3;
  3634. if($quote == 4) goto Lquote4;
  3635. Lquote0:
  3636. npctalk "If 0 is randomly picked you will see this";
  3637. setnpctimer 0;
  3638. end;
  3639. Lquote1:
  3640. npctalk "If 1 is randomly picked you will see this";
  3641. setnpctimer 0;
  3642. end;
  3643. Lquote2:
  3644. npctalk "If 2 is randomly picked you will see this";
  3645. setnpctimer 0;
  3646. end;
  3647. Lquote3:
  3648. npctalk "If 3 is randomly picked you will see this";
  3649. setnpctimer 0;
  3650. end;
  3651. Lquote4:
  3652. npctalk "If 4 is randomly picked you will see this";
  3653. setnpctimer 0;
  3654. end;
  3655. // This OnInit label will run when the script is loaded, so that the timer
  3656. // is initialised immediately as the server starts. It is dropped back to 0
  3657. // every time the NPC says something, so it will cycle continiously.
  3658. OnInit:
  3659. initnpctimer;
  3660. end;
  3661. Example 3:
  3662. mes "[Man]";
  3663. mes "I have been waiting "+(getnpctimer(0)/1000)+" seconds for you";
  3664. // we divide the timer returned by 1000 cause it will be displayed in
  3665. // milliseconds otherwise
  3666. close;
  3667. Example 4:
  3668. mes "[Man]";
  3669. mes "Ok I will let you have 30 sec more";
  3670. close2;
  3671. setnpctimer (getnpctimer(0)-30000);
  3672. // Notice the 'close2'. If there were a 'next' there the timer would be
  3673. // changed only after the player pressed the 'next' button.
  3674. end;
  3675. ---------------------------------------
  3676. *sleep {<milliseconds>};
  3677. *sleep2 {<milliseconds>};
  3678. *awake "<NPC name>";
  3679. These commands are used to control the pause of a NPC.
  3680. sleep and sleep2 will pause the script for the given amount of milliseconds.
  3681. Awake is used to cancel a sleep. When awake is callen on a NPC it will run as
  3682. if the sleep timer ran out, and thus making the script continue. Sleep and sleep2
  3683. basically do the same, but the main difference is that sleep will not keep the rid,
  3684. while sleep2 does.
  3685. Examples:
  3686. sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore)
  3687. sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached.
  3688. awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'.
  3689. ---------------------------------------
  3690. //
  3691. 5,1.- End of time-related commands
  3692. //
  3693. *announce "<text>",<flag>{,<color>};
  3694. This command will broadcast a message to all or most players, similar to
  3695. @kami/@kamib GM commands.
  3696. The region the broadcast is heard in and the color the message will come up as
  3697. will be determined by the flags:
  3698. announce "This will be shown to everyone at all in yellow.",0;
  3699. The flag values are coded as constants in db/const.txt to make them easier to use:
  3700. - bc_all: Broadcast message is sent server-wide
  3701. - bc_map: Message is sent to everyone in the same map
  3702. - bc_area: Message is sent to players in the vecinity of the source.
  3703. - bc_self: Message is sent only to current player.
  3704. - bc_npc: Broadcast source is the npc, not the player attached to the script
  3705. (useful when a player is not attached or the message should be sent to those
  3706. nearby the npc)
  3707. - bc_yellow: The default is to send broadcasts in yellow color.
  3708. - bc_blue: Alternate broadcast is displayed in blue color.
  3709. The optional parameter, color, allows usage of broadcasts in any custom color.
  3710. The color parameter is a single number which can be in hexadecimal notation.
  3711. For example:
  3712. announce "This will be shown to everyone at all in yellow.",bc_all,0xFFFF00;
  3713. Will display a global announce in yellow. The color format is in RGB (0xRRGGBB).
  3714. Using this for private messages to players is probably not that good an idea,
  3715. but it can be used instead in NPCs to "preview" an announce.
  3716. // This will be a private message to the player using the NPC that made the
  3717. // annonucement
  3718. announce "This is my message just for you",bc_blue|bc_self;
  3719. // This will be shown on everyones screen that is in sight of the NPC.
  3720. announce "This is my message just for you people here",bc_area;
  3721. ---------------------------------------
  3722. *mapannounce "<map name>","<text>",<flag>{,<color>};
  3723. This command will work like 'announce' but will only broadcast to characters
  3724. currently residing on the specified map. The flag and optional color
  3725. parameters are the same as in 'announce', even though the only ones that make
  3726. sense are the color related ones.
  3727. ---------------------------------------
  3728. *areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>[,<color>];
  3729. This command works like 'announce' but will only broadcast to characters
  3730. residing in the specified x1/y1-x2/y2 square on the map given. The flags and
  3731. color parameter given are the same as in 'announce', but only the color
  3732. related ones have effect.
  3733. areaannounce "prt_church.gat",0,0,350,350,"God's in his heaven, all right with the world",0;
  3734. ---------------------------------------
  3735. *callshop "<name>",<option>;
  3736. These are a series of commands used to create dynamic shops.
  3737. The callshop function calls a invisible shop (view -1) as if the player clicked on it.
  3738. For the options on callShop:
  3739. 0 = The normal window (buy, sell and cancel)
  3740. 1 = The buy window
  3741. 2 = The sell window
  3742. Example(s):
  3743. callshop "DaShop",1; //Will call the shop named DaShop and opens the buy menu.
  3744. The shop which is called by callshop (as long as an npcshop* command is executed
  3745. from that NPC (see note 1)) will trigger the labels OnBuyItem and OnSellitem. These
  3746. labels can take over handling for relatively the buying of items from the shop
  3747. and selling the items to a shop. Via these labels you can customize the way an item
  3748. is bought or sold by a player.
  3749. In the OnBuyItem, two arrays are set (@bought_nameid and @bough_quantity), which
  3750. hold information about the name id (item id) sold and the amount sold of it. Same
  3751. goes for the OnSellItem label, only the variables are named different
  3752. (@sold_nameid and @sold_quantity). An example on a shop comes with eAthena, and
  3753. can be found in the npc/sample/npc_dynamic_shop.txt file.
  3754. This example shows how to use the labels and their set variables to create a dynamic shop.
  3755. Note 1: These labels will only be triggered if a npcshop* command is executed, this is
  3756. because these commands set a special data on the shop npc,named master_nd in the source.
  3757. The OnSellItem and OnBuyItem are triggered in the NPC whose master_nd is given in the shop.
  3758. This was found out thanks to 'Hondacrx', noticing the OnBuyItem wasn't triggered unless
  3759. npcshopitem was used. After rechecking the source, I found what caused this.
  3760. ---------------------------------------
  3761. *npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}}
  3762. This command lets you override the contents of an existing npc shop. The
  3763. current sell list will be wiped, and only the items specified with the price
  3764. specified will be for sale.
  3765. The function returns 1 if shop was updated successfully, or 0 if not found.
  3766. Note that you cannot use -1 to specify default selling price!
  3767. ---------------------------------------
  3768. *npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}}
  3769. This command will add more items at the end of the selling list for the
  3770. specified npc shop. If you specify an item already for sell, that item will
  3771. appear twice on the sell list.
  3772. The function returns 1 if shop was updated successfully, or 0 if not found.
  3773. Note that you cannot use -1 to specify default selling price!
  3774. ---------------------------------------
  3775. *npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}}
  3776. This command will remove items from the specified npc shop.
  3777. If the item to remove exists more than once on the shop, all instances will be
  3778. removed.
  3779. Note that the function returns 1 even if no items were removed. The return
  3780. value is only to confirm that the shop was indeed found.
  3781. ---------------------------------------
  3782. *npcshopattach "<name>"{,<flag>}
  3783. This command will attach the current script to the given npc shop.
  3784. When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem"
  3785. of your script will be executed whenever a player buys/sells from the shop.
  3786. Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[]
  3787. and @sold_quantity[] will be filled up with the items and quantities
  3788. bought/sold.
  3789. The optional parameter specifies whether to attach ("1") or detach ("0") from
  3790. the shop (the default is to attach). Note that detaching will detach any npc
  3791. attached to the shop, even if it's from another script, while attaching will
  3792. override any other script that may be already attached.
  3793. The function returns 0 if the shop was not found, 1 otherwise.
  3794. ---------------------------------------
  3795. *waitingroom "<chatroom name>",<limit>{,<event label>,<trigger>};
  3796. This command will create a chat room, owned by the NPC object running this
  3797. script and displayed above the NPC sprite.
  3798. The maximum length of a chatroom name is 60 letters.
  3799. The limit is the maximum number of people allowed to enter the chat room. If the
  3800. optional event and trigger parameters are given, the event label
  3801. ("<NPC object name>::<label name>") will be invoked as if with a 'doevent' upon
  3802. the number of people in the chat room reaching the given triggering amount.
  3803. It's funny, but for compatibility with jAthena, you can swap the event label and
  3804. the trigger parameters, and it will still work.
  3805. // The NPC will just show a box above its head that says "Hello World", clicking
  3806. // it will do nothing, since the limit is zero.
  3807. waitingroom "Hello World",0;
  3808. // The NPC will have a box above its head, it will say "Disco - Waiting Room"
  3809. // and will have 8 waiting slots. Clicking this will enter the chat room, where
  3810. // the player will be able to wait until 8 people accumulate. Once this happens,
  3811. // it will cause the NPC "Bouncer" run the label "OnStart"
  3812. waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",8;
  3813. Creating a waiting room does not stop the execution of the script and it will
  3814. continue to the next line.
  3815. For more examples see the 2-1 and 2-2 job quest scripts which make extensive use
  3816. of waiting rooms.
  3817. ---------------------------------------
  3818. *delwaitingroom {"<NPC object name"};
  3819. This command will delete a waiting room. If no parameter is given, it will
  3820. delete a waiting room attached to the NPC object running this command, if it is,
  3821. it will delete a waiting room owned by another NPC object. This is the only way
  3822. to get rid of a waiting room, nothing else will cause it to disappear.
  3823. It's not clear what happens to a waiting room if the NPC is disabled with
  3824. 'disablenpc', by the way.
  3825. ---------------------------------------
  3826. *enablewaitingroomevent {"<NPC object name>"};
  3827. *disablewaitingroomevent {"<NPC object name>"};
  3828. This will enable and disable triggering the waiting room event (see
  3829. 'waitingroom') respectively. Optionally giving an NPC object name will do that
  3830. for a specified NPC object. The chat room will not disappear when triggering is
  3831. disabled and enabled in this manner and players will not be kicked out of it.
  3832. Enabling a chat room event will also cause it to immediately check whether the
  3833. number of users in it exceeded the trigger amount and trigger the event
  3834. accordingly.
  3835. Normally, whenever a waiting room was created to make sure that only one
  3836. character is, for example, trying to pass a job quest trial, and no other
  3837. characters are present in the room to mess up the script.
  3838. ---------------------------------------
  3839. *getwaitingroomstate(<information type>{,"<NPC object name>"})
  3840. This function will return information about the wating room state for the
  3841. attached waiting room or for a waiting room attached to the specified NPC if
  3842. any.
  3843. The valid information types are:
  3844. 0 - Number of users currently chatting.
  3845. 1 - Maximum number of users allowed.
  3846. 2 - Will return 1 if the waiting room has a trigger set.
  3847. 0 otherwise.
  3848. 3 - Will return 1 if the waiting room is currently disabled.
  3849. 0 otherwise.
  3850. 4 - The Title of the waiting room (string)
  3851. 5 - Password of the waiting room, if any. Pointless, since there is no way to
  3852. set a password on a waiting room right now.
  3853. 16 - Event name of the waiting room (string)
  3854. 32 - Whether or not the waiting room is full.
  3855. 33 - Whether the amount of users in the waiting room is higher than the trigger
  3856. number.
  3857. ---------------------------------------
  3858. *warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
  3859. This command will warp the amount of characters equal to the trigger number of
  3860. the waiting room chat attached to the NPC object running this command to the
  3861. specified map and coordinates, kicking them out of the chat. Those waiting the
  3862. longest will get warped first. It can also do a random warp on the same map
  3863. ("Random" instead of map name) and warp to the save point ("SavePoint").
  3864. The list of characters to warp is taken from the list of the chat room members.
  3865. Those not in the chat room will not be considered even if they are talking to
  3866. the NPC in question. If the number of people is given, exactly this much people
  3867. will be warped.
  3868. This command can also keep track of who just got warped. It does this by setting
  3869. special variables:
  3870. $@warpwaitingpc[] is an array containing the character id numbers of the
  3871. characters who were just warped.
  3872. $@warpwaitingpcnum contains the number of the character it just warped.
  3873. See also 'getpartymember' for advice on what to do with those variables.
  3874. The obvious way of using this effectively would be to set up a waiting room for
  3875. two characters to be warped onto a random PVP map for a one-on-one duel, for
  3876. example.
  3877. ---------------------------------------
  3878. *waitingroomkickall {"<NPC object name>"};
  3879. This command would kick everybody out of a specified waiting room chat. IF it
  3880. was properly linked into the script interpreter which it isn't, even though the
  3881. code for it is in place. Expect this to become available in upcoming SVN
  3882. releases.
  3883. ---------------------------------------
  3884. *setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
  3885. This command sets the 'nosave' flag for the specified map and also gives an
  3886. alternate respawn-upon-relogin point.
  3887. It does not make a map impossible to make a savepoint on as you would normally
  3888. think, 'savepoint' will still work. It will, however, make the specified map
  3889. kick the reconnecting players off to the alternate map given to the coordinates
  3890. specified.
  3891. ---------------------------------------
  3892. *setmapflag "<map name>",<flag>;
  3893. This command marks a specified map with a map flag given. Map flags alter the
  3894. behavior of the map, you can see the list of the available ones in
  3895. 'db/const.txt' under 'mf_'.
  3896. The map flags alter the behavior of the map regarding teleporting (mf_nomemo,
  3897. mf_noteleport, mf_nowarp, mf_nogo) storing location when disconnected
  3898. (mf_nosave), dead branch usage (mf_nobranch), penalties upon death
  3899. (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty,
  3900. mf_pvp_noguild, mf_nopvp), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use
  3901. skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall),
  3902. current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds,
  3903. mf_fireworks) and whether day/night will be in effect on this map (mf_indoors).
  3904. ---------------------------------------
  3905. *setbattleflag "<battle flag>",<value>;
  3906. *getbattleflag "<battle flag>";
  3907. Sets or gets the value of the given battle flag.
  3908. Battle flags are the flags found in the battle/*.conf files and is also used in Lupus' variable rates script.
  3909. Example(s):
  3910. //will set the base experience rate to 20x (2000%)
  3911. setBattleFlag "base_exp_rate",2000;
  3912. //will return the value of the base experience rate (when used after the above example, it would return 2000).
  3913. getBattleFlag "base_exp_rate";
  3914. ---------------------------------------
  3915. *removemapflag "<map name>",<flag>;
  3916. This command removes a mapflag from a specified map. See 'setmapflag'.
  3917. ---------------------------------------
  3918. *warpportal <x>,<y>,"<mapname>",<x>,<y>;
  3919. Creates a warp Portal as if a acolyte class character did it.
  3920. The first x and y is the place of the warp portal on the map where the NPC is on
  3921. The mapname and second x and y is the target area of the warp portal.
  3922. Example(s):
  3923. //Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180.
  3924. warpPortal 150,150,"prontera.gat",150,180;
  3925. ---------------------------------------
  3926. *mapwarp "<from map>","<to map>",<x>,<y>;
  3927. This command will collect all characters located on the From map and warp them
  3928. wholesale to the same point on the To map, or randomly distribute them there if
  3929. the coordinates are zero. "Random" is understood as a special To map name and
  3930. will mean randomly shuffling everyone on the same map.
  3931. ---------------------------------------
  3932. \\
  3933. 5,2.- Guild-related Commands
  3934. \\
  3935. ---------------------------------------
  3936. *maprespawnguildid "<map name>",<guild id>,<flag>;
  3937. This command goes through the specified map and for each player and monster
  3938. found there does stuff.
  3939. Flag is a bitmask (add up numbers to get effects you want)
  3940. 1 - warp all guild members to their savepoints.
  3941. 2 - warp all non-guild members to their savepoints.
  3942. 4 - remove all monsters which are not guardian or emperium.
  3943. Flag 7 will, therefore, mean 'wipe all mobs but guardians and the emperium and
  3944. kick all characters out', which is what the official scripts do upon castle
  3945. surrender. Upon start of WoE, the scripts do 2 (warp all intruiders out).
  3946. Characters not belonging to any guild will warp out regardless of the flag setting.
  3947. For examples, check the WoE scripts in the distribution.
  3948. ---------------------------------------
  3949. *agitstart;
  3950. *agitend;
  3951. These two commands will start and end War of Emperium.
  3952. This is a bit more complex than it sounds, since the commands themselves won't
  3953. actually do anything interesting, except causing all 'OnAgitStart:' and
  3954. 'OnAgitEnd:' events to run everywhere, respectively. They are used as
  3955. simple triggers to run a lot of complex scripts all across the server, and they,
  3956. in turn, are triggered by clock with an 'OnClock<time>:' time-triggering label.
  3957. ---------------------------------------
  3958. *gvgon "<map name>";
  3959. *gvgoff "<map name>";
  3960. These commands will turn GVG mode for the specified maps on and off, setting up
  3961. appropriate map flags. In GVG mode, maps behave as if during the time of WoE,
  3962. even though WoE itself may or may not actually be in effect.
  3963. ---------------------------------------
  3964. *flagemblem <guild id>;
  3965. This command only works when run by the NPC objects which have sprite id 722,
  3966. which is a 3D guild flag sprite. If it isn't, the data will change, but nothing
  3967. will be seen by anyone. If it is invoked in that manner, the emblem of the
  3968. specified guild will appear on the flag, though, if any players are watching it
  3969. at this moment, they will not see the emblem change until they move out of sight
  3970. of the flag and return.
  3971. This is commonly used in official guildwar scripts with a function call which
  3972. returns a guild id:
  3973. // This will change the emblem on the flag to that of the guild that owns
  3974. // "guildcastle"
  3975. flagemblem GetCastleData("guildcastle.gat",1);
  3976. ---------------------------------------
  3977. *guardian "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>"}{,<guardian index>};
  3978. This command is roughly equivalent to 'monster', but is meant to be used with
  3979. castle guardian monsters and will only work with them. It will set the guardian
  3980. characteristics up according to the castle's investment values and otherwise
  3981. set the things up that only castle guardians need.
  3982. ---------------------------------------
  3983. *guardianinfo(<guardian number>)
  3984. This function will return the current hit point value for the specified guardian
  3985. number, if such guardian is currently installed. This function will only work if
  3986. the invoking character is on a castle map, and will refer only to the guardians
  3987. of that castle, regardless of anything else, i.e. whether the character is a
  3988. member of the guild owning the castle, etc, etc.
  3989. If no guardian is installed in this slot, the function will return -1.
  3990. ---------------------------------------
  3991. //
  3992. 5,2.- End of guild-related commands
  3993. //
  3994. ---------------------------------------
  3995. *npcspeed <speed value>;
  3996. *npcwalkto <x>,<y>;
  3997. *npcstop;
  3998. These commands will make the NPC object in question move around the map. As they
  3999. currently are, they are a bit buggy and are not useful for much more than making
  4000. an NPC move randomly around the map. (see 'npc/custom/devnpc.txt' for an example
  4001. of such usage)
  4002. 'npcspeed' will set the NPCs walking speed to a specified value. As in the
  4003. @speed GM command, 200 is the slowest possible speed while 0 is the fastest
  4004. possible (instant motion). 100 is the default character walking speed.
  4005. 'npcwalkto' will start the NPC sprite moving towards the specified coordinates
  4006. on the same map as it is currently on.
  4007. 'npcstop' will stop the motion.
  4008. While in transit, the NPC will be clickable, but invoking it will cause it to
  4009. stop motion, which will make it's coordinates different from what the client
  4010. computed based on the speed and motion coordinates. The effect is rather
  4011. unnerving.
  4012. Only a few NPC sprites have walking animations, and those that do, do not get
  4013. the animation invoked when moving the NPC, due to the problem in the npc walking
  4014. code, which looks a bit silly. You might have better success by defining a job-
  4015. sprite based sprite id in 'db/mob-avail.txt' with this.
  4016. ---------------------------------------
  4017. *movenpc <NPC name>,x,y;
  4018. This command looks like the NPCWalkToxy function,but is a little different.
  4019. While NPCWalkToXY just makes the NPC 'walk' to the coordinates given
  4020. (which sometimes gives problems if the path isn't a straight line without objects),
  4021. this command just moves the NPC. It basically warps out and in on the current and given spot.
  4022. Example(s):
  4023. //This will move Bugga from it's current position to the coords 100,20 (if those coords are walkable (legit)).
  4024. moveNPC "Bugga",100,20;
  4025. ---------------------------------------
  4026. =====================
  4027. |6.- Other commands.|
  4028. =====================
  4029. ---------------------------------------
  4030. *debugmes "<message>";
  4031. This command will send the message to the server console (map-server window). It
  4032. will not be displayed anywhere else.
  4033. debugmes strcharinfo(0)+" has just done this that and the other";
  4034. // You would see in the map-server window "NAME has just done this that and
  4035. // the other"
  4036. ---------------------------------------
  4037. *logmes "<message>";
  4038. This command will write the message given to the map server npc log file, as
  4039. specified in 'conf/log_athena.conf'. In the TXT version of the server, the log
  4040. file is 'log/npclog.log' by default. In the SQL version, if SQL logging is
  4041. enabled, the message will go to the 'npclog' table, otherwise, it will go to the
  4042. same log file.
  4043. If logs are not enabled, nothing will happen.
  4044. ---------------------------------------
  4045. *globalmes "<message>"{,"<NPC name>"};
  4046. This command will send a message to the chat window of all currently connected
  4047. characters.
  4048. If NPC name is specified, the message will be sent as if the sender would be
  4049. the npc with the said name.
  4050. ---------------------------------------
  4051. *rand(<number>{,<number>});
  4052. This function returns a number, randomly positioned between 0 and the number you
  4053. specify (if you only specify one) and the two numbers you specify if you give it
  4054. two.
  4055. rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9
  4056. rand(2,10) would result in 2,3,4,5,6,7,8,9 or 10
  4057. ---------------------------------------
  4058. *viewpoint <action>,<x>,<y>,<point number>,<color>;
  4059. This command will mark places on the mini map in the client connected to the
  4060. invoking character. It uses the normal X and Y coordinates from the main map.
  4061. The colors of the marks are defined using a hexidecimal number, same as the ones
  4062. used to color text in 'mes' output, but are written as hexadecimal numbers in C.
  4063. (They look like 0x<six numbers>.)
  4064. Action is what you want to do with a point, 1 will set it, while 2 will clear
  4065. it. Point number is the number of the point - you can have several. If more than
  4066. one point is drawn at the same coordinates, they will cycle, which can be used
  4067. to create flashing marks.
  4068. // This command will show a mark at coordinates X 30 Y 40, is mark number 1,
  4069. // and will be red.
  4070. viewpoint 1,30,40,1,0xFF0000;
  4071. This will create three points:
  4072. viewpoint 1,30,40,1,0xFF0000;
  4073. viewpoint 1,35,45,2,0xFF0000;
  4074. viewpoint 1,40,50,3,0xFF0000;
  4075. And this is how you remove them:
  4076. viewpoint 2,30,40,1,0xFF0000;
  4077. viewpoint 2,35,45,2,0xFF0000;
  4078. viewpoint 2,40,50,3,0xFF0000;
  4079. The client determines what it does with the points entirely, the server keeps no
  4080. memory of where the points are set whatsoever.
  4081. ---------------------------------------
  4082. *cutin "<filename>",<position>;
  4083. This command will display a picture stored in the GRF file in the client for the
  4084. player.
  4085. The files are taken from '\data\texture\A_A£AI�I’„AI«§\illust' directory in the
  4086. GRF file. Also it seems that card cutins from \cardbmp will work here as well.
  4087. Only bitmaps (images stored in the bitmap format) will actually get displayed.
  4088. The '.bmp' extension is optional.
  4089. The client has no problem rendering huge 4096x4096 bitmaps, but usually they're
  4090. around 500x500. Bright magenta (color FF00FF) is considered to be transparent in
  4091. these pictures. You can easily add and alter them, but how to do this is outside
  4092. of the scope of this document.
  4093. The position determines just where on screen the picture will appear:
  4094. 0 - bottom left corner
  4095. 1 - bottom middle
  4096. 2 - bottom right corner
  4097. 3 - middle of screen in a movable window with an empty title bar.
  4098. 4 - middle of screen without the window header, but still movable.
  4099. 255 - will remove the cutin previously displayed.
  4100. Giving an empty string for the filename and 255 for the position will remove all
  4101. cutin pictures. Any other position value will not cause a script error but will
  4102. cause the player's client to curl up and die. Only one cutin may be on screen at
  4103. any given time, any new cutins will replace it.
  4104. // This will display the picture of the 7th kafra,
  4105. // the one in orange and the mini-skirt :P
  4106. cutin "kafra_7",2;
  4107. // This will remove the displayed picture.
  4108. cutin "Kafra_7",255;
  4109. // This will remove all pictures displayed.
  4110. cutin "",255;
  4111. ---------------------------------------
  4112. *pet <pet id>;
  4113. This command is used in all the item scripts for taming items. Running this
  4114. command will make the pet catching cursor appear on the client connected to the
  4115. invoking character, usable on the monsters with the specified pet ID number. It
  4116. will still work outside an item script.
  4117. A full list of pet IDs can be found inside 'db/pet_db.txt'
  4118. ---------------------------------------
  4119. *emotion <emotion number>{, target};
  4120. This command makes an object display an emoticon sprite above their own as
  4121. if they were doing that emotion. For a full list of emotion numbers,
  4122. see 'db/const.txt' under 'e_'. The inobvious ones are 'e_what' (a question mark)
  4123. and 'e_gasp' (the exclamation mark).
  4124. The optional target parameter specifies who will get the emotion on top of
  4125. their head. If 0 (the default if omitted), the NPC in current use will show
  4126. the emotion, if 1, the player that is running the script will display it.
  4127. ---------------------------------------
  4128. *misceffect <effect number>;
  4129. This command, if run from an NPC object that has a sprite, will call up a
  4130. specified effect number, centered on the NPC sprite. If the running code does
  4131. not have an object ID (a 'floating' npc) or is not running from an NPC object at
  4132. all (an item script) the effect will be centered on the character who's RID got
  4133. attached to the script, if any. For usable item scripts, this command will
  4134. create an effect centered on the player using the item.
  4135. A full list of known effects is found in 'doc/effect_list.txt'. The list of
  4136. those that actually work may differ greatly between client versions.
  4137. ---------------------------------------
  4138. *soundeffect "<effect filename>",<number>
  4139. *soundeffectall "<effect filename>",<number>
  4140. These two commands will play a sound effect to either the invoking character
  4141. only 'soundeffect' or everyone around ('soundeffectall'). If the running code
  4142. does not have an object ID (a 'floating' npc) or is not running from an NPC
  4143. object at all (an item script) the sound will be centered on the character who's
  4144. RID got attached to the script, if any. If it does, it will be centered on that
  4145. object. (an NPC sprite)
  4146. Effect filename is the filename of the wav in GRF. It must have an extension.
  4147. It's not quite certain what the number actually does, it is sent to the client
  4148. directly, probably it determines which directory of the GRF the effect is played
  4149. from - the sound effect type. It's certain that giving 0 for the number will
  4150. play sound files from 'data/wav', but where the other numbers will read from is
  4151. unclear.
  4152. You can add your own effects this way, naturally.
  4153. ---------------------------------------
  4154. *pvpon "<map name>";
  4155. *pvpoff "<map name>";
  4156. These commands will turn PVP mode for the specified maps on and off. Beside
  4157. setting the flags referred to in 'setmapflag', 'pvpon' will also create a PVP
  4158. timer and ranking as will @pvpon GM command do.
  4159. ---------------------------------------
  4160. *atcommand "<command line>";
  4161. This command will run the given command line exactly as if it was typed in from
  4162. the keyboard by the player connected to the invoking character, and that
  4163. character belonged to an account which had GM level 99.
  4164. // This will ask the invoker for a character name and then use the '@nuke'
  4165. // GM command on them, killing them mercilessly.
  4166. input @player$;
  4167. atcommand "@nuke "+@player$;
  4168. This command has a lot of good uses, I am sure you can have some fun with this
  4169. one.
  4170. ---------------------------------------
  4171. *charcommand <command>;
  4172. NOTE: This command is changed a bit on newer trunk versions,
  4173. scroll down a bit for the new version!
  4174. On older trunk versions and stable:
  4175. command is the name of the current character (strcharinfo(0))
  4176. followed by ':' and the command and it's parameters.
  4177. Example(s):
  4178. //Will be executed as if a lvl 99 GM done the #option command.
  4179. charCommand strcharinfo(0)+":#option 0 0 0 Roy";
  4180. Newer Trunk version:
  4181. The big change is that the character name is no longer needed.
  4182. This also enabled the commands to run without a player attached (according to Lance).
  4183. Example(s):
  4184. //this would do the same as above, but now doesn't need a player attached by default.
  4185. charCommand "#option 0 0 0 Roy";
  4186. ---------------------------------------
  4187. *unitskilluseid <GID>,<skill id>,<skill lvl>;
  4188. *unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>;
  4189. This is the replacement of the older commands, these use the same values for
  4190. GID as the other unit* commands (See 'GID').
  4191. Skill ID is the ID of the skill, skill level is the level of the skill.
  4192. For the position, the x and y are given in the unitSkillUsePos.
  4193. ---------------------------------------
  4194. *day;
  4195. *night;
  4196. These two commands will switch the entire server between day and night mode.
  4197. Depending on the configuration, it may cause differing client effects. If your
  4198. server is set to cycle between day and night, it will eventually return to that
  4199. cycle.
  4200. This example will set the night time to start at 03 AM and end at 08 AM, and the
  4201. nighttime will persist if the server restarts during the night, if the automated
  4202. day/night switching is turned off in the configuration files. Figure it out on
  4203. your own:
  4204. -%TAB%script%TAB%DayNight%TAB%-1,{
  4205. end;
  4206. OnClock0300:
  4207. OnClock0800:
  4208. OnInit:
  4209. set $@minutesfrommidnight, gettime(3)*60+gettime(2);
  4210. set $@night_start, 180; // 03:00
  4211. set $@night_end, 480; // 08:00
  4212. if ($@minutesfrommidnight>=$@night_start && $@minutesfrommidnight<$@night_end) goto StartNight;
  4213. goto StartDay;
  4214. StartNight:
  4215. night;
  4216. end;
  4217. StartDay:
  4218. day;
  4219. end; }
  4220. ---------------------------------------
  4221. *defpattern <set number>,"<regular expression pattern>","<event label>";
  4222. *activatepset <set number>;
  4223. *deactivatepset <set number>;
  4224. *deletepset <set number>;
  4225. This set of commands is only available if the server is compiled with regular
  4226. expressions library enabled. Default compilation and most binary distributions
  4227. aren't, which is probably bad, since these, while complex to use, are quite
  4228. fascinating.
  4229. They will make the NPC object listen for text spoken publicly by players and
  4230. match it against regular expression patterns, then trigger labels associated
  4231. with these regular expression patterns.
  4232. Patterns are organised into sets, which are referred to by a set number. You can
  4233. have multiple sets patterns, and multiple patterns may be active at once.
  4234. Numbers for pattern sets start at 1.
  4235. 'defpattern' will associate a given regular expression pattern with an event
  4236. label. This event will be triggered whenever something a player says is matched
  4237. by this regular expression pattern, if the pattern is currently active.
  4238. 'activatepset' will make the pattern set specified active. An active pattern
  4239. will enable triggering labels defined with 'defpattern', which will not happen
  4240. by default.
  4241. 'deactivatepset' will deactivate a specified pattern set. Giving -1 as a pattern
  4242. set number in this case will deactivate all pattern sets defined.
  4243. 'deletepset' will delete a pattern set from memory, so you can create a new
  4244. pattern set in it's place.
  4245. Using regular expressions is high wizardry. But with this high wizardry comes
  4246. unparallelled power of text manipulation. For an explanation of what a regular
  4247. expression pattern is, see a few web pages:
  4248. http://www.regular-expressions.info/
  4249. http://www.weitz.de/regex-coach/
  4250. For an example of this in use, see 'npc\custom\eliza.txt'.
  4251. With this you could, for example, automagically punish players for asking for
  4252. zeny in public places, or alternatively, automagically give them zeny instead if
  4253. they want it so much.
  4254. ---------------------------------------
  4255. *pow(<number>,<power>)
  4256. Returns the result of the calculation.
  4257. Example:
  4258. set @i, pow(2,3); // @i will be 8
  4259. ---------------------------------------
  4260. *sqrt(<number>)
  4261. Returns square-root of number.
  4262. Examlpe:
  4263. set @i, sqrt(25); // @i will be 5
  4264. ---------------------------------------
  4265. *distance(<x0>,<y0>,<x1>,<y1>)
  4266. Returns distance between 2 points.
  4267. Example:
  4268. set @i, distance(100,200,101,202);
  4269. ---------------------------------------
  4270. *query_sql "your MySQL query", <array name>{,<array name>{;
  4271. Returns up to 127 values into array and return the number of row
  4272. Example:
  4273. set @nb, query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", @name$, @fame);
  4274. mes "Hall Of Fame: TOP5";
  4275. mes "1."+@name$[0]+"("+@fame[0]+")"; // Will return a person with the biggest fame value.
  4276. mes "2."+@name$[1]+"("+@fame[1]+")";
  4277. mes "3."+@name$[2]+"("+@fame[2]+")";
  4278. mes "4."+@name$[3]+"("+@fame[3]+")";
  4279. mes "5."+@name$[4]+"("+@fame[4]+")";
  4280. Note: In the TXT version it doesn't fill the array and always return -1.
  4281. Note: Use $ as suffix in the array to recieve all data as text.
  4282. ---------------------------------------
  4283. *setitemscript(<ItemID>,<"{ new item script }">);
  4284. Set a new script bonus to the Item. Very useful for game events.
  4285. You can remove an item's itemscript by leaving empty the itemscript argument.
  4286. Example:
  4287. setitemscript 2637,"{ bonus bDamageWhenUnequip,40; if(isequipped(2236)==0)end; if(getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
  4288. setitemscript 2639,"";
  4289. ---------------------------------------
  4290. *atoi ("<string>")
  4291. *axtoi ("<string>")
  4292. These commands are used to convert strings to numbers.
  4293. atoi will convert string using normal number (0,1,2,3,etc) while axtoi converts them to
  4294. hexadecimal numbers (0,1,11,01).
  4295. Example:
  4296. mes atoi("11"); // Will display 11 (can also be used to set a @var to 11)
  4297. set @var, axtoi("FF"); // Will set the @var to 255
  4298. mes axtoi("11"); // Will display 17 (1 = 1, 10 = 16,
  4299. // hexadecimal number set: {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F})
  4300. ---------------------------------------
  4301. *compare (<string>,<substring>)
  4302. This command returns 1 or 0 when a the substring is in the main string (1) or not (0).
  4303. This command is not case sensitive.
  4304. Example(s):
  4305. //dothis; will be executed ('Bloody Murderer' contains 'Blood').
  4306. if (compare("Bloody Murderer","Blood"))
  4307. dothis;
  4308. //dothat; will not be executed ('Blood butterfly' does not contain 'Bloody').
  4309. if (compare("Blood Butterfly","Bloody"))
  4310. dothat;
  4311. --------------------------------------
  4312. *charisalpha("<string>",<position>)
  4313. This function will return 1 if the character number Position in the given string
  4314. is a letter, 0 if it isn't a letter but a digit or a space.
  4315. ---------------------------------------
  4316. *wedding_effect;
  4317. Starts the effect used when a wedding is done (music and everything else)
  4318. Example can be found in the wedding script.
  4319. --------------------------------------
  4320. * The Pet AI commands
  4321. These commands will only work if the invoking character has a pet, and are meant
  4322. to be executed from pet scripts. They will modify the pet AI decision-making for
  4323. the current pet of the invoking character, and will NOT have any independent
  4324. effect by themselves, which is why only one of them each may be in effect at any
  4325. time for a specific pet. A pet may have 'petloot', 'petskillbonus',
  4326. 'petskillattack' OR 'petpetskillattack2' and 'petskillsupport' OR 'petheal' at
  4327. the same time. 'petheal' is deprecated and is no longer used in the default pet
  4328. scripts.
  4329. *petskillbonus <bonus type>,<value>,<duration>,<delay>;
  4330. This command will make the pet give a bonus to the owner's stat (bonus type -
  4331. bInt,bVit,bDex,bAgi,bLuk,bStr,bSpeedRate - for a full list, see the values
  4332. starting with 'b' in 'db/const.txt')
  4333. *petrecovery <status type>,<delay>;
  4334. This command will make the pet cure a specified status condition. The curing
  4335. actions will occur once every Delay seconds. For a full list of status
  4336. conditions that can be cured, see the list of 'SC_' status condition constants
  4337. in 'db/const.txt'
  4338. *petloot <max items>;
  4339. This command will turn on pet looting, with a maximum number of items to loot
  4340. specified. Pet will store items and return them when the maximum is reached or
  4341. when pet performance is activated.
  4342. *petskillsupport <skill id>,<skill level>,<delay>,<percent hp>,<percent sp>;
  4343. *petheal <level>,<delay>,<percent hp>,<percent sp>;
  4344. This will make the pet use a specified support skill on the owner whenever the
  4345. HP and SP are below the given percent values, with a specified delay time
  4346. between activations. The skill numbers are as per 'db/skill_db.txt'.
  4347. 'petheal' works the same as 'petskillsupport' but has the skill ID hardcoded to
  4348. 28 (Heal). This command is deprecated.
  4349. It's not quite certain who's stats will be used for the skills cast, the
  4350. character's or the pets. Probably, Skotlex can answer that question.
  4351. *petskillattack <skill id>,<skill level>,<rate>,<bonusrate>;
  4352. *petskillattack2 <skill id>,<damage>,<number of attacks>,<rate>,<bonusrate>;
  4353. These two commands will make the pet cast an attack skill on the enemy the pet's
  4354. owner is currently fighting. Skill IDs and levels are as per 'petskillsupport'.
  4355. 'petskillattack2' will make the pet cast the skill with a fixed amount of damage
  4356. inflicted and the specified number of attacks.
  4357. All commands with delays and durations will only make the behavior active for
  4358. the specified duration of seconds, with a delay of the specified number of
  4359. seconds between activations. Rates are a chance of the effect occuring and are
  4360. given in percent. 'bonusrate' is added to the normal rate if the pet intimacy is
  4361. at the maximum possible.
  4362. The behavior modified with the abovementioned commands will only be exibited if
  4363. the pet is loyal and appropriate configuration options are set in
  4364. 'battle_athena.conf'.
  4365. Pet scripts in the database normally run whenever a pet of that type hatches
  4366. from the egg. Other commands usable in item scripts (see 'bonus') will also
  4367. happily run from pet scripts. Apparently, the pet-specific commands will also
  4368. work in NPC scripts and modify the behavior of the current pet up until the pet
  4369. is hatched again. (Which will also occur when the character is logged in again
  4370. with the pet still out of the egg.) It is not certain for how long the effect of
  4371. such command running from an NPC script will eventually persist, but apparently,
  4372. it is possible to usefully employ them in usable item scripts to create pet
  4373. buffing items.
  4374. Nobody tried this before, so you're essentially on your own here.
  4375. --------------------------------------
  4376. *bpet;
  4377. This command opens up a pet hatching window on the client connected to the
  4378. invoking character. It is used in item script for the pet incubators and will
  4379. let the player hatch an owned egg. If the character has no eggs, it will just
  4380. open up an empty incubator window.
  4381. This is still usable outside item scripts.
  4382. ---------------------------------------
  4383. *makepet <pet id>;
  4384. This command will create a pet egg and put it in the invoking character's
  4385. inventory. The kind of pet is specified by pet ID numbers listed in
  4386. 'db/pet_db.txt'. The egg is created exactly as if the character just successfuly
  4387. caught a pet in the normal way.
  4388. // This will make you a poring:
  4389. makepet 1002;
  4390. Notice that you absolutely have to create pet eggs with this command. If you try
  4391. to give a pet egg with 'getitem', pet data will not be created by the char
  4392. server and the egg will disappear when anyone tries to hatch it.
  4393. ---------------------------------------
  4394. Whew.
  4395. That's about all of them.