diff options
Diffstat (limited to 'doc/sample')
27 files changed, 1607 insertions, 0 deletions
diff --git a/doc/sample/bank_test.txt b/doc/sample/bank_test.txt new file mode 100644 index 000000000..b040f80f2 --- /dev/null +++ b/doc/sample/bank_test.txt @@ -0,0 +1,67 @@ +//===== rAthena Script ======================================= +//= Sample: Bank Test +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20070315 +//===== Description: ========================================= +//= Contains commands needed for a basic bank. +//============================================================ + +prontera,162,188,1 script Bank Test 112,{ + cutin "kafra_06",2; + + mes "[Bank Test]"; + mes "Welcome to Prontera's Bank Test."; + mes "You can only deposit a minimal of"; + mes "1000z. What do you want to do?"; + next; + menu "Deposit",BANK_IN,"Withdraw",BANK_OUT,"Exit",B_EXIT2; +BANK_IN: + mes "[Bank Test]"; + mes "You must deposit the same of less"; + mes "amount of zeny that you carry."; + mes "How much do you want to deposit?"; + next; + input @kafrabank; + + if(@kafrabank<1000) goto B_EXIT2; + set @kafrabank2,@kafrabank*1/100; + if(@kafrabank+@kafrabank2>Zeny) goto BANK_F; + set Zeny,Zeny-@kafrabank-@kafrabank2; + set #kafrabank,#kafrabank+@kafrabank; + mes "You now have: ^135445" + @kafrabank2 + "z^000000"; + + goto B_EXIT; +BANK_OUT: + if(#kafrabank==0) goto BANK_F2; + mes "[Bank Test]"; + mes "You can only withdraw equally or below this quantity:"; + mes "^135445" + #kafrabank + "^000000z"; + mes "How much do you want to withdraw?"; + next; + input @kafrabank; + + if(@kafrabank<1) goto B_EXIT2; + if(@kafrabank>#kafrabank) goto BANK_F; + set #kafrabank,#kafrabank-@kafrabank; + set Zeny,Zeny+@kafrabank; + + goto B_EXIT; + +BANK_F: + mes "[Bank Test]"; + mes "You can't withdraw more than ^135445"+ #kafrabank + "^000000z."; + goto B_EXIT2; +BANK_F2: + mes "[Bank Test]"; + mes "Your account is empty, you may not withdraw at this time."; + goto B_EXIT2; + +B_EXIT: + mes "Thanks for using depositing"; +B_EXIT2: + mes "Good bye!"; + cutin "kafra_06",255; + close; +}
\ No newline at end of file diff --git a/doc/sample/basejob_baseclass_upper.txt b/doc/sample/basejob_baseclass_upper.txt new file mode 100644 index 000000000..fc0e9282e --- /dev/null +++ b/doc/sample/basejob_baseclass_upper.txt @@ -0,0 +1,18 @@ +//===== rAthena Script ======================================= +//= Sample: Class Constants +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20110123 +//===== Description: ========================================= +//= Outputs the values of class constants. +//============================================================ + +prontera,155,177,1 script Tell Me 725,{ + mes "[Tell Me]"; + mes "Class: " + Class; + mes "BaseClass: " + BaseClass; + mes "BaseJob: " + BaseJob; + mes "Upper: " + Upper; + close; +}
\ No newline at end of file diff --git a/doc/sample/checkoption.txt b/doc/sample/checkoption.txt new file mode 100644 index 000000000..0af9b2d36 --- /dev/null +++ b/doc/sample/checkoption.txt @@ -0,0 +1,17 @@ +//===== rAthena Script ======================================= +//= Sample: Checkoption +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20070315 +//===== Description: ========================================= +//= Demonstrates the 'checkoption' command. +//============================================================ + +prontera,156,89,6 script test_checkoption 117,{ + mes "Please enter a value of type!"; + input @value; + if(checkoption(@value) == 1) mes "True!"; + else if(checkoption(@value) == 0) mes "False!"; + close; +}
\ No newline at end of file diff --git a/doc/sample/delitem2.txt b/doc/sample/delitem2.txt new file mode 100644 index 000000000..6810a3c26 --- /dev/null +++ b/doc/sample/delitem2.txt @@ -0,0 +1,39 @@ +//===== rAthena Script ======================================= +//= Sample: Delitem2 +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20070315 +//===== Description: ========================================= +//= Demonstrates the 'delitem2' command. +//============================================================ + +prontera,160,182,5 script Delitem2 51,{ + mes "Item ID?"; + next; + input @nameid; + mes "Amount?"; + next; + input @amount; + mes "Identified? (0:no, 1:yes)"; + next; + input @iden; + mes "Refined how many times?"; + next; + input @ref; + mes "Attribute? (0:normal, 1:broken)"; + next; + input @attr; + mes "4 cards (one after another)..."; + next; + input @c1; + input @c2; + input @c3; + input @c4; + mes "Your command is:"; + mes "delitem2 "+@nameid+","+@amount+","+@iden+","+@ref+","+@attr+","+@c1+","+@c2+","+@c3+","+@c4; + next; + delitem2 @nameid,@amount,@iden,@ref,@attr,@c1,@c2,@c3,@c4; + mes "And here is the moment when your item should disappear! :P"; + close; +}
\ No newline at end of file diff --git a/doc/sample/getequipcardid.txt b/doc/sample/getequipcardid.txt new file mode 100644 index 000000000..9c2e506d4 --- /dev/null +++ b/doc/sample/getequipcardid.txt @@ -0,0 +1,25 @@ +//===== rAthena Script ======================================= +//= Sample: Getequipcardid +//===== By: ================================================== +//= Lupus +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= Demonstrates the 'getequipcardid' command. +//============================================================ + +prontera,155,177,4 script Check My Hat 810,{ + mes "Checking your head..."; + if (getequipisequiped(1)) { + set @id,getequipid(1); + set @ref,getequiprefinerycnt(1); + mes "Your hat is... "+getitemname(@id)+"..."; + if(@ref) mes "It has been refined "+@ref+" times."; + mes "Card Slot 0:"+getequipcardid(1,0)+" 1:"+getequipcardid(1,1); + mes "Card Slot 2:"+getequipcardid(1,2)+" 3:"+getequipcardid(1,3); + close; + } + mes "Nothing?"; + emotion e_hmm; + close; +}
\ No newline at end of file diff --git a/doc/sample/getequipid.txt b/doc/sample/getequipid.txt new file mode 100644 index 000000000..02d80780f --- /dev/null +++ b/doc/sample/getequipid.txt @@ -0,0 +1,16 @@ +//===== rAthena Script ======================================= +//= Sample: Getequipid +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= Demonstrates the 'getequipid' command. +//============================================================ + +prontera,161,181,6 script GetEquipID Sample 105,{ + mes "[GetEquipID Sample]"; + for(set .@i,1; .@i<11; set .@i,.@i+1) + mes "GetEquipID(" + .@i + ") : " + getequipid(1); + close; +}
\ No newline at end of file diff --git a/doc/sample/getiteminfo.txt b/doc/sample/getiteminfo.txt new file mode 100644 index 000000000..f2076cc75 --- /dev/null +++ b/doc/sample/getiteminfo.txt @@ -0,0 +1,23 @@ +//===== rAthena Script ======================================= +//= Sample: Getiteminfo +//===== By: ================================================== +//= Lupus +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= Demonstrates the 'getiteminfo' command. +//============================================================ + +prontera,156,179,6 script test_getiteminfo 117,{ + mes "Please enter an item ID."; + input .@value; + + // This line uses an INTERNAL function of your client to show item name by its ID! + // ^nItemID^XXXX -> Item Name + mes "Item ID: "+.@value+" ^nItemID^"+.@value; + + mes "Current item info:"; + for(set .@id,0; .@id<14; set .@id,.@id+1) + mes " getiteminfo("+.@value+","+.@id+") = "+getiteminfo(.@value,.@id); + close; +}
\ No newline at end of file diff --git a/doc/sample/getmonsterinfo.txt b/doc/sample/getmonsterinfo.txt new file mode 100644 index 000000000..084924739 --- /dev/null +++ b/doc/sample/getmonsterinfo.txt @@ -0,0 +1,23 @@ +//===== rAthena Script ======================================= +//= Sample: Getmonsterinfo +//===== By: ================================================== +//= Lupus +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= Demonstrates the 'getmonsterinfo' command. +//============================================================ + +prontera,156,179,6 script test_getmonsterinfo 117,{ + mes "Please enter a monster ID."; + input .@value; + if(getmonsterinfo(.@value,MOB_LV)<0 || getmonsterinfo(.@value,MOB_NAME)=="Dummy") { + mes "Invalid monster ID."; + close; + } + mes "Monster ID: "+.@value+" '"+getmonsterinfo(.@value,MOB_NAME)+"'"; + mes "Current Monster info:"; + for(set .@id,0; .@id<23; set .@id,.@id+1) + mes " getmonsterinfo("+.@value+","+@id+") = "+getmonsterinfo(.@value,@id); + close; +}
\ No newline at end of file diff --git a/doc/sample/gstorage_test.txt b/doc/sample/gstorage_test.txt new file mode 100644 index 000000000..9745b4b09 --- /dev/null +++ b/doc/sample/gstorage_test.txt @@ -0,0 +1,44 @@ +//===== rAthena Script ======================================= +//= Sample: Guild Storage Test +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20070315 +//===== Description: ========================================= +//= Contains commands needed for a guild warehouse NPC. +//============================================================ + +prontera,165,188,4 script Guild Warehouse 112,{ + cutin "kafra_06",2; + + mes "[Guild Warehouse Coupler]"; + mes "This is the guild warehouse coupler service."; + mes "You will not receive zeny for this is a test."; + next; + menu "Access Guild Warehouse", GS_OPEN, "Exit", GS_EXIT3; + +GS_OPEN: + set @flag,guildopenstorage(0); + if(@flag == 1) goto GS_EXIT1; + if(@flag == 2) goto GS_EXIT2; + goto GS_EXIT4; + +GS_EXIT1: + mes "[Guild Warehouse]"; + mes "The guild warehouse is being used right now."; + mes "Please wait a while, then come back."; + goto GS_EXIT4; + +GS_EXIT2: + mes "[Guild Warehouse]"; + mes "You can't use this service if you're not in a guild!"; + goto GS_EXIT4; + +GS_EXIT3: + mes "[Guild Warehouser]"; + mes "Come back whenever you want."; + +GS_EXIT4: + cutin "kafra_06",255; + close; +}
\ No newline at end of file diff --git a/doc/sample/localized_npc.txt b/doc/sample/localized_npc.txt new file mode 100644 index 000000000..b3946162e --- /dev/null +++ b/doc/sample/localized_npc.txt @@ -0,0 +1,151 @@ +//===== rAthena Script ======================================= +//= Sample localized NPC +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= v1.0 +//===== Compatible With: ===================================== +//= rAthena with setd, getd +//===== Description: ========================================= +//= Example of a localized NPC. +//= +//= There are many ways to do it, this is just one option. +//= The player has a global account variable ##_langid_ that +//= identifies the it's language. +//= +//= The default language should always have langid 0. +//= When a message isn't found for the player's langid +//= (strlen = 0), the message from langid 0 is used instead. +//= +//= Each message is identified by a string that must only +//= contain valid variable name characters. +//= +//= void setlang(int langid) +//= - sets the player's language +//= int getlang(void) +//= - returns the player's language +//= void setmes2(string name,int langid,string text) +//= - sets the localized text for name +//= string getmes2(string name,int langid) +//= - returns the localized text of name +//= void mes2(string name) +//= - displays the localized text of name +//= +//===== Additional Comments: ================================= +//= To use this globally, just put the functions in Global_Functions.txt +//============================================================ + +////////////////////////////////////////////////////////////// +/// Sets the language of the player account. +/// @param langid Languange identifier (0 for default) +function script setlang { + set ##_langid_, getarg(0); + return; +} + +////////////////////////////////////////////////////////////// +/// Returns the language identifier of the player +function script getlang { + return ##_langid_; +} + +////////////////////////////////////////////////////////////// +/// Sets a localized text entry. +/// Does not need a RID attached. +/// @param name Message identifier +/// @param langid Language identifier (0 for default) +/// @param text Text message +function script setmes2 { + set $@mes2_name$, getarg(0); + set $@mes2_langid, getarg(1); + set $@mes2_text$, getarg(2); + set $@mes2_var$, "$@__"+ $@mes2_name$ +"_"+ $@mes2_langid +"$"; + + //debugmes "setmes2 \""+ $@mes2_var$ +"\", \""+ $@mes2_text$ +"\";"; + + // set the localized text + setd $@mes2_var$, $@mes2_text$; + return; +} + +////////////////////////////////////////////////////////////// +/// Sets a localized text entry. +/// Does not need a RID attached. +/// @param name Message identifier +/// @param langid Language identifier (0 for default) +/// @return Text message +function script getmes2 { + set $@mes2_name$, getarg(0); + set $@mes2_langid, getarg(1); + set $@mes2_var$, "$@__"+ $@mes2_name$ +"_"+ $@mes2_langid +"$"; + set $@mes2_text$, getd($@mes2_var$); + + //debugmes "getmes2(\""+ $@mes2_var$ +"\")=\""+ $@mes2_text$ +"\""; + + return $@mes2_text$; +} + +////////////////////////////////////////////////////////////// +/// mes for localized text. +/// index should be a unique string, made up only of characters +/// that are valis as a variable name +/// @param index Message identifier +function script mes2 { + set @mes2_index$, getarg(0); + + if( getstrlen(@mes2_index$) == 0 ) + return; // invalid index + + // print localized text + set @mes2_text$, callfunc("getmes2",@mes2_index$,##_langid_); + if( getstrlen(@mes2_text$) == 0 ) + { + if( ##_langid_ != 0 ) + {// revert to default language + set @mes2_text$, callfunc("getmes2",@mes2_index$,0); + if( getstrlen(@mes2_text$) != 0 ) + mes @mes2_text$; // default text + } + } else + mes @mes2_text$; // localized text + return; +} + +////////////////////////////////////////////////////////////// +/// Sample localized NPC +prontera,155,183,4 script LocalizedNPC 705,{ + // Get text for specific languages + set @menu1$, callfunc("getmes2","LNPC_lang",0); + set @menu2$, callfunc("getmes2","LNPC_lang",1); + do { + // get text that fallbacks to language 0 + callfunc "mes2", "LNPC_name"; + // localized mes + callfunc "mes2", "LNPC_lang"; + callfunc "mes2", "LNPC_text"; + next; + + switch(select(@menu1$,@menu2$,"Cancel")) + { + case 1: + case 2: + // Set player language + callfunc "setlang",@menu-1; + break; + } + } while( @menu != 3 ); + close; + end; + +OnInterIfInitOnce: + // Load the localized text. + // This can be anywhere, as long as it's executed before the coresponding getmes2/mes2 calls + // 0 - English (default) + // 1 - Portuguese + callfunc "setmes2", "LNPC_name", 0, "[LocalizedNPC]"; + callfunc "setmes2", "LNPC_lang", 0, "EN"; + callfunc "setmes2", "LNPC_lang", 1, "PT"; + callfunc "setmes2", "LNPC_text", 0, "Something in english"; + callfunc "setmes2", "LNPC_text", 1, "Algo em portugu�s"; + end; +} diff --git a/doc/sample/npc_dynamic_shop.txt b/doc/sample/npc_dynamic_shop.txt new file mode 100644 index 000000000..b6ed48808 --- /dev/null +++ b/doc/sample/npc_dynamic_shop.txt @@ -0,0 +1,95 @@ +//===== rAthena Script ======================================= +//= Sample: Dynamic Shop +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20101219 +//===== Description: ========================================= +//= Contains commands needed for a dynamic shop. +//============================================================ + +// Dummy shop to insert items into: +- shop dyn_shop1 -1,501:50. + +prontera,181,200,4 script Dynamic Shop 123,{ + callshop "dyn_shop1",0; + npcshopattach "dyn_shop1"; + end; + +OnSellItem: + for(set @i, 0; @i < getarraysize(@sold_nameid); set @i, @i + 1){ + if(countitem(@sold_nameid[@i]) < @sold_quantity[@i] || @sold_quantity[@i] <= 0){ + mes "omgh4x!"; + close; + } else if(@sold_nameid[@i] == 501){ + delitem 501, @sold_quantity[@i]; + set $@rpotsleft, $@rpotsleft + @sold_quantity[@i]; + set Zeny, Zeny + @sold_quantity[@i]*20; + } else { + if(@sold_nameid[@i] == 502){ + delitem 502, @sold_quantity[@i]; + set $@opotsleft, $@opotsleft + @sold_quantity[@i]; + set Zeny, Zeny + @sold_quantity[@i]*100; + } else { + mes "Sorry, I don't need your items."; + close; + } + } + } + deletearray @sold_quantity, getarraysize(@sold_quantity); + deletearray @sold_nameid, getarraysize(@sold_nameid); + mes "Deal completed."; + close; + +OnBuyItem: + for(set @i, 0; @i < getarraysize(@bought_nameid); set @i, @i + 1){ + if(@bought_quantity[@i] <= 0){ + mes "omgh4x!"; + close; + } else if(@bought_nameid[@i] == 501){ + if(@bought_quantity[@i] > $@rpotsleft){ + if($@rpotsleft > 0){ + set @bought_quantity[@i], $@rpotsleft; + } else { + mes "We are out of red potions!"; + close; + } + } + if(Zeny >= 40*@bought_quantity[@i]){ + set Zeny, Zeny - 40*@bought_quantity[@i]; + getitem 501, @bought_quantity[@i]; + set $@rpotsleft, $@rpotsleft - @bought_quantity[@i]; + } else { + mes "You have insufficient cash."; + close; + } + } else { + if(@bought_quantity[@i] > $@opotsleft){ + if($@opotsleft > 0){ + set @bought_quantity[@i], $@opotsleft; + } else { + mes "We are out of orange potions!"; + close; + } + } + if(Zeny >= 200*@bought_quantity[@i]){ + set Zeny, Zeny - 200*@bought_quantity[@i]; + getitem 502, @bought_quantity[@i]; + set $@opotsleft, $@opotsleft - @bought_quantity[@i]; + } else { + mes "You have insufficient cash."; + close; + } + } + } + deletearray @bought_quantity, getarraysize(@bought_quantity); + deletearray @bought_nameid, getarraysize(@bought_nameid); + mes "Trade done."; + close; + +OnInit: + npcshopitem "dyn_shop1", 501,40,502,200; + set $@rpotsleft, 10; + set $@opotsleft, 10; + end; +}
\ No newline at end of file diff --git a/doc/sample/npc_extend_shop.txt b/doc/sample/npc_extend_shop.txt new file mode 100644 index 000000000..ccc2ce5bb --- /dev/null +++ b/doc/sample/npc_extend_shop.txt @@ -0,0 +1,30 @@ +//===== rAthena Script ======================================= +//= Sample: Extended Shops +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= An example of shop NPCs. +//============================================================ + +prontera,182,213,3 shop Super Novice Shop 716,1243:-1,2112:-1,2340:-1,2352:-1,2414:-1,2510:-1,2628:-1,5055:-1 +prontera,149,139,5 shop Whips Merchant 58,1951:-1,1953:-1,1955:-1,1957:-1,1959:-1,1961:-1,1962:-1,1963:-1,1964:-1 +prontera,162,175,3 shop Headgears Merchant 1 73,2209:-1,2210:-1,2211:-1,2221:-1,2223:-1,2217:-1,2227:-1,2231:-1,2225:-1,2229:-1 +prontera,162,172,3 shop Headgears Merchant 2 73,2203:-1,2212:-1,2218:-1,2239:-1,2241:-1,2242:-1,2243:-1,2263:-1,2265:-1,2276:-1,2288:-1,2291:-1,2297:-1 +prontera,162,169,3 shop Armours Merchant 73,2311:-1,2313:-1,2315:-1,2317:-1,2318:-1,2320:-1,2322:-1,2324:-1,2326:-1,2327:-1,2329:-1,2331:-1,2334:-1,2336:-1,2337:-1,2342:-1 +prontera,162,166,3 shop Shields Merchant 73,2102:-1,2104:-1,2106:-1,2108:-1,2109:-1,2110:-1,2111:-1 +prontera,162,163,3 shop Boots Merchant 73,2402:-1,2404:-1,2406:-1,2407:-1,2412:-1,2413:-1 +prontera,162,160,3 shop Robes Merchant 73,2502:-1,2504:-1,2506:-1,2507:-1,2508:-1,2509:-1 +prontera,162,157,3 shop Accessory Merchant 73,2601:-1,2602:-1,2603:-1,2604:-1,2605:-1,2607:-1,2608:-1,2615:-1,2616:-1,2618:-1,2619:-1 +prontera,162,154,3 shop Arrows Merchant 73,1750:-1,1751:-1,1752:-1,1753:-1,1754:-1,1755:-1,1756:-1,1757:-1,1758:-1,1759:-1,1760:-1,1761:-1,1762:-1,1763:-1,1764:-1,1765:-1,1766:-1,1767:-1,1768:-1,1769:-1 +prontera,162,151,3 shop Alchemist Shop 73.7127:-1,7128:-1,7129:-1,7130:-1,7131:-1,7132:-1,7133:-1,7144:-1,7134:-1,1093:-1 +prontera,162,148,3 shop Taming Merchant 73,619:-1,620:-1,621:-1,623:-1,624:-1,625:-1,626:-1,627:-1,628:-1,629:-1,630:-1,631:-1,632:-1,633:-1,634:-1,635:-1,636:-1,637:-1,638:-1,639:-1,640:-1,641:-1,642:-1,659:-1 +prontera,162,145,3 shop Pet Equipment 73,10001:-1,10002:-1,10003:-1,10004:-1,10005:-1,10006:-1,10007:-1,10008:-1,10009:-1,10010:-1,10011:-1,10012:-1,10013:-1,10014:-1,10015:-1,10016:-1,10017:-1,10018:-1,10019:-1,10020:-1 +prontera,148,234,5 shop Weapon Card Merchant 80,4004:100000,4018:100000,4025:100000,4026:100000,4019:100000,4029:100000,4043:100000,4017:100000,4020:100000,4024:100000,4037:100000,4055:100000,4057:100000,4076:100000,4096:100000,4104:100000,4030:100000,4049:100000,4062:100000,4069:100000,4085:100000,4007:100000,4060:100000,4063:100000,4068:100000,4080:100000,4094:100000,4111:100000,4118:100000,4082:20700,4092:100000,4126:100000,4072:100000,4115:100000,4035:100000,4086:100000,4106:100000,4117:100000,4125:100000 +prontera,148,231,5 shop Headgear Card Merchant 80,4010:100000,4039:100000,4046:100000,4052:100000,4087:100000,4110:100000,4112:100000,4122:100000,4127:100000 +prontera,146,229,5 shop Armor Card Merchant 80,4003:100000,4008:100000,4011:100000,4014:100000,4016:100000,4021:100000,4023:100000,4031:100000,4078:100000,4089:100000,4098:100000,4099:100000,4101:100000,4114:100000,4119:100000,4141:100000,4061:100000,4105:100000 +prontera,144,227,5 shop Shield Card Merchant 80,4013:100000,4032:100000,4058:100000,4059:100000,4066:100000,4074:100000,4083:100000,4120:100000,4124:100000,4136:100000,4138:100000,4045:100000,4067:100000,4075:100000,4090:100000 +prontera,142,225,5 shop Robe Card Merchant 80,4056:100000,4071:100000,4081:100000,4095:100000,4108:100000,4109:100000,4113:100000,4116:100000,4133:100000,4015:100000,4088:100000,4102:100000,4129:100000 +prontera,140,223,5 shop Shoes Card Merchant 80,4009:100000,4038:100000,4050:100000,4070:100000,4097:100000,4100:100000,4107:100000 +prontera,138,221,5 shop Accessory Card Merchant 80,4022:100500,4027:100500,4028:100500,4034:100500,4051:100500,4064:100500,4091:100500,4079:100500,4033:100500,4040:100500,4044:100500,4048:100500,4053:100500,4073:100500,4077:100500,4084:100500,4093:100500,4103:100500,4139:100500
\ No newline at end of file diff --git a/doc/sample/npc_live_dialogues.txt b/doc/sample/npc_live_dialogues.txt new file mode 100644 index 000000000..6ba1c7ee2 --- /dev/null +++ b/doc/sample/npc_live_dialogues.txt @@ -0,0 +1,54 @@ +//===== rAthena Script ======================================= +//= Sample: Live Dialogue +//===== By: ================================================== +//= Lupus +//===== Current Version: ===================================== +//= 20070320 +//===== Description: ========================================= +//= An example of an NPC with live dialogue. +//= Note: This relies on Global_Functions.txt to run. +//============================================================ + +prontera,167,177,5 script Luppy 1107,{ + mes "[Luppy]"; + + // Say a random greeting from Global_Functions.txt + mes callfunc("F_Hi"); + + // Say a compliment according to player's gender + // 1st string is for FEMALE, 2nd for MALE + mes callfunc("F_Sex","What a beautiful lady!","What a handsome man!"); + + // Add some random greeting and goodbye into the menu + menu callfunc("F_Hi"),-, callfunc("F_Bye"),M_BYE; + + mes "[Luppy]"; + // Give a random prize from set list of items + if(@gotstuff){ + // Again, say stuff according to player's gender + mes "I like "+callfunc("F_Sex","smiling ladies!","bloody pirates!"); + + // Show one of 3 emotion from the list (we added ,1 to show emotion over PLAYER's head) + emotion callfunc("F_RandMes",3,e_scissors,e_kis,e_pat),1; + close; + } + + // We set a temp var to give present just once. Player can get more by relogging. + set @gotstuff,1; + + // Get item ID from the list of presents: Apple, Mastela Fruit, Yggdrasil Seed or Orange Juice + set @itemIDfromList, callfunc("F_RandMes",4,512,522,608,620); + + // Again, say stuff according to player's gender + mes "Hey, "+callfunc("F_Sex","sister!","brother!")+" I have "+getitemname(@itemIDfromList)+" for you!"; + + // Get the item from the list + getitem @itemIDfromList,1; + close; + +M_BYE: + mes "[Luppy]"; + // Add some random goodbye from Global_Functions.txt + mes callfunc("F_Bye"); + close; +}
\ No newline at end of file diff --git a/doc/sample/npc_shop_test.txt b/doc/sample/npc_shop_test.txt new file mode 100644 index 000000000..c86562cb4 --- /dev/null +++ b/doc/sample/npc_shop_test.txt @@ -0,0 +1,40 @@ +//===== rAthena Script ======================================= +//= Sample: Shops +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20090206 +//===== Description: ========================================= +//= An example of shop NPCs. +//============================================================ + +// Near fountain in Prontera +prontera,156,192,3 shop Card Shop1 95,4001:100,4002:100,4003:100,4004:100,4005:100,4006:100,4007:100,4008:100,4009:100,4010:100,4011:100,4012:100,4013:100,4014:100,4015:100,4016:100,4017:100,4018:100,4019:100,4020:100,4021:100,4022:100,4023:100,4024:100,4025:100,4026:100,4027:100,4028:100,4029:100,4030:100,4031:100,4032:100,4033:100,4034:100,4035:100,4036:100,4037:100,4038:100,4039:100,4040:100,4041:100,4042:100,4043:100,4044:100,4045:100,4046:100,4047:100,4048:100,4049:100,4050:100 +prontera,154,192,1 shop Card Shop2 123,4051:100,4052:100,4053:100,4054:100,4055:100,4056:100,4057:100,4058:100,4059:100,4060:100,4061:100,4062:100,4063:100,4064:100,4065:100,4066:100,4067:100,4068:100,4069:100,4070:100,4071:100,4072:100,4073:100,4074:100,4075:100,4076:100,4077:100,4078:100,4079:100,4080:100,4081:100,4082:100,4083:100,4084:100,4085:100,4086:100,4087:100,4088:100,4089:100,4090:100,4091:100,4092:100,4093:100,4094:100,4095:100,4096:100,4097:100,4098:100,4099:100,4100:100 +prontera,158,192,1 shop Card Shop3 67,4101:100,4102:100,4103:100,4104:100,4105:100,4106:100,4107:100,4108:100,4109:100,4110:100,4111:100,4112:100,4113:100,4114:100,4115:100,4116:100,4117:100,4118:100,4119:100,4120:100,4121:100,4122:100,4123:100,4124:100,4125:100,4126:100,4127:100,4128:100,4129:100,4130:100,4131:100,4132:100,4133:100,4134:100,4135:100,4136:100,4137:100,4138:100,4139:100,4140:100,4141:100,4142:100,4143:100,4144:100,4145:100,4146:100,4147:100,4148:100 +prontera,144,205,1 shop Headgear Shop1 71,2201:100,2202:100,2203:100,2204:100,2205:100,2206:100,2207:100,2208:100,2209:100,2210:100,2211:100,2212:100,2213:100,2214:100,2215:100,2216:100,2217:100,2218:100,2219:100,2220:100,2221:100,2222:100,2223:100,2224:100,2225:100,2226:100,2227:100,2228:100,2229:100,2230:100,2231:100,2232:100,2233:100,2234:100,2235:100,2236:100,2237:100,2239:100,2240:100,2241:100,2242:100,2243:100,2244:100,2245:100,2246:100,2247:100,2248:100,2249:100,2250:100 +prontera,144,203,3 shop Headgear Shop2 101,2251:100,2252:100,2253:100,2254:100,2255:100,2256:100,2257:100,2258:100,2259:100,2260:100,2261:100,2262:100,2263:100,2264:100,2265:100,2266:100,2267:100,2268:100,2269:100,2270:100,2271:100,2272:100,2273:100,2274:100,2275:100,2276:100,2277:100,2278:100,2279:100,2280:100,2281:100,2282:100,2283:100,2284:100,2285:100,2286:100,2287:100,2288:100,2289:100,2290:100,2291:100,2292:100,2293:100,2294:100,2295:100,2296:100,2297:100,2298:100,2299:100 +prontera,144,201,3 shop Headgear Shop3 69,5001:100,5002:100,5003:100,5004:100,5005:100,5006:100,5007:100,5008:100,5009:100,5010:100,5011:100,5012:100,5013:100,5014:100,5015:100,5016:100,5017:100,5018:100,5019:100 +prontera,167,202,5 shop Accessories Shop 102,2601:100,2602:100,2603:100,2604:100,2605:100,2607:100,2608:100,2609:100,2610:100,2611:100,2612:100,2613:100,2614:100,2615:100,2616:100,2617:100,2618:100,2619:100,2620:100,2621:100,2622:100,2623:100,2624:100,2625:100,2626:100,2627:100,2628:100 +prontera,167,204,6 shop General Store 96,501:100,502:100,503:100,504:100,505:100,506:100,507:100,508:100,509:100,510:100,511:100,512:100,513:100,514:100,515:100,516:100,517:100,518:100,519:100,520:100,521:100,522:100,523:100,525:100,526:100,528:100,529:100,530:100,531:100,532:100,533:100,534:100,535:100,536:100,537:100,538:100,539:100,601:100,602:100,603:100,604:100,605:100,606:100,607:100,608:100,609:100,610:100 +prontera,167,206,6 shop Blacksmith Shop 90,714:100,715:100,716:100,717:100,718:100,719:100,720:100,721:100,722:100,723:100,724:100,725:100,726:100,727:100,728:100,729:100,730:100,731:100,732:100,733:100,756:100,757:100,984:100,985:100,990:100,991:100,992:100,993:100,994:100,995:100,996:100,997:100,1010:100,1011:100,998:100,999:100,1000:100,1001:100,1002:100,1003:100,913:100,920:100,718:100,958:100,957:100,922:100,963:100,923:100,968:100,1005:100,612:100,615:100,989:100 +prontera,164,204,5 shop Japan Store Limited 81,542:100,543:100,1766:100 + +// South-central Prontera +prontera,141,175,5 shop Bow man 102,1705:100,1711:100,1716:100,1719:100,1720:100,1750:1,1751:1,1752:1,1753:1,1754:1,1755:1,1756:1,1766:1,1065:1 +prontera,141,173,5 shop Sword shop 102,1117:100,1125:100,1155:100,1162:100,1130:100,1131:100,1132:100,1133:100,1134:100,1135:100,1136:100,1137:100,1138:100,1139:100,1140:100,1141:100,1161:100,1162:100,1163:100,1164:100,1165:100,1166:100,1167:100,1168:100,1169:100,1170:100 +prontera,141,171,5 shop Spear man 102,1408:100,1461:100,1464:100,1413:100,1414:100,1415:100,1416:100,1466:100,1467:100,1468:100,1469:100,1470:100,1471:100 +prontera,141,169,5 shop Axe man 102,1352:100,1355:100,1361:100,1363:100,1364:100,1365:100,1366:100,1367:100,1368:100,1369:100 +prontera,141,167,5 shop Dagger man 102,1208:100,1220:100,1223:100,1224:100,1225:100,1226:100,1227:100,1228:100,1229:100,1230:100,1231:100,1232:100,1233:100,1234:100,1235:100,1236:100,1237:100 +prontera,141,165,5 shop Mace shop 102,1505:100,1520:100,1514:100,1517:100,1522:100,1523:100,1524:100,1525:100,1526:100,1527:100,1528:100 +prontera,141,163,5 shop Katar shop 102,1251:100,1253:100,1255:100,1256:100,1257:100,1258:100,1259:100,1260:100,1261:100 +prontera,141,161,5 shop Rod man 102,1602:100,1608:100,1611:100,1613:100,1614:100,1615:100 +prontera,141,159,5 shop Bookstore 102,1550:100,1551:100,1552:100,1553:100,1554:100,1555:100,1556:100,1557:100,1558:100 +prontera,141,177,5 shop Armor shop 102,2306:100,2339:100,2311:100,2331:100,2336:100,2337:100,2326:100,2327:100,2315:100,2317:100,2102:100,2104:100,2106:100,2108:100,2402:100,2404:100,2406:100,2407:100,2408:100,2409:100,2502:100,2504:100,2506:100,2507:100,2508:100 + +// Pet Groomer Merchant +prontera,218,211,4 shop Pet Groomer 125,537:2500,643:3000,10013:1500,10014:2000 +izlude,164,138,4 shop Pet Groomer 124,537:2500,643:3000,10013:1500,10014:2000 +morocc,269,167,4 shop Pet Groomer 125,537:2500,643:3000,10013:1500,10014:2000 +geffen,193,152,4 shop Pet Groomer 124,537:2500,643:3000,10013:1500,10014:2000 +payon,142,104,4 shop Pet Groomer 124,537:2500,643:3000,10013:1500,10014:2000
\ No newline at end of file diff --git a/doc/sample/npc_test_array.txt b/doc/sample/npc_test_array.txt new file mode 100644 index 000000000..97aa5baf0 --- /dev/null +++ b/doc/sample/npc_test_array.txt @@ -0,0 +1,43 @@ +//===== rAthena Script ======================================= +//= Sample: Array Test +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20090206 +//===== Description: ========================================= +//= Demonstrates array commands. +//============================================================ + +prontera,164,190,1 script Array Test 112,{ + set @hoge[0],1; + set @hoge[1],5; + mes "Please enter a value for hoge[2]."; + next; + input @hoge[2]; + mes "hoge => " + @hoge; + mes "hoge[0]=> " + @hoge[0]; + mes "hoge[1]=> " + @hoge[1]; + mes "hoge[2]=> " + @hoge[2]; + next; + setarray @hoge[1],2,3,4,5; + mes "true: 5,1,2,3,4"; + mes "hoge size = "+ getarraysize(@hoge); + mes "hoge[0]=> " + @hoge[0]; + mes "hoge[1]=> " + @hoge[1]; + mes "hoge[2]=> " + @hoge[2]; + mes "hoge[3]=> " + @hoge[3]; + next; + copyarray @fuga[0],@hoge[2],2; + mes "true: 3,4,0"; + mes "fuga[0]=> " + @fuga[0]; + mes "fuga[1]=> " + @fuga[1]; + mes "fuga[2]=> " + @fuga[2]; + next; + deletearray @hoge[1],2; + mes "true: 1,4,5,0"; + mes "hoge[0]=> " + @hoge[0]; + mes "hoge[1]=> " + @hoge[1]; + mes "hoge[2]=> " + @hoge[2]; + mes "hoge[3]=> " + @hoge[3]; + close; +}
\ No newline at end of file diff --git a/doc/sample/npc_test_chat.txt b/doc/sample/npc_test_chat.txt new file mode 100644 index 000000000..7a8a65471 --- /dev/null +++ b/doc/sample/npc_test_chat.txt @@ -0,0 +1,37 @@ +//===== rAthena Script ======================================= +//= Sample: Chat Test +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= Demonstrates waitingroom commands. +//============================================================ + +prontera,158,182,0 script Chat Test::test0001 116,{ + mes "Trigger Number: " + getwaitingroomstate(2); + mes "Trigger State: " + getwaitingroomstate(3); + switch(select("Enable:Disable:Delete:Create")) { + case 1: + enablewaitingroomevent; + close; + case 2: + disablewaitingroomevent; + close; + case 3: + delwaitingroom; + close; + case 4: + waitingroom "Test",15,"test0001::OnChatEvent",1; + close; + } + +OnInit: + waitingroom "Test",15,"test0001::OnChatEvent",1; + end; + +OnChatEvent: + disablewaitingroomevent; + warpwaitingpc "prontera",160,180; + end; +}
\ No newline at end of file diff --git a/doc/sample/npc_test_checkweight.txt b/doc/sample/npc_test_checkweight.txt new file mode 100644 index 000000000..195ff856e --- /dev/null +++ b/doc/sample/npc_test_checkweight.txt @@ -0,0 +1,164 @@ +//===== rAthena Script ======================================= +//= Sample: CheckWeight +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20121113 +//===== Description: ========================================= +//= Demonstrates 'checkweight' command. +//============================================================ + +prontera,161,181,6 script ChkSpace 763,{ + +function ChkResult; +function FinalReport; + +L_RESET: + resetlvl(1); + getinventorylist; + for(set .@i,0; .@i < @inventorylist_count; set .@i,.@i+1){ + delitem(@inventorylist_id[.@i],@inventorylist_amount[.@i]); //clear inventory + } + + +L_TEST1: //basic backward chk + .@testid = 0; + .@succes = 0; + .@ret = checkweight(512,10); + set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success + .@ret = checkweight("Apple",10); + set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success + .@ret = checkweight(6320,33000); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure too many item amount item weight=0 + .@ret = checkweight("Premium_Reset_Stone",33000); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure too many item amount + .@ret = checkweight(717,500); + set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success weight based on max weight=2030 + .@ret = checkweight(717,1000); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure weight based on max weight=2030 + .@ret = checkweight(2794,100); + set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success + .@ret = checkweight(2794,101); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure (with MAX_INVENTORY = 100) + .@ret = checkweight(-1,1); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure invalide item id + .@ret = checkweight(512,0); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure invalide amount + + debugmes "End backward test"; + FinalReport(.@testid,.@succes); + + +L_TEST2: //update using list test + .@testid = 0; + .@succes = 0; + + .@ret = checkweight(512,10,513,10); + set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success + .@ret = checkweight("Apple",10,"Banana",10); + set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success + .@ret = checkweight(512,80,513,33000); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure + .@ret = checkweight("Apple",80,"Banana",33000); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure too many item amount + .@ret = checkweight("Apple",10,"Banana",21,512); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure invalid nb of args + .@ret = checkweight(717,500,716,100); + set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be succes weight 1800/2030 + .@ret = checkweight(717,500,716,500); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure weight 3000/2030 + .@ret = checkweight(2794,95,2795,5); + set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success + .@ret = checkweight(2794,95,2795,10); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure (with MAX_INVENTORY = 100) + .@ret = checkweight(512,1,-1,1); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure invalide item id + .@ret = checkweight(512,1,513,0); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure invalide amount + .@ret = checkweight(6320,31000,6320,2000); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure overamount inventory + .@ret = checkweight(512,1,513,1,514,1,515,1); + set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be sucess + + debugmes "End update by list tests"; + FinalReport(.@testid,.@succes); + +L_TEST3: //update using array tests + .@testid = 0; + .@succes = 0; + + setarray .@item[0], 512,513,514,515; + setarray .@count[0], 1,5,9,12; + .@ret = checkweight2(.@item,.@count); + set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be sucess + cleararray .@item[0], 0, 4; + cleararray .@count[0], 0, 4; + setarray .@item[0], 512,513,514,515; + setarray .@count[0], 1,5,-1,12; + .@ret = checkweight2(.@item,.@count); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, invalide amout + cleararray .@item[0], 0, 4; + cleararray .@count[0], 0, 4; + setarray .@item[0], 512,513,514,-1; + setarray .@count[0], 1,5,15,12; + .@ret = checkweight2(.@item,.@count); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, invalide id + cleararray .@item[0], 0, 4; + cleararray .@count[0], 0, 4; + setarray .@item[0], 717,715,716,714; + setarray .@count[0], 300,300,300,300; + .@ret = checkweight2(.@item,.@count); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, total by weight + cleararray .@item[0], 0, 4; + cleararray .@count[0], 0, 4; + setarray .@item[0], 6320,6320; + setarray .@count[0], 31000,2000; + .@ret = checkweight2(.@item,.@count); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, total by weight + cleararray .@item[0], 0, 2; + cleararray .@count[0], 0, 2; + setarray .@item[0], 2794,2795; + setarray .@count[0], 95,5; + .@ret = checkweight2(.@item,.@count); + set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success + setarray .@count[0], 95,10; + .@ret = checkweight2(.@item,.@count); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure overamount item + cleararray .@item[0], 0, 2; + cleararray .@count[0], 0, 2; + setarray .@item[0], 6320,6320,512; + setarray .@count[0], 1,3; + .@ret = checkweight2(.@item,.@count); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, size mistmatch + cleararray .@item[0], 0, 3; + cleararray .@count[0], 0, 2; + setarray .@item[0], 6320,6320; + setarray .@count[0], 1,3,5; + .@ret = checkweight2(.@item,.@count); + set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, size mistmatch + + + debugmes "End update by array tests"; + FinalReport(.@testid,.@succes); + +L_FINAL: + end; + + + function ChkResult { + .@tid = getarg(0); + .@expected = getarg(1); + .@ret = getarg(2); + .@sucess = (.@ret==.@expected); + debugmes "Test "+.@tid+" = "+(.@sucess?"Sucess":"Fail"); + return .@sucess; + } + + function FinalReport { + .@tdone = getarg(0); + .@succes = getarg(1); + debugmes "Results = Pass : "+.@succes+"/"+.@tdone+" Fails : "+(.@tdone-.@succes)+"/"+.@tdone; + if(.@succes != .@tdone) { debugmes "Some failure as occured, enable chkresult print to found out"; } + return; + } +} diff --git a/doc/sample/npc_test_duplicate.txt b/doc/sample/npc_test_duplicate.txt new file mode 100644 index 000000000..46684c3d2 --- /dev/null +++ b/doc/sample/npc_test_duplicate.txt @@ -0,0 +1,32 @@ +//===== rAthena Script ======================================= +//= Sample: Duplicate Test +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20070915 +//===== Description: ========================================= +//= An example of how duplicate NPCs are handled: +//= NPC variables are shared between all duplicates. +//= Each duplicate knows its own map coordinates. +//= Duplicates always override the source NPC's trigger area (even 0x0). +//= 'OnInit' loads the middle Poring last, for some reason. +//============================================================ + +- script Test Script -1,1,1,{ + mes "Hi."; + mes "My coords are "+ .map$ +", "+ .x +"/" +.y ; + close; + +OnInit: + getmapxy(.map$, .x, .y, 1); + end; + +OnTouch: + getmapxy(.map$, .x, .y, 1); + emotion e_scissors; + end; +} + +prontera,150,175,4 duplicate(Test Script) Test1 909 +prontera,155,175,4 duplicate(Test Script) Test2 909,2,2 +prontera,160,175,4 duplicate(Test Script) Test3 909,3,3
\ No newline at end of file diff --git a/doc/sample/npc_test_func.txt b/doc/sample/npc_test_func.txt new file mode 100644 index 000000000..1a60ac69d --- /dev/null +++ b/doc/sample/npc_test_func.txt @@ -0,0 +1,35 @@ +//===== rAthena Script ======================================= +//= Sample: Functions +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20120901 +//===== Description: ========================================= +//= Demonstrates use of functions. +//============================================================ + +// Define the function func001 +function script func001 { + mes "Hello there!"; + next; + return; // Return to script +} + +// Define the function func002 +function script func002 { + return "I'm a function"; +} + +// Uses 3 different methods of displaying dialogue from both internal and external sources. +prontera,168,189,1 script Functions 112,{ + callfunc "func001"; // Calls func001 and displays "Hello there!" + mes callfunc("func002"); // Calls func002 and displays "I'm a function" + next; + callsub L_SUB001; // Calls the label L_SUB001 and displays "I'm a label" + close; + end; + +L_SUB001: + mes "I'm a label"; + return; +} diff --git a/doc/sample/npc_test_npctimer.txt b/doc/sample/npc_test_npctimer.txt new file mode 100644 index 000000000..f3f661b6d --- /dev/null +++ b/doc/sample/npc_test_npctimer.txt @@ -0,0 +1,42 @@ +//===== rAthena Script ======================================= +//= Sample: NPC Timers +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= Demonstrates NPC timer commands. +//============================================================ + +prontera,156,183,0 script NPCtimerTest::npctimerX0000 116,{ + mes "Timer value" + getnpctimer(0); + mes "State timer" + getnpctimer(1,"npctimerX0000"); + mes "Number of events" + getnpctimer(2); + switch(select("Initialization:Stop:Start:Settings")) { + case 1: + initnpctimer; + close; + case 2: + stopnpctimer; + close; + case 3: + startnpctimer; + close; + case 4: + input .@temp; + setnpctimer .@temp; + close; + } + +OnTimer1000: + npctalk "After a second..."; + end; + +OnTimer5000: + npctalk "After 5 seconds..."; + end; + +OnTimer10000: + npctalk "After 10 seconds..."; + end; +}
\ No newline at end of file diff --git a/doc/sample/npc_test_npctimer2.txt b/doc/sample/npc_test_npctimer2.txt new file mode 100644 index 000000000..bd634b9d2 --- /dev/null +++ b/doc/sample/npc_test_npctimer2.txt @@ -0,0 +1,23 @@ +//===== rAthena Script ======================================= +//= Sample: Attached NPC Timers +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= Demonstrates attached NPC timer commands. +//============================================================ + +prontera,156,183,0 script NPCtimerTest::npctimerX0000 116,{ + mes "What would you like to know?"; + select("Tell me my level."); + mes "I need time to think..."; + initnpctimer; + attachnpctimer; + close; + +OnTimer5000: + mes "Ah, your level is " + readparam(11) + "!"; + detachnpctimer; + close; +}
\ No newline at end of file diff --git a/doc/sample/npc_test_pcre.txt b/doc/sample/npc_test_pcre.txt new file mode 100644 index 000000000..adc96f585 --- /dev/null +++ b/doc/sample/npc_test_pcre.txt @@ -0,0 +1,402 @@ +//===== rAthena Script ======================================= +//= Sample: PCRE +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20100108 +//===== Description: ========================================= +//= Demonstrates PCRE commands. +//============================================================ + +prontera,152,181,5 script MouseJstr 763,{ + +// hello +Lquote0: + npctalk "How do you do. Please state your problem."; + end; + +// computer +Lquote1: + switch(rand(4)) { + case 0: npctalk "Do computers worry you?"; break; + case 1: npctalk "What do you think about machines?"; break; + case 2: npctalk "Why do you mention computers?"; break; + case 3: npctalk "What do you think machines have to do with your problem?"; break; + } + end; + +// name +Lquote2: + npctalk "I am not interested in names"; + end; + +// sorry +Lquote3: + switch(rand(3)) { + case 0: npctalk "Please don't apologize"; break; + case 1: npctalk "Apologies are not necessary"; break; + case 2: npctalk "What feelings do you have when you apologize"; break; + } + end; + +// I remember $@p2$ +Lquote4: + switch(rand(6)) { + case 0: npctalk "Do you often think of "+$@p2$+"?"; break; + case 1: npctalk "Does thinking of "+$@p2$+" bring anything else to mind?"; break; + case 2: npctalk "What else do you remember?"; break; + case 3: npctalk "Why do you recall "+$@p2$+" right now?"; break; + case 4: npctalk "What in the present situation reminds you of "+$@p2$+"?"; break; + case 5: npctalk "What is the connection between me and "+$@p2$+"?"; break; + } + end; + +// do you remember +Lquote5: + switch (rand(4)) { + case 0: npctalk "Did you think I would forget "+$@p2$+" ?"; break; + case 1: npctalk "Why do you think I should recall "+$@p2$+" now"; break; + case 2: npctalk "What about "+$@p2$+""; break; + case 3: npctalk "You mentioned "+$@p2$+""; break; + } + end; + +// if +Lquote6: + switch(rand(4)) { + case 0: npctalk "Do you really think its likely that "+$@p2$+""; break; + case 1: npctalk "Do you wish that "+$@p2$+"?"; break; + case 2: npctalk "What do you think about "+$@p2$+"?"; break; + case 3: npctalk "Really-- if "+$@p2$+"?"; break; + } + end; + +// i dreamt +Lquote7: + switch(rand(3)) { + case 0: npctalk "Really-- "+$@p2$+""; break; + case 1: npctalk "Have you ever fantasized "+$@p2$+" while you were awake?"; break; + case 2: npctalk "Have you dreamt "+$@p2$+" before?"; break; + } + end; + +// dream about +Lquote8: + npctalk "How do you feel about "+$@p2$+" in reality?"; + end; + +// dream +Lquote9: + switch(rand(4)) { + case 0: npctalk "What does this dream suggest to you?"; break; + case 1: npctalk "Do you dream often?"; break; + case 2: npctalk "What persons appear in your dreams?"; break; + case 3: npctalk "Don't you believe that dream has to do with your problem?"; break; + } + end; + +// my mother +Lquote10: + switch(rand(2)) { + case 0: npctalk "Who else in your family "+$@p2$+""; break; + case 1: npctalk "Tell me more about your family"; break; + } + end; + +// my father +Lquote11: + switch(rand(3)) { + case 0: npctalk "Your father"; break; + case 1: npctalk "Does he influence you strongly?"; break; + case 2: npctalk "What else comes to mind when you think of your father?"; break; + } + end; + +// I want +Lquote12: + switch(rand(3)) { + case 0: npctalk "What would it mean if you got "+$@p2$+""; break; + case 1: npctalk "Why do you want "+$@p2$+""; break; + case 2: npctalk "Suppose you got "+$@p2$+" soon"; break; + } + end; + +// I am glad +Lquote13: + switch(rand(3)) { + case 0: npctalk "How have I helped you to be "+$@p2$+""; break; + case 1: npctalk "What makes you happy just now"; break; + case 2: npctalk "Can you explain why you are suddenly "+$@p2$+""; break; + } + end; + +// I am sad +Lquote14: + switch(rand(2)) { + case 0: npctalk "I am sorry to hear you are depressed"; break; + case 1: npctalk "I'm sure its not pleasant to be sad"; break; + } + end; + +// $@p2 are like "+$@p3$+" +Lquote15: + npctalk "What resemblance do you see between "+$@p2$+" and "+$@p3$+""; + end; + +// "+$@p2$+" is like "+$@p3$+" +Lquote16: + switch(rand(4)) { + case 0: npctalk "In what way is it that "+$@p2$+" is like "+$@p3$+""; break; + case 1: npctalk "What resemblance do you see?"; break; + case 2: npctalk "Could there really be some connection?"; break; + case 3: npctalk "How?"; break; + } + end; + +// alike +Lquote17: + switch(rand(2)) { + case 0: npctalk "In what way?"; break; + case 1: npctalk "What similarities are there?"; break; + } + end; + +// same +Lquote18: + npctalk "What other connections do you see?"; + end; + +// I was "+$@p2$+" +Lquote19: + switch(rand(3)) { + case 0: npctalk "Were you really?"; break; + case 1: npctalk "Perhaps I already knew you were "+$@p2$+""; break; + case 2: npctalk "Why do you tell me you were "+$@p2$+" now?"; break; + } + end; + +// was I +Lquote20: + switch(rand(3)) { + case 0: npctalk "What if you were "+$@p2$+" ?"; break; + case 1: npctalk "Do you thin you were "+$@p2$+""; break; + case 2: npctalk "What would it mean if you were "+$@p2$+""; break; + } + end; + +// I am +Lquote21: + switch(rand(2)) { + case 0: npctalk "In what way are you "+$@p2$+""; break; + case 1: npctalk "Do you want to be "+$@p2$+" ?"; break; + } + end; + +// am I +Lquote22: + switch(rand(4)) { + case 0: npctalk "Do you believe you are "+$@p2$+""; break; + case 1: npctalk "Would you want to be "+$@p2$+""; break; + case 2: npctalk "You wish I would tell you you are "+$@p2$+""; break; + case 3: npctalk "What would it mean if you were "+$@p2$+""; break; + } + end; + +// am +Lquote23: + switch(rand(2)) { + case 0: npctalk "Why do you say AM?"; break; + case 1: npctalk "I don't understand that"; break; + } + end; + +// are you +Lquote24: + switch(rand(3)) { + case 0: npctalk "Why are you interested in whether I am "+$@p2$+" or not?"; break; + case 1: npctalk "Would you prefer if I weren't "+$@p2$+""; break; + case 2: npctalk "Perhaps I am "+$@p2$+" in your fantasies"; break; + } + end; + +// you are +Lquote25: + npctalk "What makes you think I am "+$@p2$+" ?"; + end; + +// because +Lquote26: + switch(rand(3)) { + case 0: npctalk "Is that the real reason?"; break; + case 1: npctalk "What other reasons might there be?"; break; + case 2: npctalk "Does that reason seem to explain anything else?"; break; + } + end; + +// were you +Lquote27: + switch(rand(3)) { + case 0: npctalk "Perhaps I was "+$@p2$+""; break; + case 1: npctalk "What do you think?"; break; + case 2: npctalk "What if I had been "+$@p2$+""; break; + } + end; + +// I can't +Lquote28: + switch(rand(2)) { + case 0: npctalk "Maybe you could "+$@p3$+" now"; break; + case 1: npctalk "What if you could "+$@p3$+" ?"; break; + } + end; + +// I feel +Lquote29: + npctalk "Do you often feel "+$@p2$+" ?"; + end; + +// I felt +Lquote30: + npctalk "What other feelings do you have?"; + end; + +// $@p1$ I $@p2$ you $@p3$ +Lquote31: + npctalk "Perhaps in your fantasy we "+$@p3$+" each other?"; + end; + +// why don't you +Lquote32: + switch(rand(3)) { + case 0: npctalk "Should you "+$@p3$+" yourself?"; break; + case 1: npctalk "Do you believe I don't "+$@p3$+""; break; + case 2: npctalk "Perhaps I will "+$@p3$+" in good time"; break; + } + end; + +// yes +Lquote33: + switch(rand(3)) { + case 0: npctalk "You seem quite positive"; break; + case 1: npctalk "You are sure?"; break; + case 2: npctalk "I understand"; break; + } + end; + +// no +Lquote34: + switch(rand(3)) { + case 0: npctalk "Why not?"; break; + case 1: npctalk "You are being a bit negative"; break; + case 2: npctalk "Are you saying NO just to be negative?"; break; + } + end; + +// someone +Lquote35: + npctalk "Can you be more specific?"; + end; + +// everyone +Lquote36: + switch(rand(4)) { + case 0: npctalk "surely not everyone"; break; + case 1: npctalk "Can you think of anyone in particular?"; break; + case 2: npctalk "Who for example?"; break; + case 3: npctalk "You are thinking of a special person?"; break; + } + end; + +// always +Lquote37: + switch(rand(4)) { + case 0: npctalk "Can you think of a specific example?"; break; + case 1: npctalk "When?"; break; + case 2: npctalk "What incident are you thinking of?"; break; + case 3: npctalk "Really-- always?"; break; + } + end; + +// what +Lquote38: + switch(rand(5)) { + case 0: npctalk "Why do you ask?"; break; + case 1: npctalk "Does that question interest you?"; break; + case 2: npctalk "What is it you really want to know?"; break; + case 3: npctalk "What do you think?"; break; + case 4: npctalk "What comes to your mind when you ask that?"; break; + } + end; + +// perhaps +Lquote39: + npctalk "You do not seem quite certain"; + end; + +// are +Lquote40: + switch(rand(2)) { + case 0: npctalk "Did you think they might not be "+$@p2$+""; break; + case 1: npctalk "Possibly they are "+$@p2$; break; + } + end; + +// default +Lquote41: + switch(rand(6)) { + case 0: npctalk "Very interesting"; break; + case 1: npctalk "I am not sure I understand you fully"; break; + case 2: npctalk "What does that suggest to you?"; break; + case 3: npctalk "Please continue"; break; + case 4: npctalk "Go on"; break; + case 5: npctalk "Do you feel strongly about discussing such things?"; break; + } + end; + +OnInit: + defpattern 1, "([^:]+):.*\\shello.*", "Lquote0"; + defpattern 1, "([^:]+):.*\\scomputer.*", "Lquote1"; + defpattern 1, "([^:]+):.*\\sname.*", "Lquote2"; + defpattern 1, "([^:]+):.*\\ssorry.*", "Lquote3"; + defpattern 1, "([^:]+):.*\\si\\s+remember\\s+(.*)", "Lquote4"; + defpattern 1, "([^:]+):.*\\sdo\\s+you\\s+remember\\s+(.*)", "Lquote5"; + defpattern 1, "([^:]+):.*\\sif\\s+(.*)", "Lquote6"; + defpattern 1, "([^:]+):.*\\si\\s+dreamt\\s+(.*)", "Lquote7"; + defpattern 1, "([^:]+):.*\\sdream\\s+about\\s+(.*)", "Lquote8"; + defpattern 1, "([^:]+):.*\\sdream\\s+(.*)", "Lquote9"; + defpattern 1, "([^:]+):.*\\smy\\s+mother\\s+(.*)", "Lquote10"; + defpattern 1, "([^:]+):.*\\smy\\s+father\\s+(.*)", "Lquote11"; + defpattern 1, "([^:]+):.*\\si\\s+want\\s+(.*)", "Lquote12"; + defpattern 1, "([^:]+):.*\\si\\s+am\\s+glad\\s+(.*)", "Lquote13"; + defpattern 1, "([^:]+):\\s+(.*)\\s+i\\s+am\\s+sad\\s+(.*)", "Lquote14"; + defpattern 1, "([^:]+):\\s+(.*)\\s+are\\s+like\\s+(.*)", "Lquote15"; + defpattern 1, "([^:]+):\\s+(.*)\\s+is\\s+like\\s+(.*)", "Lquote16"; + defpattern 1, "([^:]+):.*\\salike\\s+(.*)", "Lquote17"; + defpattern 1, "([^:]+):.*\\ssame\\s+(.*)", "Lquote18"; + defpattern 1, "([^:]+):.*\\si\\s+was\\s+(.*)", "Lquote19"; + defpattern 1, "([^:]+):.*\\swas\\s+i\\s+(.*)", "Lquote20"; + defpattern 1, "([^:]+):.*\\si\\s+am\\s+(.*)", "Lquote21"; + defpattern 1, "([^:]+):.*\\sam\\s+i\\s+(.*)", "Lquote22"; + defpattern 1, "([^:]+):.*\\sam\\s+(.*)", "Lquote23"; + defpattern 1, "([^:]+):.*\\sare\\s+you\\s+(.*)", "Lquote24"; + defpattern 1, "([^:]+):.*\\syou\\s+are\\s+(.*)", "Lquote25"; + defpattern 1, "([^:]+):.*\\sbecause\\s+(.*)", "Lquote26"; + defpattern 1, "([^:]+):.*\\swere\\s+you\\s+(.*)", "Lquote27"; + defpattern 1, "([^:]+):.*\\si\\s+(cant|can't|cannot)\\s+(.*)", "Lquote28"; + defpattern 1, "([^:]+):.*\\si\\s+feel\\s+(.*)", "Lquote29"; + defpattern 1, "([^:]+):.*\\si\\s+felt\\s+(.*)", "Lquote30"; + defpattern 1, "([^:]+):.*\\si\\s+(.*)\\s+you\\s+(.*)", "Lquote31"; + defpattern 1, "([^:]+):.*\\swhy\\s+(don't|dont)\\s+you\\s+(.*)", "Lquote32"; + defpattern 1, "([^:]+):.*\\syes\\s+(.*)", "Lquote33"; + defpattern 1, "([^:]+):.*\\sno\\s+(.*)", "Lquote34"; + defpattern 1, "([^:]+):.*\\ssomeone\\s+(.*)", "Lquote35"; + defpattern 1, "([^:]+):.*\\severyone\\s+(.*)", "Lquote36"; + defpattern 1, "([^:]+):.*\\salways\\s+(.*)", "Lquote37"; + defpattern 1, "([^:]+):.*\\swhat\\s+(.*)", "Lquote38"; + defpattern 1, "([^:]+):.*\\sperhaps\\s+(.*)", "Lquote39"; + defpattern 1, "([^:]+):.*\\sare\\s+(.*)", "Lquote40"; + defpattern 1, "([^:]+):(.*)", "Lquote41"; + + activatepset 1; + end; +} diff --git a/doc/sample/npc_test_quest.txt b/doc/sample/npc_test_quest.txt new file mode 100644 index 000000000..15fcdc210 --- /dev/null +++ b/doc/sample/npc_test_quest.txt @@ -0,0 +1,48 @@ +//===== rAthena Script ======================================= +//= Sample: Quest Test +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20121227 +//===== Description: ========================================= +//= Demonstrates quest commands. +//============================================================ + +// Before installing an NPC like the one below, you would +// need to add the quest to /db/quest_db.txt - e.g: +// 70000,0,1002,3,0,0,0,0,"3 Splats Please!" + +prontera,90,95,1 script Jelly 123,{ + if(checkquest(70000) == -1) { // Quest not yet started. + mes "[Jelly]"; + mes "Hey there! Would you help me?"; + next; + switch(select("I'd rather not:What's up?")){ + case 1: + mes "[Jelly]"; + mes "I didn't want your help anyway!"; + close; + case 2: + mes "[Jelly]"; + mes "Those Porings are weirding me out."; + mes "Would you kill 3 for me?"; + setquest 70000; // Adds the quest to your Quest Window. + close; + } + } else if(checkquest(70000,HUNTING) == 2) { // All monsters killed. + mes "[Jelly]"; + mes "Awesome! Thank you!"; + getexp 10000,0; + dispbottom "You have been rewarded with 10,000 Base Exp."; + completequest 70000; // Sets quest status to "complete". + close; + } else if(checkquest(70000) == 1) { // Quest is active. + mes "[Jelly]"; + mes "Keep going, almost there!"; + close; + } else if(checkquest(70000) == 2) { // Quest finished. + mes "[Jelly]"; + mes "Thanks again for doing that for me!"; + close; + } +}
\ No newline at end of file diff --git a/doc/sample/npc_test_setitemx.txt b/doc/sample/npc_test_setitemx.txt new file mode 100644 index 000000000..eba53e008 --- /dev/null +++ b/doc/sample/npc_test_setitemx.txt @@ -0,0 +1,49 @@ +//===== rAthena Script ======================================= +//= Sample: Setiteminfo & Setitemscript +//===== By: ================================================== +//= Lupus +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= Demonstrates 'setiteminfo' and 'setitemscript' commands. +//============================================================ + +prontera,164,161,5 script Lupus 1013,{ + menu + "Make Knife[3] Edible",M_1, + "Make Apple Equippable",M_2, + "Edible Knife = Full SP",M_3, + "Knife = Weapon + 3 Notes",M_4; + close; + +M_1: + mes "Ok. We made Knife[3] edible."; + setiteminfo(1201,2,0); //type = 0 : potion + setitemscript(1201,"{dispbottom \"* You used Knife[3]\";}"); + close; + +M_2: + mes "Ok. We made Apple equippable."; + setiteminfo(512,2,5); //item type -> headgear (type = 5) + setiteminfo(512,5,512); //where to equip to (equip = 512) + setiteminfo(512,11,256); //set as headgear location (loc = 256) + setiteminfo(512,14,85); //set Headgear Sprite ID (view id = 85) + setitemscript(512,"{dispbottom \"* Other item's changed\";}",0); + setitemscript(512,"{dispbottom \"* Equipped\";}",1); + setitemscript(512,"{dispbottom \"* Unequipped\";}",2); + close; + +M_3: + mes "Ok. Now edible Knife[3] restores your SP."; + setitemscript(1201,2,0); + setitemscript(1201,"{dispbottom \"* You ate Knife[3] + Full SP\"; percentheal 0,100;}"); + close; + +M_4: + mes "Ok. We made Knife a weapon, but added 3 notes."; + setiteminfo(1201,2,4); //type = 4 : weapon again + setitemscript(1201,"{dispbottom \"* 1 Used\";}",0); + setitemscript(1201,"{dispbottom \"* 2 Equipped\";}",1); + setitemscript(1201,"{dispbottom \"* 3 Unequipped\";}",2); + close; +} diff --git a/doc/sample/npc_test_setmapflag.txt b/doc/sample/npc_test_setmapflag.txt new file mode 100644 index 000000000..00da0d37d --- /dev/null +++ b/doc/sample/npc_test_setmapflag.txt @@ -0,0 +1,32 @@ +//===== rAthena Script ======================================= +//= Sample: Mapflag Test +//===== By: ================================================== +//= Jbain +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= Demonstrates mapflag commands. +//============================================================ + +prontera,165,145,0 script EXPflagtest 123,{ + mes "[EXPflagtest]"; + mes "Set up the map rates:"; + switch(select("Job EXP:Base EXP:PVP on:Reset all flags")) { + case 1: + input .@rate; + setmapflag "prontera",MF_JEXP,.@rate; + close; + case 2: + input .@rate; + setmapflag "prontera",MF_BEXP,.@rate; + close; + case 3: + setmapflag "prontera",MF_PVP; + close; + case 4: + removemapflag "prontera",MF_BEXP; + removemapflag "prontera",MF_JEXP; + removemapflag "prontera",MF_PVP; + close; + } +}
\ No newline at end of file diff --git a/doc/sample/npc_test_skill.txt b/doc/sample/npc_test_skill.txt new file mode 100644 index 000000000..99eaa9f37 --- /dev/null +++ b/doc/sample/npc_test_skill.txt @@ -0,0 +1,33 @@ +//===== rAthena Script ======================================= +//= Sample: Skill +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20121003 +//===== Description: ========================================= +//= Demonstrates the 'skill' command. +//============================================================ + +// skill <skill id>,<level>{,<flag>}; +// flag=0 Grants the skill permanently +// flag=1 Grants the skill temporarily +// flag=2 Level bonus, stackable +// If flag is undefined, it defaults to 1 +// View db/(pre-)re/skill_db.txt for skill IDs + +prontera,157,182,0 script Skills 116,{ + mes "What skill would you like?"; + switch(select("First Aid:Play Dead:Heal:None")) { + case 1: + skill 142,1,0; // Permanently gives player level 1 First Aid + close; + case 2: + skill 143,1,0; // Permanently gives player level 1 Play Dead + close; + case 3: + skill 28,3,1; // Temporarily gives player level 3 Heal + close; + case 4: + close; + } +} diff --git a/doc/sample/npc_test_time.txt b/doc/sample/npc_test_time.txt new file mode 100644 index 000000000..8c5cbdb3e --- /dev/null +++ b/doc/sample/npc_test_time.txt @@ -0,0 +1,25 @@ +//===== rAthena Script ======================================= +//= Sample: Time Test +//===== By: ================================================== +//= rAthena Dev Team +//===== Current Version: ===================================== +//= 20070315 +//===== Description: ========================================= +//= Demonstrates time commands. +//============================================================ + +prontera,157,181,6 script Time Sample 105,{ + mes "[Time Sample]"; + mes "System Tick : " + gettimetick(0); + mes " Time Tick : " + gettimetick(1); + mes " GetTime(0) : " + gettime(0); + mes " GetTime(1) : " + gettime(1) + " (Sec)"; + mes " GetTime(2) : " + gettime(2) + " (Min)"; + mes " GetTime(3) : " + gettime(3) + " (Hour)"; + mes " GetTime(4) : " + gettime(4) + " (WeekDay)"; + mes " GetTime(5) : " + gettime(5) + " (MonthDay)"; + mes " GetTime(6) : " + gettime(6) + " (Month)"; + mes " GetTime(7) : " + gettime(7) + " (Year)"; + mes " GetTimeStr : " + gettimestr("%Y-%m/%d %H:%M:%S",19); + close; +}
\ No newline at end of file |