script_commands.txt 263 KB

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