script_commands.txt 349 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730
  1. //===== rAthena Documentation ================================
  2. //= rAthena Script Commands
  3. //===== By: ==================================================
  4. //= rAthena Dev Team
  5. //===== Last Updated: ========================================
  6. //= 20161206
  7. //===== Description: =========================================
  8. //= A reference manual for the rAthena scripting language.
  9. //= Commands are sorted depending on their functionality.
  10. //============================================================
  11. This document is a reference manual for all the scripting commands and functions
  12. available in rAthena. It is not a simple tutorial. When people tell you to
  13. "Read The F***ing Manual", they mean this.
  14. This is not a place to teach you basic programming. This document will not teach
  15. you basic programming by itself. It's more of a reference for those who have at
  16. least a vague idea of what they want to do and want to know what tools they have
  17. available to do it. We've tried to keep it as simple as possible, but if you
  18. don't understand it, getting a clear book on programming in general will help
  19. better than yelling around the forum for help.
  20. A little learning never caused anyone's head to explode.
  21. Structure
  22. ---------
  23. The script commands are listed in no particular order, but are grouped by
  24. relative function.
  25. *Name of the command and parameters (if any).
  26. Descriptive text
  27. Small example if possible. Will usually be incomplete, it's there just to
  28. give you an idea of how it works in practice.
  29. To find a specific command, use Ctrl+F, (or whatever keys call up a search
  30. function in whatever you're reading this with) put an asterisk (*) followed by the command
  31. name, and it should find the command description for you.
  32. If you find anything missing, please let us know!
  33. Syntax
  34. ------
  35. Throughout this document, wherever a command wants an argument, it is given in
  36. <angle brackets>. This doesn't mean you should type the angle brackets. If an
  37. argument of a command is optional, it is given in {curly brackets}. You've
  38. doubtlessly seen this convention somewhere. If a command can optionally take
  39. an unspecified number of arguments, you'll see a list like this:
  40. command <argument>{,<argument>...<argument>}
  41. This still means they will want to be separated by commas.
  42. Where a command wants a string, it will be given in "quotes", if it's a number,
  43. it will be given without them. Normally, you can put an expression, like a bunch
  44. of functions or operators returning a value, in (round brackets) instead of most
  45. numbers. Round brackets will not always be required, but they're often a good
  46. idea.
  47. Wherever you refer to a map name, it's always 'map name' (.gat suffix is deprecated).
  48. Script loading structure
  49. ------------------------
  50. Scripts are loaded by the map server as referenced in the 'conf/map_athena.conf'
  51. configuration file, but in the default configuration, it doesn't load any script
  52. files itself. Instead, it loads the file 'npc/(pre-)re/scripts_main.conf' which itself
  53. contains references to other files. The actual scripts are loaded from txt
  54. files, which are linked up like this:
  55. npc: <path to a filename>
  56. Any line like this, invoked, ultimately, by 'map_athena.conf' will load up the
  57. script contained in this file, which will make the script available. No file
  58. will get loaded twice to prevent possible errors.
  59. Another configuration file option of relevance is:
  60. delnpc: <path to a filename>
  61. This will unload a specified script filename from memory, which, while
  62. seemingly useless, may sometimes be required.
  63. Whenever '//' is encountered in a line upon reading, everything beyond this on
  64. that line is considered to be a comment and is ignored. This works wherever you
  65. place it.
  66. // This line will be ignored when processing the script.
  67. Block comments can also be used, where you can place /* and */ between any text you
  68. wish rAthena to ignore.
  69. Example:
  70. /* This text,
  71. * no matter which new line you start
  72. * is ignored, until the following
  73. * symbol is encountered: */
  74. The asterisks (*) in front of each line is a personal preference and is not required.
  75. Upon loading all the files, the server will execute all the top-level commands
  76. in them. No variables exist yet at this point, no commands can be called other
  77. than those given in this section. These commands set up the basic structure - create
  78. NPC objects, spawn monster objects, set map flags, etc. No code is actually
  79. executed at this point. The top-level commands are pretty confusing, since
  80. they aren't structured like you would expect (command name first), but rather,
  81. normally start with a map name.
  82. What's more confusing about the top-level commands is that most of them use a
  83. tab symbol to divide their arguments.
  84. To prevent problems and confusion, the tab symbols are written as '%TAB%'
  85. throughout this document, even though this makes the text a bit less readable.
  86. Using an invisible symbol to denote arguments is one of the bad things about
  87. this language.
  88. Here is a list of valid top-level commands:
  89. ** Set a map flag:
  90. <map name>%TAB%mapflag%TAB%<flag>
  91. This will, upon loading, set a specified map flag on a map you like. These are
  92. normally in files inside 'npc/mapflag' and are loaded first, so by the time the
  93. server's up, all the maps have the flags they should have. Map flags determine
  94. the behavior of the map in various situations. For more details, see 'setmapflag'
  95. and 'doc/mapflags.txt'.
  96. ** Create a permanent monster spawn:
  97. <map name>,<x>,<y>{,<xs>{,<ys>}}%TAB%monster%TAB%<monster name>{,<monster level>}%TAB%<mob id>,<amount>{,<delay1>{,<delay2>{,<event>{,<mob size>{,<mob ai>}}}}}
  98. Map name is the name of the map the monsters will spawn on. x,y are the
  99. coordinates where the mob should spawn. If xs and ys are non-zero, they
  100. specify the 'radius' of a spawn-rectangle area centered at x,y.
  101. Putting zeros instead of these coordinates will spawn the monsters randomly.
  102. Note this is only the initial spawn zone, as mobs random-walk, they are free
  103. to move away from their specified spawn region.
  104. Monster name is the name the monsters will have on screen, and has no relation
  105. whatsoever to their names anywhere else. It's the mob id that counts, which
  106. identifies monster record in 'mob_db.txt' database of monsters. If the mob name
  107. is given as "--ja--", the 'japanese name' field from the monster database is
  108. used, (which, in rAthena, actually contains an English name) if it's "--en--",
  109. it's the 'english name' from the monster database (which contains an uppercase
  110. name used to summon the monster with a GM command).
  111. You can specify a custom level to use for the mob different from the one of
  112. the database by adjoining the level after the name with a comma. eg:
  113. "Poring,50" for a name will spawn a monster with name Poring and level 50.
  114. Amount is the amount of monsters that will be spawned when this command is
  115. executed, it is affected by spawn rates in 'battle_athena.conf'.
  116. Delay1 and delay2 control monster respawn delays - the first one is the fixed
  117. base respawn time, and the second is random variance on top of the base time.
  118. Both values are given in milliseconds (1000 = 1 second).
  119. Note that the server also enforces a minimum respawn delay of 5 seconds.
  120. Event is a script event to be executed when the mob is killed. The event must
  121. be in the form "NPCName::OnEventName" to execute, and the event name label
  122. should start with "On". As with all events, if the NPC is an on-touch NPC, the
  123. player who triggers the script must be within 'trigger' range for the event to
  124. work.
  125. There are two optional fields for monster size and AI.
  126. <mob size> can be:
  127. Size_Small (0)
  128. Size_Medium (1)
  129. Size_Large (2)
  130. <mob ai> can be:
  131. AI_NONE (0) (default)
  132. AI_ATTACK (1) (attack/friendly)
  133. AI_SPHERE (2) (Alchemist skill)
  134. AI_FLORA (3) (Alchemist skill)
  135. AI_ZANZOU (4) (Kagerou/Oboro skill)
  136. AI_LEGION (5) (Sera skill)
  137. AI_FAW (6) (Mechanic skill)
  138. Alternately, a monster spawned using 'boss_monster' instead of 'monster' is able
  139. to be detected on the map with the SC_BOSSMAPINFO status (used by Convex Mirror).
  140. ** NPC names
  141. /!\ WARNING: this applies to warps, NPCs, duplicates and shops /!\
  142. NPC names are kinda special and are formatted this way:
  143. <Display name>{::<Unique name>}
  144. All NPCs need to have a unique name that is used for identification purposes.
  145. When you have to identify a NPC by its name, you should use <Unique name>.
  146. If <Unique name> is not provided, use <Display name> instead.
  147. The client has a special feature when displaying names:
  148. if the display name contains a '#' character, it hides that part of the name.
  149. ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter'
  150. <Display name> must be at most 24 characters in length.
  151. <Unique name> must be at most 24 characters in length.
  152. ** Define a warp point
  153. <from mapname>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to mapname>,<toX>,<toY>
  154. <from mapname>,<fromX>,<fromY>,<facing>%TAB%warp2%TAB%<warp name>%TAB%<spanx>,<spany>,<to mapname>,<toX>,<toY>
  155. This will define a warp NPC that will warp a player between maps, and while most
  156. arguments of that are obvious, some deserve special mention.
  157. SpanX and SpanY will make the warp sensitive to a character who didn't step
  158. directly on it, but walked into a zone which is centered on the warp from
  159. coordinates and is SpanX in each direction across the X axis and SpanY in each
  160. direction across the Y axis.
  161. Warp NPC objects also have a name, because you can use it to refer to them later
  162. with 'enablenpc'/'disablenpc'
  163. Facing of a warp object is irrelevant, it is not used in the code and all
  164. current scripts have a zero in there.
  165. Unlike 'warp', 'warp2' will also be triggered by hidden player.
  166. ** Define an NPC object.
  167. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
  168. <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
  169. This will place an NPC object on a specified map at the specified location, and
  170. is a top-level command you will use the most in your custom scripting. The NPCs
  171. are triggered by clicking on them, and/or by walking in their trigger area, if
  172. defined, see that below.
  173. Facing is a direction the NPC sprite will face in. Not all NPC sprites have
  174. different images depending on the direction you look from, so for some facing
  175. will be meaningless. Facings are counted counterclockwise in increments of 45
  176. degrees, where 0 means facing towards the top of the map. (So to turn the sprite
  177. towards the bottom of the map, you use facing 4, and to make it look southeast
  178. it's facing 5.)
  179. Sprite ID is the sprite number or constant used to display this particular NPC.
  180. You may also use a monster's ID instead to display a monster sprite for this NPC.
  181. It is possible to use a job sprite as well, but you must first define it as a
  182. monster sprite in 'mob_avail.txt', a full description on how to do this is not
  183. in the scope of this manual.
  184. A '-1' Sprite ID will make the NPC invisible (and unclickable).
  185. A '111' Sprite ID will make an NPC which does not have a sprite, but is still
  186. clickable, which is useful if you want to make a clickable object of the 3D
  187. terrain.
  188. TriggerX and triggerY, if given, will define an area, centered on NPC and
  189. spanning triggerX cells in every direction across X and triggerY in every
  190. direction across Y. Walking into that area will trigger the NPC. If no
  191. 'OnTouch:' special label is present in the NPC code, the execution will start
  192. from the beginning of the script, otherwise, it will start from the 'OnTouch:'
  193. label. Monsters can also trigger the NPC, though the label 'OnTouchNPC:' is
  194. used in this case.
  195. The code part is the script code that will execute whenever the NPC is
  196. triggered. It may contain commands and function calls, descriptions of which
  197. compose most of this document. It has to be in curly brackets, unlike elsewhere
  198. where we use curly brackets, these do NOT signify an optional parameter.
  199. ** Define a 'floating' NPC object.
  200. -%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>}
  201. This will define an NPC object not triggerable by normal means. This would
  202. normally mean it's pointless since it can't do anything, but there are
  203. exceptions, mostly related to running scripts at specified time, which is what
  204. these floating NPC objects are for. More on that below.
  205. ** Define a shop/cashshop/itemshop/pointshop NPC.
  206. -%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  207. <map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  208. -%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  209. <map name>,<x>,<y>,<facing>%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
  210. -%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  211. <map name>,<x>,<y>,<facing>%TAB%itemshop%TAB%<NPC Name>%TAB%<sprite id>,<costitemid>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  212. -%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  213. <map name>,<x>,<y>,<facing>%TAB%pointshop%TAB%<NPC Name>%TAB%<sprite id>,<costvariable>{:<discount>},<itemid>:<price>{,<itemid>:<price>...}
  214. <map name>,<x>,<y>,<facing>%TAB%marketshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>:<quantity>{,<itemid>:<price>:<quantity>...}
  215. This will define a shop NPC, which, when triggered (which can only be done by
  216. clicking) will cause a shop window to come up. No code whatsoever runs in shop
  217. NPCs and you can't change the prices otherwise than by editing the script
  218. itself.
  219. The Item ID is the number of item in the 'item_db.txt' database. If Price is set
  220. to -1, the 'buy price' given in the item database will be used. Otherwise, the
  221. price you gave will be used for this item, which is how you create differing
  222. prices for items in different shops.
  223. There are other types of shops available:
  224. cashshop - use "cashshop" in place of "shop" to use the Cash Shop interface, allowing
  225. you to buy items with special points that are stored as account variables
  226. called #CASHPOINTS and #KAFRAPOINTS. This type of shop will not allow you to sell
  227. items at it, only make purchases. The layout used to define sale items still count, and
  228. "<price>" refers to how many points will be spent purchasing the them.
  229. "itemshop" and "pointshop" use the Shop interface, allowing you to buy items with a specific
  230. item or special points from a variable. 'pointshop' only supports permanent character variables,
  231. temporary character variables, permanent local account variables or permanent global account
  232. variables. These variables must be of integer type, not string. 'discount' flag is an
  233. optional value which makes the price at that shop become affected by discount skill.
  234. ** Define an warp/shop/cashshop/itemshop/pointshop/NPC duplicate.
  235. warp/warp2: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
  236. shop/cashshop/itemshop/pointshop/npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  237. shop/cashshop/itemshop/pointshop/npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
  238. npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  239. npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
  240. This will duplicate an warp/shop/cashshop/itemshop/pointshop/NPC referred to by 'label'.
  241. Warp duplicates inherit the target location.
  242. Shop/cashshop/itemshop/pointshop duplicates inherit the item list.
  243. NPC duplicates inherit the script code.
  244. The rest (name, location, facing, sprite ID, span/trigger area)
  245. is obtained from the definition of the duplicate (not inherited).
  246. ** Define a function object
  247. function%TAB%script%TAB%<function name>%TAB%{<code>}
  248. This will define a function object, callable with the 'callfunc' command (see
  249. below). This object will load on every map server separately, so you can get at
  250. it from anywhere. It's not possible to call the code in this object by
  251. anything other than the 'callfunc' script command.
  252. The code part is the script code that will execute whenever the function is
  253. called with 'callfunc'. It has to be in curly brackets, unlike elsewhere where
  254. we use curly brackets, these do NOT signify an optional parameter.
  255. Once an object is defined which has a 'code' field to its definition, it
  256. contains script commands which can actually be triggered and executed.
  257. ~ RID? GID? ~
  258. What a RID is and why do you need to know
  259. -----------------------------------------
  260. Most scripting commands and functions will want to request data about a
  261. character, store variables referenced to that character, send stuff to the
  262. client connected to that specific character. Whenever a script is invoked by a
  263. character, it is passed a so-called RID - this is the account ID number of a
  264. character that caused the code to execute by clicking on it, walking into its
  265. OnTouch zone, or otherwise.
  266. If you are only writing common NPCs, you don't need to bother with it. However,
  267. if you use functions, if you use timers, if you use clock-based script
  268. activation, you need to be aware of all cases when a script execution can be
  269. triggered without a RID attached. This will make a lot of commands and functions
  270. unusable, since they want data from a specific character, want to send stuff to
  271. a specific client, want to store variables specific to that character, and they
  272. would not know what character to work on if there's no RID.
  273. Unless you use 'attachrid' to explicitly attach a character to the script first.
  274. Whenever we say 'invoking character', we mean 'the character who's RID is
  275. attached to the running script. The script function "playerattached" can be
  276. used to check which is the currently attached player to the script (it will
  277. return 0 if the there is no player attached or the attached player no longer
  278. is logged on to the map-server).
  279. But what about GID?
  280. -------------------
  281. GID stands for the Game ID of something, this can either be the GID obtained
  282. through mobspawn (mob control commands) or the account ID of a character.
  283. Another way would be to right click on a mob, NPC or char as GM sprited char
  284. to view the GID.
  285. See also 'getpetinfo', 'getmercinfo', 'gethominfo', and 'geteleminfo'.
  286. This is mostly used for the new version of skill and the mob control commands
  287. implemented.
  288. Item and pet scripts
  289. --------------------
  290. Each item in the item database has three special fields - Script , OnEquip_Script
  291. and OnUnequip_Script. The first is script code run every time a character equips the item,
  292. with the RID of the equipping character. Every time they unequip an item, all
  293. temporary bonuses given by the script commands are cleared, and all the scripts
  294. are executed once again to rebuild them. This also happens in several other
  295. situations (like upon login) but the full list is currently unknown.
  296. OnEquip_Script is a piece of script code run whenever the item is used by a character
  297. by double-clicking on it. OnUnequip_Script runs whenever the
  298. equipment is unequip by a character
  299. Not all script commands work properly in the item scripts. Where commands and
  300. functions are known to be meant specifically for use in item scripts, they are
  301. described as such.
  302. Every pet in the pet database has a PetScript field, which determines pet
  303. behavior. It is invoked wherever a pet of the specified type is spawned.
  304. (hatched from an egg, or loaded from the char server when a character who had
  305. that pet following them connects) This may occur in some other situations as
  306. well. Don't expect anything other than commands definitely marked as usable in
  307. pet scripts to work in there reliably.
  308. Numbers
  309. -------
  310. Beside the common decimal numbers, which are nothing special whatsoever (though
  311. do not expect to use fractions, since ALL numbers are integer in this language),
  312. the script engine also handles hexadecimal numbers, which are otherwise
  313. identical. Writing a number like '0x<hex digits>' will make it recognized as a
  314. hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try
  315. to 'mes 0x10' it will print '16'.
  316. Number values can't exceed the limits of an integer variable: Any number
  317. greater than INT_MAX (2147483647) or smaller than INT_MIN (-2147483648) will
  318. be capped to those values and will cause a warning to be reported.
  319. Variables
  320. ---------
  321. The meat of every programming language is variables - places where you store
  322. data.
  323. In the rAthena scripting language, variable names are not case sensitive.
  324. Variables are divided into and uniquely identified by the combination of:
  325. prefix - determines the scope and extent (or lifetime) of the variable
  326. name - an identifier consisting of '_' and alphanumeric characters
  327. postfix - determines the type of the variable: integer or string
  328. Scope can be:
  329. global - global to all servers
  330. local - local to the server
  331. account - attached to the account of the character identified by RID
  332. character - attached to the character identified by RID
  333. npc - attached to the NPC
  334. scope - attached to the scope of the instance
  335. Extent can be:
  336. permanent - They still exist when the server resets.
  337. temporary - They cease to exist when the server resets.
  338. Prefix: scope and extent
  339. nothing - A permanent variable attached to the character, the default variable
  340. type. They are stored by char-server in the `char_reg_num` and
  341. `char_reg_str`.
  342. "@" - A temporary variable attached to the character.
  343. SVN versions before 2094 revision and RC5 version will also treat
  344. 'l' as a temporary variable prefix, so beware of having variable
  345. names starting with 'l' if you want full backward compatibility.
  346. "$" - A global permanent variable.
  347. They are stored by map-server in database table `mapreg`.
  348. "$@" - A global temporary variable.
  349. This is important for scripts which are called with no RID
  350. attached, that is, not triggered by a specific character object.
  351. "." - A NPC variable.
  352. They exist in the NPC and disappear when the server restarts or the
  353. NPC is reloaded. Can be accessed from inside the NPC or by calling
  354. 'getvariableofnpc'. Function objects can also have .variables which
  355. are accessible from inside the function, however 'getvariableofnpc'
  356. does NOT work on function objects.
  357. ".@" - A scope variable.
  358. They are unique to the instance and scope. Each instance has its
  359. own scope that ends when the script ends. Calling a function with
  360. callsub/callfunc starts a new scope, returning from the function
  361. ends it. When a scope ends, its variables are converted to values
  362. ('return .@var;' returns a value, not a reference).
  363. "'" - An instance variable.
  364. These are used with the instancing system and are unique to each
  365. instance type.
  366. "#" - A permanent local account variable.
  367. They are stored by char-server in the `acc_reg_num` table and
  368. `acc_reg_str`.
  369. "##" - A permanent global account variable stored by the login server.
  370. They are stored in the `global_acc_reg_num` table and
  371. `global_acc_reg_str`.
  372. The only difference you will note from normal # variables is when
  373. you have multiple char-servers connected to the same login server.
  374. The # variables are unique to each char-server, while the ## variables
  375. are shared by all these char-servers.
  376. Postfix: integer or string
  377. nothing - integer variable, can store positive and negative numbers, but only
  378. whole numbers (so don't expect to do any fractional math)
  379. '$' - string variable, can store text
  380. Examples:
  381. name - permanent character integer variable
  382. name$ - permanent character string variable
  383. @name - temporary character integer variable
  384. @name$ - temporary character string variable
  385. $name - permanent global integer variable
  386. $name$ - permanent global string variable
  387. $@name - temporary global integer variable
  388. $@name$ - temporary global string variable
  389. .name - NPC integer variable
  390. .name$ - NPC string variable
  391. .@name - scope integer variable
  392. .@name$ - scope string variable
  393. 'name - instance integer variable
  394. 'name$ - instance string variable
  395. #name - permanent local account integer variable
  396. #name$ - permanent local account string variable
  397. ##name - permanent global account integer variable
  398. ##name$ - permanent global account string variable
  399. If a variable was never set, it is considered to equal zero for integer
  400. variables or an empty string ("", nothing between the quotes) for string
  401. variables. Once you set it to that, the variable is as good as forgotten
  402. forever, and no trace remains of it even if it was stored with character or
  403. account data.
  404. Some variables are special, that is, they are already defined for you by the
  405. scripting engine. You can see the full list in 'src/map/script_constants.h', which
  406. is a file you should read, since it also allows you to replace lots of numbered
  407. arguments for many commands with easier to read text. The special variables most
  408. commonly used are all permanent character-based variables:
  409. Zeny - Amount of Zeny.
  410. Hp - Current amount of hit points.
  411. MaxHp - Maximum amount of hit points.
  412. Sp - Current spell points.
  413. MaxSp - Maximum amount of spell points.
  414. StatusPoint - Amount of status points remaining.
  415. SkillPoint - Amount of skill points remaining.
  416. BaseLevel - Character's base level.
  417. JobLevel - Character's job level.
  418. BaseExp - Amount of base experience points.
  419. JobExp - Amount of job experience points.
  420. NextBaseExp - Amount of base experience points needed to reach the next level.
  421. NextJobExp - Amount of job experience points needed to reach the next level.
  422. Weight - Amount of weight the character currently carries.
  423. MaxWeight - Maximum weight the character can carry.
  424. Sex - 0 if female, 1 if male.
  425. Class - Character's job.
  426. Upper - 0 if the character is a normal class, 1 if advanced, 2 if baby.
  427. BaseClass - The character's 1-1 'normal' job, regardless of Upper value.
  428. For example, this will return Job_Acolyte for Acolyte, Priest/Monk,
  429. High Priest/Champion, and Arch Bishop/Sura. If the character has not
  430. reached a 1-1 class, it will return Job_Novice.
  431. BaseJob - The character's 'normal' job, regardless of Upper value.
  432. For example, this will return Job_Acolyte for Acolyte,
  433. Baby Acolyte, and High Acolyte.
  434. Karma - The character's karma. Karma system is not fully functional, but
  435. this doesn't mean this doesn't work at all. Not tested.
  436. Manner - The character's manner rating. Becomes negative if the player
  437. utters words forbidden through the use of 'manner.txt' client-side
  438. file.
  439. While these behave as variables, do not always expect to just set them - it is
  440. not certain whether this will work for all of them. Whenever there is a command
  441. or a function to set something, it's usually preferable to use that instead. The
  442. notable exception is Zeny, which you can and often will address directly -
  443. setting it will make the character own this number of Zeny.
  444. If you try to set Zeny to a negative number, the script will be terminated with an error.
  445. Some source-end constants can also be accessed in scripts. This list is located in
  446. 'src/map/script.c' in the 'script_hardcoded_constants' function, which contains
  447. constants such as server defines and status options:
  448. PACKETVER, MAX_LEVEL, MAX_STORAGE, MAX_INVENTORY, MAX_CART, MAX_ZENY, MAX_PARTY,
  449. MAX_GUILD, MAX_GUILDLEVEL, MAX_GUILD_STORAGE, MAX_BG_MEMBERS, MAX_CHAT_USERS,
  450. VIP_SCRIPT, MIN_STORAGE
  451. Option_Nothing, Option_Sight, Option_Hide, Option_Cloak, Option_Falcon, Option_Riding,
  452. Option_Invisible, Option_Orcish, Option_Wedding, Option_Chasewalk, Option_Flying,
  453. Option_Xmas, Option_Transform, Option_Summer, Option_Dragon1, Option_Wug,
  454. Option_Wugrider, Option_Madogear, Option_Dragon2, Option_Dragon3, Option_Dragon4,
  455. Option_Dragon5, Option_Hanbok, Option_Oktoberfest, Option_Dragon, Option_Costume
  456. Assigning variables
  457. --------- ---------
  458. Variables can be accessed and modified much like in other programming languages.
  459. @x = 100;
  460. @x = @y = 100;
  461. Support for modifying variable values using 'set' is still supported (and required
  462. to exist for this new method to work) so previous scripts will continue to work.
  463. When assigning values, all operator methods are supported which exist in the below
  464. 'Operators' section. For instance:
  465. @x += 100;
  466. @x -= 100;
  467. @x *= 2;
  468. @x /= 2;
  469. @x %= 5;
  470. @x >>= 2;
  471. @x <<= 2;
  472. Will all work. For more information on available operators, see the Operators section
  473. described below. All operators listed there may be placed in-front of the '=' sign
  474. when modifying variables to perform the action as required.
  475. Note:
  476. !! Currently the scripting engine does not support directly copying array variables.
  477. !! In order to copy arrays between variables the use of 'copyarray' function is still
  478. !! required.
  479. Strings
  480. -------
  481. To include symbol '"' in a string you should use prefix '\"'
  482. Arrays
  483. ------
  484. Arrays (in rAthena at least) are essentially a set of variables going under the
  485. same name. You can tell between the specific variables of an array with an
  486. 'array index', a number of a variable in that array:
  487. <variable name>[<array index>]
  488. All variable types can be used as arrays.
  489. Variables stored in this way, inside an array, are also called 'array elements'.
  490. Arrays are specifically useful for storing a set of similar data (like several
  491. item IDs for example) and then looping through it. You can address any array
  492. variable as if it was a normal variable:
  493. set @arrayofnumbers[0],1;
  494. You can also do things like using a variable (or an expression, or even a
  495. value from another array) to get at an array value:
  496. set @x,100;
  497. set @arrayofnumbers[@x],10;
  498. This will make @arrayofnumbers[100] equal to 10.
  499. Index numbering always starts with 0 and arrays can hold over 2 billion
  500. variables. As such, the (guaranteed) allowed values for indices are in the
  501. range 0 ~ 2147483647.
  502. And array indexes probably can't be negative. Nobody tested what happens when
  503. you try to get a negatively numbered variable from an array, but it's not going
  504. to be pretty.
  505. Arrays can naturally store strings:
  506. @menulines$[0] is the 0th element of the @menulines$ array of strings. Notice
  507. the '$', normally denoting a string variable, before the square brackets that
  508. denotes an array index.
  509. Variable References
  510. -------------------
  511. //##TODO
  512. Operators
  513. ---------
  514. Operators are things you can do to variables and numbers. They are either the
  515. common mathematical operations or conditional operators
  516. + - will add two numbers. If you try to add two strings, the result will be a
  517. string glued together at the +. You can add a number to a string, and the
  518. result will be a string. No other math operators work with strings.
  519. - - will subtract two numbers.
  520. * - will multiply two numbers.
  521. / - will divide two numbers. Note that this is an integer division, i.e.
  522. 7/2 is not equal 3.5, it's equal 3.
  523. % - will give you the remainder of the division. 7%2 is equal to 1.
  524. There are also conditional operators. This has to do with the conditional
  525. command 'if' and they are meant to return either 1 if the condition is satisfied
  526. and 0 if it isn't. (That's what they call 'boolean' variables. 0 means 'False'.
  527. Anything except the zero is 'True' Odd as it is, -1 and -5 and anything below
  528. zero will also be True.)
  529. You can compare numbers to each other and you compare strings to each other, but
  530. you can not compare numbers to strings.
  531. == - Is true if both sides are equal. For strings, it means they are the same.
  532. >= - True if the first value is equal to, or greater than, the second value.
  533. <= - True if the first value is equal to, or less than, the second value
  534. > - True if the first value greater than the second value
  535. < - True if the first value is less than the second value
  536. != - True if the first value IS NOT equal to the second one
  537. Examples:
  538. 1==1 is True.
  539. 1<2 is True while 1>2 is False.
  540. @x>2 is True if @x is equal to 3. But it isn't true if @x is 2.
  541. Only '==' and '!=' have been tested for comparing strings. Since there's no way
  542. to code a seriously complex data structure in this language, trying to sort
  543. strings by alphabet would be pointless anyway.
  544. Comparisons can be stacked in the same condition:
  545. && - Is True if and only if BOTH sides are true.
  546. ('1==1 && 2==2' is true. '2==1 && 1==1' is false.)
  547. || - Is True if either side of this expression is True.
  548. 1==1 && 2==2 is True.
  549. 1==1 && 2==1 is False.
  550. 1==1 || 2==1 is True.
  551. Logical bitwise operators work only on numbers, and they are the following:
  552. << - Left shift.
  553. >> - Right shift.
  554. Left shift moves the binary 1(s) of a number n positions to the left,
  555. which is the same as multiplying by 2, n times.
  556. In the other hand, Right shift moves the binary 1(s) of a number n positions
  557. to the right, which is the same as dividing by 2, n times.
  558. Example:
  559. set b,2;
  560. set a, b << 3;
  561. mes a;
  562. set a, a >> 2;
  563. mes a;
  564. The first mes command would display 16, which is the same as 2 x (2 x 2 x 2) = 16.
  565. The second mes command would display 4, which is the same as 16 / 2 = 8. 8 / 2 = 4.
  566. & - And.
  567. | - Or.
  568. The bitwise operator AND (&) is used to test two values against each other,
  569. and results in setting bits which are active in both arguments. This can
  570. be used for a few things, but in rAthena this operator is usually used to
  571. create bit-masks in scripts.
  572. The bitwise operator OR (|)sets to 1 a binary position if the binary position
  573. of one of the numbers is 1. This way a variable can hold several values we can check,
  574. known as bit-mask. A variable currently can hold up to 32 bit-masks (from position 0
  575. to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks
  576. that a player can have.
  577. A bit-mask basically is (ab)using the variables bits to set various options in
  578. one variable. With the current limit if variables it is possible to store 32
  579. different options in one variable (by using the bits on position 0 to 31).
  580. Example(s):
  581. - Basic example of the & operator, bit example:
  582. 10 & 2 = 2
  583. Why? :
  584. 10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010
  585. 2 = 2^1 (2), so in bits (same size) it would be 0010
  586. The & (AND) operator sets bits which are active (1) in both arguments, so in the
  587. example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit
  588. 0010, which is 2.
  589. - Basic example of creating and using a bit-mask:
  590. set @options,2|4|16; //(note: this is the same as 2+4+16, or 22)
  591. if (@options & 1) mes "Option 1 is activated";
  592. if (@options & 2) mes "Option 2 is activated";
  593. if (@options & 4) mes "Option 3 is activated";
  594. if (@options & 8) mes "Option 4 is activated";
  595. if (@options & 16) mes "Options 5 is activated";
  596. This would return the messages about option 2, 3 and 5 being shown (since we've set
  597. the 2,4 and 16 bit to 1).
  598. ^ - Xor.
  599. The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if both
  600. numbers have the same value in the said position. On the other hand, it
  601. sets to 1 if they have different values in the said binary position.
  602. This is another way of setting and unsetting bits in bit-masks.
  603. Example:
  604. - First let's set the quests that are currently in progress:
  605. set inProgress,1|8|16; // quest 1,8 and 16 are in progress
  606. - After playing for a bit, the player starts another quest:
  607. if( inProgress&2 == 0 ){
  608. // this will set the bit for quest 2 (inProgress has that bit set to 0)
  609. set inProgress,inProgress^2;
  610. mes "Quest 2: find a newbie and be helpful to him for an hour.";
  611. close;
  612. }
  613. - After spending some time reading info on Xor's, the player finally completes quest 1:
  614. if( inProgress&1 && isComplete ){
  615. // this will unset the bit for quest 1 (inProgress has that bit set to 1)
  616. set inProgress,inProgress^1;
  617. mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
  618. close;
  619. }
  620. Unary operators with only with a single number, which follows the operator, and
  621. are following:
  622. - - Negation.
  623. The sign of the number will be reversed. If the number was positive, it will
  624. become negative and vice versa.
  625. Example:
  626. set .@myvar,10;
  627. mes "Negative 10 is "+(-.@myvar);
  628. ! - Logical Not.
  629. Reverses the boolean result of an expression. True will become false and
  630. false will become true.
  631. Example:
  632. if(!callfunc("F_dosomething"))
  633. {
  634. mes "Doing something failed.";
  635. close;
  636. }
  637. ~ - Bitwise Not.
  638. Reverses each bit in a number, also known as one's complement. Cleared bits
  639. are set, and set bits are cleared.
  640. Example:
  641. - Ensure, that quest 2 is disabled, while keeping all other active, if they are.
  642. set inProgress,inProgress&(~2); // same as set inProgress,inProgress&0xfffffffd
  643. Ternary operators take three expressions (numbers, strings or boolean), and are
  644. following:
  645. ?: - Conditional operator
  646. Very useful e.g. to replace
  647. if(Sex) mes "..."; else mes "...";
  648. clauses with simple
  649. mes "Welcome, " + (Sex?"Mr.":"Mrs.") + " " + strcharinfo(0);
  650. or to replace any other simple if-else clauses. It might be worth
  651. mentioning that ?: has low priority and has to be enclosed with
  652. parenthesis in most (if not all) cases.
  653. Labels
  654. ------
  655. Within executable script code, some lines can be labels:
  656. <label name>:
  657. Labels are points of reference in your script, which can be used to route
  658. execution with 'goto', 'menu' and 'jump_zero' commands, invoked with 'doevent'
  659. and 'donpcevent' commands and are otherwise essential. A label's name may not be
  660. longer than 22 characters. (23rd is the ':'.) There is some confusion in the
  661. source about whether it's 22, 23 or 24 all over the place, so keeping labels
  662. under 22 characters could be wise. It may only contain alphanumeric characters
  663. and underscore. In addition to labels you name yourself, there are also some
  664. special labels which the script engine will start execution from if a special
  665. event happens:
  666. OnClock<hour><minute>:
  667. OnMinute<minute>:
  668. OnHour<hour>:
  669. On<weekday><hour><minute>:
  670. OnDay<month><day>:
  671. This will execute when the server clock hits the specified date or time. Hours
  672. and minutes are given in military time. ('0105' will mean 01:05 AM). Weekdays
  673. are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01 to 31.
  674. Remember the zero.
  675. OnInit:
  676. OnInterIfInit:
  677. OnInterIfInitOnce:
  678. OnInit will execute every time the scripts loading is complete, including when
  679. they are reloaded with @reloadscript command. OnInterIfInit will execute when
  680. the map server connects to a char server, OnInterIfInitOnce will only execute
  681. once and will not execute if the map server reconnects to the char server later.
  682. OnAgitStart:
  683. OnAgitEnd:
  684. OnAgitInit:
  685. OnAgitStart2:
  686. OnAgitEnd2:
  687. OnAgitInit2:
  688. OnAgitStart3:
  689. OnAgitEnd3:
  690. OnAgitInit3:
  691. OnAgitStart will run whenever the server shifts into WoE mode, whether it is
  692. done with @agitstart GM command or with 'AgitStart' script command. OnAgitEnd
  693. will do likewise for the end of WoE.
  694. OnAgitInit will run when data for all castles and all guilds that hold a castle
  695. is received by map-server from the char-server after initial connect.
  696. No RID will be attached while any of the above mentioned labels are triggered, so
  697. no character or account-based variables will be accessible, until you attach a
  698. RID with 'attachrid' (see below).
  699. The above also applies to, the last three labels, the only difference is that
  700. these labels are used exclusively for WoE SE, and are called independently.
  701. OnInstanceInit:
  702. This label will be executed when an instance is created and initialized through
  703. the 'instance_create' command. It will run again if @reloadscript is used while
  704. an instance is in progress.
  705. OnInstanceDestroy:
  706. This label will be executed when an instance is destroyed by a timeout, exceeding
  707. the keepalive time or through the 'instance_destroy' command. It will be called
  708. exactly before the instance will be destroyed and all other NPCs of the instance
  709. will still be available at this point of time.
  710. OnTouch:
  711. This label will be executed if a trigger area is defined for the NPC object it's
  712. in. If it isn't present, the execution will start from the beginning of the NPC
  713. code. The RID of the triggering character object will be attached.
  714. OnTouch_:
  715. Similar to OnTouch, but will only run one instance. Another character is
  716. chosen once the triggering character leaves the area.
  717. OnTouchNPC:
  718. Similar to OnTouch, but will only trigger for monsters. For this case, by using
  719. 'getattachedrid' will returns GID (ID that returned when use 'monster').
  720. OnPCLoginEvent:
  721. OnPCLogoutEvent:
  722. OnPCBaseLvUpEvent:
  723. OnPCJobLvUpEvent:
  724. It's pretty obvious when these four special labels will be invoked.
  725. OnPCDieEvent:
  726. This special label triggers when a player dies. The variable 'killerrid' is
  727. set to the ID of the killer.
  728. OnPCKillEvent:
  729. This special label triggers when a player kills another player. The variable
  730. 'killedrid' is set to the ID of the player killed.
  731. OnNPCKillEvent:
  732. This special label triggers when a player kills a monster without label. The variable
  733. 'killedrid' is set to the Class (mob ID) of the monster killed.
  734. OnPCLoadMapEvent:
  735. This special label triggers when a player steps in a map marked with the
  736. 'loadevent' mapflag and attaches its RID. The fact that this label requires a
  737. mapflag for it to work is because, otherwise, it'd be server-wide and trigger
  738. every time a player would change maps. Imagine the server load with 1,000 players
  739. (oh the pain...)
  740. OnPCStatCalcEvent:
  741. This special label triggers when a player's stats are recalculated, such as when
  742. changing stats, equipment, or maps, as well as when logging in, leveling up, and
  743. mounting a job mount. This can be used to grant additional item bonuses to certain
  744. player groups, for instance.
  745. OnWhisperGlobal:
  746. This special label triggers when a player whispers the NPC, and will run with the
  747. player's RID attached. It can accept up to ten parameters, which will be stored
  748. into separate temporary character string variables @whispervar0$ to @whispervar9$.
  749. See 'doc/whisper_sys.txt' for further documentation.
  750. Only the special labels which are not associated with any script command are
  751. listed here. There are other kinds of labels which may be triggered in a similar
  752. manner, but they are described with their associated commands.
  753. On<label name>:
  754. These special labels are used with Mob scripts mostly, and script commands
  755. that requires you to point/link a command to a mob or another NPC, giving a label
  756. name to start from. The label name can be any of your liking, but must be
  757. started with "On".
  758. Example:
  759. monster "prontera",123,42,"Poringz0rd",2341,23,"Master::OnThisMobDeath";
  760. amatsu,13,152,4 script Master 767,{
  761. mes "Hi there";
  762. close;
  763. OnThisMobDeath:
  764. announce "Hey, "+strcharinfo(0)+" just killed a Poringz0rd!",bc_blue|bc_all;
  765. end;
  766. }
  767. Each time you kill one, that announce will appear in blue to everyone.
  768. "Global" labels
  769. There's a catch with labels and doevent. If you call a label (using doevent)
  770. and called label is in NPC that has trigger area, that label must end with
  771. "Global" to work globally (i.e. if RID is outside of the trigger area, which
  772. usually happens since otherwise there would be no point calling the label with
  773. doevent, because OnTouch would do the job). For further reference look for
  774. npc_event in npc.c.
  775. Scripting commands and functions
  776. --------------------------------
  777. The commands and functions are listed here in no particular order. There's a
  778. difference between commands and functions - commands leave no 'return value'
  779. which might be used in a conditional statement, as a command argument, or stored
  780. in a variable. Calling commands as if they were functions will sometimes work,
  781. but is not advised, as this can lead to some hard to track errors. Calling
  782. functions as if they were commands will mess up the stack, so 'return' command
  783. will not return correctly after this happens in a particular script.
  784. All commands must end with a ';'.
  785. -------------------------
  786. From here on, we will have the commands sorted as follow:
  787. 1.- Basic commands.
  788. 2.- Information-retrieving commands.
  789. 3.- Checking commands.
  790. 4.- Player-related commands.
  791. 5.- Mob / NPC -related commands.
  792. 6.- Other commands.
  793. 7.- Instance commands.
  794. 8.- Quest Log commands.
  795. 9.- Battleground commands.
  796. 10.- Pet commands.
  797. 10.1.- The Pet AI commands.
  798. 11.- Homunculus commands.
  799. 12.- Mercenary commands.
  800. 13.- Party commands.
  801. 14.- Channel commands.
  802. =====================
  803. |1.- Basic commands.|
  804. =====================
  805. ---------------------------------------
  806. *mes "<string>"{,"<string>"{,...}};
  807. This command will display a box on the screen for the invoking character, if no
  808. such box is displayed already, and will print the string specified into that
  809. box. There is normally no 'close' or 'next' button on this box, unless you
  810. create one with 'close' or 'next', and while it's open the player can't do much
  811. else, so it's important to create a button later. If the string is empty, it
  812. will show up as an empty line.
  813. mes "Text that will appear in the box";
  814. Colors
  815. ------
  816. Inside the string you may put color codes, which will alter the color of the
  817. text printed after them. The color codes are all '^<R><G><B>' and contain three
  818. hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is
  819. bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.
  820. ^FF00FF is a pure magenta, but it's also a color that is considered transparent
  821. whenever the client is drawing windows on screen, so printing text in that color
  822. will have kind of a weird effect. Once you've set a text's color to something,
  823. you have to set it back to black unless you want all the rest of the text be in
  824. that color:
  825. mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";
  826. Notice that the text coloring is handled purely by the client. If you use non-
  827. English characters, the color codes might get screwed if they stick to letters
  828. with no intervening space. Separating them with spaces from the letters on
  829. either side solves the problem.
  830. Multiple Lines
  831. --------------
  832. To display multiple lines of message while only using a single 'mes' command,
  833. use the script command in the following format:
  834. mes "Line 1", "Line 2", "Line 3";
  835. This will display 3 different lines while only consuming a single line in
  836. the relevant script file.
  837. Navigation
  838. ----------
  839. For clients dated 2011-10-10aRagexe onwards, you can generate navigation links
  840. using HTML-like labels:
  841. <NAVI>Display Name<INFO>mapname,x,y,0,000,flag</INFO></NAVI>
  842. The "flag" parameter can be:
  843. 0: Do not open Navigation Window (default).
  844. 1: Open Navigation Window.
  845. The example below will make the [Tool Shop] text clickable and begin navigation
  846. to alberta (98,154) when clicked.
  847. mes "Have you checked out the <NAVI>[Tool Shop]<INFO>alberta,98,154,0,000,0</INFO></NAVI>?";
  848. See also 'navigateto', which can be used for certain NPC events.
  849. Items
  850. -----
  851. You can refer to items by using HTML-like links to certain items:
  852. <ITEMLINK>Display Name<INFO>Item ID</INFO></ITEMLINK>
  853. Where <Display Name> is the name that will be displayed for your link and
  854. <Item ID> being the ID of the item you want to link to when clicked.
  855. In 2015 the tag name was changed to <ITEM> resulting in the following syntax:
  856. <ITEM>Display Name<INFO>Item ID</INFO></ITEM>
  857. The following sample will open a preview window for Red Potion:
  858. mes "Did you ever consume a <ITEMLINK>Red Potion<INFO>501</INFO></ITEMLINK>?";
  859. // Or in 2015:
  860. mes "Did you ever consume a <ITEM>Red Potion<INFO>501</INFO></ITEM>?";
  861. NOTE: Be aware that item links are rendered incorrectly in 2015+ clients at the moment.
  862. URLs
  863. ----
  864. Similarly, you can create links to websites that launch in a new window:
  865. <URL>Display Name<INFO>http://www.example.com/</INFO></URL>";
  866. ---------------------------------------
  867. *next;
  868. This command will display a 'next' button in the message window for the
  869. invoking character. Clicking on it will cause the window to clear and display
  870. a new one. Used to segment NPC-talking, next is often used in combination with
  871. 'mes' and 'close'.
  872. If no window is currently on screen, one will be created, but once the invoking
  873. character clicks on it, a warning is thrown on the server console and the script
  874. will terminate.
  875. mes "[Woman]";
  876. mes "This would appear on the page";
  877. next;
  878. // This is needed since it is a new page and the top will now be blank
  879. mes "[Woman]";
  880. mes "This would appear on the 2nd page";
  881. ---------------------------------------
  882. *close;
  883. This command will create a 'close' button in the message window for the invoking
  884. character. If no window is currently on screen, the script execution will end. This is one
  885. of the ways to end a speech from an NPC. Once the button is clicked, the NPC
  886. script execution will end, and the message box will disappear.
  887. mes "[Woman]";
  888. mes "I am finished talking to you. Click the close button.";
  889. close;
  890. mes "This command will not run at all, since the script has ended.";
  891. ---------------------------------------
  892. *close2;
  893. This command will create a 'close' button in the message window for the invoking
  894. character. WARNING: If no window is currently on screen, the script execution will halt
  895. indefinitely! See 'close'. There is one important difference, though - even though
  896. the message box will have closed, the script execution will not stop, and commands after
  897. 'close2' will still run, meaning an 'end' has to be used to stop the script, unless you
  898. make it stop in some other manner.
  899. mes "[Woman]";
  900. mes "I will warp you now.";
  901. close2;
  902. warp "place",50,50;
  903. end;
  904. Don't expect things to run smoothly if you don't make your scripts 'end'.
  905. ---------------------------------------
  906. *end;
  907. This command will stop the execution for this particular script. The two
  908. versions are perfectly equivalent. It is the normal way to end a script which
  909. does not use 'mes'.
  910. if (BaseLevel<=10) goto L_Lvl10;
  911. if (BaseLevel<=20) goto L_Lvl20;
  912. if (BaseLevel<=30) goto L_Lvl30;
  913. if (BaseLevel<=40) goto L_Lvl40;
  914. if (BaseLevel<=50) goto L_Lvl50;
  915. if (BaseLevel<=60) goto L_Lvl60;
  916. if (BaseLevel<=70) goto L_Lvl70;
  917. L_Lvl10:
  918. npctalk "Look at that you are still a n00b";
  919. end;
  920. L_Lvl20:
  921. npctalk "Look at that you are getting better, but still a n00b";
  922. end;
  923. L_Lvl30:
  924. npctalk "Look at that you are getting there, you are almost 2nd profession now right???";
  925. end;
  926. L_Lvl40:
  927. npctalk "Look at that you are almost 2nd profession";
  928. end;
  929. Without the use of 'end' it would travel through the labels until the end of the
  930. script. If you were lvl 10 or less, you would see all the speech lines, the use
  931. of 'end' stops this, and ends the script.
  932. ---------------------------------------
  933. *set <variable>,<expression>{,<char_id>};
  934. *set(<variable>,<expression>{,<char id>})
  935. This command will set a variable to the value that the expression results in.
  936. Variables may either be set through this command or directly, much like any
  937. other programming language (refer to the "Assigning variables" section).
  938. This is the most basic script command and is used a lot whenever you try to do
  939. anything more advanced than just printing text into a message box.
  940. set @x,100;
  941. will make @x equal 100.
  942. set @x,1+5/8+9;
  943. will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are
  944. integer in this language) and make @x equal it.
  945. Returns the variable reference (since trunk r12870).
  946. ---------------------------------------
  947. *setd "<variable name>",<value>{,<char_id>};
  948. Works almost identically as set, except the variable name is identified as a string
  949. and can thus be constructed dynamically.
  950. This command is equivalent to:
  951. set getd("variable name"),<value>;
  952. Examples:
  953. setd ".@var$", "Poporing";
  954. mes .@var$; // Displays "Poporing".
  955. setd ".@" + .@var$ + "123$", "Poporing is cool";
  956. mes .@Poporing123$; // Displays "Poporing is cool".
  957. NOTE:
  958. 'char_id' only works for non-server variables.
  959. Player with Character ID 'char_id' must be online.
  960. ---------------------------------------
  961. *getd("<variable name>")
  962. Returns a reference to a variable, the name can be constructed dynamically.
  963. Refer to 'setd' for usage.
  964. This can also be used to set an array dynamically:
  965. setarray getd(".array[0]"), 1, 2, 3, 4, 5;
  966. Examples:
  967. set getd("$varRefence"), 1;
  968. set @i, getd("$" + "pikachu");
  969. ---------------------------------------
  970. *getvariableofnpc(<variable>,"<npc name>")
  971. Returns a reference to a NPC variable (. prefix) from the target NPC.
  972. This can only be used to get . variables.
  973. Examples:
  974. //This will return the value of .var, note that this can't be used, since the value isn't caught.
  975. getvariableofnpc(.var,"TargetNPC");
  976. //This will set the .v variable to the value of the TargetNPC's .var variable.
  977. set .v, getvariableofnpc(.var,"TargetNPC");
  978. //This will set the .var variable of TargetNPC to 1.
  979. set getvariableofnpc(.var,"TargetNPC"), 1;
  980. Note: even though function objects can have .variables,
  981. getvariableofnpc will not work on them.
  982. ---------------------------------------
  983. *getvar <variable>,<char_id>;
  984. Get variable value from the specified player. Only player/account variables
  985. are allowed to be used (temporary character variable "@", permanent
  986. character "", permanent local account "#", and permanent global account "##").
  987. ---------------------------------------
  988. *goto <label>;
  989. This command will make the script jump to a label, usually used in conjunction
  990. with other command, such as "if", but often used on its own.
  991. ...
  992. goto Label;
  993. mes "This will not be seen";
  994. Label:
  995. mes "This will be seen";
  996. This command should be avoided and only used if there is no other option.
  997. ---------------------------------------
  998. *menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...};
  999. This command will create a selectable menu for the invoking character. Only one
  1000. menu can be on screen at the same time.
  1001. Depending on what the player picks from the menu, the script execution will
  1002. continue from the corresponding label. (it's string-label pairs, not label-
  1003. string)
  1004. Options can be grouped together, separated by the character ':'.
  1005. menu "A:B",L_Wrong,"C",L_Right;
  1006. It also sets a special temporary character variable @menu, which contains the
  1007. number of option the player picked. (Numbering of options starts at 1.)
  1008. This number is consistent with empty options and grouped options.
  1009. menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
  1010. L_Wrong:
  1011. // If they click "A" or "B" they will end up here
  1012. // @menu == 1 if "A"
  1013. // @menu == 2 will never happen because the option is empty
  1014. // @menu == 3 if "B"
  1015. L_Impossible:
  1016. // Empty options are not displayed and therefore can't be selected
  1017. // this label will never be reached from the menu command
  1018. L_Right:
  1019. // If they click "C" they will end up here
  1020. // @menu == 5
  1021. If a label is '-', the script execution will continue right after the menu
  1022. command if that option is selected, this can be used to save you time, and
  1023. optimize big scripts.
  1024. menu "A::B:",-,"C",L_Right;
  1025. // If they click "A" or "B" they will end up here
  1026. // @menu == 1 if "A"
  1027. // @menu == 3 if "B"
  1028. L_Right:
  1029. // If they click "C" they will end up here
  1030. // @menu == 5
  1031. Both these examples will perform the exact same task.
  1032. If you give an empty string as a menu item, the item will not display. This
  1033. can effectively be used to script dynamic menus by using empty string for
  1034. entries that should be unavailable at that time.
  1035. You can do it by using arrays, but watch carefully - this trick isn't high
  1036. wizardry, but minor magic at least. You can't expect to easily duplicate it
  1037. until you understand how it works.
  1038. Create a temporary array of strings to contain your menu items, and populate it
  1039. with the strings that should go into the menu at this execution, making sure not
  1040. to leave any gaps. Normally, you do it with a loop and an extra counter, like
  1041. this:
  1042. setarray @possiblemenuitems$[0],<list of potential menu items>;
  1043. @j = 0; // That's the menu lines counter.
  1044. // We loop through the list of possible menu items.
  1045. // @i is our loop counter.
  1046. for( @i = 0; @i < getarraysize(@possiblemenuitems$); @i++ )
  1047. {
  1048. // That 'condition' is whatever condition that determines whether
  1049. // a menu item number @i actually goes into the menu or not.
  1050. if (<condition>)
  1051. {
  1052. // We record the option into the list of options actually available.
  1053. @menulist$[@j] = @possiblemenuitems$[@i];
  1054. // We just copied the string, we do need its number for later
  1055. // though, so we record it as well.
  1056. @menureference[@j] = @i;
  1057. // Since we've just added a menu item into the list, we increment
  1058. // the menu lines counter.
  1059. @j++;
  1060. }
  1061. // We go on to the next possible menu item.
  1062. }
  1063. This will create you an array @menulist$ which contains the text of all items
  1064. that should actually go into the menu based on your condition, and an array
  1065. @menureference, which contains their numbers in the list of possible menu items.
  1066. (Remember, arrays start with 0.) There's less of them than the possible menu
  1067. items you've defined, but the menu command can handle the empty lines - only if
  1068. they are last in the list, and if it's made this way, they are. Now comes a
  1069. dirty trick:
  1070. // X is whatever the most menu items you expect to handle.
  1071. menu @menulist$[0],-,@menulist$[1],-,....@menulist$[<X>],-;
  1072. This calls up a menu of all your items. Since you didn't copy some of the
  1073. possible menu items into the list, its end is empty and so no menu items will
  1074. show up past the end. But this menu call doesn't jump anywhere, it just
  1075. continues execution right after the menu command. (And it's a good thing it
  1076. doesn't, cause you can only explicitly define labels to jump to, and how do you
  1077. know which ones to define if you don't know beforehand which options will end up
  1078. where in your menu?)
  1079. But how do you figure out which option the user picked? Enter the @menu.
  1080. @menu contains the number of option that the user selected from the list,
  1081. starting with 1 for the first option. You know now which option the user picked
  1082. and which number in your real list of possible menu items it translated to:
  1083. mes "You selected "+@possiblemenuitems$[@menureference[@menu-1]]+"!";
  1084. @menu is the number of option the user picked.
  1085. @menu-1 is the array index for the list of actually used menu items that we
  1086. made.
  1087. @menureference[@menu-1] is the number of the item in the array of possible menu
  1088. items that we've saved just for this purpose.
  1089. And @possiblemenuitems$[@menureference[@menu-1]] is the string that we used to
  1090. display the menu line the user picked. (Yes, it's a handful, but it works.)
  1091. You can set up a bunch of 'if (@menureference[@menu-1]==X) goto Y' statements to
  1092. route your execution based on the line selected and still generate a different
  1093. menu every time, which is handy when you want to, for example, make users select
  1094. items in any specific order before proceeding, or make a randomly shuffled menu.
  1095. Kafra code bundled with the standard distribution uses a similar array-based
  1096. menu technique for teleport lists, but it's much simpler and doesn't use @menu,
  1097. probably since that wasn't documented anywhere.
  1098. See also 'select', which is probably better in this particular case. Instead of
  1099. menu, you could use 'select' like this:
  1100. @dummy = select(@menulist$[0],@menulist$[1],....@menulist$[<X>]);
  1101. For the purposes of the technique described above these two statements are
  1102. perfectly equivalent.
  1103. ---------------------------------------
  1104. *select("<option>"{,"<option>",...})
  1105. *prompt("<option>"{,"<option>",...})
  1106. This function is a handy replacement for 'menu' for some specific cases where
  1107. you don't want a complex label structure - like, for example, asking simple yes-
  1108. no questions. It will return the number of menu option picked, starting with 1.
  1109. Like 'menu', it will also set the variable @menu to contain the option the user
  1110. picked.
  1111. if (select("Yes:No")==1) mes "You said yes, I know.";
  1112. And like 'menu', the selected option is consistent with grouped options
  1113. and empty options.
  1114. 'prompt' works almost the same as select, except that when a character clicks
  1115. the Cancel button, this function will return 255 instead.
  1116. ---------------------------------------
  1117. *input(<variable>{,<min>{,<max>}})
  1118. This command will make an input box pop up on the client connected to the
  1119. invoking character, to allow entering of a number or a string. This has many
  1120. uses, one example would be a guessing game, also making use of the 'rand'
  1121. function:
  1122. mes "[Woman]";
  1123. mes "Try and guess the number I am thinking of.";
  1124. mes "The number will be between 1 and 10.";
  1125. next;
  1126. .@number = rand(1,10);
  1127. input .@guess;
  1128. if (.@guess == .@number) {
  1129. mes "[Woman]";
  1130. mes "Well done, that was the number I was thinking of!";
  1131. close;
  1132. } else {
  1133. mes "[Woman]";
  1134. mes "Sorry, that wasn't the number I was thinking of.";
  1135. close;
  1136. }
  1137. If you give the input command a string variable to put the input in, it will
  1138. allow the player to enter text. Otherwise, only numbers will be allowed.
  1139. mes "[Woman]";
  1140. mes "Please say HELLO";
  1141. next;
  1142. input .@var$;
  1143. if (.@var$ == "HELLO") {
  1144. mes "[Woman]";
  1145. mes "Well done, you typed it correctly.";
  1146. close;
  1147. } else {
  1148. mes "[Woman]";
  1149. mes "Sorry, you got it wrong.";
  1150. close;
  1151. }
  1152. Normally you may not input a negative number with this command.
  1153. This is done to prevent exploits in badly written scripts, which would
  1154. let people, for example, put negative amounts of Zeny into a bank script and
  1155. receive free Zeny as a result.
  1156. Since trunk r12192 the command has two optional arguments and a return value.
  1157. The default value of 'min' and 'max' can be set with 'input_min_value' and
  1158. 'input_max_value' in script_athena.conf.
  1159. For numeric inputs the value is capped to the range [min,max]. Returns 1 if
  1160. the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
  1161. For string inputs it returns 1 if the string was longer than 'max', -1 is
  1162. shorter than 'min' and 0 otherwise.
  1163. ---------------------------------------
  1164. *callfunc "<function>"{,<argument>,...<argument>};
  1165. *callfunc("<function>"{,<argument>,...<argument>})
  1166. This command lets you call up a function NPC. A function NPC can be called from
  1167. any script on any map server. Using the 'return' command it will come back to
  1168. the place that called it.
  1169. place,50,50,6%TAB%script%TAB%Woman%TAB%115,{
  1170. mes "[Woman]"
  1171. mes "Let's see if you win...";
  1172. callfunc "funcNPC";
  1173. mes "Well done, you have won!";
  1174. close;
  1175. }
  1176. function%TAB%script%TAB%funcNPC%TAB%{
  1177. .@win = rand(2);
  1178. if (.@win == 0) return;
  1179. mes "Sorry, you lost.";
  1180. close;
  1181. }
  1182. You can pass arguments to your function - values telling it what exactly to do -
  1183. which will be available there with getarg() (see 'getarg')
  1184. Notice that returning is not mandatory, you can end execution right there.
  1185. If you want to return a real value from inside your function NPC, it is better
  1186. to write it in the function form, which will also work and will make the script
  1187. generally cleaner:
  1188. place,50,50,6%TAB%script%TAB%Man%TAB%115,{
  1189. mes "[Man]"
  1190. mes "Gimme a number!";
  1191. next;
  1192. input @number;
  1193. if (callfunc("OddFunc",@number)) mes "It's Odd!";
  1194. close;
  1195. }
  1196. function%TAB%script%TAB%OddFunc%TAB%{
  1197. if (getarg(0)%2==0) return 0;// it's even
  1198. return 1;// it's odd
  1199. }
  1200. Alternately, as of rAthena revision 15979 and 15981, user-defined functions
  1201. may be called directly without the use of the 'callfunc' script command.
  1202. function<tab>script<tab>SayHello<tab>{
  1203. mes "Hello " + getarg(0);
  1204. return 0;
  1205. }
  1206. place,50,50,6<tab>script<tab>Man<tab>115,{
  1207. mes "[Man]";
  1208. SayHello strcharinfo(0);
  1209. close;
  1210. }
  1211. Note:
  1212. !! A user-defined function must be declared /before/ a script attempts to
  1213. !! call it. That is to say, any functions should be placed above scripts or NPCs
  1214. !! (or loaded in a separate file first) before attempting to call them directly.
  1215. ---------------------------------------
  1216. *callsub <label>{,<argument>,...<argument>};
  1217. *callsub(<label>{,<argument>,...<argument>})
  1218. This command will go to a specified label within the current script (do NOT use
  1219. quotes around it) coming in as if it were a 'callfunc' call, and pass it
  1220. arguments given, if any, which can be recovered there with 'getarg'. When done
  1221. there, you should use the 'return' command to go back to the point from where
  1222. this label was called. This is used when there is a specific thing the script
  1223. will do over and over, this lets you use the same bit of code as many times as
  1224. you like, to save space and time, without creating extra NPC objects which are
  1225. needed with 'callfunc'. A label is not callable in this manner from another
  1226. script.
  1227. Example 1: callsub for checking (if checks pass, return to script)
  1228. callsub S_CheckFull, "guild_vs2",50;
  1229. switch( rand(4) ) {
  1230. case 0: warp "guild_vs2",9,50; end;
  1231. case 1: warp "guild_vs2",49,90; end;
  1232. case 2: warp "guild_vs2",90,50; end;
  1233. case 3: warp "guild_vs2",49,9; end;
  1234. }
  1235. ...
  1236. S_CheckFull:
  1237. if (getmapusers(getarg(0)) >= getarg(1)) {
  1238. mes "I'm sorry, this arena is full. Please try again later.";
  1239. close;
  1240. }
  1241. return;
  1242. Example 2: callsub used repeatedly, with different arguments
  1243. // notice how the Zeny check/delete is reused, instead of copy-pasting for every warp
  1244. switch(select("Abyss Lake:Amatsu Dungeon:Anthell:Ayothaya Dungeon:Beacon Island, Pharos") {
  1245. case 1: callsub S_DunWarp,"hu_fild05",192,207;
  1246. case 2: callsub S_DunWarp,"ama_in02",119,181;
  1247. case 3: callsub S_DunWarp,"moc_fild20",164,145;
  1248. case 4: callsub S_DunWarp,"ayo_fild02",279,150;
  1249. case 5: callsub S_DunWarp,"cmd_fild07",132,125;
  1250. // etc
  1251. }
  1252. ...
  1253. S_DunWarp:
  1254. // getarg(0) = "map name"
  1255. // getarg(1) = x
  1256. // getarg(2) = y
  1257. if (Zeny >= 100) {
  1258. Zeny -= 100;
  1259. warp getarg(0),getarg(1),getarg(2);
  1260. } else {
  1261. mes "Dungeon warp costs 100 Zeny.";
  1262. }
  1263. close;
  1264. ---------------------------------------
  1265. *getarg(<index>{,<default_value>})
  1266. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1267. call you can specify variables that will make that call different from another
  1268. one. This function will return an argument the function or subroutine was
  1269. called with, and is the normal way to get them.
  1270. This is another thing that can let you use the same code more than once.
  1271. Argument numbering starts with 0, i.e. the first argument you gave is number 0.
  1272. If no such argument was given, a zero is returned.
  1273. place,50,50,6%TAB%script%TAB%Woman1%TAB%115,{
  1274. mes "[Woman]";
  1275. mes "Let's see if you win...";
  1276. callfunc "funcNPC",2;
  1277. mes "Well done, you have won!";
  1278. close;
  1279. }
  1280. place,52,50,6%TAB%script%TAB%Woman2%TAB%115,{
  1281. mes "[Woman]";
  1282. mes "Let's see if you win...";
  1283. callfunc "funcNPC",5;
  1284. mes "Well done, you have won!";
  1285. close;
  1286. }
  1287. function%TAB%script%TAB%funcNPC%TAB%{
  1288. .@win = rand(getarg(0));
  1289. if (.@win == 0) return;
  1290. mes "Sorry, you lost.";
  1291. close;
  1292. |
  1293. "woman1" NPC object calls the funcNPC. The argument it gives in this call is
  1294. stated as 2, so when the random number is generated by the 'rand' function, it
  1295. can only be 0 or 1. Whereas "woman2" gives 5 as the argument number 0 when
  1296. calling the function, so the random number could be 0, 1, 2, 3 or 4, this makes
  1297. "woman2" less likely to say the player won.
  1298. You can pass multiple arguments in a function call:
  1299. callfunc "funcNPC",5,4,3;
  1300. getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3.
  1301. 'getarg' has an optional argument since trunk r10773 and stable r10958.
  1302. If the target argument exists, it is returned.
  1303. Otherwise, if <default_value> is present it is returned instead,
  1304. if not the script terminates immediately.
  1305. In the previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1.
  1306. ---------------------------------------
  1307. *getargcount()
  1308. This function is used when you use the 'callsub' or 'callfunc' commands. In the
  1309. call you can specify arguments. This function will return the number of arguments
  1310. provided.
  1311. Example:
  1312. callfunc "funcNPC",5,4,3;
  1313. ...
  1314. function%TAB%script%TAB%funcNPC%TAB%{
  1315. .@count = getargcount(); // 3
  1316. ...
  1317. }
  1318. ---------------------------------------
  1319. *return {<value>};
  1320. This command causes the script execution to leave previously called function
  1321. with callfunc or script with callsub and return to the location, where the call
  1322. originated from. Optionally a return value can be supplied, when the call was
  1323. done using the function form.
  1324. Using this command outside of functions or scripts referenced by callsub will
  1325. result in error and termination of the script.
  1326. callfunc "<your function>";// when nothing is returned
  1327. set <variable>,callfunc("<your function>");// when a value is being returned
  1328. ---------------------------------------
  1329. *function <function name>;
  1330. *<function name>{(<argument>,...<argument>)};
  1331. *function <function name> {
  1332. <code>
  1333. }
  1334. This works like callfunc, and is used for cleaner and faster scripting. The function
  1335. must be defined and used within a script, and works like a label with arguments.
  1336. Note that the name may only contain alphanumeric characters and underscore.
  1337. Usage:
  1338. 1. Declare the function.
  1339. function <function name>;
  1340. 2. Call the function anywhere within the script.
  1341. It can also return a value when used with parentheses.
  1342. <function name>;
  1343. 3. Define the function within the script.
  1344. <function name> {<code>}
  1345. Example:
  1346. prontera,154,189,4 script Item Seller 767,{
  1347. /* Function declaration */
  1348. function SF_Selling;
  1349. if (Zeny > 50) {
  1350. mes "Welcome!";
  1351. /* Function call */
  1352. SF_Selling;
  1353. }
  1354. else mes "You need 50z, sorry!";
  1355. close;
  1356. /* Function definition */
  1357. function SF_Selling {
  1358. mes "Would you like to buy a phracon for 50z?";
  1359. next;
  1360. if(select("Yes","No, thanks") == 1) {
  1361. Zeny -= Zeny;
  1362. getitem 1010,1;
  1363. mes "Thank you!";
  1364. }
  1365. return;
  1366. }
  1367. }
  1368. Example with parameters and return value:
  1369. prontera,150,150,0 script TestNPC 123,{
  1370. /* Function declaration */
  1371. function MyAdd;
  1372. mes "Enter two numbers.";
  1373. next;
  1374. input .@a;
  1375. input .@b;
  1376. /* Function call */
  1377. mes .@a+" + "+.@b+" = "+MyAdd(.@a,.@b);
  1378. close;
  1379. /* Function definition */
  1380. function MyAdd {
  1381. return getarg(0)+getarg(1);
  1382. }
  1383. }
  1384. ---------------------------------------
  1385. *is_function("<function name>")
  1386. This command checks whether a function exists.
  1387. It returns 1 if function is found, or 0 if it isn't.
  1388. Example:
  1389. function script try {
  1390. dothat;
  1391. }
  1392. - script test -1,{
  1393. .@try = is_function("try"); // 1
  1394. .@not = is_function("not"); // 0
  1395. }
  1396. ---------------------------------------
  1397. *if (<condition>) <statement>;
  1398. This is the basic conditional statement command, and just about the only one
  1399. available in this scripting language.
  1400. The condition can be any expression. All expressions resulting in a non-zero
  1401. value will be considered True, including negative values. All expressions
  1402. resulting in a zero are false.
  1403. If the expression results in True, the statement will be executed. If it isn't
  1404. true, nothing happens and we move on to the next line of the script.
  1405. if (1) mes "This will always print.";
  1406. if (0) mes "And this will never print.";
  1407. if (5) mes "This will also always print.";
  1408. if (-1) mes "Funny as it is, this will also print just fine.";
  1409. For more information on conditional operators see the operators section above.
  1410. Anything that is returned by a function can be used in a condition check without
  1411. bothering to store it in a specific variable:
  1412. if (strcharinfo(0)=="Daniel Jackson") mes "It is true, you are Daniel!";
  1413. More examples of using the 'if' command in the real world:
  1414. Example 1:
  1415. .@answer = 1;
  1416. input .@input;
  1417. if (.@input == .@answer)
  1418. close;
  1419. mes "Sorry, your answer is incorrect.";
  1420. close;
  1421. Example 2:
  1422. .@answer = 1;
  1423. input .@input;
  1424. if (.@input != .@answer)
  1425. mes "Sorry, your answer is incorrect.";
  1426. close;
  1427. Notice that examples 1 and 2 have the same effect.
  1428. Example 3:
  1429. @count++;
  1430. mes "[Forgetful Man]";
  1431. if (@count == 1) mes "This is the first time you have talked to me.";
  1432. if (@count == 2) mes "This is the second time you have talked to me.";
  1433. if (@count == 3) mes "This is the third time you have talked to me.";
  1434. if (@count == 4) {
  1435. mes "This is the fourth time you have talked to me.";
  1436. mes "I think I am getting amnesia, I have forgotten about you...";
  1437. @count = 0;
  1438. }
  1439. close;
  1440. Example 4:
  1441. mes "[Quest Person]";
  1442. if (countitem(512) < 1) { // 512 is the item ID for Apple, found in item_db
  1443. mes "Can you please bring me an apple?";
  1444. close;
  1445. }
  1446. mes "Oh, you brought an Apple!";
  1447. mes "I didn't want it, I just wanted to see one.";
  1448. close;
  1449. Example 5:
  1450. mes "[Person Checker]";
  1451. if ($@name$ == "") { // global variable not yet set
  1452. mes "Please tell me someones name";
  1453. next;
  1454. input $@name$;
  1455. $@name2$ = strcharinfo(0);
  1456. mes "[Person Checker]";
  1457. mes "Thank you.";
  1458. close;
  1459. }
  1460. if ($@name$ == strcharinfo(0)) { // player name matches $@name$
  1461. mes "You are the person that " +$@name2$+ " just mentioned.";
  1462. mes "Nice to meet you!";
  1463. // reset the global variables
  1464. $@name$ = "";
  1465. $@name2$ = "";
  1466. close;
  1467. }
  1468. mes "You are not the person that " +$name2$+ " mentioned.";
  1469. close;
  1470. See 'strcharinfo' for an explanation of what this function does.
  1471. Example 6: Using complex conditions.
  1472. mes "[Multiple Checks]";
  1473. if ( (@queststarted == 1) && (countitem(512) >= 5) ) {
  1474. mes "Well done, you have started the quest and brought me 5 Apples.";
  1475. @queststarted = 0;
  1476. delitem 512,5;
  1477. close;
  1478. }
  1479. mes "Please bring me 5 apples.";
  1480. @queststarted = 1;
  1481. close;
  1482. The script engine also supports nested 'if' statements:
  1483. if (<condition>)
  1484. dothis;
  1485. else
  1486. dothat;
  1487. If the condition isn't met, it'll do the action following the 'else'.
  1488. We can also group several actions depending on a condition:
  1489. if (<condition>) {
  1490. dothis1;
  1491. dothis2;
  1492. } else {
  1493. dothat1;
  1494. dothat2;
  1495. dothat3;
  1496. }
  1497. Remember that if you plan to do several actions upon the condition being false, and
  1498. you forget to use the curly braces (the { } ), the second action will be executed regardless
  1499. the output of the condition, unless of course, you stop the execution of the script if the
  1500. condition is true (that is, in the first grouping using a return; , and end; or a close; )
  1501. Also, you can have multiple conditions nested or chained.
  1502. if (<condition 1>)
  1503. dothis;
  1504. else if (<condition 2>) {
  1505. dothat;
  1506. end;
  1507. } else
  1508. dothis;
  1509. ---------------------------------------
  1510. *jump_zero (<condition>),<label>;
  1511. This command works kinda like an 'if'+'goto' combination in one go. (See 'if').
  1512. If the condition is false (equal to zero) this command will immediately jump to
  1513. the specified label like in 'goto'. While 'if' is more generally useful, for
  1514. some cases this could be an optimization.
  1515. The main reason for this command is that other control statements, like
  1516. 'switch', 'for' or 'while', are disassembled into simple expressions together
  1517. with this command when a script is parsed.
  1518. ---------------------------------------
  1519. *switch (expression);
  1520. The switch statement is similar to a series of if statements on the same expression.
  1521. In many occasions, you may want to compare the same variable (or expression)
  1522. with many different values, and execute a different piece of code depending
  1523. on which value it equals to. This is exactly what the switch statement is for.
  1524. It is important to understand how the switch statement is executed in order
  1525. to avoid mistakes. The switch statement executes line by line (actually, statement by statement).
  1526. In the beginning, no code is executed. Only when a case statement is found
  1527. with a value that matches the value of the switch expression the case statement(s)
  1528. will to executed. The parser continues to execute the statements until the end
  1529. of the switch block, or the first time it sees a break statement. If you don't
  1530. write a break statement at the end of a case's statement list, the parser will
  1531. go on executing the statements of the following case (fall-through).
  1532. Example 1:
  1533. switch(select("Yes:No")) {
  1534. case 1:
  1535. mes "You said yes!";
  1536. break;
  1537. case 2:
  1538. mes "Aww, why?";
  1539. break;
  1540. }
  1541. close;
  1542. The example above would work like a menu and would go to the first case if
  1543. the user selects option, otherwise, would go to the second one.
  1544. Example 2:
  1545. switch(getgroupid()) {
  1546. case 1:
  1547. mes "Wow, you're super!";
  1548. break;
  1549. case 2:
  1550. mes "A helping hand!";
  1551. break;
  1552. case 3:
  1553. mes "10001010010011";
  1554. break;
  1555. case 4:
  1556. mes "Yes, milord?";
  1557. break;
  1558. default:
  1559. mes "Hello there!";
  1560. break;
  1561. }
  1562. The example above would print a message depending on the player's groupid.
  1563. If there is no statement declared for the corresponding groupid, the script
  1564. would use the 'default' statement that applies to rest of possible values,
  1565. similar to 'else' in the if-else statement.
  1566. ---------------------------------------
  1567. *while (<condition>) <statement>;
  1568. This is probably the simplest and most frequently used loop structure. The 'while'
  1569. statement can be interpreted as "while <condition> is true, perform <statement>".
  1570. It is a pretest loop, meaning the conditional expression is tested before any of the
  1571. statements in the body of the loop are performed. If the condition evaluates to
  1572. false, the statement(s) in the body of the loop is/are never executed. If the
  1573. condition evaluates to true, the statement(s) are executed, then control transfers
  1574. back to the conditional expression, which is reevaluated and the cycle continues.
  1575. Multiple statements can be grouped with { }, curly braces, just like with the 'if' statement.
  1576. Example 1:
  1577. while (switch(select("Yes:No") == 2 ))
  1578. mes "You picked no.";
  1579. close;
  1580. Example 2: multiple statements
  1581. while (switch(select("Yes:No") == 2 )) {
  1582. mes "Why did you pick no?";
  1583. mes "You should pick yes instead!";
  1584. }
  1585. close;
  1586. Example 3: counter-controlled loop
  1587. .@i = 1;
  1588. while (.@i <= 5) {
  1589. mes "This line will print 5 times.";
  1590. .@i += 1;
  1591. }
  1592. close;
  1593. Example 4: sentinel-controlled loop
  1594. mes "Input 0 to stop";
  1595. input .@num;
  1596. while (.@num != 0) {
  1597. mes "You entered " + .@num;
  1598. input .@num;
  1599. }
  1600. close;
  1601. ---------------------------------------
  1602. *for (<variable initialization>; <condition>; <variable update>) <statement>;
  1603. Another pretest looping structure is the 'for' statement. It is considered a
  1604. specialized form of the 'while' statement, and is usually associated with counter-
  1605. controlled loops. Here are the steps of the 'for' statement: the initialize
  1606. statement is executed first and only once. The condition test is performed.
  1607. When the condition evaluates to false, the rest of the for statement is skipped.
  1608. When the condition evaluates to true, the body of the loop is executed, then the
  1609. update statement is executed (this usually involves incrementing a variable).
  1610. Then the condition is reevaluated and the cycle continues.
  1611. Example 1:
  1612. for( .@i = 1; .@i <= 5; .@i++ )
  1613. mes "This line will print 5 times.";
  1614. Example 2:
  1615. mes "This will print the numbers 1 - 5.";
  1616. for( .@i = 1; .@i <= 5; .@i++ )
  1617. mes "Number: " + .@i;
  1618. ---------------------------------------
  1619. *do { <statement>; } while (<condition>);
  1620. The 'do...while' is the only post-test loop structure available in this script
  1621. language. With a post-test, the statements are executed once before the condition
  1622. is tested. When the condition is true, the statement(s) are repeated. When the
  1623. condition is false, control is transferred to the statement following the
  1624. 'do...while' loop expression.
  1625. Example 1: sentinel-controlled loop
  1626. mes "This menu will keep appearing until you pick Cancel";
  1627. do {
  1628. .@menu = select("One:Two:Three:Cancel");
  1629. } while (.@menu != 4);
  1630. Example 2: counter-controlled loop
  1631. mes "This will countdown from 10 to 1.";
  1632. .@i = 10;
  1633. do {
  1634. mes .@i;
  1635. .@i -= 1;
  1636. } while (.@i > 0);
  1637. ---------------------------------------
  1638. *freeloop({<toggle>})
  1639. Toggling this to enabled (1) allows the script instance to bypass the infinite loop
  1640. protection, allowing your script to loop as much as it may need. Disabling (0) will
  1641. warn you if an infinite loop is detected.
  1642. The command will return the state of freeloop for the attached script, even if no
  1643. argument is provided.
  1644. Example:
  1645. freeloop(1); // enable script to loop freely
  1646. // be careful with what you do here
  1647. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1648. dothis;
  1649. // will sleep the script for 1ms when detect an infinity loop to
  1650. // let rAthena do what it needs to do (socket, timer, process, etc.)
  1651. }
  1652. freeloop(0); // disable freeloop
  1653. for ( .@i = 0; .@i < .@bigloop; .@i++ ) {
  1654. dothis;
  1655. // throw an infinity loop error
  1656. }
  1657. ---------------------------------------
  1658. *setarray <array name>[<first value>],<value>{,<value>...<value>};
  1659. This command will allow you to quickly fill up an array in one go. Check the
  1660. Kafra scripts in the distribution to see this used a lot.
  1661. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1662. First value is the index of the first element of the array to alter. For
  1663. example:
  1664. setarray @array[0],200,200,200;
  1665. setarray @array[1],300,150;
  1666. will produce:
  1667. @array[0]=200
  1668. @array[1]=300
  1669. @array[2]=150
  1670. ---------------------------------------
  1671. *cleararray <array name>[<first value to alter>],<value>,<number of values to set>;
  1672. This command will change many array values at the same time to the same value.
  1673. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1674. // This will make all 6 values 0
  1675. cleararray @array[0],0,6;
  1676. // This will make array element 0 change to 245
  1677. cleararray @array[0],245,1;
  1678. // This will make elements 1 and 2 change to 345
  1679. cleararray @array[1],345,2;
  1680. See 'setarray'.
  1681. ---------------------------------------
  1682. *copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>;
  1683. This command lets you quickly shuffle a lot of data between arrays, which is in
  1684. some cases invaluable.
  1685. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1686. // So we have made @array[]
  1687. copyarray @array2[0],@array[2],2;
  1688. // Now, @array2[0] will be equal to @array[2] (300) and
  1689. // @array2[1] will be equal to @array[3].
  1690. So using the examples above:
  1691. @array[0] = 100
  1692. @array[1] = 200
  1693. @array[2] = 300
  1694. @array[3] = 400
  1695. @array[4] = 500
  1696. @array[5] = 600
  1697. New Array:
  1698. @array2[0] = 300
  1699. @array2[1] = 400
  1700. @array2[2] = 0
  1701. @array2[3] = 0
  1702. Notice that @array[4] and @array[5] won't be copied to the second array, and it will return a
  1703. 0.
  1704. ---------------------------------------
  1705. *deletearray <array name>[<first value>],<how much to delete>;
  1706. This command will delete a specified number of array elements totally from an
  1707. array, shifting all the elements beyond this towards the beginning.
  1708. // This will delete array element 0, and move all the other array elements
  1709. // up one place.
  1710. deletearray @array[0],1
  1711. // This would delete array elements numbered 1, 2 and 3, leave element 0 in its
  1712. // place, and move the other elements ups, so there are no gaps.
  1713. deletearray @array[1],3
  1714. ---------------------------------------
  1715. ======================================
  1716. |2.- Information-retrieving commands.|
  1717. ======================================
  1718. ---------------------------------------
  1719. *strcharinfo(<type>{,<char_id>})
  1720. This function will return either the name, party name or guild name for the
  1721. invoking character. Whatever it returns is determined by type.
  1722. 0 - Character's name.
  1723. 1 - The name of the party they're in if any.
  1724. 2 - The name of the guild they're in if any.
  1725. 3 - The name of the map the character is in.
  1726. If a character is not a member of any party or guild, an empty string will be
  1727. returned when requesting that information.
  1728. ---------------------------------------
  1729. *strnpcinfo(<type>)
  1730. This function will return the various parts of the name of the calling NPC.
  1731. Whatever it returns is determined by type.
  1732. 0 - The NPC's display name (visible#hidden)
  1733. 1 - The visible part of the NPC's display name
  1734. 2 - The hidden part of the NPC's display name
  1735. 3 - The NPC's unique name (::name)
  1736. 4 - The name of the map the NPC is in.
  1737. ---------------------------------------
  1738. *getarraysize(<array name>)
  1739. This function returns highest index of the array that is filled.
  1740. Notice that zeros and empty strings at the end of this array are not
  1741. counted towards this number.
  1742. For example:
  1743. setarray @array[0], 100, 200, 300, 400, 500, 600;
  1744. set @arraysize,getarraysize(@array);
  1745. This will make @arraysize == 6. But if you try this:
  1746. setarray @array[0], 100, 200, 300, 400, 500, 600, 0;
  1747. set @arraysize,getarraysize(@array);
  1748. @arraysize will still equal 6, even though you've set 7 values.
  1749. ---------------------------------------
  1750. *getelementofarray(<array name>,<index>)
  1751. This command retrieves the value of the element of given array at given index.
  1752. This is equivalent to using:
  1753. <array name>[<index>]
  1754. The reason for this is, that this short form is internally converted into a call
  1755. to getelementofarray, when the script is loaded.
  1756. Also useful when passing arrays to functions or accessing another npc's arrays:
  1757. getelementofarray(getarg(0),<index>)
  1758. getelementofarray(getvariableofnpc(.var, "testNPC"),<index>)
  1759. ---------------------------------------
  1760. *readparam(<parameter number>{,"<character name>"})
  1761. *readparam(<parameter number>{,<char_id>})
  1762. This function will return the specified stat of the invoking character, or, if a
  1763. character name or character id is specified, of that player. The stat can either
  1764. be a number or parameter name, defined in 'src/map/script_constants.h'.
  1765. Some example parameters:
  1766. StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight, MaxWeight,
  1767. JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp, Sp, MaxSp,
  1768. BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk
  1769. All of these also behave as variables, but don't expect to be able to just 'set'
  1770. them - some will not work for various internal reasons.
  1771. Example 1:
  1772. // Returns how many status points you haven't spent yet.
  1773. mes "Unused status points: "+readparam(9);
  1774. Using this particular information as a function call is not required. Typing this
  1775. will return the same result:
  1776. mes "Unused status points: "+StatusPoint;
  1777. Example 2:
  1778. You can also use this command to get stat values.
  1779. if (readparam(bVit) > 77)
  1780. mes "Only people with over 77 Vit are reading this!";
  1781. ---------------------------------------
  1782. *getcharid(<type>{,"<character name>"})
  1783. This function will return a unique ID number of the invoking character, or, if a
  1784. character name is specified, of that player.
  1785. Type is the kind of associated ID number required:
  1786. 0 - Character ID
  1787. 1 - Party ID
  1788. 2 - Guild ID
  1789. 3 - Account ID
  1790. 4 - Battle Ground ID
  1791. 5 - Clan ID
  1792. For most purposes other than printing it, a number is better to have than a name
  1793. (people do horrifying things to their character names).
  1794. If the character is not in a party or not in a guild, the function will return 0
  1795. if guild or party number is requested. If a name is specified and the character
  1796. is not found, 0 is returned.
  1797. If getcharid(0) returns a zero, the script got called not by a character and
  1798. doesn't have an attached RID. Note that this will cause the map server to
  1799. print "player not attached!" error messages, so it is preferred to use
  1800. "playerattached" to check for the character attached to the script.
  1801. if (getcharid(2) == 0)
  1802. mes "Only members of a guild are allowed here!";
  1803. ---------------------------------------
  1804. *getnpcid(<type>{,"<npc name>"});
  1805. Retrieves IDs of the currently invoked NPC. If a unique npc name is
  1806. given, IDs of that NPC are retrieved instead. Type specifies what ID
  1807. to retrieve and can be one of the following:
  1808. 0 - NPC Game ID
  1809. If an invalid type is given or the NPC does not exist, 0 is returned.
  1810. ---------------------------------------
  1811. *getchildid({<char_id>})
  1812. *getmotherid({<char_id>})
  1813. *getfatherid({<char_id>})
  1814. These functions return the character ID of the attached player's child,
  1815. mother, mother, or father, respectively. It returns 0 if no ID is found.
  1816. if (getmotherid()) mes "Your mother's ID is: "+getmotherid();
  1817. ---------------------------------------
  1818. *ispartneron({<char_id>})
  1819. This function returns 1 if the invoking character's marriage partner is
  1820. currently online and 0 if they are not or if the character has no partner.
  1821. ---------------------------------------
  1822. *getpartnerid({<char_id>})
  1823. This function returns the character ID of the invoking character's marriage
  1824. partner, if any. If the invoking character is not married, it will return 0,
  1825. which is a quick way to see if they are married:
  1826. if (getpartnerid()) mes "I'm not going to be your girlfriend!";
  1827. if (getpartnerid()) mes "You're married already!";
  1828. ---------------------------------------
  1829. *getlook(<type>{,<char_id>})
  1830. This function will return the number for the current character look value
  1831. specified by type. See 'setlook' for valid look types.
  1832. This can be used to make a certain script behave differently for characters
  1833. dressed in black.
  1834. ---------------------------------------
  1835. *getsavepoint(<information type>{,<char_id>})
  1836. This function will return information about the invoking character's save point.
  1837. You can use it to let a character swap between several recorded save points.
  1838. Available information types are:
  1839. 0 - Map name (a string)
  1840. 1 - X coordinate
  1841. 2 - Y coordinate
  1842. ---------------------------------------
  1843. *getcharip({"<character name>"|<account id>|<char id>})
  1844. This function will return the IP address of the invoking character, or, if a player
  1845. is specified, of that character. A blank string is returned if no player is attached.
  1846. Examples:
  1847. // Outputs IP address of attached player.
  1848. mes "Your IP: " + getcharip();
  1849. // Outputs IP address of character "Silver".
  1850. mes "Silver's IP: " + getcharip("Silver");
  1851. ---------------------------------------
  1852. *vip_status(<type>,{"<character name>"})
  1853. Returns various information about a player's VIP status.
  1854. Valid types:
  1855. VIP_STATUS_ACTIVE - VIP status: true if the player is a VIP or false if not
  1856. VIP_STATUS_EXPIRE - VIP expire timestamp if the player is VIP or 0 if not
  1857. VIP_STATUS_REMAINING - VIP time remaining in seconds
  1858. NOTE: This command is only available if the VIP System is enabled.
  1859. ---------------------------------------
  1860. *vip_time <time>,{"<character name>"};
  1861. Changes a player's VIP time (in minutes). A positive value will increase time, and a
  1862. negative value will decrease time.
  1863. NOTE: This command is only available if the VIP System is enabled.
  1864. ---------------------------------------
  1865. *addspiritball <count>,<duration>{,<char_id>};
  1866. Adds spirit ball to player for 'duration' in milisecond.
  1867. ---------------------------------------
  1868. *delspiritball <count>{,<char_id>};
  1869. Deletes the spirit ball(s) from player.
  1870. ---------------------------------------
  1871. *countspiritball {<char_id>};
  1872. Counts the spirit ball that player has.
  1873. ---------------------------------------
  1874. *ignoretimeout <flag>{,<char_id>};
  1875. Disables the SECURE_NPCTIMEOUT function on the character invoking the script,
  1876. or by the given character ID/character name.
  1877. Valid flag:
  1878. 0 - Enabled SECURE_NPCTIMEOUT.
  1879. 1 - Disable SECURE_NPCTIMEOUT.
  1880. Note: SECURE_NPCTIMEOUT must be enabled for this to work.
  1881. ---------------------------------------
  1882. \\
  1883. 2,2 Item-related commands
  1884. \\
  1885. ---------------------------------------
  1886. *getequipid({<equipment slot>,<char_id>})
  1887. This function returns the item ID of the item slot that calls the script
  1888. on the invoking character or the specified equipment slot. If nothing is
  1889. equipped there, it returns -1.
  1890. Valid equipment slots are:
  1891. EQI_COMPOUND_ON (-1) - Item slot that calls this script (In context of item script)
  1892. EQI_ACC_L (0) - Accessory 1
  1893. EQI_ACC_R (1) - Accessory 2
  1894. EQI_SHOES (2) - Footgear (shoes, boots)
  1895. EQI_GARMENT (3) - Garment (mufflers, hoods, manteaux)
  1896. EQI_HEAD_LOW (4) - Lower Headgear (beards, some masks)
  1897. EQI_HEAD_MID (5) - Middle Headgear (masks, glasses)
  1898. EQI_HEAD_TOP (6) - Upper Headgear
  1899. EQI_ARMOR (7) - Armor (jackets, robes)
  1900. EQI_HAND_L (8) - Left hand (weapons, shields)
  1901. EQI_HAND_R (9) - Right hand (weapons)
  1902. EQI_COSTUME_HEAD_TOP (10) - Upper Costume Headgear
  1903. EQI_COSTUME_HEAD_MID (11) - Middle Costume Headgear
  1904. EQI_COSTUME_HEAD_LOW (12) - Lower Costume Headgear
  1905. EQI_COSTUME_GARMENT (13) - Costume Garment
  1906. EQI_AMMO (14) - Arrow/Ammunition
  1907. EQI_SHADOW_ARMOR (15) - Shadow Armor
  1908. EQI_SHADOW_WEAPON (16) - Shadow Weapon
  1909. EQI_SHADOW_SHIELD (17) - Shadow Shield
  1910. EQI_SHADOW_SHOES (18) - Shadow Shoes
  1911. EQI_SHADOW_ACC_R (19) - Shadow Accessory 2
  1912. EQI_SHADOW_ACC_L (20) - Shadow Accessory 1
  1913. Notice that a few items occupy several equipment slots, and if the character is
  1914. wearing such an item, 'getequipid' will return its ID number for either slot.
  1915. Can be used to check if you have something equipped, or if you haven't got
  1916. something equipped:
  1917. if(getequipid(EQI_HEAD_TOP)==2234) goto L_WearingTiara;
  1918. mes "Come back when you have a Tiara on";
  1919. close;
  1920. L_WearingTiara:
  1921. mes "What a lovely Tiara you have on";
  1922. close;
  1923. You can also use it to make sure people don't pass a point before removing an
  1924. item totally from them. Let's say you don't want people to wear Legion Plate
  1925. armor, but also don't want them to equip if after the check, you would do this:
  1926. if ((getequipid(EQI_ARMOR) == 2341) || (getequipid(EQI_ARMOR) == 2342) goto L_EquipedLegionPlate;
  1927. // the || is used as an or argument, there is 2341 and 2342 cause there are
  1928. // two different legion plate armors, one with a slot one without.
  1929. if ((countitem(2341) > 0) || (countitem(2432) > 0) goto L_InventoryLegionPlate;
  1930. mes "I will lets you pass";
  1931. close2;
  1932. warp "place",50,50;
  1933. end;
  1934. L_EquipedLegionPlate:
  1935. mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
  1936. close;
  1937. L_InventoryLegionPlate:
  1938. mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
  1939. close;
  1940. ---------------------------------------
  1941. *getequipuniqueid(<equipment slot>{,<char_id>})
  1942. This function returns the unique ID (as a string) of the item equipped in the equipment slot
  1943. specified on the invoking character. If nothing is equipped there, it returns an empty string.
  1944. See 'getequipid' for a full list of valid equipment slots.
  1945. ---------------------------------------
  1946. *getequipname(<equipment slot>{,<char_id>})
  1947. Returns the jname of the item equipped in the specified equipment slot on the
  1948. invoking character, or an empty string if nothing is equipped in that position.
  1949. Does the same thing as getitemname(getequipid()). Useful for an NPC to state
  1950. what your are wearing, or maybe saving as a string variable.
  1951. See 'getequipid' for a full list of valid equipment slots.
  1952. if( getequipname(EQI_HEAD_TOP) != "" )
  1953. mes "So you are wearing a "+getequipname(EQI_HEAD_TOP)+" on your head";
  1954. else
  1955. mes "You are not wearing any head gear";
  1956. ---------------------------------------
  1957. *getitemname(<item id>)
  1958. Given the database ID number of an item, this function will return the text
  1959. stored in the 'japanese name' field (which, in rAthena, stores an English name
  1960. the players would normally see on screen.)
  1961. ---------------------------------------
  1962. *getbrokenid(<number>{,<char_id>})
  1963. This function will search the invoking character's inventory for any broken
  1964. items, and will return their item ID numbers. Since the character may have
  1965. several broken items, 1 given as an argument will return the first one found, 2
  1966. will return the second one, etc. Will return 0 if no such item is found.
  1967. // Let's see if they have anything broken:
  1968. if (getbrokenid(1)==0) goto Skip;
  1969. // They do, so let's print the name of the first broken item:
  1970. mes "Oh, I see you have a broken "+getitemname(getbrokenid(1))+" here!";
  1971. Skip:
  1972. mes "You don't have anything broken, quit bothering me.";
  1973. ---------------------------------------
  1974. *getequipisequiped(<equipment slot>{,<char_id>})
  1975. This functions will return 1 if there is an equipment placed on the specified
  1976. equipment slot and 0 otherwise. For a list of equipment slots
  1977. see 'getequipid'. Function originally used by the refining NPCs:
  1978. if (getequipisequiped(EQI_HEAD_TOP)) goto L_equipped;
  1979. mes "[Refiner]";
  1980. mes "Do you want me to refine your dumb head?";
  1981. close;
  1982. L_equipped:
  1983. mes "[Refiner]";
  1984. mes "That's a fine hat you are wearing there...";
  1985. close;
  1986. ---------------------------------------
  1987. *getequipisenableref(<equipment slot>{,<char_id>})
  1988. Will return 1 if the item equipped on the invoking character in the specified
  1989. equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
  1990. see 'getequipid'.
  1991. if (getequipisenableref(EQI_HEAD_TOP)) goto L_Refine;
  1992. mes "[Refiner]";
  1993. mes "I can't refine this hat!...";
  1994. close;
  1995. L_Refine:
  1996. mes "[Refiner]";
  1997. mes "Ok I can refine this";
  1998. close;
  1999. ---------------------------------------
  2000. *getequiprefinerycnt(<equipment slot>{,<char_id>})
  2001. Returns the current number of pluses for the item in the specified equipment
  2002. slot. For a list of equipment slots see 'getequipid'.
  2003. Can be used to check if you have reached a maximum refine value, default for
  2004. this is +10:
  2005. if(getequiprefinerycnt(EQI_HEAD_TOP) < 10) goto L_Refine_HeadGear;
  2006. mes "Sorry, it's not possible to refine hats better than +10";
  2007. close;
  2008. L_Refine_HeadGear:
  2009. mes "I will now upgrade your "+getequipname(EQI_HEAD_TOP);
  2010. ---------------------------------------
  2011. *getequipweaponlv(<equipment slot>{,<char_id>})
  2012. This function returns the weapon level for the weapon equipped in the specified
  2013. equipment slot on the invoking character. For a list of equipment slots see
  2014. 'getequipid'.
  2015. Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons have
  2016. a weapon level. You can, however, probably, use this field for other equippable
  2017. custom items as a flag or something.
  2018. If no item is equipped in this slot, or if it doesn't have a weapon level
  2019. according to the database, 0 will be returned.
  2020. Examples:
  2021. // Right hand can only contain a weapon.
  2022. switch (getequipweaponlv(EQI_HAND_R)) {
  2023. case 1: mes "You are holding a lvl 1 weapon."; break;
  2024. case 2: mes "You are holding a lvl 2 weapon."; break;
  2025. case 3: mes "You are holding a lvl 3 weapon."; break;
  2026. case 4: mes "You are holding a lvl 4 weapon."; break;
  2027. case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
  2028. default: mes "Seems you don't have a weapon on."; break;
  2029. }
  2030. // Left hand can hold either a weapon or shield.
  2031. if (getequipid(EQI_HAND_R) == 0) {
  2032. mes "Seems you have nothing equipped here.";
  2033. close;
  2034. }
  2035. switch (getequipweaponlv(EQI_HAND_L)) {
  2036. case 0: mes "You are holding a shield, so it doesn't have a level."; break;
  2037. case 1: mes "You are holding a lvl 1 weapon."; break;
  2038. case 2: mes "You are holding a lvl 2 weapon."; break;
  2039. case 3: mes "You are holding a lvl 3 weapon."; break;
  2040. case 4: mes "You are holding a lvl 4 weapon."; break;
  2041. case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design..."; break;
  2042. }
  2043. ---------------------------------------
  2044. *getequippercentrefinery(<equipment slot>{,<char_id>})
  2045. This function calculates and returns the percent value chance to successfully
  2046. refine the item found in the specified equipment slot of the invoking character
  2047. by +1. There is no actual formula, the success rate for a given weapon level of
  2048. a certain refine level is found in the db/refine_db.txt file. For a list of
  2049. equipment slots see 'getequipid'.
  2050. These values can be displayed for the player to see, or used to calculate the
  2051. random change of a refine succeeding or failing and then going through with it
  2052. (which is what the official NPC refinery scripts use it for)
  2053. // This will find a random number from 0 - 99 and if that is equal to or more
  2054. // than the value recovered by this command it will go to L_Fail
  2055. if (getequippercentrefinery(EQI_HAND_L)<=rand(100)) goto L_Fail;
  2056. ---------------------------------------
  2057. *getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
  2058. This function will count all the items with the specified ID number lying on the
  2059. ground on the specified map within the x1/y1-x2/y2 square on it and return that
  2060. number.
  2061. This is the only function around where a parameter may be either a string or a
  2062. number! If it's a number, it means that only the items with that item ID number
  2063. will be counted. If it is a string, it is assumed to mean the 'english name'
  2064. field from the item database. If you give it an empty string, or something that
  2065. isn't found from the item database, it will count items number '512' (apples).
  2066. ---------------------------------------
  2067. *getequipcardcnt(<equipment slot>)
  2068. This function will return the number of cards that have been compounded onto a
  2069. specific equipped item for the invoking character. See 'getequipid' for a list
  2070. of possible equipment slots.
  2071. ---------------------------------------
  2072. *getinventorylist {<char_id>};
  2073. This command sets a bunch of arrays with a complete list of whatever the
  2074. invoking character has in their inventory, including all the data needed to
  2075. recreate these items perfectly if they are destroyed. Here's what you get:
  2076. @inventorylist_id[] - array of item ids.
  2077. @inventorylist_amount[] - their corresponding item amounts.
  2078. @inventorylist_equip[] - on which position the item is equipped (see EQP_* constants)
  2079. It will contain 0 if the item is not equipped.
  2080. @inventorylist_refine[] - for how much it is refined.
  2081. @inventorylist_identify[] - whether it is identified.
  2082. @inventorylist_attribute[] - whether it is broken.
  2083. @inventorylist_card1[] - These four arrays contain card data for the items.
  2084. @inventorylist_card2[] These data slots are also used to store names
  2085. @inventorylist_card3[] inscribed on the items, so you can explicitly check
  2086. @inventorylist_card4[] if the character owns an item made by a specific
  2087. craftsman.
  2088. @inventorylist_expire[] - expire time (Unix time stamp). 0 means never expires.
  2089. @inventorylist_bound[] - the bound type of the items (see BOUND_* constants)
  2090. @inventorylist_count - the number of items in these lists.
  2091. This could be handy to save/restore a character's inventory, since no other
  2092. command returns such a complete set of data, and could also be the only way to
  2093. correctly handle an NPC trader for carded and named items who could resell them
  2094. - since NPC objects cannot own items, so they have to store item data in
  2095. variables and recreate the items.
  2096. Notice that the variables this command generates are all temporary, attached to
  2097. the character, and integer.
  2098. Be sure to use @inventorylist_count to go through these arrays, and not
  2099. 'getarraysize', because the arrays are not automatically cleared between runs
  2100. of 'getinventorylist'.
  2101. ---------------------------------------
  2102. *cardscnt()
  2103. This function will return the number of cards inserted into the equipment
  2104. from which the function is called.
  2105. This function is intended for use in item scripts.
  2106. ---------------------------------------
  2107. *getrefine()
  2108. This function will return the refine count of the equipment from which the
  2109. function is called.
  2110. This function is intended for use in item scripts.
  2111. ---------------------------------------
  2112. *getnameditem(<item id>,"<name to inscribe>"|<char id>);
  2113. *getnameditem("<item name>","<name to inscribe>"|<char id>);
  2114. This function is equivalent to using 'getitem', however, it will not just give
  2115. the character an item object, but will also inscribe it with a specified
  2116. character's name. You may not inscribe items with arbitrary strings, only with
  2117. names of characters that actually exist. While this isn't said anywhere
  2118. specifically, apparently, named items may not have cards in them, slots or no -
  2119. these data slots are taken by the character ID who's name is inscribed. Only one
  2120. remains free and it's not quite clear if a card may be there.
  2121. This function will return 1 if an item was successfully created and 0 if it
  2122. wasn't for whatever reason. Like 'getitem', this function will also accept an
  2123. 'english name' from the item database as an item name and will return 0 if no
  2124. such item exists.
  2125. ---------------------------------------
  2126. *getitemslots(<item ID>)
  2127. This function will look up the item with the specified ID number in the database
  2128. and return the number of slots this kind of items has - 0 if they are not
  2129. slotted. It will also be 0 for all non-equippable items, naturally, unless
  2130. someone messed up the item database. It will return -1 if there is no such item.
  2131. Example:
  2132. //.@slots now has the amount of slots of the item with ID 1205.
  2133. .@slots = getitemslots(1205);
  2134. ---------------------------------------
  2135. *getiteminfo(<item ID>,<type>)
  2136. This function will look up the item with the specified ID number in the database
  2137. and return the info set by TYPE argument.
  2138. It will return -1 if there is no such item.
  2139. Valid types are:
  2140. 0 - Buy Price
  2141. 1 - Sell Price
  2142. 2 - Type
  2143. 3 - maxchance (max drop chance of this item, e.g. 1 = 0.01%)
  2144. if = 0, then monsters don't drop it at all (rare or a quest item)
  2145. if = 10000, then this item is sold in NPC shops only
  2146. 4 - Gender
  2147. 5 - Loc
  2148. 6 - Weight
  2149. 7 - ATK
  2150. 8 - DEF
  2151. 9 - Range
  2152. 10 - Slot
  2153. 11 - View
  2154. 12 - eLV
  2155. 13 - wLV
  2156. 14 - SpriteID from 'db/item_avail.txt'
  2157. 15 - eLVMax
  2158. 16 - matk if RENEWAL is defined
  2159. See the sample in 'doc/sample/getiteminfo.txt'.
  2160. ---------------------------------------
  2161. *getequipcardid(<equipment slot>,<card slot>)
  2162. Returns value from equipped item slot in the indicated slot (0, 1, 2, or 3).
  2163. This function returns CARD ID, CARD0_FORGE, CARD0_CREATE, or CARD0_PET (for card 0, if the item is produced).
  2164. It's useful for when you want to check whether an item contains cards or if it's signed.
  2165. ---------------------------------------
  2166. *mergeitem({,<char_id>});
  2167. Open merge item window to merge available item can be merged.
  2168. Examples
  2169. 1. See the NPC 'npc/re/other/merge_item.txt'.
  2170. 2. Simple usage:
  2171. mes "Let's check if any item can be merged.";
  2172. close2;
  2173. mergeitem;
  2174. end;
  2175. ---------------------------------------
  2176. *mergeitem2({<item_id>{,<char_id>}});
  2177. *mergeitem2({"<item name>"{,<char_id>}});
  2178. Merge all stackable items that separated by GUID flags
  2179. (either by flag 4 item_flag.txt or GUID in item_group).
  2180. If no item ID/name given, all possible items in player's inventory will be merged.
  2181. ---------------------------------------
  2182. //
  2183. 2,1.- End of item-related commands.
  2184. //
  2185. ---------------------------------------
  2186. *getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})
  2187. This function will locate a character object, NPC object or pet's coordinates
  2188. and place their coordinates into the variables specified when calling it. It
  2189. will return 0 if the search was successful, and -1 if the parameters given were
  2190. not variables or the search was not successful.
  2191. Type is the type of object to search for:
  2192. UNITTYPE_PC - Character object
  2193. UNITTYPE_NPC - NPC object
  2194. UNITTYPE_PET - Pet object
  2195. UNITTYPE_HOM - Homunculus object
  2196. UNITTYPE_MER - Mercenary object
  2197. UNITTYPE_ELEM - Elemental object
  2198. The search string is optional. If it is not specified, the location of the
  2199. invoking character will always be returned for types UNITTYPE_PC and UNITTYPE_PET,
  2200. the location of the NPC running this function for type 1.
  2201. If a search string is specified, for types UNITTYPE_PC and UNITTYPE_NPC, the
  2202. character or NPC with the specified name will be located.
  2203. If type is UNITTYPE_PET/UNITTYPE_HOM/UNITTYPE_MER/UNITTYPE_ELEM, the search
  2204. will locate the current object of the character who's name is given in the
  2205. search string, it will NOT locate the object by name.
  2206. Example:
  2207. prontera,164,301,3%TAB%script%TAB%Meh%TAB%730,{
  2208. mes "My name is Meh. I'm here so that Nyah can find me.";
  2209. close;
  2210. }
  2211. prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
  2212. mes "My name is Nyah.";
  2213. mes "I will now search for Meh all across the world!";
  2214. if (getmapxy(@mapname$, @mapx, @mapy, UNITTYPE_NPC, "Meh") !=0) {
  2215. mes "I can't seem to find Meh anywhere!";
  2216. close;
  2217. }
  2218. mes "And I found him on map "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !";
  2219. close;
  2220. }
  2221. Notice that NPC objects disabled with 'disablenpc' will still be located.
  2222. ---------------------------------------
  2223. *mapid2name(<map ID>)
  2224. Returns the map name of the given map ID. Returns an empty string if given
  2225. map ID doesn't exist.
  2226. ---------------------------------------
  2227. *getgmlevel({<char_id>})
  2228. This function will return the (GM) level associated with the player group to which
  2229. the invoking character belongs. If this is somehow executed from a console command,
  2230. 99 will be returned, and 0 will be returned if the account has no GM level.
  2231. This allows you to make NPC's only accessible for certain GM levels, or behave
  2232. specially when talked to by GMs.
  2233. if (getgmlevel()) mes "What is your command, your godhood?";
  2234. ---------------------------------------
  2235. *getgroupid({<char_id>})
  2236. This function will return the group id to which the invoking player belongs.
  2237. ---------------------------------------
  2238. *gettimetick(<tick type>)
  2239. This function will return a tick depending on <tick type>:
  2240. 0: The server's tick, a measurement in milliseconds used by the server's timer
  2241. system. This tick is an unsigned int which loops every ~50 days.
  2242. 1: The time, in seconds, since the start of the current day.
  2243. 2: The system time in UNIX epoch time, or the number of seconds elapsed since
  2244. January 1st, 1970. Useful for reliably measuring time intervals.
  2245. ---------------------------------------
  2246. *gettime(<type>)
  2247. This function will return specified information about the current system time.
  2248. DT_SECOND - Seconds (of the current minute)
  2249. DT_MINUTE - Minutes (of the current hour)
  2250. DT_HOUR - Hour (of the current day)
  2251. DT_DAYOFWEEK - Week day (constants for MONDAY to SUNDAY are available)
  2252. DT_DAYOFMONTH - Day of the current month
  2253. DT_MONTH - Month (constants for JANUARY to DECEMBER are available)
  2254. DT_YEAR - Year
  2255. DT_DAYOFYEAR - Day of the year
  2256. It will only return numbers. If another type is supplied -1 will be returned.
  2257. if (gettime(DT_DAYOFWEEK)==SATURDAY) mes "It's a Saturday. I don't work on Saturdays.";
  2258. ---------------------------------------
  2259. *gettimestr(<format string>,<max length>)
  2260. This function will return a string containing time data as specified by the
  2261. format string.
  2262. This uses the C function 'strfmtime', which obeys special format characters. For
  2263. a full description see, for example, the description of 'strfmtime' at
  2264. http://www.delorie.com/gnu/docs/glibc/libc_437.html
  2265. All the format characters given in there should properly work.
  2266. Max length is the maximum length of a time string to generate.
  2267. The example given in rAthena sample scripts works like this:
  2268. mes gettimestr("%Y-%m/%d %H:%M:%S",21);
  2269. This will print a full date and time like 'YYYY-MM/DD HH:MM:SS'.
  2270. ---------------------------------------
  2271. *getusers(<type>)
  2272. This function will return a number of users on a map or the whole server. What
  2273. it returns is specified by Type.
  2274. Type can be one of the following values, which control what will be returned:
  2275. 0 - Count of all characters on the map of the invoking character.
  2276. 1 - Count of all characters in the entire server.
  2277. 8 - Count of all characters on the map of the NPC the script is
  2278. running in.
  2279. ---------------------------------------
  2280. *getmapusers("<map name>")
  2281. This function will return the number of users currently located on the specified
  2282. map.
  2283. This is used officially in PVP scripts to check whether a room is filled to capacity.
  2284. ---------------------------------------
  2285. *getareausers("<map name>",<x1>,<y1>,<x2>,<y2>)
  2286. This function will return the count of connected characters which are located
  2287. within the specified area - an x1/y1-x2/y2 square on the specified map.
  2288. This is useful for maps that are split into many buildings, such as all the
  2289. "*_in" maps, due to all the shops and houses.
  2290. ---------------------------------------
  2291. \\
  2292. 2,2.- Guild-related commands
  2293. \\
  2294. ---------------------------------------
  2295. *getguildname(<guild id>)
  2296. This function returns a guild's name given an ID number. If there is no such
  2297. guild, "null" will be returned.
  2298. Example:
  2299. mes "The guild "+getguildname(10007)+" are all nice people.";
  2300. ---------------------------------------
  2301. *getguildmember <guild id>{,<type>{,<array_variable>}};
  2302. This command will find all members of a specified guild and returns their names
  2303. (or character id or account id depending on the value of "type") into an array
  2304. of temporary global variables.
  2305. Upon executing this,
  2306. $@guildmembername$[] is a global temporary string array which contains all the
  2307. names of these guild members.
  2308. (only set when type is 0 or not specified)
  2309. $@guildmembercid[] is a global temporary number array which contains the
  2310. character id of these guild members.
  2311. (only set when type is 1)
  2312. $@guildmemberaid[] is a global temporary number array which contains the
  2313. account id of these guild members.
  2314. (only set when type is 2)
  2315. $@guildmembercount is the number of guild members that were found.
  2316. The guild members will be found regardless of whether they are online or offline.
  2317. Note that the names come in no particular order.
  2318. Be sure to use $@guildmembercount to go through this array, and not
  2319. 'getarraysize', because it is not cleared between runs of 'getguildmember'.
  2320. If 'array_variable' is set, the result will be stored to that variable instead
  2321. using global variable.
  2322. For usage examples, see 'getpartymember'.
  2323. ---------------------------------------
  2324. *getguildmaster(<guild id>)
  2325. This function return the name of the master of the guild which has the specified
  2326. ID number. If there is no such guild, "null" will be returned.
  2327. Example 1:
  2328. // Prints the guild master of guild 10007, whoever that might be.
  2329. mes getguildmaster(10007)+" runs "+getguildname(10007);
  2330. Example 2:
  2331. // Checks if the character is the guild master of the specified guild.
  2332. .@GID = getcharid(2);
  2333. if (.@GID == 0) {
  2334. mes "Sorry, you are not in a guild.";
  2335. close;
  2336. }
  2337. if (strcharinfo(0) != getguildmaster(.@GID)) {
  2338. mes "Sorry, you don't own the guild you are in.";
  2339. close;
  2340. }
  2341. mes "Welcome, guild master of "+getguildname(.@GID);
  2342. close;
  2343. ---------------------------------------
  2344. *getguildmasterid(<guild id>)
  2345. This function will return the character ID number of the guild master of the
  2346. guild specified by the ID. 0 if the character is not a guild master of any guild.
  2347. ---------------------------------------
  2348. *getcastlename("<map name>")
  2349. This function returns the name of the castle when given the map name for that
  2350. castle. The data is read from 'db/castle_db.txt'.
  2351. ---------------------------------------
  2352. *getcastledata("<map name>",<type of data>)
  2353. *setcastledata "<map name>",<type of data>,<value>;
  2354. This function returns the castle ownership information for the castle referred
  2355. to by its map name. Castle information is stored in `guild_castle` SQL table.
  2356. Types of data correspond to `guild_castle` table columns:
  2357. 1 - `guild_id` - Guild ID.
  2358. 2 - `economy` - Castle Economy score.
  2359. 3 - `defense` - Castle Defense score.
  2360. 4 - `triggerE` - Number of times the economy was invested in today.
  2361. 5 - `triggerD` - Number of times the defense was invested in today.
  2362. 6 - `nextTime` - unused
  2363. 7 - `payTime` - unused
  2364. 8 - `createTime` - unused
  2365. 9 - `visibleC` - Is 1 if a Kafra was hired for this castle, 0 otherwise.
  2366. 10 - `visibleG0` - Is 1 if the 1st guardian is present (Soldier Guardian)
  2367. 11 - `visibleG1` - Is 1 if the 2nd guardian is present (Soldier Guardian)
  2368. 12 - `visibleG2` - Is 1 if the 3rd guardian is present (Soldier Guardian)
  2369. 13 - `visibleG3` - Is 1 if the 4th guardian is present (Archer Guardian)
  2370. 14 - `visibleG4` - Is 1 if the 5th guardian is present (Archer Guardian)
  2371. 15 - `visibleG5` - Is 1 if the 6th guardian is present (Knight Guardian)
  2372. 16 - `visibleG6` - Is 1 if the 7th guardian is present (Knight Guardian)
  2373. 17 - `visibleG7` - Is 1 if the 8th guardian is present (Knight Guardian)
  2374. All types of data have their meaning determined by War of Emperium scripts,
  2375. with exception of:
  2376. - `guild_id` that is always considered ID of the guild that owns the castle,
  2377. - `defense` that is used in Guardians & Emperium HP calculations,
  2378. - `visibleG` that is always considered to hold guardian presence bits.
  2379. The 'setcastledata' command will behave identically, but instead of returning
  2380. values for the specified types of accessible data, it will alter them and cause
  2381. them to be sent to the char-server for storage.
  2382. Changing Guild ID or Castle Defense will trigger additional actions, like
  2383. recalculating guardians' HP.
  2384. ---------------------------------------
  2385. *getgdskilllv(<guild id>,<skill id>)
  2386. *getgdskilllv(<guild id>,"<skill name>")
  2387. This function returns the level of the skill <skill id> of the guild <guild id>.
  2388. If the guild does not have that skill, 0 is returned.
  2389. If the guild does not exist, -1 is returned.
  2390. Refer to 'db/(pre-)re/skill_db.txt' for the full list of skills. (GD_* are guild skills)
  2391. ---------------------------------------
  2392. *requestguildinfo <guild id>{,"<event label>"};
  2393. This command requests the guild data from the char server and merrily continues
  2394. with the execution. Whenever the guild information becomes available (which
  2395. happens instantly if the guild information is already in memory, or later, if it
  2396. isn't and the map server has to wait for the char server to reply) it will run
  2397. the specified event as in a 'donpcevent' call.
  2398. ---------------------------------------
  2399. *getmapguildusers("<map name>",<guild id>)
  2400. Returns the amount of characters from the specified guild on the given map.
  2401. Example:
  2402. mes "You have "+getMapGuildUsers("prontera",getcharid(2))+" guild members in Prontera.";
  2403. ---------------------------------------
  2404. //
  2405. 2,2.- End of guild-related commands
  2406. //
  2407. ---------------------------------------
  2408. *getskilllv(<skill id>)
  2409. *getskilllv("<skill name>")
  2410. This function returns the level of the specified skill that the invoking
  2411. character has. If they don't have the skill, 0 will be returned. The full list
  2412. of character skills is available in 'db/(pre-)re/skill_db.txt'.
  2413. There are two main uses for this function, it can check whether the character
  2414. has a skill or not, and it can tell you if the level is high enough.
  2415. Example 1:
  2416. if (getskilllv(152)) goto L_HasSkillThrowStone;
  2417. mes "You don't have Throw Stone";
  2418. close;
  2419. L_HasSkillThrowStone:
  2420. mes "You have got the skill Throw Stone";
  2421. close;
  2422. Example 2:
  2423. if (getskilllv(28) >= 5) goto L_HasSkillHeallvl5orMore;
  2424. if (getskilllv(28) == 10) goto L_HasSkillHealMaxed;
  2425. mes "You heal skill is below lvl 5";
  2426. close;
  2427. L_HasSkillHeallvl6orMore:
  2428. mes "Your heal lvl is 5 or more";
  2429. close;
  2430. L_HasSkillHealMaxed:
  2431. mes "Your heal lvl has been maxed";
  2432. close;
  2433. ---------------------------------------
  2434. *getskilllist({<char_id>});
  2435. This command sets a bunch of arrays with a complete list of skills the
  2436. invoking character has. Here's what you get:
  2437. @skilllist_id[] - skill ids.
  2438. @skilllist_lv[] - skill levels.
  2439. @skilllist_flag[] - see 'skill' for the meaning of skill flags.
  2440. @skilllist_count - number of skills in the above arrays.
  2441. While 'getskillv' is probably more useful for most situations, this is the
  2442. easiest way to store all the skills and make the character something else for a
  2443. while. Advanced job for a day? This could also be useful to see how many
  2444. skills a character has.
  2445. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2446. ---------------------------------------
  2447. *getmonsterinfo(<mob ID>,<type>)
  2448. This function will look up the monster with the specified ID number in the
  2449. mob database and return the info set by TYPE argument.
  2450. It will return -1 if there is no such monster (or the type value is invalid),
  2451. or "null" if you requested the monster's name.
  2452. Valid types are:
  2453. MOB_NAME - monster's name, if there is no such monster "null" is returned
  2454. MOB_LV - monster's level
  2455. MOB_MAXHP - monster's maximum hp
  2456. MOB_BASEEXP - monster's base experience
  2457. MOB_JOBEXP - monster's job experience
  2458. MOB_ATK1 - monster's atk
  2459. MOB_ATK2 - monster's atk2
  2460. MOB_DEF - monster's def
  2461. MOB_MDEF - monster's mdef
  2462. MOB_STR - monster's str
  2463. MOB_AGI - monster's agi
  2464. MOB_VIT - monster's vit
  2465. MOB_INT - monster's int
  2466. MOB_DEX - monster's dex
  2467. MOB_LUK - monster's luk
  2468. MOB_RANGE - monster's range
  2469. MOB_RANGE2 - monster's range2
  2470. MOB_RANGE3 - monster's range3
  2471. MOB_SIZE - monster's size
  2472. MOB_RACE - monster's race
  2473. MOB_ELEMENT - monster's element(doesn't return the element level, only the element ID)
  2474. MOB_MODE - monster's mode
  2475. MOB_MVPEXP - monster's mvp experience
  2476. For more details, see the sample in 'doc/sample/getmonsterinfo.txt'.
  2477. ---------------------------------------
  2478. *getmobdrops(<mob id>)
  2479. This command will find all drops of the specified mob and return the item IDs
  2480. and drop percentages into arrays of temporary global variables.
  2481. 'getmobdrops' returns 1 if successful and 0 if the mob ID doesn't exist.
  2482. Upon executing this,
  2483. $@MobDrop_item[] is a global temporary number array which contains the
  2484. item IDs of the monster's drops.
  2485. $@MobDrop_rate[] is a global temporary number array which contains the
  2486. drop percentages of each item. (1 = .01%)
  2487. $@MobDrop_count is the number of item drops found.
  2488. Be sure to use $@MobDrop_count to go through the arrays, and not
  2489. 'getarraysize', because the temporary global arrays are not cleared between
  2490. runs of 'getmobdrops'. If a mob with 7 item drops is looked up, the arrays would
  2491. have 7 elements. But if another mob is looked up and it only has 5 item drops,
  2492. the server will not clear the arrays for you, overwriting the values instead. So
  2493. in addition to returning the 5 item drops, the 6th and 7th elements from the
  2494. last call remain, and you will get 5+2 item drops, of which the last 2 don't
  2495. belong to the new mob. $@MobDrop_count will always contain the correct number
  2496. (5), unlike 'getarraysize()' which would return 7 in this case.
  2497. Example:
  2498. // get a Mob ID from the user
  2499. input .@mob_id;
  2500. if (getmobdrops(.@mob_id)) { // 'getmobdrops' returns 1 on success
  2501. // immediately copy global temporary variables into scope variables,
  2502. // since we don't know when 'getmobdrops' will get called again for
  2503. // another mob, overwriting your global temporary variables
  2504. .@count = $@MobDrop_count;
  2505. copyarray .@item[0],$@MobDrop_item[0],.@count;
  2506. copyarray .@rate[0],$@MobDrop_rate[0],.@count;
  2507. mes getmonsterinfo(.@mob_id,MOB_NAME) + " - " + .@count + " drops found:";
  2508. for( .@i = 0; .@i < .@count; .@i++ ) {
  2509. mes .@item[.@i] + " (" + getitemname(.@item[.@i]) + ") " + .@rate[.@i]/100 + ((.@rate[.@i]%100 < 10) ? ".0":".") + .@rate[.@i]%100 + "%";
  2510. }
  2511. } else {
  2512. mes "Unknown monster ID.";
  2513. }
  2514. close;
  2515. ---------------------------------------
  2516. *skillpointcount({<char_id>})
  2517. Returns the total amount of skill points a character possesses (SkillPoint+SP's used in skills)
  2518. This command can be used to check the currently attached characters total amount of skill points.
  2519. This means the skill points used in skill are counted, and added to SkillPoints (number of skill points not used).
  2520. This command does not count skills which are set as flag 4 (permament granted) (ALL_BUYING_STORE/ALL_INCCARRY)
  2521. Example 1:
  2522. .@skillPoints = skillpointcount();
  2523. mes "You have " + .@skillPoints + " skill points in total!";
  2524. Example 2:
  2525. if (skillpointcount() > 20)
  2526. mes "Wow, you have more then 20 Skill Points in total!";
  2527. ---------------------------------------
  2528. *getscrate(<effect type>,<base rate>{,<GID>})
  2529. This function will return the chance of a status effect affecting the invoking
  2530. character, in percent, modified by the their current defense against said
  2531. status. The 'base rate' is the base chance of the status effect being inflicted,
  2532. in percent.
  2533. if (rand(100) > getscrate(Eff_Blind, 50)) goto BlindHimNow;
  2534. You can see the full list of available effect types you can possibly inflict in
  2535. 'db/const.txt' under 'Eff_'.
  2536. ---------------------------------------
  2537. ========================
  2538. |3.- Checking commands.|
  2539. ========================
  2540. -------------------------
  2541. *playerattached()
  2542. Returns the ID of the player currently attached to the script. It will return
  2543. 0 if no one is attached, or if the attached player no longer exists on the map
  2544. server. It is wise to check for the attached player in script functions that
  2545. deal with timers as there's no guarantee the player will still be logged on
  2546. when the timer triggers. Note that the ID of a player is actually their
  2547. account ID.
  2548. ---------------------------------------
  2549. *getattachedrid();
  2550. Returns RID from running script. Script may not be attached to any RID like
  2551. a floating script or function and will return 0.
  2552. ---------------------------------------
  2553. *isloggedin(<account id>{,<char id>})
  2554. This function returns 1 if the specified account is logged in and 0 if they
  2555. aren't. You can also pass the char id to check for both account and char id.
  2556. ---------------------------------------
  2557. *checkweight(<item id>,<amount>{,<item id>,<amount>,<item id>,<amount>,...});
  2558. *checkweight("<item name>",<amount>{,"<item name>",<amount>,"<item name>",<amount>,...});
  2559. *checkweight2(<id_array>,<amount_array>);
  2560. These functions will compute and return 1 if the total weight of the specified
  2561. number of specific items does not exceed the invoking character's carrying
  2562. capacity, and 0 otherwise. It is important to see if a player can carry the
  2563. items you expect to give them, failing to do that may open your script up to
  2564. abuse or create some very unfair errors.
  2565. The second function will check an array of items and amounts, and also
  2566. returns 1 on success and 0 on failure.
  2567. The functions, in addition to checking to see if the player is capable of
  2568. holding a set amount of items, also ensure the player has room in their
  2569. inventory for the item(s) they will be receiving.
  2570. Like 'getitem', this function will also accept an 'english name' from the
  2571. database as an argument.
  2572. Example 1:
  2573. if (checkweight(512,10)) {
  2574. getitem 512,10;
  2575. } else {
  2576. mes "Sorry, you cannot hold this amount of apples!";
  2577. }
  2578. Example 2:
  2579. setarray .@item[0],512,513,514;
  2580. setarray .@amount[0],10,5,5;
  2581. if (!checkweight2(.@item,.@amount)) {
  2582. mes "Sorry, you cannot hold this amount of fruit!";
  2583. }
  2584. ---------------------------------------
  2585. *basicskillcheck()
  2586. This function will return the state of the configuration option
  2587. 'basic_skill_check' in 'battle_athena.conf'. It returns 1 if the option is
  2588. enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which
  2589. it is by default, characters must have a certain number of basic skill levels to
  2590. sit, request a trade, use emotions, etc. Making your script behave differently
  2591. depending on whether the characters must actually have the skill to do all these
  2592. things might in some cases be required.
  2593. ---------------------------------------
  2594. *checkoption(<option number>{,<char_id>})
  2595. *checkoption1(<option number>{,<char_id>})
  2596. *checkoption2(<option number>{,<char_id>})
  2597. *setoption <option number>{,<flag>{,<char_id>}};
  2598. The 'setoption' series of functions check for a so-called option that is set on
  2599. the invoking character. 'Options' are used to store status conditions and a lot
  2600. of other non-permanent character data of the yes-no kind. For most common cases,
  2601. it is better to use 'checkcart','checkfalcon','checkriding' and other similar
  2602. functions, but there are some options which you cannot get at this way. They
  2603. return 1 if the option is set and 0 if the option is not set.
  2604. Option numbers valid for the first (option) version of this command are:
  2605. 0x1 - Sight in effect.
  2606. 0x2 - Hide in effect.
  2607. 0x4 - Cloaking in effect.
  2608. 0x8 - Cart number 1 present.
  2609. 0x10 - Falcon present.
  2610. 0x20 - Peco Peco present.
  2611. 0x40 - GM Perfect Hide in effect.
  2612. 0x80 - Cart number 2 present.
  2613. 0x100 - Cart number 3 present.
  2614. 0x200 - Cart number 4 present.
  2615. 0x400 - Cart number 5 present.
  2616. 0x800 - Orc head present.
  2617. 0x1000 - The character is wearing a wedding sprite.
  2618. 0x2000 - Ruwach is in effect.
  2619. 0x4000 - Chasewalk in effect.
  2620. 0x8000 - Flying or Xmas suit.
  2621. 0x10000 - Sighttrasher.
  2622. 0x100000 - Warg present.
  2623. 0x200000 - The character is riding a warg.
  2624. Option numbers valid for the second version (opt1) of this command are:
  2625. 1 - Petrified.
  2626. 2 - Frozen.
  2627. 3 - Stunned.
  2628. 4 - Sleeping.
  2629. 6 - Petrifying (the state where you can still walk)
  2630. Option numbers valid for the third version (opt2) of this command are:
  2631. 0x1 - Poisoned.
  2632. 0x2 - Cursed.
  2633. 0x4 - Silenced.
  2634. 0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
  2635. 0x10 - Blinded.
  2636. 0x80 - Deadly poisoned.
  2637. Option numbers (except for opt1) are bit-masks - you can add them up to check
  2638. for several states, but the functions will return true if at least one of them
  2639. is in effect.
  2640. 'setoption' will set options on the invoking character. There are no second and
  2641. third versions of this command, so you can only change the values in the first
  2642. list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted),
  2643. the option will be added to what the character currently has; if 0, the option is removed.
  2644. This is definitely not a complete list of available option flag numbers. Ask a
  2645. core developer (or read the source: src/map/status.h) for the full list.
  2646. ---------------------------------------
  2647. *setcart {<type>{,<char_id>}};
  2648. *checkcart({<char_id>});
  2649. If <type> is 0 this command will remove the cart from the character.
  2650. Otherwise it gives the invoking character a cart. The cart given will be
  2651. cart number <type> and will work regardless of whether the character is a
  2652. merchant class or not.
  2653. Note: the character needs to have the skill MC_PUSHCART to gain a cart
  2654. The accompanying function will return 1 if the invoking character has a cart
  2655. (any kind of cart) and 0 if they don't.
  2656. if (checkcart()) mes "But you already have a cart!";
  2657. ---------------------------------------
  2658. *setfalcon {<flag>{,<char_id>}};
  2659. *checkfalcon({<char_id>});
  2660. If <flag> is 0 this command will remove the falcon from the character.
  2661. Otherwise it gives the invoking character a falcon. The falcon will be there
  2662. regardless of whether the character is a hunter or not. It will (probably) not
  2663. have any useful effects for non-hunters though.
  2664. Note: the character needs to have the skill HT_FALCON to gain a falcon
  2665. The accompanying function will return 1 if the invoking character has a falcon
  2666. and 0 if they don't.
  2667. if (checkfalcon()) mes "But you already have a falcon!";
  2668. ---------------------------------------
  2669. *setriding {<flag>{,<char_id>}};
  2670. *checkriding({<char_id>});
  2671. If <flag> is 0 this command will remove the mount from the character.
  2672. Otherwise it gives the invoking character a PecoPeco (if they are a Knight
  2673. series class), a GrandPeco (if they are a Crusader series class), or
  2674. a Gryphon (if they are a Royal Guard). Unlike 'setfalcon' and 'setcart'
  2675. this will not work at all if they aren't of a class which can ride.
  2676. Note: the character needs to have the skill KN_RIDING to gain a mount
  2677. The accompanying function will return 1 if the invoking character is riding a
  2678. bird and 0 if they aren't.
  2679. if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!";
  2680. ---------------------------------------
  2681. *setdragon {<color>{,<char_id>}};
  2682. *checkdragon({<char_id>});
  2683. The 'setdragon' function toggles mounting a dragon for the invoking character.
  2684. It will return 1 if successful, 0 otherwise.
  2685. The available colors are:
  2686. 1 - Green Dragon (default)
  2687. 2 - Brown Dragon
  2688. 3 - Gray Dragon
  2689. 4 - Blue Dragon
  2690. 5 - Red Dragon
  2691. Note: the character must be a Rune Knight and have the skill RK_DRAGONTRAINING to gain a mount
  2692. The accompanying function will return 1 if the invoking character is riding a
  2693. dragon and 0 if they aren't.
  2694. ---------------------------------------
  2695. *setmadogear {<flag>{,<char_id>}};
  2696. *checkmadogear({<char_id>});
  2697. If <flag> is 0 this command will remove the mount from the character.
  2698. Otherwise it gives the invoking character a Mado (if they are a Mechanic).
  2699. The accompanying function will return 1 if the invoking character has a
  2700. Mado and 0 if they don't.
  2701. ---------------------------------------
  2702. *setmounting {<char_id>};
  2703. *ismounting({<char_id>});
  2704. The 'setmounting' function toggles cash mount for the invoking character.
  2705. It will return 1 if successful, 0 otherwise.
  2706. Note: Character must not be mounting a non-cash mount (eg. dragon, peco, wug, etc.)
  2707. The accompanying function will return 1 if the invoking character has a
  2708. cash mount and 0 if they don't.
  2709. ---------------------------------------
  2710. *checkwug({<char_id>});
  2711. This function will return 1 if the invoking character has a
  2712. warg and 0 if they don't.
  2713. ---------------------------------------
  2714. *checkvending({"<Player Name>"})
  2715. Checks if the player is vending or has has a buyingstore. Additionally
  2716. it gives you the information whether the player uses autotrade or not.
  2717. Name is optional, and defaults to the attached player if omitted.
  2718. The returned value is bitmask of.
  2719. 0 = doesn't have a vending or buyingstore (which also means he can't use autotrade)
  2720. 1 = normal vending
  2721. 2 = using @autotrade
  2722. 4 = has a buyingstore
  2723. Examples:
  2724. //This will check Aaron's state
  2725. .@state = checkvending("Aaron");
  2726. if (.@state&1)
  2727. mes "Aaron is currently vending!";
  2728. if (.@state&4)
  2729. mes "Aaron has a buying store!";
  2730. if (.@state&2)
  2731. mes "Aaron is autotrading!";
  2732. ---------------------------------------
  2733. *checkchatting({"<Player Name>"})
  2734. Checks if the player is in a chatroom.
  2735. Name is optional, and defaults to the attached player if omitted.
  2736. Returns 1 if they are in a chat room, 0 if they are not.
  2737. Examples:
  2738. //This will check if the attached player in a chat room or not.
  2739. if (checkchatting())
  2740. mes "You are currently in a chat room!";
  2741. ---------------------------------------
  2742. *checkidle({"<Player Name>"})
  2743. Returns the time, in seconds, that the specified player has been idle.
  2744. Name is optional, and defaults to the attached player if omitted.
  2745. ---------------------------------------
  2746. *agitcheck()
  2747. *agitcheck2()
  2748. *agitcheck3()
  2749. These function will let you check whether the server is currently in WoE:FE mode
  2750. (agitcheck()), WoE:SE mode (agitcheck2()), or WoE:TE mode (agitcheck3()) and will
  2751. return true if War of Emperium is on and false if it isn't.
  2752. ---------------------------------------
  2753. *isnight()
  2754. *isday()
  2755. These functions will return 1 or 0 depending on whether the server is in night
  2756. mode or day mode. 'isnight' returns 1 if it's night and 0 if it isn't, 'isday'
  2757. the other way around. They can be used interchangeably, pick the one you like
  2758. more:
  2759. // These two are equivalent:
  2760. if (isday()) mes "I only prowl in the night.";
  2761. if (isnight()!=1) mes "I only prowl in the night.";
  2762. ---------------------------------------
  2763. *checkre(<type>)
  2764. Checks if a renewal feature is enabled or not in renewal.h, and returns 1 if
  2765. enabled and 0 for disabled.
  2766. The renewal feature to check is determined by type.
  2767. 0 - RENEWAL (game renewal server mode)
  2768. 1 - RENEWAL_CAST (renewal cast time)
  2769. 2 - RENEWAL_DROP (renewal drop rate algorithms)
  2770. 3 - RENEWAL_EXP (renewal exp rate algorithms)
  2771. 4 - RENEWAL_LVDMG (renewal level modifier on damage)
  2772. 5 - RENEWAL_ASPD (renewal ASPD)
  2773. ---------------------------------------
  2774. *is_clientver(<type>,<value>{,<char id>})
  2775. Checks a character's client version against a specified value. If no char id is
  2776. given, the command will run for the invoking character. The function will return
  2777. 1 if the player's version is greater than or equal to the value, and 0 otherwise.
  2778. Available types are:
  2779. 0 - version number (packet_db_ver)
  2780. 1 - client date (YYYYMMDD)
  2781. ---------------------------------------
  2782. \\
  2783. 3,1.- Item-related commands
  2784. \\
  2785. ---------------------------------------
  2786. *isequipped(<id>{,<id>{,<id>{,<id>}}})
  2787. This function will return 1 if the invoking character has all of the item
  2788. IDs given equipped (if card IDs are passed, then it checks if the cards are
  2789. inserted into slots in the equipment they are currently wearing). Theoretically
  2790. there is no limit to the number of items that may be tested for at the same time.
  2791. If even one of the items given is not equipped, 0 will be returned.
  2792. // (Poring,Santa Poring,Poporing,Marin)
  2793. if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
  2794. // (Poring)
  2795. if (isequipped(4001)) mes "A poring card is useful, don't you think?";
  2796. The function was meant for item scripts to support the cards released by Gravity
  2797. in February 2005, but it will work just fine in normal NPC scripts.
  2798. ---------------------------------------
  2799. *isequippedcnt(<card id>{,<card id>{,<card id>{,<card id>}}})
  2800. This function is similar to 'isequipped', but instead of 1 or 0, it will return
  2801. the number of cards in the list given that were found on the invoking character.
  2802. If a given parameter is not a card, the function returns the amount of that
  2803. item equipped on the invoking character.
  2804. if (isequippedcnt(4001,4005,4033,4196) == 4) mes "Finally got all four poring cards?";
  2805. ---------------------------------------
  2806. *checkequipedcard(<card id>)
  2807. This function will return 1 if the card specified by its item ID number is
  2808. inserted into any equipment they have in their inventory, currently equipped or
  2809. not.
  2810. ---------------------------------------
  2811. //
  2812. 3,1.- End of item-related commands
  2813. //
  2814. ---------------------------------------
  2815. ==============================
  2816. |4.- Player-related commands.|
  2817. ==============================
  2818. -------------------------
  2819. *attachrid(<account ID>)
  2820. *detachrid;
  2821. These commands allow the manipulation of the script's currently attached player.
  2822. While 'attachrid' allows attaching of a different player by using its account id
  2823. for the parameter RID, 'detachrid' makes the following commands run as if the
  2824. script was never invoked by a player.
  2825. The command returns 0 if the player cannot be attached (if the account is offline
  2826. or does not exist), and 1 upon success.
  2827. -------------------------
  2828. *addrid(<type>{,<flag>{,<parameters>}});
  2829. This command will attach other RIDs to the current script without detaching the
  2830. invoking RID. It returns 1 if successful and 0 upon failure.
  2831. <type> determines what RIDs are attached:
  2832. 0: All players in the server.
  2833. 1: All players in the map of the invoking player, or the invoking NPC if no player is attached.
  2834. 2: Party members of a specified party ID.
  2835. [ Parameters: <party id> ]
  2836. 3: Guild members of a specified guild ID.
  2837. [ Parameters: <guild id> ]
  2838. 4: All players in a specified area of the map of the invoking player (or NPC).
  2839. [ Parameters: <x0>,<y0>,<x1>,<y1> ]
  2840. 5: All players in the map.
  2841. [ Parameters: "<map name>" ]
  2842. Account ID: If type is Account ID, attach the specified account ID.
  2843. <flag> can prevent certain players from being attached:
  2844. 0: Players are always attached. (default)
  2845. 1: Players currently running another script will not be attached.
  2846. ---------------------------------------
  2847. *rid2name(<rid>)
  2848. Converts rid to name. Note: The player/monster/NPC must be online/enabled.
  2849. Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
  2850. Note: rid2name may not produce correct character names since rid = account id.
  2851. It will return the current online character of the account only.
  2852. ---------------------------------------
  2853. *message "<character name>","<message>";
  2854. That command will send a message to the chat window of the character specified
  2855. by name. The text will also appear above the head of that character. It will not
  2856. be seen by anyone else.
  2857. ---------------------------------------
  2858. *dispbottom "<message>"{,<color>{,<char_id>}};
  2859. This command will send the given message with color into the invoking character's chat
  2860. window. The color format is in RGB (0xRRGGBB). The color is
  2861. by default green
  2862. ---------------------------------------
  2863. *showscript "<message>"{,<GID>};
  2864. Makes attached player or GID says a message like shouting a skill name, the message
  2865. will be seen to everyone around but not in chat window.
  2866. ---------------------------------------
  2867. *warp "<map name>",<x>,<y>{,<char id>};
  2868. This command will take the invoking character or <char id>, if specified, to the specified map, and if
  2869. wanted, specified coordinates too, but these can be random.
  2870. warp "place",50,55;
  2871. This would take them to X 50 Y 55 on the map called "place". If your X and Y
  2872. coordinates land on an unwalkable map square, it will send the warped character
  2873. to a random place. Same will happen if they are both zero:
  2874. warp "place",0,0;
  2875. Notice that while warping people to coordinates 0,0 will normally get them into
  2876. a random place, it's not certain to always be so. Darned if I know where this is
  2877. actually coded, it might be that this happens because square 0,0 is unwalkable
  2878. on all official maps. If you're using custom maps, beware.
  2879. There are also three special 'map names' you can use.
  2880. "Random" will warp the player randomly on the current map.
  2881. "Save" and "SavePoint" will warp the player back to their save point.
  2882. ---------------------------------------
  2883. *areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
  2884. This command is similar to 'warp', however, it will not refer to the invoking
  2885. character, but instead, all characters within a specified area, defined by the
  2886. x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
  2887. including the activating character, if they are outside the area.
  2888. areawarp "place",10,10,120,120,"place2",150,150;
  2889. Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
  2890. shape, on the map called "place", will be affected, and warped to "place2" X 150
  2891. Y 150
  2892. areawarp "place",10,10,120,120,"place2",0,0;
  2893. By using ,0,0; as the destination coordinates it will take all the characters in
  2894. the affected area to a random set of co-ordinates on "place2".
  2895. areawarp "place",10,10,120,120,"place2",150,150,200,200;
  2896. By using the optional x4 and y4 parameters, the destination coordinates will be a
  2897. random place within the defined x3/y3-x4/y4 square.
  2898. Like 'warp', areawarp will also explicitly warp characters randomly into the
  2899. current map if you give the 'to map name' as "Random".
  2900. See also 'warp'.
  2901. ---------------------------------------
  2902. *warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>",<range x>,<range y>};
  2903. Warps a party to specified map and coordinate given the party ID, which you can get with
  2904. getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
  2905. You can use the following "map names" for special warping behavior:
  2906. Random: All party members are randomly warped in their current map (as if they
  2907. all used a fly wing)
  2908. SavePointAll: All party members are warped to their respective save point.
  2909. SavePoint: All party members are warped to the save point of the currently
  2910. attached player (will fail if there's no player attached).
  2911. Leader: All party members are warped to the leader's position. The leader must
  2912. be online and in the current map-server for this to work.
  2913. If you specify a from_mapname, 'warpparty' will only affect those on that map.
  2914. The <range x> and <range y> optional values allow for a randomization with the
  2915. player's warp point. The values will randomly add or subtract from the given <x>
  2916. and <y> coordinates.
  2917. Example:
  2918. mes "[Party Warper]";
  2919. mes "Here you go!";
  2920. close2;
  2921. .@party_id = getcharid(1);
  2922. warpparty "prontera",150,100,.@party_id;
  2923. close;
  2924. ---------------------------------------
  2925. *warpguild "<map name>",<x>,<y>,<guild_id>;
  2926. Warps a guild to specified map and coordinate given the guild id, which you can get with
  2927. getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>).
  2928. You can use the following "map names" for special warping behavior:
  2929. Random: All guild members are randomly warped in their current map (as if they
  2930. all used a fly wing)
  2931. SavePointAll: All guild members are warped to their respective save point.
  2932. SavePoint: All guild members are warped to the save point of the currently
  2933. attached player (will fail if there's no player attached).
  2934. Example:
  2935. warpguild "prontera",x,y,Guild_ID;
  2936. ---------------------------------------
  2937. *warppartner("<map name>",<x>,<y>);
  2938. This function will find the invoking character's marriage partner, if any, and
  2939. warp them to the map and coordinates given. It will return 1 upon success and
  2940. 0 if the partner is not online, the character is not married, or if there's no
  2941. invoking character (no RID). 0,0 will, as usual, normally translate to random coordinates.
  2942. ---------------------------------------
  2943. *savepoint "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
  2944. *save "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
  2945. These commands save where the invoking character will return to upon clicking
  2946. "Return to Save Point", after death and in some other cases. The two versions are
  2947. equivalent. They ignore any and all mapflags, and can make a character respawn where
  2948. no teleportation is otherwise possible.
  2949. The <range x> and <range y> optional values allow for a randomization with the
  2950. player's save point. The values will randomly add or subtract from the given <x>
  2951. and <y> coordinates.
  2952. savepoint "place",350,75;
  2953. savepoint "place",350,75,2,2; // Randomly save the character between 348,73 and 352,77
  2954. ---------------------------------------
  2955. *heal <hp>,<sp>{,<char_id>};
  2956. This command will heal a set amount of HP and/or SP on the invoking character.
  2957. heal 30000,0; // This will heal 30,000 HP
  2958. heal 0,30000; // This will heal 30,000 SP
  2959. heal 300,300; // This will heal 300 HP and 300 SP
  2960. This command just alters the hit points and spell points of the invoking
  2961. character and produces no other output whatsoever.
  2962. ---------------------------------------
  2963. *itemheal <hp>,<sp>{,<char_id>};
  2964. This command heals relative amounts of HP and/or SP on the invoking character.
  2965. Unlike heal, this command is intended for use in item scripts. It applies
  2966. potion-related bonuses, such as alchemist ranking, cards, and status changes.
  2967. When used inside an NPC script, certain bonuses are omitted.
  2968. The command also applies a SP/VIT-related bonus:
  2969. heal = heal * [(100 + STATUS*2) / 100]
  2970. Example:
  2971. // If the player has 50 vit and no bonuses, this will heal
  2972. // anything from 200 to 300 HP and 5 SP
  2973. itemheal rand(100,150),5;
  2974. ---------------------------------------
  2975. *percentheal <hp>,<sp>{,<char_id>};
  2976. This command will heal the invoking character. It heals the character, but not
  2977. by a set value - it adds percent of their maximum HP/SP.
  2978. percentheal 100,0; // This will heal 100% HP
  2979. percentheal 0,100; // This will heal 100% SP
  2980. percentheal 50,50; // This will heal 50% HP and 50% SP
  2981. So the amount that this will heal will depend on the total amount of HP or SP
  2982. you have maximum. Like 'heal', this will not call up any animations or effects.
  2983. ---------------------------------------
  2984. *recovery <type>{,<option>,<revive_flag>{,<map name>}};
  2985. This command will revive and fully restore the HP/SP of the selected characters.
  2986. It returns 1 upon successful use.
  2987. <type> is the target, and determines the <option> parameter:
  2988. 0: Player -> Character ID number
  2989. 1: Party -> Party ID number
  2990. 2: Guild -> Guild ID number
  2991. 3: Map -> Map name (a string)
  2992. 4: All -> None (takes <revive_flag> as option)
  2993. If no option is specified, the invoking player's character ID, party ID, guild ID,
  2994. or map will be used.
  2995. <revive_flag> determines the action:
  2996. 1: Revive and heal all players (default)
  2997. 2: Heal living players only
  2998. 4: Revive dead players only
  2999. <map name> can optionally be used to define a single map to execute the command on
  3000. for types 1 (party) and 2 (guild).
  3001. Examples:
  3002. // Only revive characters in invoking party on map "morocc"
  3003. recovery 1,getcharid(1),4,"morocc";
  3004. // Fully heal (don't revive) all members of invoking character's guild
  3005. recovery 2,getcharid(2),2;
  3006. // Revive and fully heal everyone in map "prontera"
  3007. recovery 3,"prontera";
  3008. // Only revive all dead characters on server
  3009. recovery 4,4;
  3010. ---------------------------------------
  3011. *jobchange <job number>{,<upper flag>,<char_id>};
  3012. This command will change the job class of the invoking character.
  3013. jobchange 1; // This would change your player into a Swordman
  3014. jobchange 4002; // This would change your player into a Swordman High
  3015. This command does work with numbers, but you can also use job names. The full
  3016. list of job names and the numbers they correspond to can be found in
  3017. 'src/map/script_constants.h'.
  3018. // This would change your player into a Swordman
  3019. jobchange Job_Swordman;
  3020. // This would change your player into a Swordman High
  3021. jobchange Job_Swordman_High;
  3022. 'upper flag' can alternatively be used to specify the type of job one changes
  3023. to. For example, jobchange Job_Swordman,1; will change the character to a high
  3024. swordsman. The upper values are:
  3025. -1 (or when omitted): preserves the current job type.
  3026. 0: Normal/standard classes
  3027. 1: High/Advanced classes
  3028. 2: Baby classes
  3029. This command will also set a permanent character-based variable
  3030. 'jobchange_level' which will contain the job level at the time right before
  3031. changing jobs, which can be checked for later in scripts.
  3032. ---------------------------------------
  3033. *jobname(<job number>)
  3034. This command retrieves the name of the given job using the map_msg entries 550->655.
  3035. mes "[Kid]";
  3036. mes "I never thought I'd met a "+jobname(Class)+" here of all places.";
  3037. close;
  3038. ---------------------------------------
  3039. *eaclass({<job number>,<char_id>})
  3040. This commands returns the "eA job-number" corresponding to the given class, and
  3041. uses the invoking player's class if none is given. The eA job-number is also a
  3042. class number system, but it's one that comes with constants which make it easy
  3043. to convert among classes. The command will return -1 if you pass it a job number
  3044. which doesn't have an eA job-number equivalent.
  3045. @eac = eaclass();
  3046. if ((@eac&EAJ_BASEMASK) == EAJ_SWORDMAN)
  3047. mes "Your base job is Swordman.";
  3048. if (@eac&EAJL_UPPER)
  3049. mes "You are a rebirth job.";
  3050. if ((@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN)
  3051. mes "You must be a Swordman, Baby Swordman or High Swordman.";
  3052. For more information on the eA Job System, see the docs/ea_job_system.txt file.
  3053. ---------------------------------------
  3054. *roclass(<job number>{,<gender>})
  3055. Does the opposite of eaclass. That is, given an eA job-number, it returns the
  3056. corresponding RO class number. A gender is required because both Bard and Dancers
  3057. share the same eA job-number (EAJ_BARDDANCER), and uses the invoking player's
  3058. gender if none is given (if no player is attached, male will be used by default).
  3059. The command will return -1 if there is no valid class to represent the specified
  3060. job (for example, if you try to get the baby version of a Taekwon class).
  3061. @eac = eaclass();
  3062. //Check if class is already rebirth
  3063. if (@eac&EAJL_UPPER) {
  3064. mes "You look strong.";
  3065. close;
  3066. }
  3067. @eac = roclass(@eac|EAJL_UPPER);
  3068. //Check if class has a rebirth version
  3069. if (@eac != -1) {
  3070. mes "Bet you can't wait to become a "+jobname(@eac)+"!";
  3071. close;
  3072. }
  3073. ---------------------------------------
  3074. *changebase <job ID number>{,<account ID>};
  3075. This command will change a character's appearance to that of the specified job
  3076. class. Nothing but appearance will change.
  3077. The command will run for the invoking character unless an account ID is given.
  3078. changebase Job_Novice; // Changes player to Novice sprite.
  3079. changebase Class; // Changes player back to default sprite.
  3080. ---------------------------------------
  3081. *classchange(<view id>{,"<NPC name>","<flag>"});
  3082. This command is very ancient, its origins are clouded in mystery.
  3083. It will send a 'display id change' packet to everyone in the immediate area of
  3084. the NPC object, which will supposedly make the NPC look like a different sprite,
  3085. an NPC sprite ID, or a monster ID. This effect is not stored anywhere and will
  3086. not persist (Which is odd, cause it would be relatively easy to make it do so)
  3087. and most importantly, will not work at all since this command was broken with
  3088. the introduction of advanced classes. The code is written with the assumption
  3089. that the lowest sprite IDs are the job sprites and the anything beyond them is
  3090. monster and NPC sprites, but since the advanced classes rolled in, they got the
  3091. ID numbers on the other end of the number pool where monster sprites float.
  3092. As a result it is currently impossible to call this command with a valid view
  3093. id. It will do nothing whatsoever if the view ID is below 4047. Getting it to
  3094. run will actually just crash the client.
  3095. It could be a real gem if it can be gotten to actually do what it's supposed to
  3096. do, but this will only happen in a later SVN revision.
  3097. Empty <NPC name> means attached NPC.
  3098. Target for <flag>:
  3099. - bc_area : Sprite is sent to players in the vicinity of the source (default value).
  3100. - bc_self : Sprite is sent only to player attached.
  3101. ---------------------------------------
  3102. *changesex({<char_id>});
  3103. This command will change the gender for the attached character's account. If it
  3104. was male, it will become female, if it was female, it will become male. The
  3105. change will be written to the character server, the player will receive the
  3106. message: "Need disconnection to perform change-sex request..." and the player
  3107. will be immediately kicked to the login screen. When they log back in, they will
  3108. be the opposite sex.
  3109. If there are any Dancer/Gypsy or Bard/Clown characters on the account,
  3110. they will also have their skills reset upon 'changesex'.
  3111. ---------------------------------------
  3112. *changecharsex({<char_id>});
  3113. This command will change the gender of the attached character. If it
  3114. was male, it will become female, if it was female, it will become male. The
  3115. change will be written to the character server, the player will receive the
  3116. message: "Need disconnection to perform change-sex request..." and the player
  3117. will be immediately kicked to the login screen. When they log back in, they will
  3118. be the opposite sex.
  3119. If the character being changed is a Dancer/Gypsy or Bard/Clown class type,
  3120. the character will also have their skills reset upon 'changecharsex'.
  3121. ---------------------------------------
  3122. *getexp <base_exp>,<job_exp>{,<char_id>};
  3123. This command will give the invoking character a specified number of base and job
  3124. experience points. Used for a quest reward. Negative values won't work.
  3125. The EXP values are adjustted by 'quest_exp_rate' config value, VIP bonus, Guild
  3126. Tax and EXP boost items such Battle Manual, Bubble Gum, or items that have
  3127. SC_EXPBOOST or SC_ITEMBOOST.
  3128. getexp 10000,5000;
  3129. ---------------------------------------
  3130. *getexp2 <base_exp>,<job_exp>{,<char_id>};
  3131. This command is safety version of 'set' command for BaseExp and JobExp. If using
  3132. 'set' while the BaseExp or JobExp value is more than 2,147,483,647 (INT_MAX) will
  3133. causing overflow error.
  3134. Unlike 'getexp', this command ignores the adjustment factors!
  3135. ---------------------------------------
  3136. *setlook <look type>,<look value>{,<char_id>};
  3137. *changelook <look type>,<look value>{,<char_id>};
  3138. 'setlook' will alter the look data for the invoking character. It is used
  3139. mainly for changing the palette used on hair and clothes: you specify which look
  3140. type you want to change, then the palette you want to use. Make sure you specify
  3141. a palette number that exists/is usable by the client you use.
  3142. 'changelook' works the same, but is only client side (it doesn't save the look value).
  3143. // This will change your hair color, so that it uses palette 8, what ever your
  3144. // palette 8 is, your hair will use that color
  3145. setlook LOOK_HAIR_COLOR,8;
  3146. // This will change your clothes color, so they are using palette 1, whatever
  3147. // your palette 1 is, your clothes will then use that set of colors.
  3148. setlook LOOK_CLOTHES_COLOR,1;
  3149. Here are the possible look types:
  3150. LOOK_BASE - Base sprite
  3151. LOOK_HAIR - Hairstyle
  3152. LOOK_WEAPON - Weapon
  3153. LOOK_HEAD_BOTTOM - Head bottom
  3154. LOOK_HEAD_TOP - Head top
  3155. LOOK_HEAD_MID - Head mid
  3156. LOOK_HAIR_COLOR - Hair color
  3157. LOOK_CLOTHES_COLOR - Clothes color
  3158. LOOK_SHIELD - Shield
  3159. LOOK_SHOES - Shoes
  3160. LOOK_BODY2 - Body style
  3161. Whatever 'shoes' means is anyone's guess, ask Gravity - the client does nothing
  3162. with this value. It still wants it from the server though, so it is kept, but
  3163. normally doesn't do a thing.
  3164. Only the look data for hairstyle, hair color and clothes color are saved to the
  3165. char server's database and will persist. Body style will also persist if 'save_body_style'
  3166. configuration is enabled in '/conf/battle/client.conf'. The rest freely change as the character
  3167. puts on and removes equipment, changes maps, logs in and out and otherwise you
  3168. should not expect to set them. In fact, messing with them is generally
  3169. hazardous, do it at your own risk, it is not tested what will this actually do -
  3170. it won't cause database corruption and probably won't cause a server crash, but
  3171. it's easy to crash the client with just about anything unusual.
  3172. However, it might be an easy way to quickly check for empty view IDs for
  3173. sprites, which is essential for making custom headgear.
  3174. Since a lot of people have different palettes for hair and clothes, it's
  3175. impossible to tell you what all the color numbers are. If you want a serious
  3176. example, there is a Stylist script inside the default rAthena installation that
  3177. you can look at: 'npc/custom/stylist.txt'
  3178. ---------------------------------------
  3179. *pushpc <direction>,<cells>;
  3180. This command will push the currently attached player to given direction by given
  3181. amount of square cells. Direction is the same as used when declaring NPCs, and
  3182. can be specified by using one of the DIR_* constants (src/map/script_constants.h).
  3183. The knock-back is not restricted by items or map flags, only obstacles are taken
  3184. into account. If there is not enough space to perform the push (e.g. due to a
  3185. wall), the character is pushed only up to the obstacle.
  3186. // pushes the character 5 cells in 3 o'clock direction from its
  3187. // current position.
  3188. pushpc DIR_EAST, 5;
  3189. ---------------------------------------
  3190. *recalculatestat;
  3191. This command will force a stat recalculation for the attached player.
  3192. ---------------------------------------
  3193. *needed_status_point(<type>,<val>{,<char id>});
  3194. Returns the number of stat points needed to change the specified stat <type> by <val>.
  3195. If <val> is negative, returns the number of stat points that would be needed to
  3196. raise the specified stat from (current value - <val>) to current value.
  3197. ---------------------------------------
  3198. *jobcanentermap("<mapname>"{,<JobID>});
  3199. Return true if player (decided by job) can enter the map, false otherwise.
  3200. For optional 'JobID', see constant of Job_*, or use player's Class, BaseJob,
  3201. and BaseClass. If no player is attached, this param must have a value.
  3202. See also db/[pre-]re/job_noenter_map.txt
  3203. ---------------------------------------
  3204. *get_revision()
  3205. This command will return the SVN revision number that the server is currently
  3206. running on.
  3207. if ( get_revision() >= 15000 )
  3208. mes "Welcome to rAthena!";
  3209. ---------------------------------------
  3210. *get_githash()
  3211. This command will return the Git Hash that the server is currently running on.
  3212. mes "Welcome to rAthena! Git Hash: " + get_githash();
  3213. ---------------------------------------
  3214. \\
  3215. 4,1.- Item-related commands
  3216. \\
  3217. ---------------------------------------
  3218. *getitem <item id>,<amount>{,<account ID>};
  3219. *getitem "<item name>",<amount>{,<account ID>};
  3220. This command will give an amount of specified items to the invoking character.
  3221. If an optional account ID is specified, and the target character is currently
  3222. online, items will be created in their inventory instead. If they are not
  3223. online, nothing will happen.
  3224. In the first and most commonly used version of this command, items are
  3225. referred to by their database ID number found inside 'db/(pre-)re/item_db.txt'.
  3226. getitem 502,10 // The person will receive 10 apples
  3227. getitem 617,1 // The person will receive 1 Old Violet Box
  3228. This transaction is logged if the log script generated transactions option is
  3229. enabled.
  3230. You may also create an item by its name in the 'english name' field in the
  3231. item database:
  3232. getitem "RED_POTION",10;
  3233. Which will do what you'd expect. If it can't find that name in the database,
  3234. apples will be created anyway. It is often a VERY GOOD IDEA to use it like this.
  3235. This is used in pretty much all NPC scripts that have to do with items and
  3236. quite a few item scripts. For more examples check just about any official script.
  3237. ---------------------------------------
  3238. *getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3239. *getitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3240. *getitem3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3241. *getitem3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3242. This command will give an amount of specified items to the invoking character.
  3243. If an optional account ID is specified, and the target character is currently
  3244. online, items will be created in their inventory instead. If they are not
  3245. online, nothing will happen. It works essentially the same as 'getitem' but is
  3246. a lot more flexible.
  3247. Those parameters that are different from 'getitem' are:
  3248. identify - Whether you want the item to be identified (1) or not (0).
  3249. refine - For how many pluses will it be refined.
  3250. It will not let you refine an item higher than the max refine.
  3251. attribute - Whether the item is broken (1) or not (0).
  3252. card1,2,3,4 - If you want a card compound to it, place the card ID number into
  3253. the specific card slot.
  3254. Card1-card4 values are also used to store name information for named items, as
  3255. well as the elemental property of weapons and armor. You can create a named item
  3256. in this manner, however, if you just need a named piece of standard equipment,
  3257. it is much easier to the 'getnameditem' function instead.
  3258. You will need to keep these values if you want to destroy and then perfectly
  3259. recreate a named item, for this see 'getinventorylist'.
  3260. If you still want to try creating a named item with this command because
  3261. 'getnameditem' won't do it for you cause it's too limited, you can do it like
  3262. this. Careful, minor magic ahead.
  3263. // First, let's get an ID of a character who's name will be on the item.
  3264. // Only an existing character's name may be there.
  3265. // Let's assume our character is 'Adam' and find his ID.
  3266. @charid = getcharid(0,"Adam");
  3267. // Now we split the character ID number into two portions with a binary
  3268. // shift operation. If you don't understand what this does, just copy it.
  3269. @card3 = @charid & 65535;
  3270. @card4 = @charid >> 16;
  3271. // If you're inscribing non-equipment, @card1 must be 254.
  3272. // Arrows are also not equipment.
  3273. @card1 = 254;
  3274. // For named equipment, card2 means the Star Crumbs and elemental
  3275. // crystals used to make this equipment. For everything else, it's 0.
  3276. @card2 = 0;
  3277. // Now, let's give the character who invoked the script some
  3278. // Adam's Apples:
  3279. getitem2 512,1,1,0,0,@card1,@card2,@card3,@card4;
  3280. This wasn't tested with all possible items, so I can't give any promises,
  3281. experiment first before relying on it.
  3282. To create equipment, continue this example it like this:
  3283. // We've already have card3 and card4 loaded with correct
  3284. // values so we'll just set up card1 and card2 with data
  3285. // for an Ice Stiletto.
  3286. // If you're inscribing equipment, @card1 must be 255.
  3287. @card1 = 255;
  3288. // That's the number of star crumbs in a weapon.
  3289. @sc = 2;
  3290. // That's the number of elemental property of the weapon.
  3291. @ele = 1;
  3292. // And that's the wacky formula that makes them into
  3293. // a single number.
  3294. @card2 = @ele+((@sc*5)<<8);
  3295. // That will make us an Adam's +2 VVS Ice Stiletto:
  3296. getitem2 1216,1,1,2,0,@card1,@card2,@card3,@card4;
  3297. Experiment with the number of star crumbs - I'm not certain just how much will
  3298. work most and what it depends on. The valid element numbers are:
  3299. 1 - Ice, 2 - Earth 3 - Fire 4 - Wind.
  3300. You can, apparently, even create duplicates of the same pet egg with this
  3301. command, creating a pet which is the same, but simultaneously exists in two
  3302. eggs, and may hatch from either, although, I'm not sure what kind of a mess will
  3303. this really cause.
  3304. 'getitem3' is advance version of 'getitem2' that also use Item Random Option as additional values.
  3305. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3306. <RandomValueArray> : Array variable of item random option's value.
  3307. <RandomParamArray> : Array variable of item random option's param.
  3308. Example to get Crimson Weapon with Ghost property:
  3309. // +9 Crimson Dagger [2]
  3310. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3311. setarray .@OptVal[0],0;
  3312. setarray .@OptParam[0],0;
  3313. getitem3 28705,1,1,9,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3314. ---------------------------------------
  3315. *getitembound <item id>,<amount>,<bound type>{,<account ID>};
  3316. *getitembound "<item name>",<amount>,<bound type>{,<account ID>};
  3317. This command behaves identically to 'getitem', but the items created will be
  3318. bound to the target character as specified by the bound type. All items created
  3319. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3320. some cases cannot be traded or stored.
  3321. Valid bound types are:
  3322. Bound_Account : Account Bound item
  3323. Bound_Guild : Guild Bound item
  3324. Bound_Party : Party Bound item
  3325. Bound_Char : Character Bound item
  3326. ---------------------------------------
  3327. *getitembound2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3328. *getitembound2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>{,<account ID>};
  3329. *getitembound3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3330. *getitembound3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<bound type>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3331. This command behaves identically to 'getitem2', but the items created will be
  3332. bound to the target character as specified by the bound type. All items created
  3333. in this manner cannot be dropped, sold, vended, auctioned, or mailed, and in
  3334. some cases cannot be traded or stored.
  3335. For a list of bound types see 'getitembound'.
  3336. 'getitembound3' is advance version of 'getitembound2' that also use Item Random Option as additional values.
  3337. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3338. <RandomValueArray> : Array variable of item random option's value.
  3339. <RandomParamArray> : Array variable of item random option's param.
  3340. Example to get Crimson Weapon with Ghost property:
  3341. // +9 Crimson Dagger [2]
  3342. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3343. setarray .@OptVal[0],0;
  3344. setarray .@OptParam[0],0;
  3345. getitembound3 28705,1,1,9,0,0,0,0,0,BOUND_CHAR,.@OptID,.@OptVal,.@OptParam;
  3346. ---------------------------------------
  3347. *getnameditem <item id>,<character name|character ID>;
  3348. *getnameditem "<item name>",<character name|character ID>;
  3349. Create an item signed with the given character's name.
  3350. The command returns 1 when the item is created successfully, or 0 if it fails.
  3351. Failure occurs when:
  3352. - There is no player attached.
  3353. - Item name or ID is not valid.
  3354. - The given character ID/name is offline.
  3355. Example:
  3356. //This will give the currently attached player a Aaron's Apple (if Aaron is online).
  3357. getnameditem "Apple","Aaron";
  3358. //Self-explanatory (I hope).
  3359. if (getnameitem("Apple","Aaron")) {
  3360. mes "You now have a Aaron's Apple!";
  3361. }
  3362. ---------------------------------------
  3363. *rentitem <item id>,<time>{,<account_id>};
  3364. *rentitem "<item name>",<time>{,<account_id>};
  3365. Creates a rental item in the attached character's inventory. The item will expire
  3366. in <time> seconds and be automatically deleted. When receiving a rental item,
  3367. the character will receive a message in their chat window. The character will
  3368. also receive warning messages in their chat window before the item disappears.
  3369. When rentals expire it will call the OnUnequip Script of the item. This can be used
  3370. for special cases such as removing a status change or resetting a variable or state
  3371. of the player.
  3372. This command can not be used to rent stackable items. Rental items cannot be
  3373. dropped, traded, sold to NPCs, or placed in guild storage. (i.e. trade mask 75)
  3374. Note: 'delitem' in an NPC script can still remove rental items.
  3375. ---------------------------------------
  3376. *rentitem2 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3377. *rentitem2 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account_id>};
  3378. *rentitem3 <item id>,<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3379. *rentitem3 "<item name>",<time>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account_id>};
  3380. Creates a rental item in the attached character's inventory. The item will expire
  3381. in <time> seconds and be automatically deleted. See 'rentitem' for further details.
  3382. See 'getitem2' for an explanation of the expanded parameters.
  3383. 'rentitem3' is advance version of 'rentitem2' that also use Item Random Option as additional values.
  3384. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3385. <RandomValueArray> : Array variable of item random option's value.
  3386. <RandomParamArray> : Array variable of item random option's param.
  3387. Example to get Crimson Weapon with Ghost property:
  3388. // +9 Crimson Dagger [2]
  3389. setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
  3390. setarray .@OptVal[0],0;
  3391. setarray .@OptParam[0],0;
  3392. rentitem3 28705,(24*60*60),1,9,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3393. ---------------------------------------
  3394. *makeitem <item id>,<amount>,"<map name>",<X>,<Y>;
  3395. *makeitem "<item name>",<amount>,"<map name>",<X>,<Y>;
  3396. This command will create an item on the specified cell of a map.
  3397. As with any dropped items, the items created with this command will disappear after
  3398. a period of time. Using an amount greater than 1 will create a single stack of the
  3399. given amount, not multiple stacks of 1.
  3400. Like 'getitem', it also accepts an 'english name' field from the database and creates
  3401. Apples if the name isn't found.
  3402. If the map name is given as "this", the map the invoking character is on will be used.
  3403. ---------------------------------------
  3404. *makeitem2 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3405. *makeitem2 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>;
  3406. *makeitem3 <item id>,<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>;
  3407. *makeitem3 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>;
  3408. This command will create an item on the specified cell of a map. See 'makeitem' for
  3409. further details.
  3410. See 'getitem2' for an explanation of the expanded parameters.
  3411. 'makeitem3' is advance version of 'makeitem2' that also use Item Random Option as additional values.
  3412. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3413. <RandomValueArray> : Array variable of item random option's value.
  3414. <RandomParamArray> : Array variable of item random option's param.
  3415. Example to get Crimson Weapon with Ghost property:
  3416. // 0.5% chance to get +0 Valkyrie Shield [1]
  3417. // with Neutral Resistance +10% and 5% damage reduction from Demi-Human or Player
  3418. // when Valkyrie Randgris killed
  3419. OnNPCKillEvent:
  3420. if (killedrid == 1751 && rand(0,1000) > 950) { // Valkyrie Randgris
  3421. getmapxy(.@map$,.@x,.@y,UNITTYPE_PC);
  3422. setarray .@OptID[0],RDMOPT_ATTR_TOLERACE_NOTHING,RDMOPT_RACE_TOLERACE_HUMAN;
  3423. setarray .@OptVal[0],10,5;
  3424. setarray .@OptParam[0],0;
  3425. makeitem3 2115,1,.@map$,.@x,.@y,0,0,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
  3426. }
  3427. end;
  3428. ---------------------------------------
  3429. *cleanarea "<map name>",<x1>,<y1>,<x2>,<y2>;
  3430. *cleanmap "<map name>";
  3431. These commands will clear all items lying on the ground on the specified map, either
  3432. within the x1/y1-x2/y2 rectangle or across the entire map.
  3433. ---------------------------------------
  3434. *searchitem <array name>,"<item name>";
  3435. This command will fill the given array with the ID of items whose name matches
  3436. the given one. It returns the number of items found. For performance reasons,
  3437. the results array is limited to 10 items.
  3438. mes "What item are you looking for?";
  3439. input .@name$;
  3440. .@qty = searchitem(.@matches[0],.@name$);
  3441. mes "I found " + .@qty + " items:";
  3442. for (.@i = 0; .@i < .@qty; .@i++)
  3443. // Display name (eg: "Apple[0]")
  3444. mes getitemname(.@matches[.@i]) + "[" + getitemslots(.@matches[.@i]) + "]";
  3445. ---------------------------------------
  3446. *delitem <item id>,<amount>{,<account ID>};
  3447. *delitem "<item name>",<amount>{,<account ID>};
  3448. This command will remove a specified amount of items from the invoking/target character.
  3449. Like all the item commands, it uses the item ID found inside 'db/(pre-)re/item_db.txt'.
  3450. delitem 502,10; // The person will lose 10 apples
  3451. delitem 617,1; // The person will lose 1 Old Violet Box
  3452. It is always a good idea to check if the player actually has the items before you delete them.
  3453. If you try to delete more items that the player has, the player will lose the ones he/she has
  3454. and the script will terminate with an error.
  3455. Like 'getitem', this command will also accept an 'english name' field from the
  3456. database. If the name is not found, nothing will be deleted.
  3457. ---------------------------------------
  3458. *cartdelitem <item id>,<amount>{,<account ID>};
  3459. *cartdelitem "<item name>",<amount>{,<account ID>};
  3460. *storagedelitem <item id>,<amount>{,<account ID>};
  3461. *storagedelitem "<item name>",<amount>{,<account ID>};
  3462. *guildstoragedelitem <item id>,<amount>{,<account ID>};
  3463. *guildstoragedelitem "<item name>",<amount>{,<account ID>};
  3464. This command behaves identically to 'delitem', but deletes items from the player's
  3465. cart, storage, or guild storage.
  3466. If no cart is mounted, 'cartdelitem' will return -1.
  3467. If player is not in a guild or storage is open, 'guildstoragedelitem' will return -1.
  3468. ---------------------------------------
  3469. *delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3470. *delitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3471. *delitem3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3472. *delitem3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
  3473. This command will remove a specified amount of items from the invoking/target character.
  3474. See 'getitem2' for an explanation of the expanded parameters.
  3475. 'delitem3' is advance version of 'delitem2' that also use Item Random Option as criteria.
  3476. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3477. <RandomValueArray> : Array variable of item random option's value.
  3478. <RandomParamArray> : Array variable of item random option's param.
  3479. ---------------------------------------
  3480. *cartdelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3481. *cartdelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3482. *storagedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3483. *storagedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3484. *guildstoragedelitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3485. *guildstoragedelitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
  3486. This command behaves identically to 'delitem2', but deletes items from the player's
  3487. cart, storage, or guild storage.
  3488. If no cart is mounted, 'cartdelitem2' will return -1.
  3489. If player is not in a guild or storage is open, 'guildstoragedelitem2' will return -1.
  3490. ---------------------------------------
  3491. *countitem(<item id>)
  3492. *countitem("<item name>")
  3493. This function will return the number of items for the specified item ID that the
  3494. invoking character has in the inventory.
  3495. mes "[Item Checker]";
  3496. mes "Hmmm, it seems you have "+countitem(502)+" apples";
  3497. close;
  3498. Like 'getitem', this function will also accept an 'english name' from the
  3499. database as an argument.
  3500. If you want to state the number at the end of a sentence, you can do it by
  3501. adding up strings:
  3502. mes "[Item Checker]";
  3503. mes "Hmmm, the total number of apples you are holding is "+countitem("APPLE");
  3504. close;
  3505. ---------------------------------------
  3506. *cartcountitem(<item id>{,<accountID>})
  3507. *cartcountitem("<item name>"{,<accountID>})
  3508. *storagecountitem(<item id>{,<accountID>})
  3509. *storagecountitem("<item name>"{,<accountID>})
  3510. *guildstoragecountitem(<nameID>{,<accountID>})
  3511. *guildstoragecountitem("<item name>"{,<accountID>})
  3512. This command behaves identically to 'countitem', but counts items from the player's
  3513. cart, storage, or guild storage.
  3514. If no cart is mounted, 'cartcountitem' will return -1.
  3515. If player is not in a guild or storage is open, 'guildstoragecountitem' will return -1.
  3516. ---------------------------------------
  3517. *countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3518. *countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
  3519. *countitem3(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>)
  3520. *countitem3("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>)
  3521. Expanded version of 'countitem' function, used for created/carded/forged items.
  3522. This function will return the number of items for the specified item ID and
  3523. other parameters that the invoking character has in the inventory.
  3524. See 'getitem2' for an explanation of the expanded parameters.
  3525. 'countitem3' is advance version of 'countitem2' that also use Item Random Option as criteria.
  3526. <RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
  3527. <RandomValueArray> : Array variable of item random option's value.
  3528. <RandomParamArray> : Array variable of item random option's param.
  3529. ---------------------------------------
  3530. *cartcountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3531. *cartcountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3532. *storagecountitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3533. *storagecountitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<accountID>})
  3534. *guildstoragecountitem2(<nameID>,<Identified>,<Refine>,<Attribute>,<Card0>,<Card1>,<Card2>,<Card3>{,<accountID>})
  3535. *guildstoragecountitem2("<item name>",<Identified>,<Refine>,<Attribute>,<Card0>,<Card1>,<Card2>,<Card3>{,<accountID>})
  3536. This command behaves identically to 'countitem2', but counts items from the player's
  3537. cart, storage, or guild storage.
  3538. If no cart is mounted, 'cartcountitem2' will return -1.
  3539. If player is not in a guild or storage is open, 'guildstoragecountitem2' will return -1.
  3540. ---------------------------------------
  3541. *countbound({<bound type>{,<char_id>}})
  3542. This function will return the number of bounded items in the character's
  3543. inventory, and sets an array @bound_items[] containing all item IDs of the
  3544. counted items. If a bound type is specified, only those items will be counted.
  3545. For a list of bound types see 'getitembound'.
  3546. Example:
  3547. mes "You currently have "+countbound()+" bounded items.";
  3548. next;
  3549. mes "The list of bounded items include:";
  3550. for(.@i = 0; .@i < getarraysize(@bound_items); .@i++)
  3551. mes getitemname(@bound_items[.@i]);
  3552. close;
  3553. ---------------------------------------
  3554. *groupranditem <group id>{,<sub_group>};
  3555. Returns the item_id of a random item picked from the group specified. The
  3556. different groups and their group number are specified in 'db/(pre-)re/item_group_db.txt'.
  3557. When used in conjunction with other functions, you can get a random item. For
  3558. example, for a random pet lure:
  3559. getitem groupranditem(IG_Taming),1;
  3560. 'sub_group' is used to get the available random items of item group from specified random
  3561. group. 0 for 'must' item group, and random item group is 1 until 5 (MAX_ITEMGROUP_RANDGROUP+1).
  3562. More info, see doc/item_group.txt.
  3563. ---------------------------------------
  3564. *getrandgroupitem <group_id>{,<quantity>{,<sub_group>}};
  3565. Similar to the above example, this command allows players to obtain the specified
  3566. quantity of a random item from the group "<group id>". The different groups and
  3567. their group number are specified in db/(pre-)re/item_group_db.txt
  3568. If 'quantity' is not defined or 0, it will uses defined amount from Item Group list.
  3569. If 'sub_group' is not defined the value will be 1 (since random group is 1 ~ 5, and 0 is
  3570. 'must' item group).
  3571. More info, see doc/item_group.txt.
  3572. ---------------------------------------
  3573. *getgroupitem <group_id>{,<char_id>};
  3574. Gives item(s) to the attached player based on item group contents.
  3575. This is not working like 'getrandgroupitem' which only give 1 item for specified
  3576. item group & sub_group.
  3577. More info, see doc/item_group.txt.
  3578. ---------------------------------------
  3579. *enable_items;
  3580. *disable_items;
  3581. These commands toggle the ability to change equipment while interacting with
  3582. an NPC. To avoid possible exploits, the commands affect the particular script
  3583. instance only. Note that if a different script also calls enable_items, it
  3584. will override the last call (so you may want to call this command at the start
  3585. of your script without assuming it is still in effect).
  3586. The default setting, 'item_enabled_npc', is defined in 'conf/battle/items.conf'.
  3587. ---------------------------------------
  3588. *itemskill <skill id>,<skill level>{,<keep requirement>};
  3589. *itemskill "<skill name>",<skill level>{,<keep requirement>};
  3590. This command is meant for item scripts to replicate single-use skills in usable
  3591. items. It will not work properly if there is a visible dialog window or menu.
  3592. If the skill is self or auto-targeting, it will be used immediately; otherwise a
  3593. target cursor is shown.
  3594. If <keep requirement> parameter is set to true, the skill's requirements will be checked.
  3595. By default, the requirements for item skills are not checked, and therefore the default value is false.
  3596. // When Anodyne is used, it will cast Endure (8), Level 1, as if the actual
  3597. // skill has been used from skill tree.
  3598. 605,Anodyne,Anodyne,11,2000,0,100,,,,,10477567,2,,,,,{ itemskill 8,1; },{}
  3599. // When Sienna_Execrate_Scroll_1_5 is used, it will cast Sienna Execrate Level 5 and consume 2 Red_Gemstones.
  3600. 23194,Sienna_Execrate_Scroll_1_5,Level 5 Sienna Execrate,11,10,,10,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_SIENNAEXECRATE",5,true; },{},{}
  3601. ---------------------------------------
  3602. *consumeitem <item id>{,<char_id>};
  3603. *consumeitem "<item name>"{,<char_id>};
  3604. This command will run the item script of the specified item on the invoking
  3605. character. The character does not need to possess the item, and the item will
  3606. not be deleted. While this command is intended for usable items, it will run
  3607. for any item type.
  3608. This command does not currently work with the 'itemskill' script command.
  3609. ---------------------------------------
  3610. *produce <item level>;
  3611. This command will open a crafting window on the client connected to the invoking
  3612. character. The 'item level' is a number which determines what kind of a crafting
  3613. window will pop-up.
  3614. You can see the full list of such item levels in 'db/produce_db.txt' which determines
  3615. what can actually be produced. The window will not be empty only if the invoking
  3616. character can actually produce the items of that type and has the appropriate raw
  3617. materials in their inventory.
  3618. The success rate to produce the item is the same as the success rate of the skill
  3619. associated with the item level. If there is no skill id, the success rate will be 50%.
  3620. Valid item levels are:
  3621. 1 - Level 1 Weapons
  3622. 2 - Level 2 Weapons
  3623. 3 - Level 3 Weapons
  3624. 21 - Blacksmith's Stones and Metals
  3625. 22 - Alchemist's Potions, Holy Water, Assassin Cross's Deadly Poison
  3626. 23 - Elemental Converters
  3627. ---------------------------------------
  3628. *cooking <dish level>;
  3629. This command will open a produce window on the client connected to the invoking
  3630. character. The 'dish level' is the number which determines what kind of dish
  3631. level you can produce. You can see the full list of dishes that can be produced in
  3632. 'db/produce_db.txt'.
  3633. The window will be shown empty if the invoking character does not have enough of
  3634. the required incredients to cook a dish.
  3635. Valid dish levels are:
  3636. 11 - Level 1 Dish
  3637. 12 - Level 2 Dish
  3638. 13 - Level 3 Dish
  3639. 14 - Level 4 Dish
  3640. 15 - Level 5 Dish
  3641. 16 - Level 6 Dish
  3642. 17 - Level 7 Dish
  3643. 18 - Level 8 Dish
  3644. 19 - Level 9 Dish
  3645. 20 - Level 10 Dish
  3646. Although it's required to set a dish level, it doesn't matter if you set it to 1
  3647. and you want to cook a level 10 dish, as long as you got the required incredients
  3648. to cook the dish the command works.
  3649. ---------------------------------------
  3650. *makerune <% success bonus>{,<char_id>};
  3651. This command will open a rune crafting window on the client connected to the
  3652. invoking character. Since this command is officially used in rune ores, a bonus
  3653. success rate must be specified (which adds to the base formula).
  3654. You can see the full list of runes that can be produced in 'db/produce_db.txt'.
  3655. The window will not be empty only if the invoking character can actually produce
  3656. a rune and has the appropriate raw materials in their inventory.
  3657. ---------------------------------------
  3658. *successremovecards <equipment slot>;
  3659. This command will remove all cards of the cards slots defined by item_db.txt
  3660. from the item found in the specified equipment slot of the invoking character,
  3661. create new card items and give them to the character.
  3662. If any cards were removed in this manner, it will also show a success effect.
  3663. ---------------------------------------
  3664. *failedremovecards <equipment slot>,<type>;
  3665. This command will remove all cards from the item found in the specified
  3666. equipment slot of the invoking character. 'type' determines what happens to the
  3667. item and the cards:
  3668. 0 - will destroy both the item and the cards.
  3669. 1 - will keep the item, but destroy the cards.
  3670. 2 - will keep the cards, but destroy the item.
  3671. Whatever the type is, it will also show a failure effect on screen.
  3672. ---------------------------------------
  3673. *repair <broken item number>{,<char_id>};
  3674. This command repairs a broken piece of equipment, using the same list of broken
  3675. items as available through 'getbrokenid'.
  3676. ---------------------------------------
  3677. *repairall {<char_id>};
  3678. This command repairs all broken equipment in the attached player's inventory.
  3679. A repair effect will be shown if any items are repaired, else the command will
  3680. end silently.
  3681. ---------------------------------------
  3682. *successrefitem <equipment slot>{,<count>{,<char_id>}};
  3683. This command will refine an item in the specified equipment slot of the invoking
  3684. character by +1, or a count if given. For a list of equipment slots see 'getequipid'.
  3685. This command will also display a 'refine success' effect on the character and put
  3686. appropriate messages into their chat window. It will also give the character fame
  3687. points if a weapon reached +10 this way, even though these will only take effect for
  3688. blacksmith who will later forge a weapon.
  3689. ---------------------------------------
  3690. *failedrefitem <equipment slot>{,<char_id>};
  3691. This command will fail to refine an item in the specified equipment slot of the
  3692. invoking character. The item will be destroyed. This will also display a 'refine
  3693. failure' effect on the character and put appropriate messages into their chat
  3694. window.
  3695. ---------------------------------------
  3696. *downrefitem <equipment slot>{,<count>{,<char_id>}};
  3697. This command will downgrade an item in the specified equipment slot of the invoking
  3698. character by -1, or a count if given. For a list of equipment slots see 'getequipid'.
  3699. This command will also display a 'refine failure' effect on the character and put
  3700. appropriate messages into their chat window.
  3701. ---------------------------------------
  3702. *unequip <equipment slot>{,<char_id>};
  3703. This command will unequip whatever is currently equipped in the invoking
  3704. character's specified equipment slot. For a full list of possible equipment
  3705. slots see 'getequipid'.
  3706. If an item occupies several equipment slots, it will get unequipped from all of
  3707. them.
  3708. ---------------------------------------
  3709. *delequip <equipment slot>{,<char_id>};
  3710. This command will destroy whatever is currently equipped in the invoking
  3711. character's specified equipment slot. For a full list of possible equipment
  3712. slots see 'getequipid'.
  3713. This command will return 1 if an item was deleted and 0 otherwise.
  3714. ---------------------------------------
  3715. *breakequip <equipment slot>{,<char_id>};
  3716. This command will break and unequip whatever is currently equipped in the
  3717. invoking character's specified equipment slot. For a full list of possible
  3718. equipment slots see 'getequipid'.
  3719. This command will return 1 if an item was broken and 0 otherwise.
  3720. ---------------------------------------
  3721. *clearitem {<char_id>};
  3722. This command will destroy all items the invoking character has in their
  3723. inventory (including equipped items). It will not affect anything else, like
  3724. storage or cart.
  3725. ---------------------------------------
  3726. *equip <item id>{,<char_id>};
  3727. *autoequip <item id>,<option>;
  3728. These commands are to equip a equipment on the attached character.
  3729. The equip function will equip the item ID given when the player has
  3730. this item in his/her inventory, while the autoequip function will
  3731. equip the given item ID when this is looted. The option parameter of
  3732. the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off.
  3733. Examples:
  3734. //This will equip a 1104 (falchion) on the character if this is in the inventory.
  3735. equip 1104;
  3736. //The invoked character will now automatically equip a falchion when it's looted.
  3737. autoequip 1104,1;
  3738. //The invoked character will no longer automatically equip a falchion.
  3739. autoequip 1104,0;
  3740. ---------------------------------------
  3741. *buyingstore <slots>;
  3742. Invokes buying store preparation window like the skill 'Open Buying Store',
  3743. without the item requirement. Amount of slots is limited by the server to
  3744. a maximum of 5 slots by default.
  3745. Example:
  3746. // Gives the player opportunity to buy 4 different kinds of items.
  3747. buyingstore 4;
  3748. ---------------------------------------
  3749. *searchstores <uses>,<effect>;
  3750. Invokes the store search window, which allows to search for both vending
  3751. and buying stores. Parameter uses indicates, how many searches can be
  3752. started, before the window has to be reopened. Effect value affects,
  3753. what happens, when a result item is double-clicked and can be one of the
  3754. following:
  3755. 0 = Shows the store's position on the mini-map and highlights the
  3756. shop sign with yellow color, when the store is on same map
  3757. as the invoking player.
  3758. 1 = Directly opens the shop, regardless of distance.
  3759. Example:
  3760. // Item Universal_Catalog_Gold (10 uses, effect: open shop)
  3761. searchstores 10,1;
  3762. ---------------------------------------
  3763. *enable_command;
  3764. *disable_command;
  3765. These commands toggle the ability to use atcommand while interacting with an NPC.
  3766. The default setting, 'atcommand_enable_npc', is defined in 'conf/battle/gm.conf'.
  3767. ---------------------------------------
  3768. //
  3769. 4,1.- End of item-related commands
  3770. //
  3771. ---------------------------------------
  3772. *openstorage;
  3773. This will open character's Kafra storage window on the client connected to the
  3774. invoking character. It can be used from any kind of NPC or item script, not just
  3775. limited to Kafra Staff.
  3776. The storage window opens regardless of whether there are open NPC dialogs or
  3777. not, but it is preferred to close the dialog before displaying the storage
  3778. window, to avoid any disruption when both windows overlap.
  3779. mes "Close this window to open your storage.";
  3780. close2;
  3781. openstorage;
  3782. end;
  3783. ---------------------------------------
  3784. *openstorage2 <storage_id>,<mode>{,<account_id>};
  3785. Just like the 'openstorage' command, except this command can open additional storages
  3786. by the specified <storage_id>. For <storage_id>, please read the conf/inter_server.conf
  3787. for storage groups.
  3788. Values for <mode> are:
  3789. STOR_MODE_NONE : Player only can read the storage entries.
  3790. STOR_MODE_GET : Player can get items from the storage.
  3791. STOR_MODE_PUT : Player can put items in the storage.
  3792. Example:
  3793. if (vip_status(VIP_STATUS_ACTIVE)) {
  3794. mes "I will open your Premium storage.";
  3795. mes "Thank you for using our service.";
  3796. close2;
  3797. openstorage2 1,STOR_MODE_GET|STOR_MODE_PUT;
  3798. } else {
  3799. mes "Sorry, your Premium status is expired.";
  3800. mes "Storage will be opened but you can't put any item into it.";
  3801. close2;
  3802. openstorage2 1,STOR_MODE_GET;
  3803. }
  3804. end;
  3805. ---------------------------------------
  3806. *openmail({<char_id>});
  3807. This will open a character's Mail window on the client connected to the
  3808. invoking character.
  3809. mes "Close this window to open your mail inbox.";
  3810. close2;
  3811. openmail;
  3812. end;
  3813. ---------------------------------------
  3814. *openauction({<char_id>});
  3815. This will open the Auction window on the client connected to the invoking character.
  3816. mes "Close this window to open the Auction window.";
  3817. close2;
  3818. openauction;
  3819. end;
  3820. ---------------------------------------
  3821. \\
  3822. 4,2.- Guild-related commands
  3823. \\
  3824. ---------------------------------------
  3825. *guildopenstorage()
  3826. This function works the same as 'openstorage' but will open a guild storage
  3827. window instead for the guild storage of the guild the invoking character belongs
  3828. to. This is a function because it returns a value - 0 if the guild storage was
  3829. opened successfully and 1 if it wasn't. (Notice, it's a ZERO upon success.)
  3830. Since guild storage is only accessible to one character at one time, it may fail
  3831. if another character is accessing the guild storage at the same time.
  3832. This will also fail and return 2 if the character does not belong to any guild.
  3833. ---------------------------------------
  3834. *guildchangegm(<guild id>,<new master's name>)
  3835. This function will change the Guild Master of a guild. The ID is the guild's
  3836. id, and the new guild master's name must be passed.
  3837. Returns 1 on success, 0 otherwise.
  3838. ---------------------------------------
  3839. *guildgetexp <amount>;
  3840. This will give the specified amount of guild experience points to the guild the
  3841. invoking character belongs to. It will silently fail if they do not belong to
  3842. any guild.
  3843. ---------------------------------------
  3844. *guildskill <skill id>,<level>
  3845. *guildskill "<skill name>",<level>
  3846. This command will bump up the specified guild skill by the specified number of
  3847. levels. This refers to the invoking character and will only work if the invoking
  3848. character is a member of a guild AND its guild master, otherwise no failure
  3849. message will be given and no error will occur, but nothing will happen - same
  3850. about the guild skill trying to exceed the possible maximum. The full list of
  3851. guild skills is available in 'db/(pre-)re/skill_db.txt', these are all the GD_ skills at
  3852. the end.
  3853. // This would give your character's guild one level of Approval (GD_APPROVAL ID
  3854. // 10000). Notice that if you try to add two levels of Approval, or add
  3855. // Approval when the guild already has it, it will only have one level of
  3856. // Approval afterwards.
  3857. guildskill 10000,1,0;
  3858. You might want to make a quest for getting a certain guild skill, make it hard
  3859. enough that all the guild needs to help or something. Doing this for the Glory
  3860. of the Guild skill, which allows your guild to use an emblem, is a good idea for
  3861. a fun quest.
  3862. ---------------------------------------
  3863. //
  3864. 4,2 End of guild-related commands.
  3865. //
  3866. ---------------------------------------
  3867. *resetlvl <action type>{,<char_id>};
  3868. This is a character reset command, meant mostly for rebirth script supporting
  3869. Advanced jobs, which will reset the invoking character's stats and level
  3870. depending on the action type given. Valid action types are:
  3871. 1 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp, wipes the
  3872. status effects (only the ones settable by 'setoption'), sets all stats to 1.
  3873. If the new job is 'Novice High', give 100 status points, give First Aid and
  3874. Play Dead skills.
  3875. 2 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp.
  3876. Skills and attribute values are not altered.
  3877. 3 - Base level 1, base exp 0. Nothing else is changed.
  3878. 4 - Job level 1, job exp 0. Nothing else is changed.
  3879. In all cases everything the character has on will be unequipped.
  3880. Even though it doesn't return a value, it is used as a function in the official
  3881. rebirth scripts. Ask AppleGirl why.
  3882. ---------------------------------------
  3883. *resetstatus({<char_id>});
  3884. This is a character reset command, which will reset the stats on the invoking
  3885. character and give back all the stat points used to raise them previously.
  3886. Nothing will happen to any other numbers about the character.
  3887. Used in reset NPC's (duh!)
  3888. ---------------------------------------
  3889. *resetskill({<char_id>});
  3890. This command takes off all the skill points on the invoking character, so they
  3891. only have Basic Skill blanked out (lvl 0) left, and returns the points for them
  3892. to spend again. Nothing else will change but the skills. Quest skills will also
  3893. reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If
  3894. the 'quest_skill_learn' option is set in there, the points in the quest skills
  3895. will also count towards the total.
  3896. Used in reset NPC's (duh!)
  3897. ---------------------------------------
  3898. *sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
  3899. *sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
  3900. *sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
  3901. *sc_end <effect type>{,<GID>};
  3902. These commands will bestow a status effect on a character.
  3903. The <effect type> determines which status is invoked. This can be either a number
  3904. or constant, with the common statuses (mostly negative) found in 'src/map/script_constants.h'
  3905. with the 'SC_' prefix. A full list is located in 'src/map/status.h', though
  3906. they are not currently documented.
  3907. The duration of the status is given in <ticks>, or milleseconds.
  3908. Certain status changes take an additional parameter <value 1>, which typically
  3909. modifies player stats by the given number or percentage. This differs for each
  3910. status, and is sometimes zero.
  3911. Optional value <rate> is the chance that the status will be invoked (100 = 1%).
  3912. This is used primarily in item scripts. When used in an NPC script, a flag MUST
  3913. be defined for the rate to work.
  3914. Optional value <flag> is how the status change start will be handled (a bitmask).
  3915. SCSTART_NOAVOID : Status change cannot be avoided.
  3916. SCSTART_NOTICKDEF : Tick cannot be reduced by stats (default).
  3917. SCSTART_LOADED : sc_data loaded, so no value will be altered.
  3918. SCSTART_NORATEDEF : Rate cannot be reduced.
  3919. SCSTART_NOICON : Status icon won't be sent to client
  3920. If a <GID> is given, the status change will be invoked on the specified character
  3921. instead of the one attached to the script. This can only be defined after setting
  3922. a rate and flag.
  3923. 'sc_start2' and 'sc_start4' allow extra parameters to be passed, and are used only
  3924. for effects that require them. The meaning of the extra values vary depending on the
  3925. effect type. For more infos, read status_change.txt containing a list of all Status Changes
  3926. and theirs val1, val2, val3, and val4 usage in source.
  3927. 'sc_end' will remove a specified status effect. If SC_ALL (-1) is given, it will
  3928. perform a complete removal of all statuses (although permanent ones will re-apply).
  3929. Examples:
  3930. // This will poison the invoking character for 10 minutes at 50% chance.
  3931. sc_start SC_POISON,600000,0,5000;
  3932. // This will bestow the effect of Level 10 Blessing.
  3933. sc_start SC_BLESSING,240000,10;
  3934. // Adjust element resistance by percentage. Sample with Resist_Fire item script:
  3935. // val1: Water resistance
  3936. // val2: Earth resistance
  3937. // val3: Fire resistance
  3938. // val4: Wind resistance
  3939. sc_start4 SC_ARMOR_ELEMENT,1200000,-15,0,20,0;
  3940. // This will end the Freezing status for the invoking character.
  3941. sc_end SC_FREEZE;
  3942. Note: to use SC_NOCHAT you should alter Manner
  3943. set Manner, -5; // Will mute a user for 5 minutes
  3944. set Manner, 0; // Will unmute a user
  3945. set Manner, 5; // Will unmute a user and prevent the next use of 'Manner'
  3946. ---------------------------------------
  3947. *getstatus(<effect type>{,<type>{,<char_id>}})
  3948. Retrieve information about a specific status effect when called. Depending on <type>
  3949. specified the function will return different information.
  3950. Possible <type> values:
  3951. - 0 or undefined: whether the status is active
  3952. - 1: the val1 of the status
  3953. - 2: the val2 of the status
  3954. - 3: the val3 of the status
  3955. - 4: the val4 of the status
  3956. - 5: the amount of time in milliseconds that the status has remaining
  3957. If <type> is not defined or is set to 0, then the script function will either
  3958. return 1 if the status is active, or 0 if the status is not active. If the status
  3959. is not active when any of the <type> fields are provided, this script function
  3960. will always return 0.
  3961. ---------------------------------------
  3962. *skilleffect <skill id>,<number>;
  3963. *skilleffect "<skill name>",<number>;
  3964. This command displays visual and aural effects of given skill on currently
  3965. attached character. The number parameter is for skill whose visual effect
  3966. involves displaying of a number (healing or damaging). Note, that this command
  3967. will not actually use the skill, it is intended for scripts, which simulate
  3968. skill usage by the NPC, such as buffs, by setting appropriate status and
  3969. displaying the skill's effect.
  3970. mes "Be blessed!";
  3971. // Heal of 2000 HP
  3972. heal 2000,0;
  3973. skilleffect 28,2000;
  3974. // Blessing Level 10
  3975. sc_start SC_BLESSING,240000,10;
  3976. skilleffect 34,0;
  3977. // Increase AGI Level 5
  3978. sc_start SC_INCREASEAGI,140000,5;
  3979. skilleffect 29,0;
  3980. This will heal the character with 2000 HP, buff it with Blessing Lv 10 and
  3981. Increase AGI Lv 5, and display appropriate effects.
  3982. ---------------------------------------
  3983. *npcskilleffect <skill id>,<number>,<x>,<y>;
  3984. *npcskilleffect "<skill name>",<number>,<x>,<y>;
  3985. This command behaves identically to 'skilleffect', however, the effect will not
  3986. be centered on the invoking character's sprite, nor on the NPC sprite, if any,
  3987. but will be centered at map coordinates given on the same map as the invoking
  3988. character.
  3989. ---------------------------------------
  3990. *specialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
  3991. This command will display special effect with the given number, centered on the
  3992. specified NPCs coordinates, if any. For a full list of special effect numbers
  3993. known see 'doc/effect_list.txt'. Some effect numbers are known not to work in
  3994. some client releases. (Notably, rain is absent from any client executables
  3995. released after April 2005.)
  3996. <NPC name> parameter will display <effect number> on another NPC. If the NPC
  3997. specified does not exist, the command will do nothing. When specifying an NPC,
  3998. <send_target> must be specified when specifying an <NPC Name>, specifying AREA
  3999. will retain the default behavior of the command.
  4000. // this will make the NPC "John Doe#1"
  4001. // show the effect "EF_HIT1" specified by
  4002. // Jane Doe. I wonder what John did...
  4003. mes "[Jane Doe]";
  4004. mes "Well, I never!";
  4005. specialeffect EF_HIT1,AREA,"John Doe#1";
  4006. close;
  4007. ---------------------------------------
  4008. *specialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
  4009. This command behaves identically to 'specialeffect', but the effect will be
  4010. centered on the invoking character's sprite.
  4011. <Player name> parameter will display <effect number> on another Player than the
  4012. one currently attached to the script. Like with specialeffect, when specifying
  4013. a player, <send_target> must be supplied, specifying AREA will retain the default
  4014. behavior of the command.
  4015. ---------------------------------------
  4016. *statusup <stat>{,<char_id>};
  4017. This command will change a specified stat of the invoking character up by one
  4018. permanently. Stats are to be given as number, but you can use these constants to
  4019. replace them:
  4020. bStr - Strength
  4021. bVit - Vitality
  4022. bInt - Intelligence
  4023. bAgi - Agility
  4024. bDex - Dexterity
  4025. bLuk - Luck
  4026. ---------------------------------------
  4027. *statusup2 <stat>,<amount>{,<char_id>};
  4028. This command will change a specified stat of the invoking character by the
  4029. specified amount permanently. The amount can be negative. See 'statusup'.
  4030. // This will decrease a character's Vit forever.
  4031. statusup2 bVit,-1;
  4032. ---------------------------------------
  4033. *bonus <bonus type>,<val1>;
  4034. *bonus2 <bonus type>,<val1>,<val2>;
  4035. *bonus3 <bonus type>,<val1>,<val2>,<val3>;
  4036. *bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
  4037. *bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
  4038. These commands are meant to be used in item scripts. They will probably work
  4039. outside item scripts, but the bonus will not persist for long. They, as
  4040. expected, refer only to an invoking character.
  4041. You can find the full list of possible bonuses and which command to use for each
  4042. kind in 'doc/item_bonus.txt'.
  4043. ---------------------------------------
  4044. *autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  4045. *autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
  4046. *autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
  4047. *autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
  4048. These commands are meant to be used in item scripts. They will probably work
  4049. outside item scripts, but the bonus will not persist for long. They, as
  4050. expected, refer only to an invoking character.
  4051. What these commands do is 'attach' a script to the player which will get
  4052. executed on attack (or when attacked in the case of autobonus2).
  4053. Rate is the trigger rate of the script (1000 = 100%).
  4054. Duration is the time that the bonus will last for since the script has triggered.
  4055. Skill ID/skill name the skill which will be used as trigger to start the bonus. (autobonus3)
  4056. The optional argument 'flag' is used to classify the type of attack where the script
  4057. can trigger (it shares the same flags as the bAutoSpell bonus script):
  4058. Range criteria:
  4059. BF_SHORT: Trigger on melee attack
  4060. BF_LONG: Trigger on ranged attack
  4061. Default: BF_SHORT+BF_LONG
  4062. Attack type criteria:
  4063. BF_WEAPON: Trigger on weapon skills
  4064. BF_MAGIC: Trigger on magic skills
  4065. BF_MISC: Trigger on misc skills
  4066. Default: BF_WEAPON
  4067. Skill criteria:
  4068. BF_NORMAL: Trigger on normal attacks
  4069. BF_SKILL: Trigger on skills
  4070. default: If the attack type is BF_WEAPON (only) BF_NORMAL is used,
  4071. otherwise BF_SKILL+BF_NORMAL is used.
  4072. The difference between the optional argument 'other script' and the 'bonus script' is that,
  4073. the former one triggers only when attacking(or attacked) and the latter one runs on
  4074. status calculation as well, which makes sure, within the duration, the "bonus" that get
  4075. lost on status calculation is restored. So, 'bonus script' is technically supposed to accept
  4076. "bonus" command only. And we usually use 'other script' to show visual effects.
  4077. In all cases, when the script triggers, the attached player will be the one
  4078. who holds the bonus. There is currently no way of knowing within this script
  4079. who was the other character (the attacker in autobonus2, or the target in
  4080. autobonus and autobonus3).
  4081. //Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
  4082. //using weapon or misc attacks (both melee and ranged skills) and shows a special
  4083. //effect when the bonus is active.
  4084. autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
  4085. ---------------------------------------
  4086. *bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};
  4087. This command will attach a script to a player for a given duration, in seconds.
  4088. After that time, the script will automatically expire. The same bonus cannot be
  4089. stacked. By default, this bonus will be stored on `bonus_script` table when player
  4090. logs out.
  4091. Flags (bitmask):
  4092. 1 : Remove when dead.
  4093. 2 : Removable by Dispell.
  4094. 4 : Removable by Clearance.
  4095. 8 : Remove when player logs out.
  4096. 16 : Removeable by Banishing Buster.
  4097. 32 : Removable by Refresh.
  4098. 64 : Removable by Lux Anima.
  4099. 128 : Remove when Madogear is activated or deactivated.
  4100. 256 : Remove when receive damage.
  4101. 512 : Script is permanent, cannot be cleared by bonus_script_clear.
  4102. 1024: Force to replace duplicated script by expanding the duration.
  4103. 2048: Force to add duplicated script. This flag cannot be stacked with 1024,
  4104. if both are defined, 1024 will be checked first and ignore this flag.
  4105. Types:
  4106. This will be used to decide negative or positive buff for 'debuff_on_logout'.
  4107. 0: Ignore the buff type and won't be removed if the flag is not &8 (Default)
  4108. 1: Buff
  4109. 2: Debuff
  4110. Status_icon: See "Status Icon" section in 'src/map/script_constants.h'. Default is SI_BLANK (-1).
  4111. Example:
  4112. // Apple gives you +5 Str bonus for 1 minute when it's consumed.
  4113. 512,Apple,Apple,0,15,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "{ bonus bStr,5; }",60; },{},{}
  4114. ---------------------------------------
  4115. *bonus_script_clear {<flag>,{<char_id>}};
  4116. Removes attached bonus_script from player. If no 'char_id' given, it will removes
  4117. from the invoker.
  4118. If 'flag' is 1, means will clears all scripts even it's Permanent effect. By default,
  4119. it just removes non-permanent script.
  4120. ---------------------------------------
  4121. *skill <skill id>,<level>{,<flag>};
  4122. *skill "<skill name>",<level>{,<flag>};
  4123. *addtoskill <skill id>,<level>{,<flag>};
  4124. *addtoskill "<skill name>",<level>{,<flag>};
  4125. These commands will give the invoking character a specified skill. This is also
  4126. used for item scripts.
  4127. Level is obvious. Skill id is the ID number of the skill in question as per
  4128. 'db/(pre-)re/skill_db.txt'. It is not known for certain whether this can be used to give
  4129. a character a monster's skill, but you're welcome to try with the numbers given
  4130. in 'db/(pre-)re/mob_skill_db.txt'.
  4131. Flag is 0 if the skill is given permanently (will get written with the character
  4132. data) or 1 if it is temporary (will be lost eventually, this is meant for card
  4133. item scripts usage.). The flag parameter is optional, and defaults to 1 in
  4134. 'skill' and to 2 in 'addtoskill'.
  4135. Flag 2 means that the level parameter is to be interpreted as a stackable
  4136. additional bonus to the skill level. If the character did not have that skill
  4137. previously, they will now at 0+the level given.
  4138. Flag 3 is the same as flag 1 in that it saves to the database. However, these skills
  4139. are ignored when any action is taken that adjusts the skill tree (reset/job change).
  4140. Flag constants:
  4141. 0 - SKILL_PERM
  4142. 1 - SKILL_TEMP
  4143. 2 - SKILL_TEMPLEVEL
  4144. 3 - SKILL_PERM_GRANT
  4145. // This will permanently give the character Stone Throw (TF_THROWSTONE,152), at
  4146. // level 1.
  4147. skill 152,1,0;
  4148. ---------------------------------------
  4149. *nude {<char_id>};
  4150. This command will unequip anything equipped on the invoking character.
  4151. It is not required to do this when changing jobs since 'jobchange' will unequip
  4152. everything not equippable by the new job class anyway.
  4153. ---------------------------------------
  4154. *sit {"<character name>"};
  4155. *stand {"<character name>"};
  4156. These commands will make a character sit or stand.
  4157. If no character is specified, the command will run for the invoking character.
  4158. Additionnally Sitting constant is true when the character is sitting, false otherwise.
  4159. ---------------------------------------
  4160. *disguise <Monster ID>{,<char_id>};
  4161. *undisguise {<char_id>};
  4162. This command disguises the current player with a monster sprite.
  4163. The disguise lasts until 'undisguise' is issued or the player logs out.
  4164. Example:
  4165. disguise 1002; // Disguise character as a Poring.
  4166. next;
  4167. undisguise; // Return to normal character sprite.
  4168. ---------------------------------------
  4169. *transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4170. *transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4171. *active_transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4172. *active_transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
  4173. This command will turn a player into a monster for a given duration and can grant
  4174. a SC attribute effect while transformed. Note that players cannot be transformed
  4175. during War of Emperium or if already disguised.
  4176. Can only be removed when you die or the duration ends.
  4177. 'transform' and 'active_transform' can stack on each other but using 'transform' or
  4178. 'active_transform' twice will not stack (it will cancel the previous bonus for the new).
  4179. 'active_transform' will take priority over transform for its duration.
  4180. ---------------------------------------
  4181. \\
  4182. 4,3 Marriage-related commands
  4183. \\
  4184. ---------------------------------------
  4185. *marriage("<spouse name>");
  4186. This function will marry two characters, the invoking character and the one
  4187. referred to by name given, together, setting them up as each other's marriage
  4188. partner. No second function call has to be issued (in current SVN at least) to
  4189. make sure the marriage works both ways. The function returns 1 upon success, or
  4190. 0 if the marriage could not be completed, either because the other character
  4191. wasn't found or because one of the two characters is already married.
  4192. This will do nothing else for the marriage except setting up the spouse ID for
  4193. both of these characters. No rings will be given and no effects will be shown.
  4194. ---------------------------------------
  4195. *wedding;
  4196. This command will call up wedding effects - the music and confetti - centered on
  4197. the invoking character. Example can be found in the wedding script.
  4198. ---------------------------------------
  4199. *divorce({<char_id>})
  4200. This function will "un-marry" the invoking character from whoever they were
  4201. married to. Both will no longer be each other's marriage partner, (at least in
  4202. current SVN, which prevents the cases of multi-spouse problems). It will return
  4203. 1 upon success or 0 if the character was not married at all.
  4204. This function will also destroy both wedding rings and send a message to both
  4205. players, telling them they are now divorced.
  4206. ---------------------------------------
  4207. *adopt("<parent_name>","<baby_name>");
  4208. *adopt(<parent_id>,<baby_id>);
  4209. This function will send the client adoption request to the specified baby
  4210. character. The parent value can be either parent. Both parents and the baby
  4211. need to be online in order for adoption to work.
  4212. Return values:
  4213. ADOPT_ALLOWED - Sent message to Baby to accept or deny.
  4214. ADOPT_ALREADY_ADOPTED - Character is already adopted.
  4215. ADOPT_MARRIED_AND_PARTY - Parents need to be married and in a party with the baby.
  4216. ADOPT_EQUIP_RINGS - Parents need wedding rings equipped.
  4217. ADOPT_NOT_NOVICE - Baby is not a Novice.
  4218. ADOPT_CHARACTER_NOT_FOUND - A parent or Baby was not found.
  4219. ADOPT_MORE_CHILDREN - You cannot adopt more than 1 child. (client message)
  4220. ADOPT_LEVEL_70 - Parents need to be at least level 70 in order to adopt someone. (client message)
  4221. ADOPT_MARRIED - You cannot adopt a married person. (client message)
  4222. ---------------------------------------
  4223. //
  4224. 4,3.- End of marriage-related commands
  4225. //
  4226. ---------------------------------------
  4227. *pcfollow <id>,<target id>;
  4228. *pcstopfollow <id>;
  4229. Makes a character follow or stop following someone. This command does the same
  4230. as the @follow command. The main difference is that @follow can use character
  4231. names, and this commands needs the account ID for the target.
  4232. Examples:
  4233. // This will make Aaron follow Bullah, when both of these characters are online.
  4234. pcfollow getCharID(3,"Aaron"),getCharID(3,"Bullah");
  4235. // Makes Aaron stop following whoever he is following.
  4236. pcstopfollow getCharID(3,"Aaron");
  4237. ---------------------------------------
  4238. *pcblockmove <id>,<option>;
  4239. *unitblockmove <id>,<option>;
  4240. Prevents the given GID from moving when the option is 1, and enables the ID to
  4241. move again when the option is 0. This command will run for the attached unit
  4242. if the given GID is zero.
  4243. Examples:
  4244. // Prevents the current char from moving away.
  4245. pcblockmove getcharid(3),1;
  4246. // Enables the current char to move again.
  4247. pcblockmove getcharid(3),0;
  4248. ---------------------------------------
  4249. *pcblockskill <id>,<option>;
  4250. *unitblockskill <id>,<option>;
  4251. Prevents the given GID from casting skills when the option is 1, and enables
  4252. the ID to cast skills again when the option is 0. This command will run for
  4253. the attached unit if the given GID is zero.
  4254. Examples:
  4255. // Prevents the current char from casting skills.
  4256. pcblockskill getcharid(3),1;
  4257. // Enables the current char to cast skills again.
  4258. pcblockskill getcharid(3),0;
  4259. ---------------------------------------
  4260. ==================================
  4261. |5.- Mob / NPC -related commands.|
  4262. ==================================
  4263. ---------------------------------------
  4264. *monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4265. *areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
  4266. This command will spawn a monster on the specified coordinates on the specified
  4267. map. If the script is invoked by a character, a special map name, "this", will
  4268. be recognized to mean the name of the map the invoking character is located at.
  4269. This command works fine in the item scripts.
  4270. The same command arguments mean the same things as described above in the
  4271. beginning of this document when talking about permanent monster spawns. Monsters
  4272. spawned in this manner will not respawn upon being killed.
  4273. Unlike the permanent monster spawns, if the mob id is -1, a random monster will
  4274. be picked from the entire database according to the rules configured in the
  4275. server for dead branches. This will work for all other kinds of non-permanent
  4276. monster spawns.
  4277. The only very special thing about this command is an event label, which is an
  4278. optional parameter. This label is written like '<NPC object name>::<label name>'
  4279. and upon the monster being killed, it will execute the script inside of the
  4280. specified NPC object starting from the label given. The RID of the player
  4281. attached at this execution will be the RID of the killing character. The variable
  4282. 'killedrid' is set to the Class (mob ID) of the monster killed.
  4283. <size> can be:
  4284. Size_Small (0) (default)
  4285. Size_Medium (1)
  4286. Size_Large (2)
  4287. <ai> can be:
  4288. AI_NONE (0) (default)
  4289. AI_ATTACK (1) (attack/friendly)
  4290. AI_SPHERE (2) (Alchemist skill)
  4291. AI_FLORA (3) (Alchemist skill)
  4292. AI_ZANZOU (4) (Kagerou/Oboro skill)
  4293. AI_LEGION (5) (Sera skill)
  4294. AI_FAW (6) (Mechanic skill)
  4295. monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
  4296. The coordinates of 0,0 will spawn the monster on a random place on the map.
  4297. The 'areamonster' command works much like the 'monster' command and is not
  4298. significantly different, but spawns the monsters within a square defined by
  4299. x1/y1-x2/y2.
  4300. Returned value is an array with the game ID of the spawned monster(s) depending
  4301. on the amount spawned. Array is stored in $@mobid[].
  4302. Simple monster killing script:
  4303. <Normal NPC object definition. Let's assume you called him NPCNAME.>
  4304. mes "[Summon Man]";
  4305. mes "Want to start the Poring hunt?";
  4306. next;
  4307. if(select("Yes.:No.") == 2) {
  4308. mes "[Summon Man]";
  4309. mes "Come back later.";
  4310. close;
  4311. }
  4312. // Summon 10 Porings.
  4313. // Using coordinates 0,0 will spawn them in a random location.
  4314. monster "prontera",0,0,"Quest Poring",1002,10,"NPCNAME::OnPoringKilled";
  4315. mes "[Summon Man]";
  4316. mes "Now go and kill all the Porings I summoned.";
  4317. close;
  4318. OnPoringKilled:
  4319. $PoringKilled++;
  4320. if ($PoringKilled >= 10) goto L_AllDead;
  4321. end;
  4322. L_AllDead:
  4323. announce "Summon Man: Well done. All the Porings are dead!",3;
  4324. $PoringKilled = 0;
  4325. end;
  4326. For more good examples see just about any official 2-1 or 2-2 job quest script.
  4327. ---------------------------------------
  4328. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4329. *areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
  4330. This command will make all monsters of the specified mob ID in the specified
  4331. area use the specified skill. Map name, x, and y define the center of the area,
  4332. which extending <range> cells in each direction (ex: a range of 3 would create
  4333. a 7x7 square). The skill can be specified by skill ID or name. <cast time> is in
  4334. milliseconds (1000 = 1 second), and the rest should be self-explanatory.
  4335. <target type> can be:
  4336. 0 = self
  4337. 1 = the mob's current target
  4338. 2 = the mob's master
  4339. 3 = random target
  4340. Example:
  4341. // spawn 1 Shining Plant in the 5x5 area centered on (155,188)
  4342. areamonster "prontera",153,186,157,190,"Shining Plant",1083,1;
  4343. // make the plant cast level 10 Cold Bolt on a random target
  4344. areamobuseskill "prontera",155,188,2,1083,"MG_COLDBOLT",10,3000,1,e_gg,3;
  4345. ---------------------------------------
  4346. *killmonster "<map name>","<event label>"{,<type>};
  4347. This command will kill all monsters that were spawned with 'monster' or
  4348. 'addmonster' and have a specified event label attached to them. Commonly used to
  4349. get rid of remaining quest monsters once the quest is complete.
  4350. If the label is given as "All", all monsters which have their respawn times set
  4351. to -1 (like all the monsters summoned with 'monster' or 'areamonster' script
  4352. command, and all monsters summoned with GM commands, but no other ones - that
  4353. is, all non-permanent monsters) on the specified map will be killed regardless
  4354. of the event label value.
  4355. As of r12876 killmonster now supports an optional argument type. Using 1 for type
  4356. will make the command fire "OnMyMobDead" events from any monsters that do die
  4357. as a result of this command.
  4358. ---------------------------------------
  4359. *killmonsterall "<map name>"{,<type>};
  4360. This command will kill all monsters on a specified map name, regardless of how
  4361. they were spawned or what they are. As of r12873, The behavior has changed slightly.
  4362. In light of a label behavior fix for mob spawning commands that will now allow the label to
  4363. trigger when there is no player, killmonsterall has also been modified to support this.
  4364. Using this the normal/old way means labels don't trigger when a player didn't
  4365. attack/kill a monster. This is because it breaks compatibility with older scripts if
  4366. forced to use the new method. However, if you wish to use the new label type with this
  4367. command, simply use 1 for type. Any other number won't be recognized.
  4368. ---------------------------------------
  4369. *strmobinfo(<type>,<monster id>);
  4370. This function will return information about a monster record in the database, as
  4371. per 'db/(pre-)re/mob_db.txt'. Type is the kind of information returned. Valid types are:
  4372. It will return 0 if there is no such monster (or the type value is invalid),
  4373. or an empty string if you requested the monster's name.
  4374. 1 - 'english name' field in the database, a string.
  4375. 2 - 'japanese name' field in the database, a string.
  4376. All other returned values are numbers:
  4377. 3 - Level.
  4378. 4 - Maximum HP.
  4379. 5 - Maximum SP.
  4380. 6 - Experience reward.
  4381. 7 - Job experience reward.
  4382. ---------------------------------------
  4383. *mobcount("<map name>","<event label>")
  4384. This function will count all the monsters on the specified map that have a given
  4385. event label and return the number or 0 if it can't find any. Naturally, only
  4386. monsters spawned with 'monster' and 'areamonster' script commands can have non-empty
  4387. event label.
  4388. If you pass this function an empty string for the event label, it will return
  4389. the total count of monster without event label, including permanently spawning monsters.
  4390. With the dynamic mobs system enabled, where mobs are not kept
  4391. in memory for maps with no actual people playing on them, this will return a 0
  4392. for any such map.
  4393. If the event label is given as "all", all monsters will be counted, regardless of
  4394. having any event label attached.
  4395. If the map name is given as "this", the map the invoking character is on will
  4396. be used. If the map is not found, or the invoker is not a character while the map
  4397. is "this", it will return -1.
  4398. ---------------------------------------
  4399. *clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
  4400. This command creates a monster which is a copy of another player. The first
  4401. four arguments serve the same purpose as in the monster script command, The
  4402. <char id> is the character id of the player to clone (player must be online).
  4403. If <master id> is given, the clone will be a 'slave/minion' of it. Master_id
  4404. must be a character id of another online player.
  4405. The mode can be specified to determine the behavior of the clone. Its
  4406. values are the same as the ones used for the mode field in the mob_db. The
  4407. default mode is aggressive, assists, can move, can attack.
  4408. Flag can be either zero or one currently. If zero, the clone is a normal
  4409. monster that'll target players, if one, it is considered a summoned monster,
  4410. and as such, it'll target other monsters. Defaults to zero.
  4411. The duration specifies how long the clone will live before it is auto-removed.
  4412. Specified in seconds, defaults to no limit (zero).
  4413. Returned value is the monster ID of the spawned clone. If command fails,
  4414. returned value is zero.
  4415. ---------------------------------------
  4416. *summon "monster name",<monster id>{,<Time Out>{,"event label"}};
  4417. This command will summon a monster. (see also 'monster') Unlike monsters spawned
  4418. with other commands, this one will set up the monster to fight to protect the
  4419. invoking character. Monster name and mob id obey the same rules as the one given
  4420. at the beginning of this document for permanent monster spawns with the
  4421. exceptions mentioned when describing 'monster' command.
  4422. The effect for the skill 'Call Homunculus' will be displayed centered on the
  4423. invoking character.
  4424. Timeout is the time in milliseconds the summon lives, and is set default
  4425. to 60000 (1 minute). Note that also the value 0 will set the timer to default,
  4426. and it is not possible to create a spawn that lasts forever.
  4427. If an event label is given, upon the monster being killed, the event label will
  4428. run as if by 'donpcevent'.
  4429. Returned value is the game ID of the spawned monster.
  4430. // Will summon a dead branch-style monster to fight for the character.
  4431. summon "--ja--",-1;
  4432. ---------------------------------------
  4433. *addmonsterdrop <monster id>,<item id>,<rate>;
  4434. *addmonsterdrop "<monster name>",<item id>,<rate>;
  4435. *delmonsterdrop <monster id>,<item id>;
  4436. *delmonsterdrop "<monster name>",<item id>;
  4437. These commands will temporarily add or delete a monster drop, which will be reset
  4438. when the mob database reloads or the server shuts down. They return 1 upon success.
  4439. If the monster already drops the specified item, its drop rate will be updated with
  4440. the given rate (100 = 1%).
  4441. Examples:
  4442. // Makes Owl Baron drop Honey at an 80% rate.
  4443. addmonsterdrop 1295,518,8000;
  4444. // Deletes Executioner's Mitten from Rybio.
  4445. delmonsterdrop 1201,7017;
  4446. ---------------------------------------
  4447. *disablenpc "<NPC object name>";
  4448. *enablenpc "<NPC object name>";
  4449. These two commands will disable and enable, respectively, an NPC object
  4450. specified by name. The disabled NPC will disappear from sight and will no longer
  4451. be triggerable in the normal way. It is not clear whether it will still be
  4452. accessible through 'donpcevent' and other triggering commands, but it probably
  4453. will be. You can disable even warp NPCs if you know their object names, which is
  4454. an easy way to make a map only accessible through walking half the time. Then
  4455. you 'enablenpc' them back.
  4456. You can also use these commands to create the illusion of an NPC switching
  4457. between several locations, which is often better than actually moving the NPC -
  4458. create one NPC object with a visible and a hidden part to their name, make a few
  4459. copies, and then disable all except one.
  4460. ---------------------------------------
  4461. *hideonnpc "<NPC object name>";
  4462. *hideoffnpc "<NPC object name>";
  4463. These commands will make the NPC object specified display as hidden/visible,
  4464. even though not actually disabled per se. Hidden as in thief Hide skill, but
  4465. unfortunately, not detectable by Ruwach or Sight.
  4466. As they are now, these commands are pointless, it is suggested to use
  4467. 'disablenpc'/'enablenpc', because these two commands actually unload the NPC
  4468. sprite location and other accompanying data from memory when it is not used.
  4469. However, you can use these for some quest ideas (such as cloaking NPCs talking
  4470. while hidden then revealing.... you can wonder around =P
  4471. ---------------------------------------
  4472. *unloadnpc "<NPC object name>";
  4473. This command will fully unload a NPC object and all of it's duplicates.
  4474. ---------------------------------------
  4475. *doevent "<NPC object name>::<event label>";
  4476. This command will start a new execution thread in a specified NPC object at the
  4477. specified label. The execution of the script running this command will not stop,
  4478. and the event called by the 'doevent' command will not run until the invoking
  4479. script has terminated. No parameters may be passed with a doevent call.
  4480. The script of the NPC object invoked in this manner will run as if it's been
  4481. invoked by the RID that was active in the script that issued a 'doevent'. As
  4482. such, the command will not work if an RID is not attached.
  4483. place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
  4484. mes "This is what you will see when you click me";
  4485. close;
  4486. OnLabel:
  4487. mes "This is what you will see if the doevent is activated";
  4488. close;
  4489. }
  4490. ....
  4491. doevent "NPC::OnLabel";
  4492. ---------------------------------------
  4493. *donpcevent "<NPC object name>::<event label>";
  4494. This command invokes the event label code within an another NPC or NPCs. It
  4495. starts a separate instance of execution, and the invoking NPC will resume
  4496. execution its immediately.
  4497. If the supplied event label has the form "NpcName::OnLabel", then only given
  4498. NPC's event label will be invoked (much like 'goto' into another NPC). If the
  4499. form is "::OnLabel" (NPC name omitted), the event code of all NPCs with given
  4500. label will be invoked, one after another. In both cases the invoked script
  4501. will run without an attached RID, whether or not the invoking script was
  4502. attached to a player. The event label name is required to start with "On".
  4503. This command can be used to make other NPCs act, as if they were responding to
  4504. the invoking NPC's actions, such as using an emotion or talking.
  4505. place,100,100,1%TAB%script%TAB%NPC1%TAB%53,{
  4506. mes "NPC2 copies my actions!";
  4507. close2;
  4508. donpcevent "NPC2::OnEmote";
  4509. OnEmote:
  4510. emotion rand(1,30);
  4511. end;
  4512. }
  4513. place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{
  4514. mes "NPC1 copies my actions!";
  4515. close2;
  4516. donpcevent "NPC1::OnEmote";
  4517. OnEmote:
  4518. emotion rand(1,30);
  4519. end;
  4520. }
  4521. Whichever of the both NPCs is talked to, both will show a random emotion at the
  4522. same time.
  4523. As of r16564, command now returns 1 or 0 on success and failure.
  4524. A debug message also shows on the console when no events are triggered.
  4525. ---------------------------------------
  4526. *cmdothernpc "<npc name>","<command>";
  4527. This is simply "donpcevent <npc name>::OnCommand<command>".
  4528. It is an approximation of official server script language's 'cmdothernpc'.
  4529. Returns true if the command was executed on the other NPC successfully, false if not.
  4530. ---------------------------------------
  4531. *npctalk "<message>"{,"<NPC name>","<flag>"};
  4532. This command will display a message as if the NPC object running it was a player
  4533. talking - that is, above their head and in the chat window.
  4534. The display name of the NPC won't get appended in front of the message.
  4535. If the <NPC name> option is given and not empty, then that NPC will display the message,
  4536. else the attached NPC will display the message.
  4537. Target for <flag>:
  4538. - bc_all : Broadcast message is sent server-wide (only in the chat window).
  4539. - bc_map : Message is sent to everyone in the same map as the source of the npc.
  4540. - bc_area : Message is sent to players in the vicinity of the source (default value).
  4541. - bc_self : Message is sent only to player attached.
  4542. // This will make everyone in the area see the NPC greet the character
  4543. // who just invoked it.
  4544. npctalk "Hello "+strcharinfo(0)+", how are you?";
  4545. ---------------------------------------
  4546. *chatmes "<message>"{,"<NPC name>"};
  4547. This command will display a message in the waitingroom (chat) of the NPC.
  4548. If the <NPC name> option is given, then that NPC will display the message, else
  4549. the attached NPC will display the message.
  4550. If the NPC is not in a waitingroom, nothing happens.
  4551. // Everyone in the waitingroom will see this message:
  4552. chatmes "Waiting 5 minutes until the next match will start";
  4553. ---------------------------------------
  4554. *setnpcdisplay("<npc name>", "<display name>", <class id>, <size>)
  4555. *setnpcdisplay("<npc name>", "<display name>", <class id>)
  4556. *setnpcdisplay("<npc name>", "<display name>")
  4557. *setnpcdisplay("<npc name>", <class id>)
  4558. Changes the display name and/or display class of the target NPC.
  4559. Returns 0 is successful, 1 if the NPC does not exist.
  4560. Size is 0 = normal 1 = small 2 = big.
  4561. ---------------------------------------
  4562. \\
  4563. 5,1.- Time-related commands
  4564. \\
  4565. ---------------------------------------
  4566. *addtimer <ticks>,"NPC::OnLabel";
  4567. *deltimer "NPC::OnLabel";
  4568. *addtimercount <ticks>,"NPC::OnLabel";
  4569. These commands will create, destroy, and delay a countdown timer - 'addtimer' to
  4570. create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified
  4571. number of ticks. For all three cases, the event label given is the identifier of
  4572. that timer. The timer runs on the character object that is attached to the script,
  4573. and can have multiple instances. When the label is run, it is run as if the player that
  4574. the timer runs on has clicked the NPC.
  4575. When this timer runs out, a new execution thread will start in the specified NPC
  4576. object at the specified label.
  4577. The ticks are given in 1/1000ths of a second.
  4578. One more thing. These timers are stored as part of player data. If the player
  4579. logs out, all of these get immediately deleted, without executing the script.
  4580. If this behavior is undesirable, use some other timer mechanism (like 'sleep').
  4581. Example:
  4582. <NPC Header> {
  4583. dispbottom "Starting a 5 second timer...";
  4584. addtimer 5000, strnpcinfo(3)+"::On5secs";
  4585. end;
  4586. On5secs:
  4587. dispbottom "5 seconds have passed!";
  4588. end;
  4589. }
  4590. ---------------------------------------
  4591. *initnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  4592. { "<NPC name>" | <Attach Flag> };
  4593. *stopnpctimer{ "<NPC name>" {, <Detach Flag>} } |
  4594. { "<NPC name>" | <Detach Flag> };
  4595. *startnpctimer{ "<NPC name>" {, <Attach Flag>} } |
  4596. { "<NPC name>" | <Attach Flag> };
  4597. *setnpctimer <tick>{,"<NPC name>"};
  4598. *getnpctimer(<type of information>{,"<NPC name>"})
  4599. *attachnpctimer {"<character name>"};
  4600. *detachnpctimer {"<NPC name>"};
  4601. This set of commands and functions will create and manage an NPC-based timer.
  4602. The NPC name may be omitted, in which case the calling NPC is used as target.
  4603. Contrary to addtimer/deltimer commands which let you have many different timers
  4604. referencing different labels in the same NPC, each with their own countdown,
  4605. 'initnpctimer' can only have one per NPC object. But it can trigger many labels
  4606. and let you know how many were triggered already and how many still remain.
  4607. This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon
  4608. creating this timer, the execution will not stop, but will happily continue
  4609. onward. The timer will then invoke new execution threads at labels
  4610. "OnTimer<time>:" in the NPC object it is attached to.
  4611. To create the timer, use the 'initnpctimer', which will start it running.
  4612. 'stopnpctimer' will pause the timer, without clearing the current tick, while
  4613. 'startnpctimer' will let the paused timer continue.
  4614. By default timers do not have a RID attached, which lets them continue even
  4615. if the player that started them logs off. To attach a RID to a timer, you can
  4616. either use the optional "attach flag" when using 'initnpctimer/startnpctimer',
  4617. or do it manually by using 'attachnpctimer'. Likewise, the optional flag of
  4618. stopnpctimer lets you detach any RID after stopping the timer, and by using
  4619. 'detachnpctimer' you can detach a RID at any time.
  4620. Normally there is only a single timer per NPC, but as an exception, as long as
  4621. you attach a player to the timer, you can have multiple timers running at once,
  4622. because these will get stored on the players instead of the NPC.
  4623. NOTE: You need to attach the RID before the timer _before_ you start it to
  4624. get a player-attached timer. Otherwise it'll stay a NPC timer (no effect).
  4625. If the player that is attached to the npctimer logs out, the "OnTimerQuit:"
  4626. event label of that NPC will be triggered, so you can do the appropriate
  4627. cleanup (the player is still attached when this event is triggered).
  4628. The 'setnpctimer' command will explicitly set the timer to a given tick.
  4629. 'getnpctimer' provides timer information. Its parameter defines what type:
  4630. 0 - Will return the current tick count of the timer.
  4631. 1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the
  4632. specified NPC waiting for execution.
  4633. 2 - Will return the number of times the timer has triggered and will trigger
  4634. an "OnTimer<tick>:" label in the specified NPC.
  4635. Example 1:
  4636. <NPC Header> {
  4637. // We need to use attachnpctimer because the mes command below needs RID attach
  4638. attachnpctimer;
  4639. initnpctimer;
  4640. npctalk "I cant talk right now, give me 10 seconds";
  4641. end;
  4642. OnTimer5000:
  4643. npctalk "Ok 5 seconds more";
  4644. end;
  4645. OnTimer6000:
  4646. npctalk "4";
  4647. end;
  4648. OnTimer7000:
  4649. npctalk "3";
  4650. end;
  4651. OnTimer8000:
  4652. npctalk "2";
  4653. end;
  4654. OnTimer9000:
  4655. npctalk "1";
  4656. end;
  4657. OnTimer10000:
  4658. stopnpctimer;
  4659. mes "[Man]";
  4660. mes "Ok we can talk now";
  4661. detachnpctimer;
  4662. // and remember attachnpctimer and detachnpctimer can only use while the NPC timer is not running !
  4663. }
  4664. Example 2:
  4665. OnTimer15000:
  4666. npctalk "Another 15 seconds have passed.";
  4667. // You have to use 'initnpctimer' instead of 'setnpctimer 0'.
  4668. // This is equal to 'setnpctimer 0' + 'startnpctimer'.
  4669. // Alternatively, you can also insert another 'OnTimer15001' label so that the timer won't stop. */
  4670. initnpctimer;
  4671. end;
  4672. // This OnInit label will run when the script is loaded, so that the timer
  4673. // is initialized immediately as the server starts. It is dropped back to 0
  4674. // every time the NPC says something, so it will cycle continuously.
  4675. OnInit:
  4676. initnpctimer;
  4677. end;
  4678. Example 3:
  4679. mes "[Man]";
  4680. mes "I have been waiting "+(getnpctimer(0)/1000)+" seconds for you.";
  4681. // We divide the timer returned by 1000 to convert milliseconds to seconds.
  4682. close;
  4683. Example 4:
  4684. mes "[Man]";
  4685. mes "Ok, I will let you have 30 more seconds...";
  4686. close2;
  4687. setnpctimer (getnpctimer(0)-30000);
  4688. // Notice the 'close2'. If there were a 'next' there the timer would be
  4689. // changed only after the player pressed the 'next' button.
  4690. end;
  4691. ---------------------------------------
  4692. *sleep {<milliseconds>};
  4693. *sleep2 {<milliseconds>};
  4694. *awake "<NPC name>";
  4695. These commands are used to control the pause of a NPC.
  4696. sleep and sleep2 will pause the script for the given amount of milliseconds.
  4697. Awake is used to cancel a sleep. When awake is called on a NPC it will run as
  4698. if the sleep timer ran out, and thus making the script continue. Sleep and sleep2
  4699. basically do the same, but the main difference is that sleep will not keep the rid,
  4700. while sleep2 does. Also sleep2 will stop the script if there is no unit attached.
  4701. Examples:
  4702. sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore)
  4703. sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached.
  4704. awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'.
  4705. ---------------------------------------
  4706. *progressbar "<color>",<seconds>;
  4707. This command works almost like sleep2, but displays a progress bar
  4708. above the head of the currently attached character (like cast bar).
  4709. Once the given amount of seconds passes, the script resumes. If the
  4710. character moves while the progress bar progresses, it is aborted and
  4711. the script ends. The color format is in RGB (0xRRGGBB). The color is
  4712. currently ignored by the client and appears always green.
  4713. ---------------------------------------
  4714. //
  4715. 5,1.- End of time-related commands
  4716. //
  4717. ---------------------------------------
  4718. *announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  4719. This command will broadcast a message to all or most players, similar to
  4720. @kami/@kamib GM commands.
  4721. announce "This will be shown to everyone at all in yellow.",0;
  4722. The region the broadcast is heard in (target), source of the broadcast
  4723. and the color the message will come up as is determined by the flags.
  4724. The flag values are coded as constants in 'src/map/script_constants.h' to make them easier to use.
  4725. Target flags:
  4726. - bc_all: Broadcast message is sent server-wide (default).
  4727. - bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below).
  4728. - bc_area: Message is sent to players in the vicinity of the source.
  4729. - bc_self: Message is sent only to current player.
  4730. You cannot use more than one target flag.
  4731. Source flags:
  4732. - bc_pc: Broadcast source is the attached player (default).
  4733. - bc_npc: Broadcast source is the NPC, not the player attached to the script
  4734. (useful when a player is not attached or the message should be sent to those
  4735. nearby the NPC).
  4736. You cannot use more than one source flag.
  4737. Special flags:
  4738. - bc_yellow: Broadcast will be displayed in yellow color (default).
  4739. - bc_blue: Broadcast will be displayed in blue color.
  4740. - bc_woe: Indicates that this broadcast is 'WoE Information' that can be disabled client-side.
  4741. Due to the way client handles broadcasts, it is impossible to set both bc_blue and bc_woe.
  4742. The optional parameters allow usage of broadcasts in custom colors, font-weights, sizes etc.
  4743. If any of the optional parameters is used, special flag is ignored.
  4744. Optional parameters may not work well (or at all) depending on a game client used.
  4745. The color parameter is a single number which can be in hexadecimal notation.
  4746. For example:
  4747. announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
  4748. Will display a global announce in green. The color format is in RGB (0xRRGGBB).
  4749. In official scripts only two font-weights (types) are used:
  4750. - normal (FW_NORMAL = 400, default),
  4751. - bold (FW_BOLD = 700).
  4752. Default font size is 12.
  4753. Using this for private messages to players is probably not that good an idea,
  4754. but it can be used instead in NPCs to "preview" an announce.
  4755. // This will be a private message to the player using the NPC that made the
  4756. // announcement
  4757. announce "This is my message just for you",bc_blue|bc_self;
  4758. // This will be shown on everyones screen that is in sight of the NPC.
  4759. announce "This is my message just for you people here",bc_npc|bc_area;
  4760. ---------------------------------------
  4761. *mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  4762. This command will work like 'announce' but will only broadcast to characters
  4763. currently residing on the specified map. The flag and optional parameters
  4764. parameters are the same as in 'announce', but target and source flags are ignored.
  4765. ---------------------------------------
  4766. *areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
  4767. This command works like 'announce' but will only broadcast to characters
  4768. residing in the specified x1/y1-x2/y2 rectangle on the map given. The flags and
  4769. optional parameters are the same as in 'announce', but target and source flags are ignored.
  4770. areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0;
  4771. ---------------------------------------
  4772. *callshop "<name>",<option>;
  4773. These are a series of commands used to create dynamic shops.
  4774. The 'callshop' function calls an invisible shop (view -1) as if the player clicked on it.
  4775. The options are:
  4776. 0 = The normal window (buy, sell and cancel)
  4777. 1 = The buy window
  4778. 2 = The sell window
  4779. A shop called with this command will trigger the labels "OnBuyItem" and "OnSellItem"
  4780. (as long as an npcshop* command is executed from that NPC, see note below). These
  4781. labels, if used, will replace how the shop handles the buying and selling of items,
  4782. allowing for the creation of dynamic shops.
  4783. The label "OnBuyItem" sets the following arrays:
  4784. @bought_nameid - item ID bought
  4785. @bought_quantity - amount bought
  4786. The label "OnSellItem" sets the following arrays:
  4787. @sold_nameid - item ID sold
  4788. @sold_quantity - amount sold
  4789. @sold_refine - refine count
  4790. @sold_attribute - if the item is broken (1) or not (0)
  4791. @sold_identify - if the item is identified (1) or not (0)
  4792. @sold_card1 - card slot 1
  4793. @sold_card2 - card slot 2
  4794. @sold_card3 - card slot 3
  4795. @sold_card4 - card slot 4
  4796. Note: These labels will only be triggered if an npcshop* command is executed because these
  4797. commands set a special data on the shop NPC, named master_nd in the source. The above labels
  4798. are triggered in the NPC whose master_nd is given in the shop.
  4799. A full example of a dynamic shop can be found in doc/sample/npc_dynamic_shop.txt.
  4800. ---------------------------------------
  4801. *npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  4802. This command lets you override the contents of an existing NPC shop or cashshop. The
  4803. current sell list will be wiped, and only the items specified with the price
  4804. specified will be for sale.
  4805. The function returns 1 if shop was updated successfully, or 0 if not found.
  4806. NOTES:
  4807. - That you cannot use -1 to specify default selling price!
  4808. - If attached shop type is market shop, need an extra param after price, it's <qty>
  4809. and make sure don't add duplication item!
  4810. ---------------------------------------
  4811. *npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
  4812. This command will add more items at the end of the selling list for the
  4813. specified NPC shop or cashshop. If you specify an item already for sell, that item will
  4814. appear twice on the sell list.
  4815. The function returns 1 if shop was updated successfully, or 0 if not found.
  4816. NOTES:
  4817. - That you cannot use -1 to specify default selling price!
  4818. - If attached shop type is market shop, need an extra param after price, it's <qty>
  4819. and make sure don't add duplication item!
  4820. ---------------------------------------
  4821. *npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}};
  4822. This command will remove items from the specified NPC shop or cashshop.
  4823. If the item to remove exists more than once on the shop, all instances will be
  4824. removed.
  4825. Note that the function returns 1 even if no items were removed. The return
  4826. value is only to confirm that the shop was indeed found.
  4827. ---------------------------------------
  4828. *npcshopattach "<name>"{,<flag>};
  4829. This command will attach the current script to the given NPC shop.
  4830. When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem"
  4831. of your script will be executed whenever a player buys/sells from the shop.
  4832. Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[]
  4833. and @sold_quantity[] will be filled up with the items and quantities
  4834. bought/sold.
  4835. The optional parameter specifies whether to attach ("1") or detach ("0") from
  4836. the shop (the default is to attach). Note that detaching will detach any NPC
  4837. attached to the shop, even if it's from another script, while attaching will
  4838. override any other script that may be already attached.
  4839. The function returns 0 if the shop was not found, 1 otherwise.
  4840. NOTES:
  4841. - If attached shop type is market shop, will be default to call the 'buy' window.
  4842. ---------------------------------------
  4843. *npcshopupdate "<name>",<item_id>,<price>{,<stock>}
  4844. Update an entry from shop. If price is 0 means don't change the price, maybe used for
  4845. marketshop to update the stock quantity. Except marketshop type, 'stock' value means
  4846. nothing.
  4847. ---------------------------------------
  4848. *waitingroom "<chatroom name>",<limit>{,"<event label>"{,<trigger>{,<required zeny>{,<min lvl>{,<max lvl>}}}}};
  4849. This command will create a chat room, owned by the NPC object running this
  4850. script and displayed above the NPC sprite.
  4851. The maximum length of a chat room name is 60 letters.
  4852. The limit is the maximum number of people allowed to enter the chat room.
  4853. The attached NPC is included in this count. If the optional event and trigger
  4854. parameters are given, the event label ("<NPC object name>::<label name>")
  4855. will be invoked as if with a 'doevent' upon the number of people in the chat
  4856. room reaching the given triggering amount.
  4857. // The NPC will just show a box above its head that says "Hello World", clicking
  4858. // it will do nothing, since the limit is zero.
  4859. waitingroom "Hello World",0;
  4860. // The NPC will have a box above its head, it will say "Disco - Waiting Room"
  4861. // and will have 8 waiting slots. Clicking this will enter the chat room, where
  4862. // the player will be able to wait until 7 players accumulate. Once this happens,
  4863. // it will cause the NPC "Bouncer" run the label "OnStart".
  4864. waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",7;
  4865. // The NPC will have a box above its head, it will say "Party - Waiting Room"
  4866. // and will have 8 waiting slots. Clicking this will allow a player who has
  4867. // 5000 zeny and lvl 50~99 to enter the chat room, where the player will be
  4868. // able to wait until 7 players accumulate. Once this happens, it will cause
  4869. // the NPC "Bouncer" run the label "OnStart".
  4870. waitingroom "Party - Waiting Room",8,"Bouncer::OnStart",7,5000,50,99;
  4871. Creating a waiting room does not stop the execution of the script and it will
  4872. continue to the next line.
  4873. For more examples see the 2-1 and 2-2 job quest scripts which make extensive use
  4874. of waiting rooms.
  4875. ---------------------------------------
  4876. *delwaitingroom {"<NPC object name"};
  4877. This command will delete a waiting room. If no parameter is given, it will
  4878. delete a waiting room attached to the NPC object running this command, if it is,
  4879. it will delete a waiting room owned by another NPC object. This is the only way
  4880. to get rid of a waiting room, nothing else will cause it to disappear.
  4881. It's not clear what happens to a waiting room if the NPC is disabled with
  4882. 'disablenpc', by the way.
  4883. ---------------------------------------
  4884. *enablewaitingroomevent {"<NPC object name>"};
  4885. *disablewaitingroomevent {"<NPC object name>"};
  4886. *enablearena;
  4887. *disablearena;
  4888. This will enable and disable triggering the waiting room event (see
  4889. 'waitingroom') respectively. Optionally giving an NPC object name will do that
  4890. for a specified NPC object. The chat room will not disappear when triggering is
  4891. disabled and enabled in this manner and players will not be kicked out of it.
  4892. Enabling a chat room event will also cause it to immediately check whether the
  4893. number of users in it exceeded the trigger amount and trigger the event
  4894. accordingly.
  4895. Normally, whenever a waiting room was created to make sure that only one
  4896. character is, for example, trying to pass a job quest trial, and no other
  4897. characters are present in the room to mess up the script.
  4898. The 'enablearena'/'disablearena' commands are just aliases with no parameter.
  4899. These are supposedly left here for compatibility with official server scripts,
  4900. but no rAthena script uses these at the moment.
  4901. ---------------------------------------
  4902. *getwaitingroomstate(<information type>{,"<NPC object name>"})
  4903. This function will return information about the waiting room state for the
  4904. attached waiting room or for a waiting room attached to the specified NPC if
  4905. any.
  4906. The valid information types are:
  4907. 0 - Number of users currently chatting.
  4908. 1 - Maximum number of users allowed.
  4909. 2 - Will return 1 if the waiting room has a trigger set.
  4910. 0 otherwise.
  4911. 3 - Will return 1 if the waiting room is currently disabled.
  4912. 0 otherwise.
  4913. 4 - The Title of the waiting room (string)
  4914. 5 - Password of the waiting room, if any. Pointless, since there is no way to
  4915. set a password on a waiting room right now.
  4916. 16 - Event name of the waiting room (string)
  4917. 32 - Whether or not the waiting room is full.
  4918. 33 - Whether the amount of users in the waiting room is higher than the trigger
  4919. number.
  4920. ---------------------------------------
  4921. *warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
  4922. This command will warp the amount of characters equal to the trigger number of
  4923. the waiting room chat attached to the NPC object running this command to the
  4924. specified map and coordinates, kicking them out of the chat. Those waiting the
  4925. longest will get warped first. It can also do a random warp on the same map
  4926. ("Random" instead of map name) and warp to the save point ("SavePoint").
  4927. The list of characters to warp is taken from the list of the chat room members.
  4928. Those not in the chat room will not be considered even if they are talking to
  4929. the NPC in question. If the number of people is given, exactly this much people
  4930. will be warped.
  4931. This command can also keep track of who just got warped. It does this by setting
  4932. special variables:
  4933. $@warpwaitingpc[] is an array containing the account_id numbers of the
  4934. characters who were just warped.
  4935. $@warpwaitingpcnum contains the number of the character it just warped.
  4936. See also 'getpartymember' for advice on what to do with those variables.
  4937. The obvious way of using this effectively would be to set up a waiting room for
  4938. two characters to be warped onto a random PVP map for a one-on-one duel, for
  4939. example.
  4940. ---------------------------------------
  4941. *waitingroomkick "<NPC object name>" , "<character name>";
  4942. This command kicks the given character from the waiting room attached to the given NPC.
  4943. ---------------------------------------
  4944. *getwaitingroomusers "<NPC object name>";
  4945. This command get all the characters in the waiting room of the given NPC and stores
  4946. their gids in the array .@waitingroom_users[]. Also, stores the the number of characters
  4947. in the variable .@waitingroom_usercount
  4948. ---------------------------------------
  4949. *kickwaitingroomall {"<NPC object name>"};
  4950. This command kicks everybody out of a specified waiting room chat.
  4951. ---------------------------------------
  4952. *setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
  4953. This command sets the 'nosave' flag for the specified map and also gives an
  4954. alternate respawn-upon-relogin point.
  4955. It does not make a map impossible to make a save point on as you would normally
  4956. think, 'savepoint' will still work. It will, however, make the specified map
  4957. kick the reconnecting players off to the alternate map given to the coordinates
  4958. specified.
  4959. ---------------------------------------
  4960. *setmapflag "<map name>",<flag>{,<zone>{,<type>}};
  4961. This command marks a specified map with the given map flag, which will alter the
  4962. behavior of the map. A full list of mapflags is located in 'src/map/script_constants.h' with
  4963. the 'mf_' prefix, and documentation can be found in 'doc/mapflags.txt'.
  4964. The map flags alter the behavior of the map regarding teleporting (mf_nomemo,
  4965. mf_noteleport, mf_nowarp, mf_nogo), storing location when disconnected
  4966. (mf_nosave), dead branch usage (mf_nobranch), penalties upon death
  4967. (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty,
  4968. mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use
  4969. skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall),
  4970. current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds,
  4971. mf_fireworks) and whether night will be in effect on this map (mf_nightenabled).
  4972. The optional parameter 'zone' is used to set the zone for restricted mapflags.
  4973. For the 'skill_damage' mapflag, 'zone' functions as 'value' (-100 to 100000) and
  4974. 'type' can be:
  4975. 1: damage against players
  4976. 2: damage against mobs
  4977. 3: damage against bosses
  4978. 4: damage against other
  4979. 5: caster type
  4980. ---------------------------------------
  4981. *removemapflag "<map name>",<flag>{,<zone>};
  4982. This command removes a mapflag from a specified map.
  4983. See 'setmapflag' for a list of mapflags.
  4984. The optional parameter 'zone' is used to remove the zone from restricted mapflags.
  4985. ---------------------------------------
  4986. *getmapflag("<map name>",<flag>{,<type>})
  4987. This command checks the status of a given mapflag and returns the mapflag's state.
  4988. 0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.
  4989. The optional parameter 'type' is used in the 'skill_damage' mapflag:
  4990. 0: if mapflag is set (default)
  4991. 1: damage against players
  4992. 2: damage against mobs
  4993. 3: damage against bosses
  4994. 4: damage against other
  4995. 5: caster type
  4996. ---------------------------------------
  4997. *setbattleflag "<battle flag>",<value>{,<reload>};
  4998. *getbattleflag("<battle flag>")
  4999. Sets or gets the value of the given battle flag.
  5000. Battle flags are the flags found in the battle / *.conf files and is also used in Lupus' variable rates script.
  5001. If the reload value is given then the server will attempt to reload monster data
  5002. to properly apply the new rates. This applies to EXP/Drop type configs. The server
  5003. will only attempt to reload specific configs.
  5004. Examples:
  5005. // Will set the base experience rate to 20x (2000%) - Monster data will continue to use previous rates at server start
  5006. setBattleFlag "base_exp_rate",2000;
  5007. // Will set the base experience rate to 20x (2000%) - Monster data will be reloaded to new value
  5008. setBattleFlag "base_exp_rate",2000,true;
  5009. // Will return the value of the base experience rate (when used after the above example, it would print 2000).
  5010. mes getBattleFlag("base_exp_rate");
  5011. ---------------------------------------
  5012. *warpportal <source x>,<source y>,"<map name>",<target x>,<target y>;
  5013. Creates a warp portal identical to the Acolyte "Warp Portal" skill.
  5014. The source coordinates specify the portal's location on the map of the invoking NPC.
  5015. The target map and coordinates determine the destination of the portal.
  5016. Examples:
  5017. // Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180.
  5018. warpportal 150,150,"prontera",150,180;
  5019. ---------------------------------------
  5020. *mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
  5021. This command will collect all characters located on the From map and warp them
  5022. wholesale to the same point on the To map, or randomly distribute them there if
  5023. the coordinates are zero. "Random" is understood as a special To map name and
  5024. will mean randomly shuffling everyone on the same map.
  5025. Optionally, a type and ID can be specified. Available types are:
  5026. 0 - Everyone
  5027. 1 - Guild
  5028. 2 - Party
  5029. Example:
  5030. // Will warp all members of guild with ID 63 on map prontera to map alberta.
  5031. mapwarp "prontera","alberta",150,150,1,63;
  5032. ---------------------------------------
  5033. \\
  5034. 5,2.- Guild-related commands
  5035. \\
  5036. ---------------------------------------
  5037. *maprespawnguildid "<map name>",<guild id>,<flag>;
  5038. This command goes through the specified map and for each player and monster
  5039. found there does stuff.
  5040. Flag is a bit-mask (add up numbers to get effects you want)
  5041. 1 - warp all guild members to their save points.
  5042. 2 - warp all non-guild members (including guildless players) to their save points.
  5043. 4 - remove all monsters which are not guardian or Emperium.
  5044. Flag 7 will, therefore, mean 'wipe all mobs but guardians and the Emperium and
  5045. kick all characters out', which is what the official scripts do upon castle
  5046. surrender. Upon start of WoE, the scripts do 2 (warp all intruders out).
  5047. For examples, check the WoE scripts in the distribution.
  5048. ---------------------------------------
  5049. *agitstart;
  5050. *agitend;
  5051. *agitstart2;
  5052. *agitend2;
  5053. *agitstart3;
  5054. *agitend3;
  5055. These commands will start and end War of Emperium FE, War of Emperium SE,
  5056. or War of Emperium TE.
  5057. This is a bit more complex than it sounds, since the commands themselves won't
  5058. actually do anything interesting, except causing all 'OnAgitStart:' and
  5059. 'OnAgitEnd:', 'OnAgitStart2:' and 'OnAgitEnd2:', or 'OnAgitStart3:' and
  5060. 'OnAgitEnd3:' in the case of latter two commands, events to run everywhere,
  5061. respectively. They are used as simple triggers to run a lot of complex scripts
  5062. all across the server, and they, in turn, are triggered by clock with an
  5063. 'OnClock<time>:' time-triggering label.
  5064. ---------------------------------------
  5065. *gvgon "<map name>";
  5066. *gvgoff "<map name>";
  5067. These commands will turn GVG mode for the specified maps on and off, setting up
  5068. appropriate map flags. In GVG mode, maps behave as if during the time of WoE,
  5069. even though WoE itself may or may not actually be in effect.
  5070. ---------------------------------------
  5071. *gvgon3 "<map name>";
  5072. *gvgoff3 "<map name>";
  5073. Theses commands behave identically to gvgon/gvgoff, but apply GVG_TE mapflag.
  5074. ---------------------------------------
  5075. *flagemblem <guild id>;
  5076. This command only works when run by the NPC objects which have sprite id 722,
  5077. which is a 3D guild flag sprite. If it isn't, the data will change, but nothing
  5078. will be seen by anyone. If it is invoked in that manner, the emblem of the
  5079. specified guild will appear on the flag, though, if any players are watching it
  5080. at this moment, they will not see the emblem change until they move out of sight
  5081. of the flag and return.
  5082. This is commonly used in official guildwar scripts with a function call which
  5083. returns a guild id:
  5084. // This will change the emblem on the flag to that of the guild that owns
  5085. // "guildcastle"
  5086. flagemblem GetCastleData("guildcastle",1);
  5087. ---------------------------------------
  5088. *guardian "<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"{,<guardian index>}};
  5089. This command is roughly equivalent to 'monster', but is meant to be used with
  5090. castle guardian monsters and will only work with them. It will set the guardian
  5091. characteristics up according to the castle's investment values and otherwise
  5092. set the things up that only castle guardians need.
  5093. Since trunk r12524:
  5094. Returns the id of the mob or 0 if an error occurred.
  5095. When 'guardian index' isn't supplied it produces a temporary guardian.
  5096. Temporary guardians are not saved with the castle and can't be accessed by guardianinfo.
  5097. ---------------------------------------
  5098. *guardianinfo("<map name>", <guardian number>, <type>);
  5099. This function will return various info about the specified guardian, or -1
  5100. if it fails for some reason. It is primarily used in the castle manager NPC.
  5101. Map name and guardian number (value between 0 and 7) define the target.
  5102. Type indicates what information to return:
  5103. 0 - visibility (whether the guardian is installed or not)
  5104. 1 - max. hp
  5105. 2 - current hp
  5106. ---------------------------------------
  5107. *getguildalliance(<guild id1>, <guild id2>);
  5108. This command will return the relation between 2 guilds.
  5109. NOTE: This should be used in collaboration with 'requestguildinfo' as the
  5110. map-server needs to request for information from the char-server.
  5111. Return values:
  5112. -2 - Guild ID1 does not exist
  5113. -1 - Guild ID2 does not exist
  5114. 0 - Both guilds have no relation OR guild ID aren't given
  5115. 1 - Both guilds are allies
  5116. 2 - Both guilds are antagonists
  5117. ---------------------------------------
  5118. //
  5119. 5,2.- End of guild-related commands
  5120. //
  5121. ---------------------------------------
  5122. *npcspeed <speed value>;
  5123. *npcwalkto <x>,<y>;
  5124. *npcstop;
  5125. These commands will make the NPC object in question move around the map. As they
  5126. currently are, they are a bit buggy and are not useful for much more than making
  5127. an NPC move randomly around the map.
  5128. 'npcspeed' will set the NPCs walking speed to a specified value. As in the
  5129. @speed GM command, 200 is the slowest possible speed while 0 is the fastest
  5130. possible (instant motion). 100 is the default character walking speed.
  5131. 'npcwalkto' will start the NPC sprite moving towards the specified coordinates
  5132. on the same map it is currently on. The script proceeds immediately after the
  5133. NPC begins moving.
  5134. 'npcstop' will stop the motion.
  5135. While in transit, the NPC will be clickable, but invoking it will cause it to
  5136. stop moving, which will make its coordinates different from what the client
  5137. computed based on the speed and motion coordinates. The effect is rather
  5138. unnerving.
  5139. Only a few NPC sprites have walking animations, and those that do, do not get
  5140. the animation invoked when moving the NPC, due to the problem in the NPC walking
  5141. code, which looks a bit silly. You might have better success by defining a job-
  5142. sprite based sprite id in 'db/mob_avail.txt' with this.
  5143. ---------------------------------------
  5144. *movenpc "<NPC name>",<x>,<y>{,<dir>};
  5145. This command looks like the NPCWalkToxy function,but is a little different.
  5146. While NPCWalkToXY just makes the NPC 'walk' to the coordinates given (which
  5147. sometimes gives problems if the path isn't a straight line without objects),
  5148. this command just moves the NPC. It basically warps out and in on the current
  5149. and given spot. Direction can be used to change the NPC's facing direction.
  5150. Example:
  5151. // This will move Bugga from it's old coordinates to the new coordinates at 100,20 (if those coordinates are legit).
  5152. moveNPC "Bugga",100,20;
  5153. ---------------------------------------
  5154. =====================
  5155. |6.- Other commands.|
  5156. =====================
  5157. ---------------------------------------
  5158. *debugmes "<message>";
  5159. This command will send the message to the server console (map-server window). It
  5160. will not be displayed anywhere else.
  5161. // Displays "NAME has clicked me!" in the map-server window.
  5162. debugmes strcharinfo(0)+" has clicked me!";
  5163. ---------------------------------------
  5164. *logmes "<message>";
  5165. This command will write the message given to the map server NPC log file, as
  5166. specified in 'conf/log_athena.conf'. In the TXT version of the server, the log
  5167. file is 'log/npclog.log' by default. In the SQL version, if SQL logging is
  5168. enabled, the message will go to the 'npclog' table, otherwise, it will go to the
  5169. same log file.
  5170. If logs are not enabled, nothing will happen.
  5171. ---------------------------------------
  5172. *globalmes "<message>"{,"<NPC name>"};
  5173. This command will send a message to the chat window of all currently connected
  5174. characters.
  5175. If NPC name is specified, the message will be sent as if the sender would be
  5176. the NPC with the said name.
  5177. The display name of the NPC won't get appended in front of the message.
  5178. ---------------------------------------
  5179. *rand(<number>{,<number>});
  5180. This function returns a number ...
  5181. (if you specify one) ... randomly positioned between 0 and the number you specify -1.
  5182. (if you specify two) ... randomly positioned between the two numbers you specify.
  5183. rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9
  5184. rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
  5185. rand(2,5) would result in 2,3,4 or 5
  5186. ---------------------------------------
  5187. *viewpoint <action>,<x>,<y>,<point number>,<color>;
  5188. This command will mark places on the mini map in the client connected to the
  5189. invoking character. It uses the normal X and Y coordinates from the main map.
  5190. The colors of the marks are defined using a hexadecimal number, same as the ones
  5191. used to color text in 'mes' output, but are written as hexadecimal numbers in C.
  5192. (They look like 0x<six numbers>.)
  5193. Action is what you want to do with a point, 1 will set it, while 2 will clear
  5194. it. 0 will also set it, but automatically removes the point after 15 seconds.
  5195. Point number is the number of the point - you can have several. If more than
  5196. one point is drawn at the same coordinates, they will cycle, which can be used
  5197. to create flashing marks.
  5198. // This command will show a mark at coordinates X 30 Y 40, is mark number 1,
  5199. // and will be red.
  5200. viewpoint 1,30,40,1,0xFF0000;
  5201. This will create three points:
  5202. viewpoint 1,30,40,1,0xFF0000;
  5203. viewpoint 1,35,45,2,0xFF0000;
  5204. viewpoint 1,40,50,3,0xFF0000;
  5205. And this is how you remove them:
  5206. viewpoint 2,30,40,1,0xFF0000;
  5207. viewpoint 2,35,45,2,0xFF0000;
  5208. viewpoint 2,40,50,3,0xFF0000;
  5209. The client determines what it does with the points entirely, the server keeps no
  5210. memory of where the points are set whatsoever.
  5211. ---------------------------------------
  5212. *cutin "<filename>",<position>;
  5213. This command will display a picture, usually an NPC illustration, also called
  5214. cutin, for the currently attached client. The position parameter determines the
  5215. placement of the illustration and takes following values:
  5216. 0 - bottom left corner
  5217. 1 - bottom middle
  5218. 2 - bottom right corner
  5219. 3 - middle of screen in a movable window with an empty title bar
  5220. 4 - middle of screen without the window header, but still movable
  5221. The picture is read from data\texture\유저인터페이스\illust, from both the GRF archive
  5222. and data folder, and is required to be a bitmap. The file extension .bmp can be
  5223. omitted. Magenta color (#ff00ff) is considered transparent. There is no limit
  5224. placed on the size of the illustrations by the client, although loading of large
  5225. pictures (about 700x700 and larger) causes the client to freeze shortly (lag).
  5226. Typically the size is about 320x480. New illustrations can be added by just
  5227. putting the new file into the location above.
  5228. The client is able to display only one cutin at the same time and each new one
  5229. will cause the old one to disappear. To delete the currently displayed
  5230. illustration without displaying a new one, an empty file name and position 255
  5231. must be used.
  5232. // Displays the Comodo Kafra illustration in lower right corner.
  5233. cutin "kafra_07",2;
  5234. // Typical way to end a script, which displayed an illustration during a
  5235. // dialog with a player.
  5236. mes "See you.";
  5237. close2;
  5238. cutin "",255;
  5239. end;
  5240. ---------------------------------------
  5241. *emotion <emotion number>{,<target>{,"<target name>"}};
  5242. This command makes an object display an emotion sprite above their own as
  5243. if they were doing that emotion. For a full list of emotion numbers,
  5244. see 'src/map/script_constants.h' under 'e_'. The not so obvious ones are 'e_what'
  5245. (a question mark) and 'e_gasp' (the exclamation mark).
  5246. The optional target parameter specifies who will get the emotion on top of
  5247. their head. If 0 (the default if omitted), the NPC in current use will show
  5248. the emotion, if 1, the player that is running the script will display it.
  5249. Target name parameter allows to display emotion on top of other NPC/PC without
  5250. event labels. If specified name is not found, command does nothing.
  5251. ---------------------------------------
  5252. *misceffect <effect number>;
  5253. This command, if run from an NPC object that has a sprite, will call up a
  5254. specified effect number, centered on the NPC sprite. If the running code does
  5255. not have an object ID (a 'floating' NPC) or is not running from an NPC object at
  5256. all (an item script) the effect will be centered on the character who's RID got
  5257. attached to the script, if any. For usable item scripts, this command will
  5258. create an effect centered on the player using the item.
  5259. A full list of known effects is found in 'doc/effect_list.txt'. The list of
  5260. those that actually work may differ greatly between client versions.
  5261. ---------------------------------------
  5262. *soundeffect "<effect filename>",<type>;
  5263. *soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
  5264. These two commands will play a sound effect to either the invoking character
  5265. only ('soundeffect') or multiple characters ('soundeffectall'). If the running
  5266. code does not have an object ID (a 'floating' NPC) or is not running from an NPC
  5267. object at all (an item script) the sound will be centered on the character who's
  5268. RID got attached to the script, if any. If it does, it will be centered on that
  5269. object. (an NPC sprite)
  5270. Effect filename is the filename in a GRF. It must have the .wav extension.
  5271. It's not quite certain what the 'type' actually does, it is sent to the client
  5272. directly. It probably determines which directory to play the effect from.
  5273. It's certain that giving 0 for the number will play sound files from '\data\wav\',
  5274. but where the other numbers will read from is unclear.
  5275. The sound files themselves must be in the PCM format, and file names should also
  5276. have a maximum length of 23 characters including the .wav extension:
  5277. soundeffect "1234567890123456789.wav", 0; // this will play the soundeffect
  5278. soundeffect "12345678901234567890.wav", 0; // throw gravity error
  5279. You can add your own effects this way, naturally.
  5280. ---------------------------------------
  5281. *playBGM "<BGM filename>";
  5282. *playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
  5283. These two commands will play a Background Music to either the invoking character
  5284. only ('playBGM') or multiple characters ('playBGMall').
  5285. BGM filename is the filename in /BGM/ folder. It has to be in .mp3 extension.
  5286. It's not required to specify the extension inside the script.
  5287. If coordinates are omitted, BGM will be broadcasted on the entire map. If the map name
  5288. is omitted as well the BGM will be played for the entire server.
  5289. You can add your own BGMs this way, naturally.
  5290. ---------------------------------------
  5291. *pvpon "<map name>";
  5292. *pvpoff "<map name>";
  5293. These commands will turn PVP mode for the specified maps on and off. Beside
  5294. setting the flags referred to in 'setmapflag', 'pvpon' will also create a PVP
  5295. timer and ranking as will @pvpon GM command do.
  5296. ---------------------------------------
  5297. *atcommand "<command>";
  5298. This command will run the given command line exactly as if it was typed in from
  5299. the keyboard by the player connected to the invoking character, and that
  5300. character belonged to an account which had GM level 99.
  5301. // This will ask the invoker for a character name and then use the '@nuke'
  5302. // GM command on them, killing them mercilessly.
  5303. input @player$;
  5304. atcommand "@nuke "+@player$;
  5305. Note that for atcommands bound using 'bindatcmd', this command will execute the
  5306. original atcommand, not the script-bound atcommand.
  5307. ---------------------------------------
  5308. *charcommand "<command>";
  5309. This command will run the given command line exactly as if it was typed in from
  5310. the keyboard from a character that belonged to an account which had GM level 99.
  5311. The commands can also run without an attached rid.
  5312. // This would do the same as above, but now
  5313. // it doesn't need a player attached by default.
  5314. charcommand "#option 0 0 0 Roy";
  5315. ---------------------------------------
  5316. *bindatcmd "<command>","<NPC object name>::<event label>"{,<atcommand level>,<charcommand level>};
  5317. This command will bind a NPC event label to an atcommand. Upon execution of the
  5318. atcommand, the user will invoke the NPC event label. Each atcommand is only allowed
  5319. one binding. If you rebind, it will override the original binding.
  5320. The following variables are set upon execution:
  5321. .@atcmd_command$ = The name of the @command used.
  5322. .@atcmd_parameters$[] = Array containing the given parameters, starting from an index of 0.
  5323. .@atcmd_numparameters = The number of parameters defined.
  5324. Example:
  5325. When a user types the command "@test", an angel effect will be shown.
  5326. - script atcmd_example -1,{
  5327. OnInit:
  5328. bindatcmd "test",strnpcinfo(3)+"::OnAtcommand";
  5329. end;
  5330. OnAtcommand:
  5331. specialeffect2 338;
  5332. end;
  5333. }
  5334. ---------------------------------------
  5335. *unbindatcmd "<command>";
  5336. This command will unbind a NPC event label from an atcommand.
  5337. ---------------------------------------
  5338. *useatcmd "<command>";
  5339. This command will execute a script-bound atcommand for the attached RID. If the
  5340. supplied command is not bound to any script, this command will act like 'atcommand'
  5341. and attempt to execute a source-defined command.
  5342. The three .@atcmd_***** variables will NOT be set when invoking script-bound atcommands
  5343. in this way.
  5344. ---------------------------------------
  5345. \\
  5346. 6,1.- Unit-related commands
  5347. \\
  5348. ---------------------------------------
  5349. *unitwalk <GID>,<x>,<y>{,"<event label>"};
  5350. *unitwalkto <GID>,<Target GID>{,"<event label>"};
  5351. This command will tell a <GID> to walk to a position, defined either as a set of
  5352. coordinates or another object. The command returns a 1 for success and 0 upon failure.
  5353. If coordinates are passed, the <GID> will walk to the given x,y coordinates on the
  5354. unit's current map. While there is no way to move across an entire map with 1 command
  5355. use, this could be used in a loop to move long distances.
  5356. If an object ID is passed, the initial <GID> will walk to the <Target GID> (similar to
  5357. walking to attack). This is based on the distance from <GID> to <Target ID>. This command
  5358. uses a hard walk check, so it will calculate a walk path with obstacles. Sending a bad
  5359. target ID will result in an error.
  5360. An optional Event Label can be passed as well which will execute when the <GID> has reached
  5361. the given coordinates or <Target GID>.
  5362. Examples:
  5363. // Makes player walk to the coordinates (150,150).
  5364. unitwalk getcharid(3),150,150;
  5365. // Performs a conditional check with the command and reports success or failure to the player.
  5366. if(unitwalk(getcharid(3),150,150))
  5367. dispbottom "Walking you there...";
  5368. else
  5369. dispbottom "That's too far away, man.";
  5370. // Makes player walk to another character named "WalkToMe".
  5371. unitwalkto getcharid(3),getcharid(3,"WalkToMe");
  5372. ---------------------------------------
  5373. *unitattack <GID>,<Target ID>{,<action type>};
  5374. *unitattack <GID>,"<Target Name>"{,<action type>};
  5375. This command will make a <GID> attack the specified target. It returns 1 upon
  5376. success and 0 for all failures.
  5377. If <GID> is a player and a non-zero <action type> is given, the unit will perform a
  5378. continuous attack instead of a single attack.
  5379. ---------------------------------------
  5380. *unitkill <GID>;
  5381. This command will kill a <GID>.
  5382. ---------------------------------------
  5383. *unitwarp <GID>,"<map name>",<x>,<y>;
  5384. This command will warp a <GID> to the specified map and coordinates.
  5385. If <GID> is zero, the command runs for the unit that invoked the script. This can be
  5386. used with "OnTouch" to warp monsters:
  5387. OnTouch:
  5388. unitwarp 0,"this",-1,-1;
  5389. ---------------------------------------
  5390. *unitstopattack <GID>;
  5391. This command will make a <GID> stop attacking.
  5392. ---------------------------------------
  5393. *unitstopwalk <GID>;
  5394. This command will make a <GID> stop moving.
  5395. Note: If this is called from OnTouch, then the walktimer attached to the unit is
  5396. removed from OnTouch which causes this command to not stop the unit from walking.
  5397. Suggest to use 'unitblockmove' to forcefully stop the unit with OnTouch.
  5398. ---------------------------------------
  5399. *unittalk <GID>,"<text>"{,flag};
  5400. This command will make a <GID> say a message. The display name of the <GID> won't get appended in front of the message.
  5401. flag: Specify target
  5402. bc_area - Message is sent to players in the vicinity of the source (default).
  5403. bc_self - Message is sent only to player attached.
  5404. ---------------------------------------
  5405. *unitemote <GID>,<emotion number>;
  5406. This command will make a <GID> display an emotion sprite.
  5407. For a full list of emotion numbers, see 'src/map/script_constants.h' under 'e_'.
  5408. ---------------------------------------
  5409. *unitskilluseid <GID>,<skill id>,<skill lvl>{,<target id>,<casttime>};
  5410. *unitskilluseid <GID>,"<skill name>",<skill lvl>{,<target id>,<casttime>};
  5411. *unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>{,<casttime>};
  5412. *unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>{,<casttime>};
  5413. This is the replacement of the older commands, these use the same values for
  5414. GID as the other unit* commands (See 'GID').
  5415. Skill ID is the ID of the skill, skill level is the level of the skill.
  5416. Cast time is the amount of seconds to add or remove from the skill. Use a positive value to
  5417. add and negative value to subtract. Using 0 or no value will use the default skill cast time.
  5418. For the position, the x and y are given in the UnitSkillUsePos.
  5419. ---------------------------------------
  5420. *unitexists <GID>;
  5421. Checks if the given Game ID exists. Returns false if the object doesn't exist, or true if
  5422. it does.
  5423. ---------------------------------------
  5424. *getunittype <GID>;
  5425. Returns the type of object from the given Game ID. Returns -1 if the given GID does not
  5426. exist.
  5427. UNITTYPE_PC 0
  5428. UNITTYPE_NPC 1
  5429. UNITTYPE_PET 2
  5430. UNITTYPE_MOB 3
  5431. UNITTYPE_HOM 4
  5432. UNITTYPE_MER 5
  5433. UNITTYPE_ELEM 6
  5434. ---------------------------------------
  5435. *getunitname <GID>;
  5436. Gets the name of the given unit. Supported types are monster, homunculus, pet, and NPC.
  5437. Mercenary and Elemental don't support custom names.
  5438. Returns "Unknown" if unit is not found.
  5439. ---------------------------------------
  5440. *setunitname <GID>,"<new name>";
  5441. Changes the name of the given unit to the new name given. Supported types are monster,
  5442. homunculus, and pet. To change an NPC's name, see 'setnpcdisplay'. Mercenary and
  5443. Elemental don't support custom names.
  5444. Changing a homunculus or pet name will be permanent.
  5445. Returns "Unknown" if unit is not found.
  5446. ---------------------------------------
  5447. *getunitdata <GID>,<arrayname>;
  5448. *setunitdata <GID>,<parameter>,<new value>;
  5449. This is used to get and set special data related to the unit.
  5450. With getunitdata, the array given will be filled with the current data. In setunitdata
  5451. the indexes in the array would be used to set that data on the unit.
  5452. Both getunitdata and setunitdata will return -1 if the given GID does not exist.
  5453. Note: When adjusting a unit's stat (STR, AGI, etc) the unit's respective statuses are
  5454. recalculated (HIT, FLEE, etc) automatically. Keep in mind that some stats don't
  5455. affect a unit's status and will have to directly be modified.
  5456. Parameters (indexes) for monsters are:
  5457. UMOB_SIZE
  5458. UMOB_LEVEL
  5459. UMOB_HP
  5460. UMOB_MAXHP
  5461. UMOB_MASTERAID
  5462. UMOB_MAPID
  5463. UMOB_X
  5464. UMOB_Y
  5465. UMOB_SPEED
  5466. UMOB_MODE
  5467. UMOB_AI
  5468. UMOB_SCOPTION
  5469. UMOB_SEX
  5470. UMOB_CLASS
  5471. UMOB_HAIRSTYLE
  5472. UMOB_HAIRCOLOR
  5473. UMOB_HEADBOTTOM
  5474. UMOB_HEADMIDDLE
  5475. UMOB_HEADTOP
  5476. UMOB_CLOTHCOLOR
  5477. UMOB_SHIELD
  5478. UMOB_WEAPON
  5479. UMOB_LOOKDIR
  5480. UMOB_CANMOVETICK
  5481. UMOB_STR
  5482. UMOB_AGI
  5483. UMOB_VIT
  5484. UMOB_INT
  5485. UMOB_DEX
  5486. UMOB_LUK
  5487. UMOB_SLAVECPYMSTRMD
  5488. UMOB_DMGIMMUNE
  5489. UMOB_ATKRANGE
  5490. UMOB_ATKMIN
  5491. UMOB_ATKMAX
  5492. UMOB_MATKMIN
  5493. UMOB_MATKMAX
  5494. UMOB_DEF
  5495. UMOB_MDEF
  5496. UMOB_HIT
  5497. UMOB_FLEE
  5498. UMOB_PDODGE
  5499. UMOB_CRIT
  5500. UMOB_RACE
  5501. UMOB_ELETYPE
  5502. UMOB_ELELEVEL
  5503. UMOB_AMOTION
  5504. UMOB_ADELAY
  5505. UMOB_DMOTION
  5506. -----
  5507. Parameter (indexes) for homunculi are:
  5508. UHOM_SIZE
  5509. UHOM_LEVEL
  5510. UHOM_HP
  5511. UHOM_MAXHP
  5512. UHOM_SP
  5513. UHOM_MAXSP
  5514. UHOM_MASTERCID
  5515. UHOM_MAPID
  5516. UHOM_X
  5517. UHOM_Y
  5518. UHOM_HUNGER
  5519. UHOM_INTIMACY
  5520. UHOM_SPEED
  5521. UHOM_LOOKDIR
  5522. UHOM_CANMOVETICK
  5523. UHOM_STR
  5524. UHOM_AGI
  5525. UHOM_VIT
  5526. UHOM_INT
  5527. UHOM_DEX
  5528. UHOM_LUK
  5529. UHOM_DMGIMMUNE
  5530. UHOM_ATKRANGE
  5531. UHOM_ATKMIN
  5532. UHOM_ATKMAX
  5533. UHOM_MATKMIN
  5534. UHOM_MATKMAX
  5535. UHOM_DEF
  5536. UHOM_MDEF
  5537. UHOM_HIT
  5538. UHOM_FLEE
  5539. UHOM_PDODGE
  5540. UHOM_CRIT
  5541. UHOM_RACE
  5542. UHOM_ELETYPE
  5543. UHOM_ELELEVEL
  5544. UHOM_AMOTION
  5545. UHOM_ADELAY
  5546. UHOM_DMOTION
  5547. -----
  5548. Parameter (indexes) for pets are:
  5549. UPET_SIZE
  5550. UPET_LEVEL
  5551. UPET_HP
  5552. UPET_MAXHP
  5553. UPET_MASTERAID
  5554. UPET_MAPID
  5555. UPET_X
  5556. UPET_Y
  5557. UPET_HUNGER
  5558. UPET_INTIMACY
  5559. UPET_SPEED
  5560. UPET_LOOKDIR
  5561. UPET_CANMOVETICK
  5562. UPET_STR
  5563. UPET_AGI
  5564. UPET_VIT
  5565. UPET_INT
  5566. UPET_DEX
  5567. UPET_LUK
  5568. UPET_DMGIMMUNE
  5569. UPET_ATKRANGE
  5570. UPET_ATKMIN
  5571. UPET_ATKMAX
  5572. UPET_MATKMIN
  5573. UPET_MATKMAX
  5574. UPET_DEF
  5575. UPET_MDEF
  5576. UPET_HIT
  5577. UPET_FLEE
  5578. UPET_PDODGE
  5579. UPET_CRIT
  5580. UPET_RACE
  5581. UPET_ELETYPE
  5582. UPET_ELELEVEL
  5583. UPET_AMOTION
  5584. UPET_ADELAY
  5585. UPET_DMOTION
  5586. -----
  5587. Parameter (indexes) for mercenaries are:
  5588. UMER_SIZE
  5589. UMER_HP
  5590. UMER_MAXHP
  5591. UMER_MASTERCID
  5592. UMER_MAPID
  5593. UMER_X
  5594. UMER_Y
  5595. UMER_KILLCOUNT
  5596. UMER_LIFETIME
  5597. UMER_SPEED
  5598. UMER_LOOKDIR
  5599. UMER_CANMOVETICK
  5600. UMER_STR
  5601. UMER_AGI
  5602. UMER_VIT
  5603. UMER_INT
  5604. UMER_DEX
  5605. UMER_LUK
  5606. UMER_DMGIMMUNE
  5607. UMER_ATKRANGE
  5608. UMER_ATKMIN
  5609. UMER_ATKMAX
  5610. UMER_MATKMIN
  5611. UMER_MATKMAX
  5612. UMER_DEF
  5613. UMER_MDEF
  5614. UMER_HIT
  5615. UMER_FLEE
  5616. UMER_PDODGE
  5617. UMER_CRIT
  5618. UMER_RACE
  5619. UMER_ELETYPE
  5620. UMER_ELELEVEL
  5621. UMER_AMOTION
  5622. UMER_ADELAY
  5623. UMER_DMOTION
  5624. -----
  5625. Parameter (indexes) for elementals are:
  5626. UELE_SIZE
  5627. UELE_HP
  5628. UELE_MAXHP
  5629. UELE_SP
  5630. UELE_MAXSP
  5631. UELE_MASTERCID
  5632. UELE_MAPID
  5633. UELE_X
  5634. UELE_Y
  5635. UELE_LIFETIME
  5636. UELE_MODE
  5637. UELE_SPEED
  5638. UELE_LOOKDIR
  5639. UELE_CANMOVETICK
  5640. UELE_STR
  5641. UELE_AGI
  5642. UELE_VIT
  5643. UELE_INT
  5644. UELE_DEX
  5645. UELE_LUK
  5646. UELE_DMGIMMUNE
  5647. UELE_ATKRANGE
  5648. UELE_ATKMIN
  5649. UELE_ATKMAX
  5650. UELE_MATKMIN
  5651. UELE_MATKMAX
  5652. UELE_DEF
  5653. UELE_MDEF
  5654. UELE_HIT
  5655. UELE_FLEE
  5656. UELE_PDODGE
  5657. UELE_CRIT
  5658. UELE_RACE
  5659. UELE_ELETYPE
  5660. UELE_ELELEVEL
  5661. UELE_AMOTION
  5662. UELE_ADELAY
  5663. UELE_DMOTION
  5664. -----
  5665. Parameter (indexes) for NPCs are:
  5666. UNPC_DISPLAY
  5667. UNPC_LEVEL
  5668. UNPC_HP
  5669. UNPC_MAXHP
  5670. UNPC_MAPID
  5671. UNPC_X
  5672. UNPC_Y
  5673. UNPC_LOOKDIR
  5674. UNPC_STR
  5675. UNPC_AGI
  5676. UNPC_VIT
  5677. UNPC_INT
  5678. UNPC_DEX
  5679. UNPC_LUK
  5680. UNPC_PLUSALLSTAT
  5681. UNPC_DMGIMMUNE
  5682. UNPC_ATKRANGE
  5683. UNPC_ATKMIN
  5684. UNPC_ATKMAX
  5685. UNPC_MATKMIN
  5686. UNPC_MATKMAX
  5687. UNPC_DEF
  5688. UNPC_MDEF
  5689. UNPC_HIT
  5690. UNPC_FLEE
  5691. UNPC_PDODGE
  5692. UNPC_CRIT
  5693. UNPC_RACE
  5694. UNPC_ELETYPE
  5695. UNPC_ELELEVEL
  5696. UNPC_AMOTION
  5697. UNPC_ADELAY
  5698. UNPC_DMOTION
  5699. *Notes:
  5700. - *_SIZE: small (0); medium (1); large (2)
  5701. - *_MAPID: this refers to the map_data index (from src/map/map.c), not the mapindex_db index (from src/common/mapindex.c)
  5702. -- For 'setunitdata', map name can also be passed in as a valid value instead of map ID
  5703. - *_SPEED: 20 - 1000
  5704. - *_MODE: see doc/mob_db_mode_list.txt
  5705. - *_LOOKDIR: north (0), northwest (1), west (2), etc
  5706. - *_CANMOVETICK: seconds * 1000 the unit will be unable to move
  5707. - *_DMGIMMUNE: unit will be immune to damage (1), or will receive damage (0)
  5708. - *_HUNGER: 0 - 100
  5709. - *_INTIMACY: 0 - 1000
  5710. - *_LIFETIME: seconds * 1000 the unit will be 'alive' for
  5711. - *_AMOTION: see doc/mob_db.txt
  5712. - *_ADELAY: see doc/mob_db.txt
  5713. - *_DMOTION: see doc/mob_db.txt
  5714. - UMOB_AI: none (0); attack (1); marine sphere (2); flora (3); zanzou (4); legion (5); faw (6)
  5715. - UMOB_SCOPTION: see the 'Variables' section at the top of this document
  5716. - UMOB_SLAVECPYMSTRMD: make the slave copy the master's mode (1), or not (0)
  5717. - UNPC_PLUSALLSTAT: same as 'bAllStats'; increases/decreses all stats by given amount
  5718. Example:
  5719. // Spawn some Porings and save the Game ID.
  5720. // - Keep in mind, when the 'monster' script command is used,
  5721. // - all the spawned monster GID's are stored in an array
  5722. // - called $@mobid[].
  5723. monster "prontera",149,190,"Poring",1002,10;
  5724. .GID = $@mobid[9]; // Store and modify the 10th Poring spawned to make him stronger!
  5725. // Save the strong Poring's mob data in the @por_arr[] variable. (@por_arr[1] being level, @por_arr[13] being class, etc.)
  5726. // With this data we can have the NPC display or manipulate it how we want. This does not have to be ran before 'setunitdata'.
  5727. getunitdata .GID,@por_arr;
  5728. // Set the max HP of the Poring to 1000 (current HP will also get updated to 1000).
  5729. setunitdata .GID,UMOB_MAXHP,1000;
  5730. ---------------------------------------
  5731. *geteleminfo <type>{,<char_id>};
  5732. Get info of elemental of attached player or player by char_id.
  5733. Other info can be obtained by 'getunitdata' command.
  5734. Valid types are:
  5735. 0: Elemental ID
  5736. 1: Elemental Game ID
  5737. ---------------------------------------
  5738. \\
  5739. 6,1.- End of unit-related commands
  5740. \\
  5741. ---------------------------------------
  5742. *npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;
  5743. *npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;
  5744. This command causes the attached NPC object to cast a skill on the attached
  5745. player. The skill will have no cast time or cooldown. The player must be
  5746. within the default skill range or the command will fail silently.
  5747. The "stat point" parameter temporarily sets all NPC stats to the given value,
  5748. and "NPC level" is the temporary level of the NPC (used in some skills).
  5749. Neither value can be greater than the max level defined in config, and will
  5750. not work properly if the NPC has a mob sprite.
  5751. // Casts Level 10 Heal on the attached player, calculated with
  5752. // all stats 99 and base level 60.
  5753. npcskill "AL_HEAL",10,99,60;
  5754. ---------------------------------------
  5755. *day;
  5756. *night;
  5757. These two commands will switch the entire server between day and night mode
  5758. respectively. If your server is set to cycle between day and night by
  5759. configuration, it will eventually return to that cycle.
  5760. Example:
  5761. - script DayNight -1,{
  5762. OnClock0600:
  5763. day;
  5764. end;
  5765. OnInit:
  5766. // setting correct mode upon server start-up
  5767. if(gettime(DT_HOUR)>=6 && gettime(DT_HOUR)<18) end;
  5768. OnClock1800:
  5769. night;
  5770. end;
  5771. }
  5772. This script allows to emulate the day/night cycle as the server does, but also
  5773. allows triggering additional effects upon change, like announces, gifts, etc.
  5774. The day/night cycle set by configuration should be disabled when this script is used.
  5775. ---------------------------------------
  5776. *defpattern <set number>,"<regular expression pattern>","<event label>";
  5777. *activatepset <set number>;
  5778. *deactivatepset <set number>;
  5779. *deletepset <set number>;
  5780. This set of commands is only available if the server is compiled with regular
  5781. expressions library enabled. Default compilation and most binary distributions
  5782. aren't, which is probably bad, since these, while complex to use, are quite
  5783. fascinating.
  5784. They will make the NPC object listen for text spoken publicly by players and
  5785. match it against regular expression patterns, then trigger labels associated
  5786. with these regular expression patterns.
  5787. Patterns are organized into sets, which are referred to by a set number. You can
  5788. have multiple sets patterns, and multiple patterns may be active at once.
  5789. Numbers for pattern sets start at 1.
  5790. 'defpattern' will associate a given regular expression pattern with an event
  5791. label. This event will be triggered whenever something a player says is matched
  5792. by this regular expression pattern, if the pattern is currently active.
  5793. 'activatepset' will make the pattern set specified active. An active pattern
  5794. will enable triggering labels defined with 'defpattern', which will not happen
  5795. by default.
  5796. 'deactivatepset' will deactivate a specified pattern set. Giving -1 as a pattern
  5797. set number in this case will deactivate all pattern sets defined.
  5798. 'deletepset' will delete a pattern set from memory, so you can create a new
  5799. pattern set in its place.
  5800. Using regular expressions is high wizardry. But with this high wizardry comes
  5801. unparalleled power of text manipulation. For an explanation of what a regular
  5802. expression pattern is, see a few web pages:
  5803. http://www.regular-expressions.info/
  5804. http://www.weitz.de/regex-coach/
  5805. For an example of this in use, see doc/sample/npc_test_pcre.txt
  5806. With this you could, for example, automatically punish players for asking for
  5807. Zeny in public places, or alternatively, automatically give them Zeny instead if
  5808. they want it so much.
  5809. ---------------------------------------
  5810. *pow(<number>,<power>)
  5811. Returns the result of the calculation.
  5812. Example:
  5813. .@i = pow(2,3); // .@i will be 8
  5814. ---------------------------------------
  5815. *sqrt(<number>)
  5816. Returns the square-root of a number.
  5817. Example:
  5818. .@i = sqrt(25); // .@i will be 5
  5819. ---------------------------------------
  5820. *distance(<x0>,<y0>,<x1>,<y1>)
  5821. Returns distance between 2 points.
  5822. Example:
  5823. .@i = distance(100,200,101,202);
  5824. ---------------------------------------
  5825. *min(<number or array>{,<number or array>,...})
  5826. *minimum(<number or array>{,<number or array>,...})
  5827. *max(<number or array>{,<number or array>,...})
  5828. *maximum(<number or array>{,<number or array>,...})
  5829. Returns the smallest (or biggest) from the set of given parameters.
  5830. These parameters have to be either numbers or number arrays.
  5831. Example:
  5832. .@minimum = min( 1, -6, -2, 8, 2 ); // .@minimum will be equal to -6
  5833. .@maximum = max( 0, 5, 10, 4 ); // .@maximum will be equal to 10
  5834. .@level = min( BaseLevel, 70 ); // .@level will be the character's base level, capped to 70
  5835. setarray .@testarray, 4, 5, 12, 6, 7, 3, 8, 9, 10;
  5836. .@minimum = min( .@testarray ); // .@minimum will be equal to 3
  5837. .@maximum = max( .@testarray ); // .@maximum will be equal to 12
  5838. .@minimum = min( -6, 1, 2, 3, .@testarray ); // .@minimum will be equal to -6
  5839. .@maximum = max( -6, 1, 2, 3, .@testarray ); // .@maximum will be equal to 12
  5840. ---------------------------------------
  5841. *md5("<string>")
  5842. Returns the md5 checksum of a number or string.
  5843. Example:
  5844. mes md5(12345);
  5845. mes md5("12345"); // Will both display 827ccb0eea8a706c4c34a16891f84e7b
  5846. mes md5("qwerty"); // Will display d8578edf8458ce06fbc5bb76a58c5ca4
  5847. ---------------------------------------
  5848. *query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  5849. *query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
  5850. Executes an SQL query. A 'select' query can fill array variables with up to 2 billion rows of
  5851. values, and will return the number of rows (i.e. array size) or -1 on failure.
  5852. Note that 'query_sql' runs on the main database while 'query_logsql' runs on the log database.
  5853. Example:
  5854. .@nb = query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", .@name$, .@fame);
  5855. mes "Hall Of Fame: TOP5";
  5856. mes "1."+.@name$[0]+"("+.@fame[0]+")"; // largest fame value.
  5857. mes "2."+.@name$[1]+"("+.@fame[1]+")";
  5858. mes "3."+.@name$[2]+"("+.@fame[2]+")";
  5859. mes "4."+.@name$[3]+"("+.@fame[3]+")";
  5860. mes "5."+.@name$[4]+"("+.@fame[4]+")";
  5861. ---------------------------------------
  5862. *escape_sql(<value>)
  5863. Converts the value to a string and escapes special characters so that it is safe to
  5864. use in query_sql(). Returns the escaped form of the given value.
  5865. Example:
  5866. .@name$ = "John's Laptop";
  5867. .@esc_str$ = escape_sql(.@name$); // Escaped string: John\'s Laptop
  5868. ---------------------------------------
  5869. *setiteminfo(<item id>,<type>,<value>)
  5870. This function will set some value of an item.
  5871. Returns the new value on success, or -1 on fail (item_id not found or invalid type).
  5872. Valid types are:
  5873. 0 - Buy Price; 1 - Sell Price; 2 - Item Type;
  5874. 3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc..
  5875. if = 0, then monsters don't drop it at all (rare or a quest item)
  5876. if = 10000, then this item is sold in NPC shops only
  5877. 4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
  5878. 10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id
  5879. Example:
  5880. setiteminfo 7049,6,9990; // Stone now weighs 999.0
  5881. ---------------------------------------
  5882. *setitemscript(<item id>,<"{ new item script }">{,<type>});
  5883. Set a new script bonus to the Item. Very useful for game events.
  5884. You can remove an item's itemscript by leaving the itemscript argument empty.
  5885. Returns 1 on success, or 0 on fail (item_id not found or new item script is invalid).
  5886. Type can optionally be used indicates which script to set (default is 0):
  5887. 0 - Script
  5888. 1 - OnEquip_Script
  5889. 2 - OnUnequip_Script
  5890. Example:
  5891. setitemscript 2637,"{ if(isequipped(2236)==0)end; if(getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
  5892. setitemscript 2637,"";
  5893. ---------------------------------------
  5894. *atoi("<string>")
  5895. *axtoi("<string>")
  5896. *strtol("<string>", base)
  5897. These commands are used to convert strings to numbers. 'atoi' will interpret
  5898. given string as a decimal number (base 10), while 'axtoi' interprets strings as
  5899. hexadecimal numbers (base 16). 'strtol' lets the user specify a base (valid range
  5900. is between 2 and 36 inclusive, or the special value0, which means auto-detection).
  5901. The 'atoi' and 'strtol' functions conform to the C functions with the same names,
  5902. and 'axtoi' is the same as strtol, with a base of 16. Results are clamped to signed
  5903. 32 bit int range (INT_MIN ~ INT_MAX).
  5904. Examples:
  5905. .@var = atoi("11"); // Sets .@var to 11
  5906. .@var = axtoi("FF"); // Sets .@var to 255
  5907. mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16)
  5908. .@var = strtol("11", 10); // Sets .@var to 11 (11 base 10)
  5909. .@var = strtol("11", 16); // Sets .@var to 17 (11 base 16)
  5910. .@var = strtol("11", 0); // Sets .@var to 11 (11 base 10, auto-detected)
  5911. .@var = strtol("0x11", 0); // Sets .@var to 17 (11 base 16, auto-detected because of the "0x" prefix)
  5912. .@var = strtol("011", 0); // Sets .@var to 9 (11 base 8, auto-detected because of the "0" prefix)
  5913. .@var = strtol("11", 2); // Sets .@var to 3 (binary 11)
  5914. ---------------------------------------
  5915. *compare("<string>","<substring>")
  5916. This command returns 1 or 0 when the substring is in the main string (1) or not (0).
  5917. This command is not case sensitive.
  5918. Examples:
  5919. //dothis; will be executed ('Bloody Murderer' contains 'Blood').
  5920. if (compare("Bloody Murderer","Blood"))
  5921. dothis;
  5922. //dothat; will not be executed ('Blood butterfly' does not contain 'Bloody').
  5923. if (compare("Blood Butterfly","Bloody"))
  5924. dothat;
  5925. ---------------------------------------
  5926. *strcmp("<string>","<string>")
  5927. This command compares two strings are returns a value:
  5928. 1: string 1 > string 2
  5929. 0: strings are equal
  5930. -1: string 1 < string 2
  5931. ---------------------------------------
  5932. *getstrlen("<string>")
  5933. This function will return the length of the string given as an argument. It is
  5934. useful to check if anything input by the player exceeds name length limits and
  5935. other length limits and asking them to try to input something else.
  5936. ---------------------------------------
  5937. *charisalpha("<string>",<position>)
  5938. This function will return 1 if the character number Position in the given string
  5939. is a letter, 0 if it isn't a letter but a digit or a space.
  5940. The first letter is position 0.
  5941. ---------------------------------------
  5942. *charat(<string>,<index>)
  5943. Returns char at specified index. If index is out of range, returns empty string.
  5944. The first letter of a string is index 0.
  5945. Example:
  5946. charat("This is a string", 10); //returns "s"
  5947. ---------------------------------------
  5948. *setchar(<string>,<char>,<index>)
  5949. Returns the original string with the char at the specified index set to the
  5950. specified char. If index out of range, the original string will be returned.
  5951. Only the 1st char in the <char> parameter will be used.
  5952. Example:
  5953. setchar("Cat", "B", 0); //returns "Bat"
  5954. ---------------------------------------
  5955. *insertchar(<string>,<char>,<index>)
  5956. Returns the original string with the specified char inserted at the specified
  5957. index. If index is out of range, the char will be inserted on the end of the
  5958. string that it is closest. Only the 1st char in the <char> parameter will be used.
  5959. Example:
  5960. insertchar("laughter", "s", 0); //returns "slaughter"
  5961. ---------------------------------------
  5962. *delchar(<string>,<index>)
  5963. Returns the original string with the char at the specified index removed.
  5964. If index is out of range, original string will be returned.
  5965. Example:
  5966. delchar("Diet", 3); //returns "Die"
  5967. ---------------------------------------
  5968. *strtoupper(<string>)
  5969. *strtolower(<string>)
  5970. Returns the specified string in its uppercase/lowercase form.
  5971. All non-alpha characters will be preserved.
  5972. Example:
  5973. strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!"
  5974. ---------------------------------------
  5975. *charisupper(<string>,<index>)
  5976. *charislower(<string>,<index>)
  5977. Returns 1 if character at specified index of specified string is
  5978. uppercase/lowercase. Otherwise, 0. Characters not of the alphabet will return 0.
  5979. Example:
  5980. charisupper("rAthena", 1); //returns 1
  5981. ---------------------------------------
  5982. *substr(<string>,<start_index>,<end_index>)
  5983. Returns the sub-string of the specified string inclusively between the set
  5984. indexes. If indexes are out of range, or the start index is after the end
  5985. index, an empty string will be returned.
  5986. Example:
  5987. substr("foobar", 3, 5); //returns "bar"
  5988. ---------------------------------------
  5989. *explode(<dest_array>,<string>,<delimiter>)
  5990. Breaks a string up into substrings based on the specified delimiter. Substrings
  5991. will be stored within the specified string array. Only the 1st char of the
  5992. delimiter parameter will be used. If an empty string is passed as a delimiter,
  5993. the string will be placed in the array in its original form.
  5994. Example:
  5995. explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
  5996. //.@my_array$ contents will be...
  5997. //.@my_array$[0]: "Explode"
  5998. //.@my_array$[1]: "Test"
  5999. //.@my_array$[2]: "1965"
  6000. //.@my_array$[3]: "red"
  6001. //.@my_array$[4]: "PIE"
  6002. ---------------------------------------
  6003. *implode(<string_array>{,<glue>})
  6004. Combines all substrings within the specified string array into a single string.
  6005. If the glue parameter is specified, it will be inserted inbetween each substring.
  6006. Example:
  6007. setarray .@my_array$[0], "This", "is", "a", "test";
  6008. implode(.@my_array$, " "); //returns "This is a test"
  6009. ---------------------------------------
  6010. *sprintf(<format>[,param[,param[,...]]])
  6011. C style sprintf. The resulting string is returned same as in PHP. All C format
  6012. specifiers are supported except %n. More info: sprintf @ www.cplusplus.com.
  6013. The number of params is only limited by rA's script engine.
  6014. Example:
  6015. .@format$ = "The %s contains %d monkeys";
  6016. dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys"
  6017. dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys"
  6018. ---------------------------------------
  6019. *sscanf(<string>,<format>[,param[,param[,...]]])
  6020. C style sscanf. All C format specifiers are supported.
  6021. More info: sscanf @ www.cplusplus.com. The number of params is only limited
  6022. by rA's script engine.
  6023. Example:
  6024. sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$);
  6025. dispbottom(.@num + " " + .@str$); //prints "42 foobar"
  6026. ---------------------------------------
  6027. *strpos(<haystack>,<needle>{,<offset>})
  6028. PHP style strpos. Finds a substring (needle) within a string (haystack).
  6029. The offset parameter indicates the index of the string to start searching.
  6030. Returns index of substring on successful search, else -1.
  6031. Comparison is case sensitive.
  6032. Example:
  6033. strpos("foobar", "bar", 0); //returns 3
  6034. strpos("foobarfoo", "foo", 0); //returns 0
  6035. strpos("foobarfoo", "foo", 1); //returns 6
  6036. ---------------------------------------
  6037. *replacestr(<input>, <search>, <replace>{, <usecase>{, <count>}})
  6038. Replaces all instances of a search string in the input with the specified
  6039. replacement string. By default is case sensitive unless <usecase> is set
  6040. to 0. If specified it will only replace as many instances as specified
  6041. in the count parameter.
  6042. Example:
  6043. replacestr("testing tester", "test", "dash"); //returns "dashing dasher"
  6044. replacestr("Donkey", "don", "mon", 0); //returns "monkey"
  6045. replacestr("test test test test test", "test", "yay", 0, 3); //returns "yay yay yay test test"
  6046. ---------------------------------------
  6047. *countstr(<input>, <search>{, <usecase>})
  6048. Counts all instances of a search string in the input. By default is case
  6049. sensitive unless <usecase> is set to 0.
  6050. Example:
  6051. countstr("test test test Test", "test"); //returns 3
  6052. countstr("cake Cake", "Cake", 0); //returns 2
  6053. ---------------------------------------
  6054. *preg_match(<regular expression pattern>,<string>{,<offset>})
  6055. Searches a string for a match to the regular expression provided. The
  6056. offset parameter indicates the index of the string to start searching.
  6057. Returns offsets to captured substrings, or 0 if no match is found.
  6058. This command is only available if the server is compiled with the regular
  6059. expressions library enabled.
  6060. ---------------------------------------
  6061. *setfont <font>;
  6062. This command sets the current RO client interface font to one of the
  6063. fonts stored in data\*.eot by using an ID of the font. When the ID
  6064. of the currently used font is used, default interface font is used
  6065. again.
  6066. 0 - Default
  6067. 1 - RixLoveangel
  6068. 2 - RixSquirrel
  6069. 3 - NHCgogo
  6070. 4 - RixDiary
  6071. 5 - RixMiniHeart
  6072. 6 - RixFreshman
  6073. 7 - RixKid
  6074. 8 - RixMagic
  6075. 9 - RixJJangu
  6076. ---------------------------------------
  6077. *showdigit <value>{,<type>};
  6078. Displays given numeric 'value' in large digital clock font on top of
  6079. the screen. The optional parameter 'type' specifies visual aspects
  6080. of the "clock" and can be one of the following values:
  6081. 0 - Displays the value for 5 seconds (default).
  6082. 1 - Incremental counter (1 tick/second).
  6083. 2 - Decremental counter (1 tick/second). Does not stop at zero,
  6084. but overflows.
  6085. 3 - Decremental counter (2 ticks/second). Two digits only, stops
  6086. at zero.
  6087. Except for type 3 the value is interpreted as seconds and formatted
  6088. as time in days, hours, minutes and seconds. Note, that the official
  6089. script command does not have the optional parameter.
  6090. // displays 23:59:59 for 5 seconds
  6091. showdigit 86399;
  6092. // counter that starts at 60 and runs for 30 seconds
  6093. showdigit 60,3;
  6094. ---------------------------------------
  6095. *setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
  6096. Each map cell has several 'flags' that specify the properties of that cell.
  6097. These include terrain properties (walkability, shootability, presence of water),
  6098. skills (basilica, land protector, ...) and other (NPC nearby, no vending, ...).
  6099. Each of these can be 'on' or 'off'. Together they define a cell's behavior.
  6100. This command lets you alter these flags for all map cells in the specified
  6101. (x1,y1)-(x2,y2) rectangle. The 'flag' can be 0 or 1 (0:clear flag, 1:set flag).
  6102. The 'type' defines which flag to modify. Possible options see 'src/map/script_constants.h'.
  6103. Example:
  6104. setcell "arena",0,0,300,300,cell_basilica,1;
  6105. setcell "arena",140,140,160,160,cell_basilica,0;
  6106. setcell "arena",135,135,165,165,cell_walkable,0;
  6107. setcell "arena",140,140,160,160,cell_walkable,1;
  6108. This will add a makeshift ring into the center of the map. The ring will be
  6109. surrounded by a 5-cell wide 'gap' to prevent interference from outside, and
  6110. the rest of the map will be marked as 'basilica', preventing observers from
  6111. casting any offensive skills or fighting among themselves. Note that the wall
  6112. will not be shown nor known client-side, which may cause movement problems.
  6113. Another example:
  6114. OnBarricadeDeploy:
  6115. setcell "schg_cas05",114,51,125,51,cell_walkable,0;
  6116. end;
  6117. OnBarricadeBreak:
  6118. setcell "schg_cas05",114,51,125,51,cell_walkable,1;
  6119. end;
  6120. This could be a part of the WoE:SE script, where attackers are not allowed
  6121. to proceed until all barricades are destroyed. This script would place and
  6122. remove a nonwalkable row of cells after the barricade mobs.
  6123. ---------------------------------------
  6124. *checkcell ("<map name>",<x>,<y>,<type>);
  6125. This command will return 1 or 0, depending on whether the specified cell has
  6126. the 'type' flag set or not. There are various types to check, all mimicking
  6127. the server's cell_chk enumeration. The types can be found in 'src/map/script_constants.h'.
  6128. The meaning of the individual types can be confusing, so here's an overview:
  6129. - cell_chkwall/water/cliff
  6130. these check directly for the 'terrain component' of the specified cell
  6131. - cell_chkpass/reach/nopass/noreach
  6132. passable = not wall & not cliff, reachable = passable wrt. no-stacking mod
  6133. - cell_chknpc/basilica/landprotector/novending/nochat
  6134. these check for specific dynamic flags (their name indicates what they do)
  6135. Example:
  6136. mes "Pick a destination map.";
  6137. input .@map$;
  6138. mes "Alright, now give me the coordinates.";
  6139. input .@x;
  6140. input .@y;
  6141. if( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) {
  6142. mes "Can't warp you there, sorry!";
  6143. close;
  6144. } else {
  6145. mes "Ok, get ready...";
  6146. close2;
  6147. warp .@map$, .@x, .@y;
  6148. end;
  6149. }
  6150. ---------------------------------------
  6151. *getfreecell "<map name>",<rX>,<rY>{,<x>,<y>,<rangeX>,<rangeY>,<flag>};
  6152. Finds a free cell on the given map and stores the reference to the found cell
  6153. in <rX> and <rY>. Passing <x> and <y> with <rangeX> and <rangeY> allows for
  6154. searching within a specified area on the given map. The <flag> is a bitmask
  6155. and has the following possible values:
  6156. - 1 = Random cell on the map or from <x>,<y> range. (default)
  6157. - 2 = The target should be able to walk to the target tile.
  6158. - 4 = There shouldn't be any players around the target tile (use the no_spawn_on_player setting).
  6159. Examples:
  6160. getfreecell("prontera",.@x,.@y); // Find a random empty cell in Prontera and store it within .@x and .@y
  6161. getfreecell("prontera",.@x,.@y,150,150,5,5); // Find a random empty cell on 150,150 (with a range of 5x5) in Prontera and store it within .@x and .@y
  6162. ---------------------------------------
  6163. *setwall "<map name>",<x>,<y>,<size>,<dir>,<shootable>,"<name>";
  6164. *delwall "<name>";
  6165. Creates an invisible wall, an array of "setcell" starting from x,y and doing a
  6166. line of the given size in the given direction. The difference with setcell is
  6167. this one update client part too to avoid the glitch problem. Directions are the
  6168. same as NPC sprite facing directions: 0=north, 1=northwest, 2=west, etc.
  6169. ---------------------------------------
  6170. *readbook <book id>,<page>;
  6171. This command will open a book item at the specified page.
  6172. ---------------------------------------
  6173. ========================
  6174. |7.- Instance commands.|
  6175. ========================
  6176. ---------------------------------------
  6177. *instance_create("<instance name>"{,<instance mode>{,<owner id>}});
  6178. Creates an instance for the <owner id> of <mode>. The instance name, along with
  6179. all other instance data, is read from 'db/(pre-)re/instance_db.txt'. Upon success,
  6180. the command generates a unique instance ID, duplicates all listed maps and NPCs,
  6181. sets the alive time, and triggers the "OnInstanceInit" label in all NPCs inside
  6182. the instance.
  6183. Instance Mode options:
  6184. IM_NONE: Attached to no one.
  6185. IM_CHAR: Attached to a single character.
  6186. IM_PARTY: Attached to a party (default instance mode).
  6187. IM_GUILD: Attached to a guild.
  6188. IM_CLAN: Attached to a clan.
  6189. The command returns the instance ID upon success, and these values upon failure:
  6190. -1: Invalid type.
  6191. -2: Character/Party/Guild/Clan not found.
  6192. -3: Instance already exists.
  6193. -4: No free instances (MAX_INSTANCE exceeded).
  6194. ---------------------------------------
  6195. *instance_destroy {<instance id>};
  6196. Destroys instance with the ID <instance id>. If no ID is specified, the instance
  6197. the script is attached to is used. If the script is not attached to an instance,
  6198. the instance of the currently attached player is used (if it is a character, party,
  6199. guild or clan mode). If it is not owned by anyone, no player needs to be attached. If
  6200. that fails, the script will come to a halt. This will also trigger the "OnInstanceDestroy"
  6201. label in all NPCs inside the instance.
  6202. ---------------------------------------
  6203. *instance_enter("<instance name>",{<x>,<y>,<char_id>,<instance id>});
  6204. Warps player to the specified instance after the script terminates. The map and
  6205. coordinates are located in 'db/(pre-)re/instance_db.txt'.
  6206. The command returns IE_OK upon success, and these values upon failure:
  6207. IE_NOMEMBER: Party/Guild/Clan not found (for party/guild/clan modes).
  6208. IE_NOINSTANCE: Character/Party/Guild/Clan does not have an instance.
  6209. IE_OTHER: Other errors (invalid instance name, instance doesn't match with character/party/guild/clan).
  6210. Put -1 for x and y if want to warp player with default entrance coordinates.
  6211. ---------------------------------------
  6212. *instance_npcname("<npc name>"{,<instance id>})
  6213. Returns the unique name of the instanced script. If no ID is specified,
  6214. the instance the script is attached to is used. If the script is not attached to
  6215. an instance, the instance of the currently attached NPC, player, party, guild
  6216. or clan is used. If that fails, the script will come to a halt.
  6217. ---------------------------------------
  6218. *instance_mapname("<map name>"{,<instance id>})
  6219. Returns the unique name of the instanced map. If no instance ID is specified,
  6220. the instance the script is attached to is used. If the script is not attached to
  6221. an instance, the instance of the currently attached player is used (if it is a
  6222. character, party, guild or clan mode). If it is not owned by anyone, no player needs
  6223. to be attached. If that fails, the command returns an empty string instead.
  6224. ---------------------------------------
  6225. *instance_id()
  6226. Returns the unique instance id of the attached script. If the script is not
  6227. attached to an instance, the instance of the currently attached player is
  6228. used (if it is a character, party, guild or clan mode). If it is not owned by anyone, no
  6229. player needs to be attached. If that fails, the function will return 0.
  6230. ---------------------------------------
  6231. *instance_warpall "<map name>",<x>,<y>{,<instance id>};
  6232. Warps all players in the instance <instance id> to <map name> at given
  6233. coordinates. If no ID is specified, the instance the script is attached to
  6234. is used. If the script is not attached to an instance, the instance of the
  6235. currently attached player is used (if it is a character, party, guild or clan
  6236. mode). If it is not owned by anyone, no player needs to be attached. If that
  6237. fails, the script will come to a halt.
  6238. ---------------------------------------
  6239. *instance_announce <instance id>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
  6240. Broadcasts a message to all players in the instance <instance id> currently
  6241. residing on an instance map. If 0 is specified for <instance id>, the instance
  6242. the script is attached to is used. If the script is not attached to an instance,
  6243. the instance of the currently attached player is used (if it is a character,
  6244. party, guild or clan mode). If it is not owned by anyone, no player needs to be attached.
  6245. For details on the other parameters, see 'announce'.
  6246. ---------------------------------------
  6247. *instance_check_party(<party id>{,<amount>{,<min>{,<max>}}})
  6248. This function checks if a party meets certain requirements, returning 1 if all
  6249. conditions are met and 0 otherwise. It will only check online characters.
  6250. amount - number of online party members (default is 1).
  6251. min - minimum level of all characters in the party (default is 1).
  6252. max - maximum level of all characters in the party (default is max level in conf).
  6253. Example:
  6254. if (instance_check_party(getcharid(1),2,2,149)) {
  6255. mes "Your party meets the Memorial Dungeon requirements.",
  6256. mes "All online members are between levels 1-150 and at least two are online.";
  6257. close;
  6258. } else {
  6259. mes "Sorry, your party does not meet requirements.";
  6260. close;
  6261. }
  6262. ---------------------------------------
  6263. *instance_check_guild(<guild id>{,<amount>{,<min>{,<max>}}})
  6264. This function checks if a guild meets certain requirements, returning 1 if all
  6265. conditions are met and 0 otherwise. It will only check online characters.
  6266. amount - number of online guild members (default is 1).
  6267. min - minimum level of all characters in the guild (default is 1).
  6268. max - maximum level of all characters in the guild (default is max level in conf).
  6269. Example:
  6270. if (instance_check_guild(getcharid(2),2,2,149)) {
  6271. mes "Your guild meets the Memorial Dungeon requirements.",
  6272. mes "All online members are between levels 1-150 and at least two are online.";
  6273. close;
  6274. } else {
  6275. mes "Sorry, your guild does not meet requirements.";
  6276. close;
  6277. }
  6278. ---------------------------------------
  6279. *instance_check_clan(<clan id>{,<amount>{,<min>{,<max>}}})
  6280. This function checks if a clan meets certain requirements, returning 1 if all
  6281. conditions are met and 0 otherwise. It will only check online characters.
  6282. amount - number of online clan members (default is 1).
  6283. min - minimum level of all characters in the clan (default is 1).
  6284. max - maximum level of all characters in the clan (default is max level in conf).
  6285. Example:
  6286. if (instance_check_clan(getcharid(5),2,2,149)) {
  6287. mes "Your clan meets the Memorial Dungeon requirements.",
  6288. mes "All online members are between levels 1-150 and at least two are online.";
  6289. close;
  6290. } else {
  6291. mes "Sorry, your clan does not meet requirements.";
  6292. close;
  6293. }
  6294. ---------------------------------------
  6295. *instance_info("<instance name>",<info type>{,<instance_db map index>});
  6296. Returns the specified <info type> of the given <instance name> from the instance database.
  6297. If the <instance name> is unknown or an invalid <info type> is supplied -1 will be returned.
  6298. Valid info types:
  6299. IIT_ID: Instance database ID as integer.
  6300. IIT_TIME_LIMIT: Instance database total life time as integer.
  6301. IIT_IDLE_TIMEOUT: Instance database timeout time as integer.
  6302. IIT_ENTER_MAP: Instance database enter map as string.
  6303. IIT_ENTER_X: Instance database enter X location as integer.
  6304. IIT_ENTER_Y: Instance database enter Y location as integer.
  6305. IIT_MAPCOUNT: Instance database total maps as integer.
  6306. IIT_MAP: Instance database map name from the given <instance_db map index> as string.
  6307. If the index is invalid an empty string will be returned.
  6308. Example:
  6309. .@name$ = "Endless Tower";
  6310. mes .@name$ + " will be destroyed if no one is in the instance for " + instance_info(.@name$,IIT_IDLETIMEOUT) + " seconds.";
  6311. // Endless Tower will be destroyed if no one is in the instance for 300 seconds.
  6312. ---------------------------------------
  6313. =========================
  6314. |8.- Quest Log commands.|
  6315. =========================
  6316. ---------------------------------------
  6317. *questinfo <Quest ID>,<Icon>{,<Map Mark Color>{,<Job Class>}};
  6318. This is esentially a combination of checkquest and showevent. Use this only
  6319. in an OnInit label. For the Quest ID, specify the quest ID that you want
  6320. checked if it has been started yet.
  6321. For Icon, use one of the following:
  6322. No Icon : QTYPE_NONE
  6323. ! Quest Icon : QTYPE_QUEST
  6324. ? Quest Icon : QTYPE_QUEST2
  6325. ! Job Icon : QTYPE_JOB
  6326. ? Job Icon : QTYPE_JOB2
  6327. ! Event Icon : QTYPE_EVENT
  6328. ? Event Icon : QTYPE_EVENT2
  6329. Warg : QTYPE_WARG
  6330. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410)
  6331. Map Mark Color, when used, creates a mark in the user's mini map on the position of the NPC,
  6332. the available color values are:
  6333. 0 - No Marker (default)
  6334. 1 - Yellow Marker
  6335. 2 - Green Marker
  6336. 3 - Purple Marker
  6337. When a user shows up on a map, each NPC is checked for questinfo that has been set.
  6338. If questinfo is present, it will check if the quest has been started, if it has not, the bubble will appear.
  6339. Optionally, you can also specify a Job Class if the quest bubble should only appear for a certain class.
  6340. Example
  6341. izlude,100,100,4 script Test 844,{
  6342. mes "[Test]";
  6343. mes "Hello World.";
  6344. close;
  6345. OnInit:
  6346. questinfo 1001, QTYPE_QUEST, 0, Job_Novice;
  6347. end;
  6348. }
  6349. ---------------------------------------
  6350. *setquestinfo_level <quest_id>,<min_level>,<max_level>;
  6351. Add level range criteria for quest info with quest id 'quest_id'.
  6352. This command must be used after 'questinfo'.
  6353. ---------------------------------------
  6354. *setquestinfo_req <quest_id>,<req_quest_id>,<state>{,<req_quest_id>,<state>,...};
  6355. Add 'req_quest_id' as requirement for quest info with quest id 'quest_id'.
  6356. Value os 'state' are:
  6357. 0: Player doesn't started 'req_quest_id'.
  6358. 1: Player has 'req_quest_id' (state is either "inactive" or "active").
  6359. 2: Player has 'req_quest_id' completed
  6360. This command must be used after 'questinfo'.
  6361. ---------------------------------------
  6362. *setquestinfo_job <quest_id>,<job_id>{,<job_id>...};
  6363. Add job criteria for quest info with quest id 'quest_id'.
  6364. The job criteria may more than one job_id.
  6365. This command must be used after 'questinfo'.
  6366. ---------------------------------------
  6367. *setquest <ID>{,<char_id>};
  6368. Place quest of <ID> in the users quest log, the state of which is "active".
  6369. If *questinfo is set, and the same ID is specified here, the icon will be cleared when the quest is set.
  6370. ---------------------------------------
  6371. *completequest <ID>{,<char_id>};
  6372. Change the state for the given quest <ID> to "complete" and remove from the users quest log.
  6373. ---------------------------------------
  6374. *erasequest <ID>{,<char_id>};
  6375. Remove the quest of the given <ID> from the user's quest log.
  6376. ---------------------------------------
  6377. *changequest <ID>,<ID2>{,<char_id>};
  6378. Remove quest of the given <ID> from the user's quest log.
  6379. Add quest of the <ID2> to the the quest log, and the state is "active".
  6380. ---------------------------------------
  6381. *checkquest(<ID>{,PLAYTIME|HUNTING{,<char_id>}})
  6382. If no additional argument supplied, return the state of the quest:
  6383. -1 = Quest not started (not in quest log)
  6384. 0 = Quest has been given, but the state is "inactive"
  6385. 1 = Quest has been given, and the state is "active"
  6386. 2 = Quest completed
  6387. If parameter "PLAYTIME" is supplied:
  6388. -1 = Quest not started (not in quest log)
  6389. 0 = the time limit has not yet been reached
  6390. 1 = the time limit has not been reached but the quest is marked as complete
  6391. 2 = the time limit has been reached
  6392. If parameter "HUNTING" is supplied:
  6393. -1 = Quest not started (not in quest log)
  6394. 0 = you haven't killed all of the target monsters and the time limit has not been reached.
  6395. 1 = you haven't killed all of the target monsters but the time limit has been reached.
  6396. 2 = you've killed all of the target monsters
  6397. ---------------------------------------
  6398. *isbegin_quest(<ID>{,<char_id>})
  6399. Return the state of the quest:
  6400. 0 = Quest not started (not in quest log)
  6401. 1 = Quest has been given (state is either "inactive" or "active")
  6402. 2 = Quest completed
  6403. ---------------------------------------
  6404. *showevent <icon>{,<mark color>{,<char_id>}}
  6405. Show an emotion on top of a NPC, and optionally,
  6406. a colored mark in the mini-map like "viewpoint".
  6407. This is used to indicate that a NPC has a quest or an event to
  6408. a certain player.
  6409. Available Icons:
  6410. Remove Icon : QTYPE_NONE
  6411. ! Quest Icon : QTYPE_QUEST
  6412. ? Quest Icon : QTYPE_QUEST2
  6413. ! Job Icon : QTYPE_JOB
  6414. ? Job Icon : QTYPE_JOB2
  6415. ! Event Icon : QTYPE_EVENT
  6416. ? Event Icon : QTYPE_EVENT2
  6417. Warg : QTYPE_WARG
  6418. Warg Face : QTYPE_WARG2 (Only for packetver >= 20120410)
  6419. Mark Color:
  6420. 0 - No Mark
  6421. 1 - Yellow Mark
  6422. 2 - Green Mark
  6423. 3 - Purple Mark
  6424. ---------------------------------------
  6425. ============================
  6426. |9.- Battleground commands.|
  6427. ============================
  6428. ---------------------------------------
  6429. *waitingroom2bg_single(<battle group>,{"<map name>",<x>,<y>{,"<npc name>"}});
  6430. Adds the first waiting player from the chat room of the given NPC to an existing battleground group.
  6431. The player will also be warped to the default spawn point of the battle group or to the specified coordinates <x> and <y> on the given <map>.
  6432. ---------------------------------------
  6433. *waitingroom2bg("<map name>",<x>,<y>,{"<On Quit Event>","<On Death Event>"{,"<NPC Name>"}});
  6434. <map name>,<x>,<y> refer to where the "respawn" base is, where the player group will respawn when they die.
  6435. <On Quit Event> refers to an NPC label that attaches to the character and is run when they relog. (Optional)
  6436. <On Death Event> refers to an NPC label that attaches to the character and is run when they die. (Optional)
  6437. Unlike the prior command, the latter will attach a GROUP in a waiting room to the battleground, and
  6438. sets the array $@arenamembers[0] where 0 holds the IDs of the first group, and 1 holds the IDs of the second.
  6439. If the optional NPC Name parameter is left out, the waiting room of the current NPC is used.
  6440. Example:
  6441. // Battle Group will be referred to as $@KvM01BG_id1, and when they die, respawn at bat_c01,52,129.
  6442. set $@KvM01BG_id1, waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
  6443. end;
  6444. ---------------------------------------
  6445. *bg_create("<map name>",<x>,<y>{,"<On Quit Event>","<On Death Event>"});
  6446. Creates an instance of battleground battle group that can be used with other battleground commands.
  6447. <map name>,<x>,<y> refer to where the "respawn" base is, where the player group will respawn when they die.
  6448. <On Quit Event> refers to an NPC label that attaches to the character and is run when they relog. (Optional)
  6449. <On Death Event> refers to an NPC label that attaches to the character and is run when they die. (Optional)
  6450. Returns battle group ID on success. Returns 0 on failure.
  6451. ---------------------------------------
  6452. *bg_join(<battle group>,{"<map name>",{<x>,<y>{,<char id>}});
  6453. Adds an attached player or <char id> if specified to an existing battleground group. The player will also be warped to the default spawn point of the battle group or to the specified coordinates <x> and <y> on the given <map>.
  6454. Returns true on success. Returns false on failure.
  6455. ---------------------------------------
  6456. *bg_team_setxy <Battle Group ID>,<x>,<y>;
  6457. Updates the respawn point of the given Battle Group to x,y on the same map. <Battle Group ID> can be retrieved using getcharid(4).
  6458. Example:
  6459. bg_team_setxy getcharid(4),56,212;
  6460. mapannounce "bat_a01", "Group [1] has taken the work shop, and will now respawn there.",bc_map,"0xFFCE00";
  6461. end;
  6462. ---------------------------------------
  6463. *bg_warp <Battle Group>,"<map name>",<x>,<y>;
  6464. Similar to the 'warp' command.
  6465. Places all members of <Battle Group> at the specified map and coordinates.
  6466. Example:
  6467. //place the battle group one for Tierra Gorge at starting position.
  6468. bg_warp $@TierraBG1_id1,"bat_a01",352,342;
  6469. end;
  6470. ---------------------------------------
  6471. *bg_monster <Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>";
  6472. *bg_monster(<Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>");
  6473. Similar to the 'monster' command.
  6474. Spawns a monster with allegiance to the given Battle Group.
  6475. Does not allow for the summoning of multiple monsters.
  6476. Monsters are similar to those in War of Emperium, in that the specified Battle Group is considered friendly.
  6477. Example:
  6478. // It can be used in two different ways.
  6479. bg_monster $@TierraBG1_id2,"bat_a01",167,50,"Food Depot",1910,"Feed Depot#1::OnMyMobDead";
  6480. end;
  6481. // Alternatively, you can set an ID for the monster using "set".
  6482. // This becomes useful when used with the command below.
  6483. set $@Guardian_3, bg_monster($@TierraBG1_id2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  6484. end;
  6485. ---------------------------------------
  6486. *bg_monster_set_team <GID>,<Battle Group>;
  6487. This command will change the allegiance if a monster in a battle ground.
  6488. GID can be set when spawning the monster via the 'bg_monster' command.
  6489. Example:
  6490. end;
  6491. OnEnable:
  6492. mapannounce "A guardian has been summoned for Battle Group 2!",bc_map,"0xFFCE00";
  6493. set $@Guardian, bg_monster($@BG_2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
  6494. initnpctimer;
  6495. end;
  6496. OnTimer1000:
  6497. stopnpctimer;
  6498. mapannounce "Erm, sorry about that! This monster was meant for Battle Group 1.",bc_map,"0xFFCE00";
  6499. bg_monster_set_team $@Guardian, $@BG_1;
  6500. end;
  6501. ---------------------------------------
  6502. *bg_leave {<char_id>};
  6503. Removes attached player from their Battle Group.
  6504. ---------------------------------------
  6505. *bg_destroy <Batte Group>;
  6506. Destroys the Battle Group created for that battle ground.
  6507. ---------------------------------------
  6508. *areapercentheal "<map name>",<x1>,<y1>,<x2>,<y2>,<hp>,<sp>;
  6509. Restores a percentage of the maximum HP/SP of players within a defined area.
  6510. This is primarily used in battleground scripts, but is not limited to them.
  6511. Example:
  6512. areapercentheal "bat_a01",52,208,61,217,100,100;
  6513. end;
  6514. ---------------------------------------
  6515. *bg_get_data(<Battle Group>,<type>);
  6516. Retrieves data related to given Battle Group. Type can be one of the following:
  6517. 0 - Amount of players currently belonging to the group.
  6518. ---------------------------------------
  6519. *bg_getareausers(<Battle Group>,"<map name>",<x0>,<y0>,<x1>,<y1>);
  6520. Retrieves the amount of players belonging to the given Battle Group on the given
  6521. map within the specified rectangular area.
  6522. ---------------------------------------
  6523. *bg_updatescore "<map name>",<Guillaume Score>,<Croix Score>;
  6524. This command will force the update of the displayed scoreboard.
  6525. It is only usable when the map is defined as a Type 2 Battleground:
  6526. mapflag <map name> battleground 2
  6527. ---------------------------------------
  6528. ====================
  6529. |10.- Pet commands.|
  6530. ====================
  6531. ---------------------------------------
  6532. *bpet;
  6533. This command opens up a pet hatching window on the client connected to the
  6534. invoking character. It is used in item script for the pet incubators and will
  6535. let the player hatch an owned egg. If the character has no eggs, it will just
  6536. open up an empty incubator window.
  6537. This is still usable outside item scripts.
  6538. ---------------------------------------
  6539. *pet <pet id>;
  6540. This command is used in all the item scripts for taming items. Running this
  6541. command will make the pet catching cursor appear on the client connected to the
  6542. invoking character, usable on the monsters with the specified pet ID number. It
  6543. will still work outside an item script.
  6544. A full list of pet IDs can be found inside 'db/pet_db.txt'.
  6545. ---------------------------------------
  6546. *makepet <pet id>;
  6547. This command will create a pet egg and put it in the invoking character's
  6548. inventory. The kind of pet is specified by pet ID numbers listed in
  6549. 'db/pet_db.txt'. The egg is created exactly as if the character just successfully
  6550. caught a pet in the normal way.
  6551. // This will make you a poring:
  6552. makepet 1002;
  6553. Notice that you absolutely have to create pet eggs with this command. If you try
  6554. to give a pet egg with 'getitem', pet data will not be created by the char
  6555. server and the egg will disappear when anyone tries to hatch it.
  6556. ---------------------------------------
  6557. *getpetinfo(<type>{,<char_id>})
  6558. This function will return pet information for the pet the invoking character
  6559. currently has active. Valid types are:
  6560. PETINFO_ID - Pet ID
  6561. PETINFO_CLASS - Pet class number as per 'db/pet_db.txt' - will tell you what kind of a pet it
  6562. is.
  6563. PETINFO_NAME - Pet name. Will return "null" if there's no pet.
  6564. PETINFO_INTIMATE - Pet friendly level (intimacy score). 1000 is full loyalty.
  6565. PETINFO_HUNGRY - Pet hungry level. 100 is completely full.
  6566. PETINFO_RENAMED - Pet rename flag. 0 means this pet has not been named yet.
  6567. PETINFO_LEVEL - Pet level
  6568. PETINFO_BLOCKID - Pet Game ID
  6569. ---------------------------------------
  6570. =============================
  6571. |10.1.- The Pet AI commands.|
  6572. =============================
  6573. ---------------------------------------
  6574. These commands will only work if the invoking character has a pet, and are meant
  6575. to be executed from pet scripts. They will modify the pet AI decision-making for
  6576. the current pet of the invoking character, and will NOT have any independent
  6577. effect by themselves, which is why only one of them each may be in effect at any
  6578. time for a specific pet. A pet may have 'petloot', 'petskillbonus',
  6579. 'petskillattack' OR 'petpetskillattack2' and 'petskillsupport'.
  6580. All commands with delays and durations will only make the behavior active for
  6581. the specified duration of seconds, with a delay of the specified number of
  6582. seconds between activations. Rates are a chance of the effect occurring and are
  6583. given in percent. 'bonusrate' is added to the normal rate if the pet intimacy is
  6584. at the maximum possible.
  6585. The behavior modified with the below mentioned commands will only be exhibited if
  6586. the pet is loyal and appropriate configuration options are set in
  6587. 'battle_athena.conf'.
  6588. Pet scripts in the database normally run whenever a pet of that type hatches
  6589. from the egg. Other commands usable in item scripts (see 'bonus') will also
  6590. happily run from pet scripts. Apparently, the pet-specific commands will also
  6591. work in NPC scripts and modify the behavior of the current pet up until the pet
  6592. is hatched again. (Which will also occur when the character is logged in again
  6593. with the pet still out of the egg.) It is not certain for how long the effect of
  6594. such command running from an NPC script will eventually persist, but apparently,
  6595. it is possible to usefully employ them in usable item scripts to create pet
  6596. buffing items.
  6597. Nobody tried this before, so you're essentially on your own here.
  6598. ---------------------------------------
  6599. *petskillbonus <bonus type>,<value>,<duration>,<delay>;
  6600. This command will make the pet give a bonus to the owner's stat in certain
  6601. duration in seconds and will be repeated for certain delay in seconds.
  6602. For a full bonus list, see 'doc/item_bonus.txt'
  6603. NOTE: Currently ONLY supported for bonuses that used by 'bonus' script.
  6604. ---------------------------------------
  6605. *petrecovery <status type>,<delay>;
  6606. This command will make the pet cure a specified status condition. The curing
  6607. actions will occur once every Delay seconds. For a full list of status
  6608. conditions that can be cured, see the list of 'SC_' status condition constants
  6609. in 'src/map/script_constants.h'.
  6610. ---------------------------------------
  6611. *petloot <max items>;
  6612. This command will turn on pet looting, with a maximum number of items to loot
  6613. specified. Pet will store items and return them when the maximum is reached or
  6614. when pet performance is activated.
  6615. ---------------------------------------
  6616. *petskillsupport <skill id>,<skill level>,<delay>,<percent hp>,<percent sp>;
  6617. *petskillsupport "<skill name>",<skill level>,<delay>,<percent hp>,<percent sp>;
  6618. This will make the pet use a specified support skill on the owner whenever the
  6619. HP and SP are below the given percent values, with a specified delay time
  6620. between activations. The skill numbers are as per 'db/(pre-)re/skill_db.txt'.
  6621. It's not quite certain who's stats will be used for the skills cast, the
  6622. character's or the pets. Probably, Skotlex can answer that question.
  6623. ---------------------------------------
  6624. *petskillattack <skill id>,<skill level>,<rate>,<bonusrate>;
  6625. *petskillattack "<skill name>",<skill level>,<rate>,<bonusrate>;
  6626. *petskillattack2 <skill id>,<damage>,<number of attacks>,<rate>,<bonusrate>;
  6627. *petskillattack2 "<skill name>",<damage>,<number of attacks>,<rate>,<bonusrate>;
  6628. These two commands will make the pet cast an attack skill on the enemy the pet's
  6629. owner is currently fighting. Skill IDs and levels are as per 'petskillsupport'.
  6630. 'petskillattack2' will make the pet cast the skill with a fixed amount of damage
  6631. inflicted and the specified number of attacks.
  6632. Value of 'rate' is between 1 and 100. 100 = 100%
  6633. ---------------------------------------
  6634. ===========================
  6635. |11.- Homunculus commands.|
  6636. ===========================
  6637. ---------------------------------------
  6638. *homevolution;
  6639. This command will try to evolve the current player's homunculus.
  6640. If it doesn't work, the /swt emotion is shown.
  6641. To evolve a homunculus, the invoking player must have a homunculus,
  6642. the homunculus must not be the last evolution and
  6643. the homunculus must have above 91000 intimacy with its owner.
  6644. ---------------------------------------
  6645. *morphembryo;
  6646. This command will try to put the invoking player's Homunculus in an
  6647. uncallable state, required for mutation into a Homunculus S. The player
  6648. will also receive a Strange Embryo (ID 6415) in their inventory if
  6649. successful, which is deleted upon mutation.
  6650. The command will fail if the invoking player does not have an evolved
  6651. Homunculus at level 99 or above. The /swt emotion is shown upon failure.
  6652. Returns 1 upon success and 0 for all failures.
  6653. ---------------------------------------
  6654. *hommutate {<ID>};
  6655. This command will try to mutate the invoking player's Homunculus into
  6656. a Homunculus S. The Strange Embryo (ID 6415) is deleted upon success.
  6657. The command will fail if the invoking player does not have an evolved
  6658. Homunculus at level 99 or above, if it is not in the embryo state
  6659. (from the 'morphembryo' command), or if the invoking player does not
  6660. possess a Strange Embryo. The /swt emotion is shown upon failure.
  6661. If the optional parameter <ID> is set, the invoking player's Homunculus
  6662. will change into the specified Homunculus ID. Otherwise, a random Homunculus S
  6663. will be chosen. See 'db/homunculus_db.txt' for a full list of IDs.
  6664. Returns 1 upon success and 0 for all failures.
  6665. ---------------------------------------
  6666. *checkhomcall()
  6667. This function checks if the attached player's Homunculus is active,
  6668. and will return the following values:
  6669. -1: The player has no Homunculus.
  6670. 0: The player's Homunculus is active.
  6671. 1: The player's Homunculus is vaporized.
  6672. 2: The player's Homunculus is in morph state.
  6673. ---------------------------------------
  6674. *gethominfo(<type>{,<char_id>})
  6675. This function will return Homunculus information for the Homunculus of the
  6676. invoking character, regardless of its vaporize state. It returns zero or
  6677. "null" if the player does not own a Homunculus.
  6678. Valid types are:
  6679. 0 - Homunculus ID
  6680. 1 - Homunculus Class
  6681. 2 - Homunculus Name
  6682. 3 - Homunculus friendly level (intimacy score). 100000 is full loyalty.
  6683. 4 - Homunculus hungry level. 100 is completely full.
  6684. 5 - Homunculus rename flag. 0 means this homunculus has not been named yet.
  6685. 6 - Homunculus level
  6686. 7 - Homunculus Game ID
  6687. ---------------------------------------
  6688. *homshuffle;
  6689. This will recalculate the homunculus stats according to its level, of the
  6690. current invoking character.
  6691. ---------------------------------------
  6692. ==========================
  6693. |12.- Mercenary commands.|
  6694. ==========================
  6695. ---------------------------------------
  6696. *mercenary_create <class>,<contract time>;
  6697. This command summons a mercenary for a given time (in milliseconds). For a
  6698. list of all available classes, see 'db/mercenary_db.txt'.
  6699. This command is typically used in item scripts of mercenary scrolls.
  6700. ---------------------------------------
  6701. *mercenary_heal <hp>,<sp>;
  6702. This command works like 'heal', but affects the mercenary of the
  6703. currently attached character.
  6704. ---------------------------------------
  6705. *mercenary_sc_start <type>,<tick>,<val1>;
  6706. This command works like 'sc_start', but affects the mercenary of the
  6707. currently attached character.
  6708. ---------------------------------------
  6709. *mercenary_get_calls(<guild>);
  6710. *mercenary_set_calls <guild>,<value>;
  6711. Sets or gets the mercenary calls value for given guild for currently
  6712. attached character. Guild can be one or the following constants:
  6713. ARCH_MERC_GUILD
  6714. SPEAR_MERC_GUILD
  6715. SWORD_MERC_GUILD
  6716. ---------------------------------------
  6717. *mercenary_get_faith(<guild>);
  6718. *mercenary_set_faith <guild>,<value>;
  6719. Sets or gets the mercenary faith value for given guild for currently
  6720. attached character. Guild can be one or the following constants:
  6721. ARCH_MERC_GUILD
  6722. SPEAR_MERC_GUILD
  6723. SWORD_MERC_GUILD
  6724. ---------------------------------------
  6725. *getmercinfo(<type>{,<char id>});
  6726. Retrieves information about mercenary of the currently attached
  6727. character. If char id is given, the information of that character is
  6728. retrieved instead. Type specifies what information to retrieve and
  6729. can be one of the following:
  6730. 0 - Mercenary ID
  6731. 1 - Mercenary Class
  6732. 2 - Mercenary Name
  6733. 3 - Mercenary faith value for this mercenary's guild, if any
  6734. 4 - Mercenary calls value for this mercenary's guild, if any
  6735. 5 - Mercenary kill count
  6736. 6 - Mercenary remaining life time in msec
  6737. 7 - Mercenary level
  6738. 8 - Mercenary Game ID
  6739. If the character does not have a mercenary, the command returns ""
  6740. for name and 0 for all other types.
  6741. ---------------------------------------
  6742. ======================
  6743. |13.- Party commands.|
  6744. ======================
  6745. ---------------------------------------
  6746. *getpartyname(<party id>)
  6747. This function will return the name of a party that has the specified ID number.
  6748. If there is no such party ID, "null" will be returned.
  6749. Lets say the ID of a party was saved as a global variable:
  6750. // This would return the name of the party from the ID stored in a variable
  6751. mes "You're in the '"+getpartyname($@var)+"' party, I know!";
  6752. ---------------------------------------
  6753. *getpartymember <party id>{,<type>{,<array_variable>}};
  6754. This command will find all members of a specified party and returns their names
  6755. (or character id or account id depending on the value of "type") into an array
  6756. of temporary global variables. There's actually quite a few commands like this
  6757. which will fill a special variable with data upon execution and not do anything
  6758. else.
  6759. Upon executing this,
  6760. $@partymembername$[] is a global temporary string array which contains all the
  6761. names of these party members
  6762. (only set when type is 0 or not specified)
  6763. $@partymembercid[] is a global temporary number array which contains the
  6764. character id of these party members.
  6765. (only set when type is 1)
  6766. $@partymemberaid[] is a global temporary number array which contains the
  6767. account id of these party members.
  6768. (only set when type is 2)
  6769. $@partymembercount is the number of party members that were found.
  6770. The party members will (apparently) be found regardless of whether they are
  6771. online or offline. Note that the names come in no particular order.
  6772. Be sure to use $@partymembercount to go through this array, and not
  6773. 'getarraysize', because it is not cleared between runs of 'getpartymember'. If
  6774. someone with 7 party members invokes this script, the array would have 7
  6775. elements. But if another person calls up the NPC, and he has a party of 5, the
  6776. server will not clear the array for you, overwriting the values instead. So in
  6777. addition to returning the 5 member names, the 6th and 7th elements from the last
  6778. call remain, and you will get 5+2 members, of which the last 2 don't belong to
  6779. the new guy's party. $@partymembercount will always contain the correct number,
  6780. (5) unlike 'getarraysize()' which will return 7 in this case.
  6781. If 'array_variable' is set, the result will be stored to that variable instead
  6782. using global variable.
  6783. Example 1: list party member names
  6784. // get the party member names
  6785. getpartymember getcharid(1),0;
  6786. // It's a good idea to copy the global temporary $@partymember*****
  6787. // variables to your own scope variables because if you have pauses in this
  6788. // script (sleep, sleep2, next, close2, input, menu, select, or prompt),
  6789. // another player could click this NPC, trigger 'getpartymember', and
  6790. // overwrite the $@partymember***** variables.
  6791. .@count = $@partymembercount;
  6792. copyarray .@name$[0], $@partymembername$[0], $@partymembercount;
  6793. // list the party member names
  6794. for (.@i = 0; .@i < .@count; .@i++)
  6795. mes (.@i +1) + ". ^0000FF" + .@name$[.@i] + "^000000";
  6796. close;
  6797. Example 2: check party count (with a 'next' pause), before warping to event
  6798. .register_num = 5; // How many party members are required?
  6799. // get the charID and accountID of character's party members
  6800. getpartymember getcharid(1), 1;
  6801. getpartymember getcharid(1), 2;
  6802. if ( $@partymembercount != .register_num ) {
  6803. mes "Please form a party of "+ .register_num +" to continue";
  6804. close;
  6805. }
  6806. // loop through both and use 'isloggedin' to count online party members
  6807. for ( .@i = 0; .@i < $@partymembercount; .@i++ )
  6808. if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
  6809. .@count_online++;
  6810. // We search accountID & charID because a single party can have multiple
  6811. // characters from the same account. Without searching through the charID,
  6812. // if a player has 2 characters from the same account inside the party but
  6813. // only 1 char online, it would count their online char twice.
  6814. if ( .@count_online != .register_num ) {
  6815. mes "All your party members must be online to continue";
  6816. close;
  6817. }
  6818. // copy the array to prevent players cheating the system
  6819. copyarray .@partymembercid, $@partymembercid, .register_num;
  6820. mes "Are you ready ?";
  6821. next; // careful here
  6822. select("Yes");
  6823. // When a script hits a next, menu, sleep or input that pauses the script,
  6824. // players can invite or /leave and make changes in their party. To prevent
  6825. // this, we call getpartymember again and compare with the original values.
  6826. getpartymember getcharid(1), 1;
  6827. if ( $@partymembercount != .register_num ) {
  6828. mes "You've made changes to your party !";
  6829. close;
  6830. }
  6831. for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
  6832. if ( .@partymembercid[.@i] != $@partymembercid[.@i] ) {
  6833. mes "You've made changes to your party !";
  6834. close;
  6835. }
  6836. }
  6837. // Finally, it's safe to start the event!
  6838. warpparty "event_map", 0,0, getcharid(1);
  6839. ---------------------------------------
  6840. *getpartyleader(<party id>{,<type>})
  6841. This function returns some information about the given party-id's leader.
  6842. When type is omitted, the default information retrieved is the leader's name.
  6843. Possible types are:
  6844. 1: Leader account id
  6845. 2: Leader character id
  6846. 3: Leader's class
  6847. 4: Leader's current map name
  6848. 5: Leader's current level as stored on the party structure (may not be
  6849. current level if leader leveled up recently).
  6850. If retrieval fails (leader not found or party does not exist), this function
  6851. returns "null" instead of the character name, and -1 for the other types.
  6852. ---------------------------------------
  6853. *party_create("<party name>"{,<character id>{,<item share>,<item share type>}});
  6854. Organizes a party with the attached or specified character as leader. If
  6855. successful, the command returns 1 and sets the global temporary variable
  6856. "$@party_create_id" to the ID of the party created.
  6857. Additionally, item sharing options can be provided:
  6858. - Item Share: 0-Each Take (default), 1-Party Share
  6859. - Item Share Type: 0-Each Take (default), 1-Even Share
  6860. These values are returned upon failure:
  6861. 0: Unknown error.
  6862. -1: Player not found.
  6863. -2: Player already has a party.
  6864. -3: Party name exists.
  6865. ---------------------------------------
  6866. *party_destroy(<party id>);
  6867. Disbands a party. The command returns 1 upon success and 0 upon failure.
  6868. ---------------------------------------
  6869. *party_addmember(<party id>,<character id>);
  6870. Adds a player to an existing party.
  6871. The command returns 1 upon success, and these values upon failure:
  6872. 0: Unknown error.
  6873. -1: Player not found.
  6874. -2: Player already has a party.
  6875. -3: Party not found.
  6876. -4: Party is full.
  6877. -5: Another character from the same account is already in the party.
  6878. ---------------------------------------
  6879. *party_delmember({<character id>,<party id>});
  6880. Removes a player from his/her party. If no player is specified, the command
  6881. will run for the invoking player. If that player is the only party member
  6882. remaining, the party will be disbanded.
  6883. The command returns 1 upon success, and these values upon failure:
  6884. 0: Unknown error.
  6885. -1: Player not found.
  6886. -2: Party not found.
  6887. -3: Player is not in the party.
  6888. ---------------------------------------
  6889. *party_changeleader(<party id>,<character id>);
  6890. Transfers leadership of a party to the specified character.
  6891. The command returns 1 upon success, and these values upon failure:
  6892. 0: Unknown error.
  6893. -1: Party not found.
  6894. -2: Player not found.
  6895. -3: Player is not in the party.
  6896. -4: Player is already party leader.
  6897. ---------------------------------------
  6898. *party_changeoption(<party id>,<option>,<flag>);
  6899. Changes a party option.
  6900. Valid options are:
  6901. 0 - Exp Share (flags: 0-Each Take, 1-Even Share)
  6902. 1 - Item Share (flags: 0-Each Take, 1-Party Share)
  6903. 2 - Item Share Type (flags: 0-Each Take, 1-Even Share)
  6904. The command returns 1 upon success, and these values upon failure:
  6905. 0: Invalid option.
  6906. -1: Party not found.
  6907. ---------------------------------------
  6908. *opendressroom(<flag>{,<char_id>});
  6909. This will open the Dress Room window on the client connected to the invoking character.
  6910. mes "Close this window to open the Dress Room window.";
  6911. close2;
  6912. opendressroom(1);
  6913. end;
  6914. Valid flag are:
  6915. 1 - Open the Dress Room window
  6916. ---------------------------------------
  6917. *navigateto("<map>"{,<x>,<y>,<flag>,<hide_window>,<monster_id>,<char_id>});
  6918. Generates a navigation for attached or specified character. Requires client
  6919. 2011-10-10aRagEXE or newer.
  6920. The flag specifies how the client will calculate the specific route.
  6921. Valid flags are:
  6922. NAV_NONE - No services
  6923. NAV_AIRSHIP_ONLY - Airship only
  6924. NAV_SCROLL_ONLY - Scroll only
  6925. NAV_AIRSHIP_AND_SCROLL - Airship and Scroll
  6926. NAV_KAFRA_ONLY - Kafra only
  6927. NAV_KAFRA_AND_AIRSHIP - Kafra and Airship
  6928. NAV_KAFRA_AND_SCROLL - Kafra and Scroll
  6929. NAV_ALL - All services
  6930. When flag is not specified, the default value is NAV_KAFRA_AND_AIRSHIP.
  6931. The hide_window specifies whether to display (0) or hide (1) the navigation window.
  6932. By default the window is hidden.
  6933. You can specify the monster_id in combination with a mapname to make the
  6934. navigation system tell you, that you have reached the desired mob.
  6935. Note:
  6936. The client requires custom monster spawns be in the navigation file
  6937. for using the embedded client Navigation feature to work properly. In this
  6938. instance sending the player to the map where the monster spawns is a simpler
  6939. solution rather than sending the map and the monster_id.
  6940. ---------------------------------------
  6941. *hateffect(<Hat Effect ID>,<State>);
  6942. This will set a Hat Effect onto the player. The state field allows you to
  6943. enable (true) or disable (false) the effect on the player.
  6944. The Hat Effect constants can be found in db/const.txt starting with HAT_EF_*.
  6945. Requires client 2015-05-13aRagEXE or newer.
  6946. ---------------------------------------
  6947. *getrandomoptinfo(<type>);
  6948. Returns value of an attribute of current random option.
  6949. Valid attributes are:
  6950. ROA_ID - ID of current option
  6951. ROA_VALUE - Value field of current option
  6952. ROA_PARAM - Param field of current option
  6953. This script command is intended for using in random option scripts.
  6954. ---------------------------------------
  6955. *getequiprandomoption(<equipment index>,<index>,<type>{,<char id>});
  6956. Returns value of an attribute of a random option on an equipped item.
  6957. See 'getequipid' for a full list of valid equipment slots.
  6958. index parameter can be 0 to MAX_ITEM_RDM_OPT-1 (default 0-4).
  6959. For valid attribute types, see `getrandomoptinfo` command reference.
  6960. ---------------------------------------
  6961. *setrandomoption(<equipment slot>,<index>,<id>,<value>,<param>{,<char id>});
  6962. Sets <index+1>th random option for equipment equipped at <equipment slot>
  6963. to <id>, <value> and <param>.
  6964. See 'getequipid' for a full list of valid equipment slots.
  6965. index parameter can be 0 to MAX_ITEM_RDM_OPT-1 (default 0-4).
  6966. ID - ID of random option. See db/const.txt for constants.
  6967. Value - Value of random option
  6968. Param - Parameter of random option
  6969. ---------------------------------------
  6970. *clan_join(<clan id>{,<char id>});
  6971. The attached player joins the clan with the <clan id>. On a successful join,
  6972. true is returned, else false if the join failed.
  6973. If <char id> is specified, the specified player is used rather than the attached one.
  6974. ---------------------------------------
  6975. *clan_leave({<char id>});
  6976. The attached player will leave their clan. On a successful leave, true is returned,
  6977. else false if the leave failed.
  6978. If <char id> is specified, the specified player is used rather than the attached one.
  6979. ---------------------------------------
  6980. ========================
  6981. |14.- Channel commands.|
  6982. ========================
  6983. ---------------------------------------
  6984. *channel_create "<chname>","<alias>"{,"<password>"{<option>{,<delay>{,<color>{,<char_id>}}}}};
  6985. Creates a public channel with <chname> as the channel name. To protect the
  6986. channel, use <password> or write "null" to create it without a password.
  6987. Channel name must start with '#' and cannot be the same as the map or ally
  6988. channel names.
  6989. <alias> will be used to change the channel name when the channel message
  6990. is displayed.
  6991. <option> values are:
  6992. CHAN_OPT_BASE - Default option including CHAN_OPT_ANNOUNCE_SELF|CHAN_OPT_MSG_DELAY|CHAN_OPT_CAN_CHAT|CHAN_OPT_CAN_LEAVE
  6993. CHAN_OPT_ANNOUNCE_SELF - Show info for player itself if player has joined/leaves the channel
  6994. CHAN_OPT_ANNOUNCE_JOIN - Display message when player is joining the channel
  6995. CHAN_OPT_ANNOUNCE_LEAVE - Display message when player is leaving the channel
  6996. CHAN_OPT_MSG_DELAY - Enable chat delay for the channel
  6997. CHAN_OPT_COLOR_OVERRIDE - Player's unique font color will override channel's color
  6998. CHAN_OPT_CAN_CHAT - Player can chat in the channel
  6999. CHAN_OPT_CAN_LEAVE - Player can leave the channel
  7000. CHAN_OPT_AUTOJOIN - Players will auto join the channel at login
  7001. The <delay> is the minimum chat delay in millisecond for a single player before
  7002. the player can chat again in the same channel.
  7003. Use <color> hex code to set the color for this channel, if not defined, default
  7004. channel color will be used.
  7005. If <char_id> is defined, the channel will be a private channel and the player
  7006. will be the the channel owner.
  7007. Returns 1 on success.
  7008. /**
  7009. * This example will shows the message on this channel as
  7010. * [rAthena] Admin : Hello world!
  7011. * instead of
  7012. * #rathena Admin : Hello world!
  7013. **/
  7014. channel_create("#rathena","[rAthena]");
  7015. channel_create("#vip","[VIP]","vipmemberonly");
  7016. ---------------------------------------
  7017. *channel_setopt "<chname>",<option>,<value>;
  7018. Set option for the channel. Use 1 in <value> to set it, or 0 to unset.
  7019. The <option> values are the same as the 'channel_create' options.
  7020. For CHAN_OPT_MSG_DELAY, the delay in millisecond must be sent or use 0
  7021. to remove the delay at <value>.
  7022. Returns 1 on success.
  7023. // Example to set delay
  7024. channel_setopt("#global",CHAN_OPT_MSG_DELAY,5000);
  7025. Only for public and private channel.
  7026. ---------------------------------------
  7027. *channel_setcolor "<chname>",<color>;
  7028. To change channel color.
  7029. <color> uses hex RGB values.
  7030. Returns 1 on success.
  7031. ---------------------------------------
  7032. *channel_setpass "<chname>","<password>";
  7033. To set, unset, or change password of a channel.
  7034. Use "null" to remove the password.
  7035. Returns 1 on success.
  7036. Only for public and private channel.
  7037. ---------------------------------------
  7038. *channel_setgroup "<chname>",<group_id>{,...,<group_id>};
  7039. *channel_setgroup2 "<chname>",<array_of_groups>;
  7040. Set group restriction for a channel. Only player with matching <group_id>
  7041. are allowed to to join the channel.
  7042. By using 0 in the first group channel, the group restriction will be
  7043. removed from the channel config.
  7044. 'channel_setgroup2' receives input for group list as an array.
  7045. Returns 0 on failure, and 1 (or n groups count) on success.
  7046. // Example 1: Remove groups
  7047. channel_setgroup("#event",0);
  7048. // Example 2: Multiple values
  7049. channel_setgroup("#vip",2,5);
  7050. // Example 3: Using array
  7051. setarray .@staffs[0],2,3,4,10,99;
  7052. channel_setgroup("#staff",.@staffs);
  7053. Only for public and private channel.
  7054. ---------------------------------------
  7055. *channel_chat "<chname>","<message>"{,<color>};
  7056. Sends message to the channel.
  7057. Returns 1 on success.
  7058. // Example if channel doesn't have alias
  7059. channel_chat(#rathena,"Hello World!"); // #rathena Hello World!
  7060. // Example if channel has alias
  7061. channel_chat(#rathena,"Hello World!"); // [rAthena] Hello World!
  7062. ---------------------------------------
  7063. *channel_ban "<chname>",<char_id>;
  7064. Ban player from a public or private channel.
  7065. Channel's owner or group with PC_PERM_CHANNEL_ADMIN cannot be banned.
  7066. Returns 1 on success.
  7067. ---------------------------------------
  7068. *channel_unban "<chname>",<char_id>;
  7069. Unban player from a public or private channel.
  7070. Returns 1 on success.
  7071. ---------------------------------------
  7072. *channel_kick "<chname>",<char_id>;
  7073. *channel_kick "<chname>","<char_name>";
  7074. Kick player from a public or private channel.
  7075. Channel's owner or group with PC_PERM_CHANNEL_ADMIN cannot be kicked.
  7076. Returns 1 on success.
  7077. ---------------------------------------
  7078. *channel_delete "<chname>";
  7079. Delete an existing public or private channel. Cannot delete ally or
  7080. local map channel.
  7081. Returns 0 on success.
  7082. ---------------------------------------