diff options
author | Haru <haru@dotalux.com> | 2013-12-26 01:34:12 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-12-30 16:08:20 +0100 |
commit | 21fa0901dc8723627c6970aa6eff97bc27e36533 (patch) | |
tree | 8890d4191c1ea44af96b6e51d8e149b1e885f043 /doc/sample | |
parent | a9156de759bc444a5f7256b86f6c4bac6a1ab47d (diff) | |
download | hercules-21fa0901dc8723627c6970aa6eff97bc27e36533.tar.gz hercules-21fa0901dc8723627c6970aa6eff97bc27e36533.tar.bz2 hercules-21fa0901dc8723627c6970aa6eff97bc27e36533.tar.xz hercules-21fa0901dc8723627c6970aa6eff97bc27e36533.zip |
Modernized syntax and fixed errors in the sample scripts
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'doc/sample')
28 files changed, 798 insertions, 520 deletions
diff --git a/doc/sample/bank_test.txt b/doc/sample/bank_test.txt index 8b29abd93..5cdf319ca 100644 --- a/doc/sample/bank_test.txt +++ b/doc/sample/bank_test.txt @@ -3,12 +3,12 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20070315 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Contains commands needed for a basic bank. //============================================================ -prontera,162,188,1 script Bank Test 112,{ +prontera,162,188,1 script Bank Test 4_F_KAFRA6,{ cutin "kafra_06",2; mes "[Bank Test]"; @@ -16,51 +16,64 @@ prontera,162,188,1 script Bank Test 112,{ 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"; + switch (select("Deposit","Withdraw","Exit")) { + case 1: + mes "[Bank Test]"; + mes "How much do you want to deposit?"; + next; + input .@kafrabank; - 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 < 1000) { + mes "[Bank Test]"; + mes "The minimum deposit is 1000z"; + next; + break; + } + if (.@kafrabank > Zeny) { + mes "[Bank Test]"; + mes "You don't have enough money."; + next; + break; + } + Zeny -= .@kafrabank; + #kafrabank += .@kafrabank; + mes "[Bank Test]"; + mes "You now have ^135445" + Zeny + "z^000000"; + mes "and your bank account ^135445" + #kafrabank + "z^000000"; + next; + break; + case 2: + if (#kafrabank == 0) { + mes "[Bank Test]"; + mes "Your bank account is currently empty, you can't withdraw."; + next; + break; + } + mes "[Bank Test]"; + mes "Current balance: ^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; + if (.@kafrabank < 1) + break; + if (.@kafrabank > #kafrabank) { + mes "[Bank Test]"; + mes "You can't withdraw more than ^135445"+ #kafrabank + "^000000z."; + next; + break; + } + #kafrabank -= .@kafrabank; + Zeny += .@kafrabank; + mes "[Bank Test]"; + mes "You now have ^135445" + Zeny + "z^000000"; + mes "and your bank account ^135445" + #kafrabank + "z^000000"; + next; + break; + case 3: + break; + } -B_EXIT: - mes "Thanks for using depositing"; -B_EXIT2: mes "Good bye!"; cutin "kafra_06",255; close; diff --git a/doc/sample/basejob_baseclass_upper.txt b/doc/sample/basejob_baseclass_upper.txt index 8e2501e09..80cc23fc7 100644 --- a/doc/sample/basejob_baseclass_upper.txt +++ b/doc/sample/basejob_baseclass_upper.txt @@ -3,12 +3,12 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20110123 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Outputs the values of class constants. //============================================================ -prontera,155,177,1 script Tell Me 725,{ +prontera,155,177,1 script Tell Me 4_F_JOB_ASSASSIN,{ mes "[Tell Me]"; mes "Class: " + Class; mes "BaseClass: " + BaseClass; diff --git a/doc/sample/checkoption.txt b/doc/sample/checkoption.txt index 8f0f96d9f..77c0a3105 100644 --- a/doc/sample/checkoption.txt +++ b/doc/sample/checkoption.txt @@ -3,15 +3,17 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20070315 +//= 20131225 //===== Description: ========================================= //= Demonstrates the 'checkoption' command. //============================================================ -prontera,156,89,6 script test_checkoption 117,{ +prontera,156,89,6 script test_checkoption 4_F_KAFRA1,{ mes "Please enter a value of type!"; - input @value; - if(checkoption(@value) == 1) mes "True!"; - else if(checkoption(@value) == 0) mes "False!"; + input .@value; + if(checkoption(.@value) == 1) + mes "True!"; + else if(checkoption(.@value) == 0) + mes "False!"; close; } diff --git a/doc/sample/delitem2.txt b/doc/sample/delitem2.txt index 9e74d76e7..46e3e42c7 100644 --- a/doc/sample/delitem2.txt +++ b/doc/sample/delitem2.txt @@ -3,37 +3,37 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20070315 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates the 'delitem2' command. //============================================================ -prontera,160,182,5 script Delitem2 51,{ +prontera,160,182,5 script Delitem2 1_M_BARD,{ mes "Item ID?"; next; - input @nameid; + input .@nameid; mes "Amount?"; next; - input @amount; + input .@amount; mes "Identified? (0:no, 1:yes)"; next; - input @iden; + input .@iden; mes "Refined how many times?"; next; - input @ref; + input .@ref; mes "Attribute? (0:normal, 1:broken)"; next; - input @attr; + input .@attr; mes "4 cards (one after another)..."; next; - input @c1; - input @c2; - input @c3; - input @c4; + input .@c1; + input .@c2; + input .@c3; + input .@c4; mes "Your command is:"; - mes "delitem2 "+@nameid+","+@amount+","+@iden+","+@ref+","+@attr+","+@c1+","+@c2+","+@c3+","+@c4; + mes "delitem2 "+.@nameid+","+.@amount+","+.@iden+","+.@ref+","+.@attr+","+.@c1+","+.@c2+","+.@c3+","+.@c4; next; - delitem2 @nameid,@amount,@iden,@ref,@attr,@c1,@c2,@c3,@c4; + delitem2 .@nameid,.@amount,.@iden,.@ref,.@attr,.@c1,.@c2,.@c3,.@c4; mes "And here is the moment when your item should disappear! :P"; close; } diff --git a/doc/sample/getequipcardid.txt b/doc/sample/getequipcardid.txt index 6b435f41f..8f7d7f27d 100644 --- a/doc/sample/getequipcardid.txt +++ b/doc/sample/getequipcardid.txt @@ -3,18 +3,19 @@ //===== By: ================================================== //= Lupus //===== Current Version: ===================================== -//= 20121003 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates the 'getequipcardid' command. //============================================================ -prontera,155,177,4 script Check My Hat 810,{ +prontera,155,177,4 script Check My Hat 1_M_SIGNROGUE,{ 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."; + .@id = getequipid(1); + .@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; diff --git a/doc/sample/getequipid.txt b/doc/sample/getequipid.txt index 6a2ef342f..6543d7932 100644 --- a/doc/sample/getequipid.txt +++ b/doc/sample/getequipid.txt @@ -3,14 +3,14 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20121003 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates the 'getequipid' command. //============================================================ -prontera,161,181,6 script GetEquipID Sample 105,{ +prontera,161,181,6 script getequipid Sample 8W_SOLDIER,{ mes "[GetEquipID Sample]"; - for(set .@i,1; .@i<11; set .@i,.@i+1) - mes "GetEquipID(" + .@i + ") : " + getequipid(1); + for (.@i = 1; .@i < 11; ++.@i) + mes "getequipid(" + .@i + ") : " + getequipid(1); close; } diff --git a/doc/sample/getiteminfo.txt b/doc/sample/getiteminfo.txt index 632999f3b..89f9a66b5 100644 --- a/doc/sample/getiteminfo.txt +++ b/doc/sample/getiteminfo.txt @@ -3,12 +3,12 @@ //===== By: ================================================== //= Lupus //===== Current Version: ===================================== -//= 20121003 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates the 'getiteminfo' command. //============================================================ -prontera,156,179,6 script test_getiteminfo 117,{ +prontera,156,179,6 script test_getiteminfo 4_F_KAFRA1,{ mes "Please enter an item ID."; input .@value; @@ -17,7 +17,7 @@ prontera,156,179,6 script test_getiteminfo 117,{ mes "Item ID: "+.@value+" ^nItemID^"+.@value; mes "Current item info:"; - for(set .@id,0; .@id<14; set .@id,.@id+1) + for (.@id = 0; .@id < 14; ++.@id) mes " getiteminfo("+.@value+","+.@id+") = "+getiteminfo(.@value,.@id); close; } diff --git a/doc/sample/getmonsterinfo.txt b/doc/sample/getmonsterinfo.txt index 471af9e5c..064f1fc71 100644 --- a/doc/sample/getmonsterinfo.txt +++ b/doc/sample/getmonsterinfo.txt @@ -3,12 +3,12 @@ //===== By: ================================================== //= Lupus //===== Current Version: ===================================== -//= 20121003 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates the 'getmonsterinfo' command. //============================================================ -prontera,156,179,6 script test_getmonsterinfo 117,{ +prontera,156,179,6 script test_getmonsterinfo 4_F_KAFRA1,{ mes "Please enter a monster ID."; input .@value; if(getmonsterinfo(.@value,MOB_LV)<0 || getmonsterinfo(.@value,MOB_NAME)=="Dummy") { @@ -17,7 +17,7 @@ prontera,156,179,6 script test_getmonsterinfo 117,{ } mes "Monster ID: "+.@value+" '"+getmonsterinfo(.@value,MOB_NAME)+"'"; mes "Current Monster info:"; - for(set .@id,0; .@id<23; set .@id,.@id+1) + for (.@id = 0; .@id < 23; ++.@id) mes " getmonsterinfo("+.@value+","+@id+") = "+getmonsterinfo(.@value,@id); close; } diff --git a/doc/sample/gstorage_test.txt b/doc/sample/gstorage_test.txt index b8f9fe2c4..8b1a1c0e6 100644 --- a/doc/sample/gstorage_test.txt +++ b/doc/sample/gstorage_test.txt @@ -3,42 +3,34 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20070315 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Contains commands needed for a guild warehouse NPC. //============================================================ -prontera,165,188,4 script Guild Warehouse 112,{ +prontera,165,188,4 script Guild Warehouse 4_F_KAFRA6,{ cutin "kafra_06",2; mes "[Guild Warehouse Coupler]"; - mes "This is the guild warehouse coupler service."; + 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; + if (select("Access Guild Warehouse","Exit") != 1) { + mes "[Guild Warehouser]"; + mes "Come back whenever you want."; + cutin "kafra_06", 255; + close; + } -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: + .@flag = guildopenstorage; + if (.@flag == 1) { + mes "[Guild Warehouse]"; + mes "The guild warehouse is being used right now."; + mes "Please wait a while, then come back."; + } else if(.@flag == 2) { + mes "[Guild Warehouse]"; + mes "You can't use this service if you're not in a guild!"; + } cutin "kafra_06",255; close; } diff --git a/doc/sample/localized_npc.txt b/doc/sample/localized_npc.txt index 91bf46062..82a08fa35 100644 --- a/doc/sample/localized_npc.txt +++ b/doc/sample/localized_npc.txt @@ -1,23 +1,23 @@ -//===== Hercules Script ======================================= +//===== Hercules Script ====================================== //= Sample localized NPC -//===== By: ================================================== +//===== By: ================================================== //= Hercules Dev Team -//===== Current Version: ===================================== -//= v1.0 -//===== Description: ========================================= +//===== Current Version: ===================================== +//= v1.1 +//===== 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 +//= 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 +//= 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 +//= +//= 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) @@ -28,16 +28,16 @@ //= - returns the localized text of name //= void mes2(string name) //= - displays the localized text of name -//= -//===== Additional Comments: ================================= +//= +//===== 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); + ##_langid_ = getarg(0); return; } @@ -54,15 +54,15 @@ function script getlang { /// @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 +"$"; + .@mes2_name$ = getarg(0); + .@mes2_langid = getarg(1); + .@mes2_text$ = getarg(2); + .@mes2_var$ = "$@__"+ .@mes2_name$ +"_"+ .@mes2_langid +"$"; - //debugmes "setmes2 \""+ $@mes2_var$ +"\", \""+ $@mes2_text$ +"\";"; + //debugmes "setmes2 \""+ .@mes2_var$ +"\", \""+ .@mes2_text$ +"\";"; // set the localized text - setd $@mes2_var$, $@mes2_text$; + setd .@mes2_var$, .@mes2_text$; return; } @@ -73,14 +73,14 @@ function script setmes2 { /// @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$); + .@mes2_name$ = getarg(0); + .@mes2_langid = getarg(1); + .@mes2_var$ = "$@__"+ .@mes2_name$ +"_"+ .@mes2_langid +"$"; + .@mes2_text$ = getd(.@mes2_var$); - //debugmes "getmes2(\""+ $@mes2_var$ +"\")=\""+ $@mes2_text$ +"\""; + //debugmes "getmes2(\""+ .@mes2_var$ +"\")=\""+ .@mes2_text$ +"\""; - return $@mes2_text$; + return .@mes2_text$; } ////////////////////////////////////////////////////////////// @@ -89,32 +89,31 @@ function script getmes2 { /// that are valis as a variable name /// @param index Message identifier function script mes2 { - set @mes2_index$, getarg(0); + .@mes2_index$ = getarg(0); - if( getstrlen(@mes2_index$) == 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 + .@mes2_text$ = callfunc("getmes2",.@mes2_index$,##_langid_); + if( getstrlen(.@mes2_text$) == 0 ) { + if( ##_langid_ != 0 ) { + // revert to default language + .@mes2_text$ = callfunc("getmes2",.@mes2_index$,0); + if( getstrlen(.@mes2_text$) != 0 ) + mes .@mes2_text$; // default text } } else - mes @mes2_text$; // localized text + mes .@mes2_text$; // localized text return; } ////////////////////////////////////////////////////////////// /// Sample localized NPC -prontera,155,183,4 script LocalizedNPC 705,{ +prontera,155,183,4 script LocalizedNPC 4_M_GEF_SOLDIER,{ // Get text for specific languages - set @menu1$, callfunc("getmes2","LNPC_lang",0); - set @menu2$, callfunc("getmes2","LNPC_lang",1); + .@menu1$ = callfunc("getmes2","LNPC_lang",0); + .@menu2$ = callfunc("getmes2","LNPC_lang",1); do { // get text that fallbacks to language 0 callfunc "mes2", "LNPC_name"; @@ -123,7 +122,7 @@ prontera,155,183,4 script LocalizedNPC 705,{ callfunc "mes2", "LNPC_text"; next; - switch(select(@menu1$,@menu2$,"Cancel")) + switch(select(.@menu1$,.@menu2$,"Cancel")) { case 1: case 2: @@ -144,6 +143,6 @@ OnInterIfInitOnce: 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"; + 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 index c3bc78293..1e4ac77e4 100644 --- a/doc/sample/npc_dynamic_shop.txt +++ b/doc/sample/npc_dynamic_shop.txt @@ -1,39 +1,37 @@ -//===== rAthena Script ======================================= +//===== Hercules Script ====================================== //= Sample: Dynamic Shop //===== By: ================================================== -//= rAthena Dev Team +//= Hercules Dev Team //===== Current Version: ===================================== -//= 20101219 -//===== Description: ========================================= +//= 20131225 +//===== 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,{ +prontera,181,200,4 script Dynamic Shop 2_F_MAGICMASTER,{ 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){ + for (.@i = 0; .@i < getarraysize(@sold_nameid); ++.@i) { + 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] == Red_Potion) { + delitem Red_Potion, @sold_quantity[.@i]; + $@rpotsleft += @sold_quantity[.@i]; + Zeny += @sold_quantity[.@i]*20; + } else if (@sold_nameid[.@i] == Orange_Potion){ + delitem Orange_Potion, @sold_quantity[.@i]; + $@opotsleft += @sold_quantity[.@i]; + Zeny += @sold_quantity[.@i]*100; } 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; - } + mes "Sorry, I don't need your items."; + close; } } deletearray @sold_quantity, getarraysize(@sold_quantity); @@ -42,40 +40,40 @@ OnSellItem: close; OnBuyItem: - for(set @i, 0; @i < getarraysize(@bought_nameid); set @i, @i + 1){ - if(@bought_quantity[@i] <= 0){ + for (.@i = 0; .@i < getarraysize(@bought_nameid); ++.@i) { + 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 if (@bought_nameid[.@i] == Red_Potion) { + if (@bought_quantity[.@i] > $@rpotsleft) { + if($@rpotsleft > 0) { + @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]; + if(Zeny >= 40*@bought_quantity[.@i]) { + Zeny -= 40*@bought_quantity[.@i]; + getitem Red_Potion, @bought_quantity[.@i]; + $@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 /*if (@bought_nameid[.@i] == Orange_Potion)*/ { + if(@bought_quantity[.@i] > $@opotsleft) { + if($@opotsleft > 0) { + @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]; + if(Zeny >= 200*@bought_quantity[.@i]) { + Zeny -= 200*@bought_quantity[.@i]; + getitem Orange_Potion, @bought_quantity[.@i]; + $@opotsleft -= @bought_quantity[.@i]; } else { mes "You have insufficient cash."; close; @@ -88,8 +86,8 @@ OnBuyItem: close; OnInit: - npcshopitem "dyn_shop1", 501,40,502,200; - set $@rpotsleft, 10; - set $@opotsleft, 10; + npcshopitem "dyn_shop1", Red_Potion, 40, Orange_Potion, 200; + $@rpotsleft = 10; + $@opotsleft = 10; end; } diff --git a/doc/sample/npc_extend_shop.txt b/doc/sample/npc_extend_shop.txt index 1ca4ed7b8..31ed0af43 100644 --- a/doc/sample/npc_extend_shop.txt +++ b/doc/sample/npc_extend_shop.txt @@ -1,30 +1,351 @@ -//===== rAthena Script ======================================= +//===== Hercules Script ====================================== //= Sample: Extended Shops //===== By: ================================================== -//= rAthena Dev Team +//= Hercules Dev Team //===== Current Version: ===================================== -//= 20121003 -//===== Description: ========================================= +//= 20131225 +//===== 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 +prontera,182,213,3 trader Super Novice Shop 4_M_KID2,{ +OnInit: + sellitem Novice_Knife; + sellitem Novice_Guard; + sellitem Novice_Breast; + sellitem Novice_Plate; + sellitem Novice_Boots; + sellitem Novice_Hood; + sellitem Novice_Armlet; + sellitem Novice_Egg_Cap; +} +prontera,149,139,5 trader Whips Merchant 1_M_MERCHANT,{ +OnInit: + sellitem Rope_; + sellitem Line_; + sellitem Wire_; + sellitem Rante_; + sellitem Tail_; + sellitem Whip_; + sellitem Lariat; + sellitem Rapture_Rose; + sellitem Chemeti; +} +prontera,162,175,3 trader Headgears Merchant 1 1_F_MERCHANT_01,{ +OnInit: + sellitem Ribbon_; + sellitem Hair_Band; + sellitem Bandana; + sellitem Hat_; + sellitem Turban_; + sellitem Biretta_; + sellitem Cap_; + sellitem Gemmed_Sallet_; + sellitem Goggle_; + sellitem Helm_; +} +prontera,162,172,3 trader Headgears Merchant 2 1_F_MERCHANT_01,{ +OnInit: + sellitem Glasses; + sellitem Eye_Bandage; + sellitem Flu_Mask; + sellitem One_Eyed_Glass; + sellitem Granpa_Beard; + sellitem Luxury_Sunglasses; + sellitem Spinning_Eyes; + sellitem Gangster_Patch; + sellitem Ganster_Mask; + sellitem Eagle_Eyes; + sellitem Mr_Scream; + sellitem Masquerade; + sellitem Goblini_Mask; +} +prontera,162,169,3 trader Armours Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Mink_Coat; + sellitem Padded_Armor_; + sellitem Chain_Mail_; + sellitem Plate_Armor_; + sellitem Clothes_Of_The_Lord; + sellitem Formal_Suit; + sellitem Silk_Robe_; + sellitem Scapulare_; + sellitem Saint_Robe_; + sellitem Holy_Robe; + sellitem Wooden_Mail_; + sellitem Tights_; + sellitem Mage_Coat; + sellitem Thief_Clothes_; + sellitem Ninja_Suit; + sellitem Full_Plate_Armor_; +} +prontera,162,166,3 trader Shields Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Guard_; + sellitem Buckler_; + sellitem Shield_; + sellitem Mirror_Shield_; + sellitem Memorize_Book; + sellitem Holy_Guard; + sellitem Herald_Of_GOD; +} +prontera,162,163,3 trader Boots Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Sandals_; + sellitem Shoes_; + sellitem Boots_; + sellitem Chrystal_Pumps; + sellitem Grave_; + sellitem Safty_Boots; +} +prontera,162,160,3 trader Robes Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Hood_; + sellitem Muffler_; + sellitem Manteau_; + sellitem Cape_Of_Ancient_Lord; + sellitem Ragamuffin_Cape; + sellitem Clack_Of_Servival; +} +prontera,162,157,3 trader Accessory Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Ring; + sellitem Earring; + sellitem Necklace; + sellitem Glove; + sellitem Brooch; + sellitem Clip; + sellitem Rosary; + sellitem Safety_Ring; + sellitem Critical_Ring; + sellitem Matyr's_Flea_Guard; + sellitem Thimble_Of_Archer; +} +prontera,162,154,3 trader Arrows Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Arrow; + sellitem Silver_Arrow; + sellitem Fire_Arrow; + sellitem Steel_Arrow; + sellitem Crystal_Arrow; + sellitem Arrow_Of_Wind; + sellitem Stone_Arrow; + sellitem Immatrial_Arrow; + sellitem Stun_Arrow; + sellitem Freezing_Arrow; + sellitem Flash_Arrow; + sellitem Curse_Arrow; + sellitem Rusty_Arrow; + sellitem Poison_Arrow; + sellitem Incisive_Arrow; + sellitem Oridecon_Arrow; + sellitem Arrow_Of_Counter_Evil; + sellitem Arrow_Of_Shadow; + sellitem Sleep_Arrow; + sellitem Silence_Arrow; +} +prontera,162,151,3 trader Alchemist Shop 1_F_MERCHANT_01,{ +OnInit: + sellitem Alcol_Create_Book; + sellitem FireBottle_Create_Book; + sellitem Acid_Create_Book; + sellitem Plant_Create_Book; + sellitem Mine_Create_Book; + sellitem Coating_Create_Book; + sellitem Slim_Potion_Create_Book; + sellitem Normal_Potion_Book; + sellitem Medicine_Bowl; + sellitem Empty_Potion; +} +prontera,162,148,3 trader Taming Merchant 1_F_MERCHANT_01,{ +OnInit: + sellitem Unripe_Apple; + sellitem Orange_Juice; + sellitem Bitter_Herb; + sellitem Rainbow_Carrot; + sellitem Earthworm_The_Dude; + sellitem Rotten_Fish; + sellitem Lusty_Iron; + sellitem Monster_Juice; + sellitem Sweet_Milk; + sellitem Well_Dried_Bone; + sellitem Singing_Flower; + sellitem Dew_Laden_Moss; + sellitem Deadly_Noxious_Herb; + sellitem Fatty_Chubby_Earthworm; + sellitem Baked_Yam; + sellitem Tropical_Banana; + sellitem Horror_Of_Tribe; + sellitem No_Recipient; + sellitem Old_Broom; + sellitem Silver_Knife_Of_Chaste; + sellitem Armlet_Of_Obedience; + sellitem Shining_Stone; + sellitem Contracts_In_Shadow; + sellitem Book_Of_Devil; + sellitem Heart_Of_Her; +} +prontera,162,145,3 trader Pet Equipment 1_F_MERCHANT_01,{ +OnInit: + sellitem Skull_Helm; + sellitem Monster_Oxygen_Mask; + sellitem Transparent_Headgear; + sellitem Pacifier; + sellitem Wig; + sellitem Queen's_Hair_Ornament; + sellitem Silk_Ribbon; + sellitem Punisher; + sellitem Wild_Flower; + sellitem Battered_Pot; + sellitem Stellar_Hairpin; + sellitem Tiny_Egg_Shell; + sellitem Backpack; + sellitem Rocker_Glasses; + sellitem Green_Lace; + sellitem Golden_Bell; + sellitem Bark_Shorts; + sellitem Monkey_Circlet; + sellitem Red_Muffler; + sellitem Sword_Of_Grave_Keeper; +} +prontera,148,234,5 trader Weapon Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Drops_Card, 100000; + sellitem Andre_Larva_Card, 100000; + sellitem Skeleton_Card, 100000; + sellitem Thief_Bug_Female_Card, 100000; + sellitem Hornet_Card, 100000; + sellitem Wolf_Card, 100000; + sellitem Andre_Card, 100000; + sellitem Savage_Babe_Card, 100000; + sellitem Farmiliar_Card, 100000; + sellitem Plankton_Card, 100000; + sellitem Snake_Card, 100000; + sellitem Marina_Card, 100000; + sellitem Metaller_Card, 100000; + sellitem Magnolia_Card, 100000; + sellitem Zenorc_Card, 100000; + sellitem Requiem_Card, 100000; + sellitem Mandragora_Card, 100000; + sellitem Vadon_Card, 100000; + sellitem Anacondaq_Card, 100000; + sellitem Drainliar_Card, 100000; + sellitem Orc_Skeleton_Card, 100000; + sellitem Pecopeco_Egg_Card, 100000; + sellitem Goblin_Card, 100000; + sellitem Caramel_Card, 100000; + sellitem Scorpion_Card, 100000; + sellitem Flora_Card, 100000; + sellitem Archer_Skeleton_Card, 100000; + sellitem Strouf_Card, 100000; + sellitem Petit_Card, 100000; + sellitem Desert_Wolf_Card, 20700; + sellitem Skel_Worker_Card, 100000; + sellitem Minorous_Card, 100000; + sellitem Golem_Card, 100000; + sellitem Hunter_Fly_Card, 100000; + sellitem Hydra_Card, 100000; + sellitem Soldier_Skeleton_Card, 100000; + sellitem Mummy_Card, 100000; + sellitem Side_Winder_Card, 100000; + sellitem Deviace_Card, 100000; +} +prontera,148,231,5 trader Headgear Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Wilow_Card, 100000; + sellitem Stainer_Card, 100000; + sellitem Martin_Card, 100000; + sellitem Elder_Wilow_Card, 100000; + sellitem Giearth_Card, 100000; + sellitem Ghoul_Card, 100000; + sellitem Marduk_Card, 100000; + sellitem Deviruchi_Card, 100000; + sellitem Nightmare_Card, 100000; +} +prontera,146,229,5 trader Armor Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Pupa_Card, 100000; + sellitem Picky_Card, 100000; + sellitem Picky__Card, 100000; + sellitem Roda_Frog_Card, 100000; + sellitem Thief_Bug_Card, 100000; + sellitem Rocker_Card, 100000; + sellitem Desert_Wolf_Babe_Card, 100000; + sellitem Pecopeco_Card, 100000; + sellitem Savage_Card, 100000; + sellitem Sword_Fish_Card, 100000; + sellitem Dokebi_Card, 100000; + sellitem Pasana_Card, 100000; + sellitem Sand_Man_Card, 100000; + sellitem Argiope_Card, 100000; + sellitem Bathory_Card, 100000; + sellitem Evil_Druid_Card, 100000; + sellitem Cornutus_Card, 100000; + sellitem Marc_Card, 100000; +} +prontera,144,227,5 trader Shield Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Andre_Egg_Card, 100000; + sellitem Ambernite_Card, 100000; + sellitem Thara_Frog_Card, 100000; + sellitem Soldier_Andre_Card, 100000; + sellitem Orc_Warrior_Card, 100000; + sellitem BigFoot_Card, 100000; + sellitem Rafflesia_Card, 100000; + sellitem Petit__Card, 100000; + sellitem Medusa_Card, 100000; + sellitem Khalitzburg_Card, 100000; + sellitem Anubis_Card, 100000; + sellitem Horn_Card, 100000; + sellitem Megalodon_Card, 100000; + sellitem Argos_Card, 100000; + sellitem Munak_Card, 100000; +} +prontera,142,225,5 trader Robe Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Dustiness_Card, 100000; + sellitem Orc_Zombie_Card, 100000; + sellitem Hode_Card, 100000; + sellitem Marse_Card, 100000; + sellitem Myst_Card, 100000; + sellitem Jakk_Card, 100000; + sellitem Marionette_Card, 100000; + sellitem Isis_Card, 100000; + sellitem Daydric_Card, 100000; + sellitem Condor_Card, 100000; + sellitem Frilldora_Card, 100000; + sellitem Whisper_Card, 100000; + sellitem Baphomet__Card, 100000; +} +prontera,140,223,5 trader Shoes Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Chonchon_Card, 100000; + sellitem Zombie_Card, 100000; + sellitem Thief_Bug_Male_Card, 100000; + sellitem Eggyra_Card, 100000; + sellitem Matyr_Card, 100000; + sellitem Sohee_Card, 100000; + sellitem Verit_Card, 100000; +} +prontera,138,221,5 trader Accessory Card Merchant 1_F_PUBGIRL,{ +OnInit: + sellitem Spore_Card, 100500; + sellitem Kukre_Card, 100500; + sellitem Tarou_Card, 100500; + sellitem Worm_Tail_Card, 100500; + sellitem Yoyo_Card, 100500; + sellitem Zerom_Card, 100500; + sellitem Kobold_Card, 100500; + sellitem Mantis_Card, 100500; + sellitem Poporing_Card, 100500; + sellitem Creamy_Card, 100500; + sellitem Smokie_Card, 100500; + sellitem Poison_Spore_Card, 100500; + sellitem Vitata_Card, 100500; + sellitem Pirate_Skel_Card, 100500; + sellitem Phen_Card, 100500; + sellitem Marine_Sphere_Card, 100500; + sellitem Obeaune_Card, 100500; + sellitem Horong_Card, 100500; + sellitem Joker_Card, 100500; +} diff --git a/doc/sample/npc_live_dialogues.txt b/doc/sample/npc_live_dialogues.txt index 8778f6c50..9ce628c30 100644 --- a/doc/sample/npc_live_dialogues.txt +++ b/doc/sample/npc_live_dialogues.txt @@ -3,13 +3,13 @@ //===== By: ================================================== //= Lupus //===== Current Version: ===================================== -//= 20070320 -//===== Description: ========================================= +//= 20131225 +//===== 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,{ +prontera,167,177,5 script Luppy DESERT_WOLF_B,{ mes "[Luppy]"; // Say a random greeting from Global_Functions.txt @@ -20,35 +20,34 @@ prontera,167,177,5 script Luppy 1107,{ 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; + if (select(callfunc("F_Hi"), callfunc("F_Bye")) != 1) { + mes "[Luppy]"; + // Add some random goodbye from Global_Functions.txt + mes callfunc("F_Bye"); + close; + } mes "[Luppy]"; // Give a random prize from set list of items - if(@gotstuff){ + 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; + 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; + @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); + .@itemIDfromList = callfunc("F_RandMes", 4, Apple, Fruit_Of_Mastela, Seed_Of_Yggdrasil, Orange_Juice); // Again, say stuff according to player's gender - mes "Hey, "+callfunc("F_Sex","sister!","brother!")+" I have "+getitemname(@itemIDfromList)+" for you!"; + 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"); + getitem .@itemIDfromList, 1; close; } diff --git a/doc/sample/npc_shop_test.txt b/doc/sample/npc_shop_test.txt deleted file mode 100644 index 5e492b257..000000000 --- a/doc/sample/npc_shop_test.txt +++ /dev/null @@ -1,40 +0,0 @@ -//===== Hercules Script ======================================= -//= Sample: Shops -//===== By: ================================================== -//= Hercules 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 diff --git a/doc/sample/npc_test_array.txt b/doc/sample/npc_test_array.txt index 36b54a3fe..a429ffb93 100644 --- a/doc/sample/npc_test_array.txt +++ b/doc/sample/npc_test_array.txt @@ -3,41 +3,41 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20090206 +//= 20131225 //===== Description: ========================================= //= Demonstrates array commands. //============================================================ -prontera,164,190,1 script Array Test 112,{ - set @hoge[0],1; - set @hoge[1],5; +prontera,164,190,1 script Array Test 4_F_KAFRA6,{ + .@hoge[0] = 1; + .@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]; + 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; + 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]; + 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; + 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]; + mes "fuga[0]=> " + .@fuga[0]; + mes "fuga[1]=> " + .@fuga[1]; + mes "fuga[2]=> " + .@fuga[2]; next; - deletearray @hoge[1],2; + 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]; + mes "hoge[0]=> " + .@hoge[0]; + mes "hoge[1]=> " + .@hoge[1]; + mes "hoge[2]=> " + .@hoge[2]; + mes "hoge[3]=> " + .@hoge[3]; close; } diff --git a/doc/sample/npc_test_chat.txt b/doc/sample/npc_test_chat.txt index ca81840ea..adc53c763 100644 --- a/doc/sample/npc_test_chat.txt +++ b/doc/sample/npc_test_chat.txt @@ -8,7 +8,7 @@ //= Demonstrates waitingroom commands. //============================================================ -prontera,158,182,0 script Chat Test::test0001 116,{ +prontera,158,182,0 script Chat Test::test0001 4_F_KAFRA2,{ mes "Trigger Number: " + getwaitingroomstate(2); mes "Trigger State: " + getwaitingroomstate(3); switch(select("Enable:Disable:Delete:Create")) { diff --git a/doc/sample/npc_test_checkweight.txt b/doc/sample/npc_test_checkweight.txt index e2560cedf..0f383ffe4 100644 --- a/doc/sample/npc_test_checkweight.txt +++ b/doc/sample/npc_test_checkweight.txt @@ -3,147 +3,141 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20121113 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates 'checkweight' command. //============================================================ -prontera,161,181,6 script ChkSpace 763,{ +prontera,161,181,6 script ChkSpace 4_M_JPN,{ + function ChkResult; + function FinalReport; -function ChkResult; -function FinalReport; - -L_RESET: + // Reset resetlvl(1); - getinventorylist; - for(set .@i,0; .@i < @inventorylist_count; set .@i,.@i+1){ - delitem(@inventorylist_id[.@i],@inventorylist_amount[.@i]); //clear inventory + getinventorylist; + for (.@i = 0; .@i < @inventorylist_count; ++.@i) { + delitem(@inventorylist_id[.@i], @inventorylist_amount[.@i]); //clear inventory } - -L_TEST1: //basic backward chk + //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 + .@ret = checkweight(Apple, 10); + .@succes += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight("Apple", 10); + .@succes += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight(Premium_Reset_Stone, 33000); + .@succes += ChkResult(.@testid++, 0, .@ret); //should be failure too many item amount item weight=0 + .@ret = checkweight("Premium_Reset_Stone", 33000); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure too many item amount + .@ret = checkweight(Blue_Gemstone, 500); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success weight based on max weight=2030 + .@ret = checkweight(Blue_Gemstone, 1000); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure weight based on max weight=2030 + .@ret = checkweight(Magic_Stone_Ring, 100); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight(Magic_Stone_Ring, 101); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure (with MAX_INVENTORY = 100) + .@ret = checkweight(-1, 1); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure invalid item id + .@ret = checkweight(Apple, 0); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure invalid amount debugmes "End backward test"; - FinalReport(.@testid,.@succes); - + FinalReport(.@testid, .@succes); -L_TEST2: //update using list test + //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 - + .@ret = checkweight(Apple, 10, Banana, 10); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight("Apple", 10, "Banana", 10); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight(Apple, 80, Banana, 33000); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure + .@ret = checkweight("Apple", 80, "Banana", 33000); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure too many item amount + .@ret = checkweight("Apple", 10, "Banana", 21, Apple); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure invalid nb of args + .@ret = checkweight(Blue_Gemstone, 500, Red_Gemstone, 100); + .@success += ChkResult(.@testid++, 1, .@ret); //should be succes weight 1800/2030 + .@ret = checkweight(Blue_Gemstone, 500, Red_Gemstone, 500); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure weight 3000/2030 + .@ret = checkweight(Magic_Stone_Ring, 95, Green_Apple_Ring, 5); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success + .@ret = checkweight(Magic_Stone_Ring, 95, Green_Apple_Ring, 10); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure (with MAX_INVENTORY = 100) + .@ret = checkweight(Apple, 1, -1, 1); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure invalid item id + .@ret = checkweight(Apple, 1, Banana, 0); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure invalid amount + .@ret = checkweight(Premium_Reset_Stone, 31000, Premium_Reset_Stone, 2000); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure overamount inventory + .@ret = checkweight(Apple, 1, Banana, 1, Grape, 1, Carrot, 1); + .@success += ChkResult(.@testid++, 1, .@ret); //should be sucess + debugmes "End update by list tests"; - FinalReport(.@testid,.@succes); + FinalReport(.@testid, .@succes); -L_TEST3: //update using array tests + //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; + setarray .@item[0], Apple, Banana, Grape, Carrot; + setarray .@count[0], 1, 5, 9, 12; + .@ret = checkweight2(.@item, .@count); + .@success += 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; + setarray .@item[0], Apple, Banana, Grape, Carrot; + setarray .@count[0], 1, 5, -1, 12; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure, invalid 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; + setarray .@item[0], Apple, Banana, Grape, -1; + setarray .@count[0], 1, 5, 15, 12; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure, invalid 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; + setarray .@item[0], Blue_Gemstone, Yellow_Gemstone, Red_Gemstone, Emperium; + setarray .@count[0], 300, 300, 300, 300; + .@ret = checkweight2(.@item, .@count); + .@success += 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; + setarray .@item[0], Premium_Reset_Stone, Premium_Reset_Stone; + setarray .@count[0], 31000, 2000; + .@ret = checkweight2(.@item, .@count); + .@success += 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; + setarray .@item[0], Magic_Stone_Ring, Green_Apple_Ring; + setarray .@count[0], 95, 5; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 1, .@ret); //should be success + setarray .@count[0], 95, 10; + .@ret = checkweight2(.@item, .@count); + .@success += 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; + setarray .@item[0], Premium_Reset_Stone, Premium_Reset_Stone, Apple; + setarray .@count[0], 1, 3; + .@ret = checkweight2(.@item, .@count); + .@success += 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 - + setarray .@item[0], Premium_Reset_Stone, Premium_Reset_Stone; + setarray .@count[0], 1, 3, 5; + .@ret = checkweight2(.@item, .@count); + .@success += ChkResult(.@testid++, 0, .@ret); //should be failure, size mistmatch debugmes "End update by array tests"; - FinalReport(.@testid,.@succes); + FinalReport(.@testid, .@succes); -L_FINAL: end; - function ChkResult { .@tid = getarg(0); diff --git a/doc/sample/npc_test_duplicate.txt b/doc/sample/npc_test_duplicate.txt index d052e1cee..7f2855a49 100644 --- a/doc/sample/npc_test_duplicate.txt +++ b/doc/sample/npc_test_duplicate.txt @@ -3,8 +3,8 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20070915 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= An example of how duplicate NPCs are handled: //= NPC variables are shared between all duplicates. //= Each duplicate knows its own map coordinates. @@ -27,6 +27,6 @@ OnTouch: 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 +prontera,150,175,4 duplicate(Test Script) Test1 4_PORING +prontera,155,175,4 duplicate(Test Script) Test2 4_PORING,2,2 +prontera,160,175,4 duplicate(Test Script) Test3 4_PORING,3,3 diff --git a/doc/sample/npc_test_func.txt b/doc/sample/npc_test_func.txt index fbde70cd1..a57b6cfb1 100644 --- a/doc/sample/npc_test_func.txt +++ b/doc/sample/npc_test_func.txt @@ -3,8 +3,8 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20120901 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates use of functions. //============================================================ @@ -21,11 +21,11 @@ function script func002 { } // 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" +prontera,168,189,1 script Functions 4_F_KAFRA6,{ + 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" + callsub L_SUB001; // Calls the label L_SUB001 and displays "I'm a label" close; end; diff --git a/doc/sample/npc_test_npctimer.txt b/doc/sample/npc_test_npctimer.txt index 7dc625785..6c9b85a0e 100644 --- a/doc/sample/npc_test_npctimer.txt +++ b/doc/sample/npc_test_npctimer.txt @@ -1,14 +1,14 @@ -//===== Hercules Script ======================================= +//===== Hercules Script ====================================== //= Sample: NPC Timers //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20121003 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates NPC timer commands. //============================================================ -prontera,156,183,0 script NPCtimerTest::npctimerX0000 116,{ +prontera,156,183,0 script NPCtimerTest::npctimerX0000 4_F_KAFRA2,{ mes "Timer value" + getnpctimer(0); mes "State timer" + getnpctimer(1,"npctimerX0000"); mes "Number of events" + getnpctimer(2); diff --git a/doc/sample/npc_test_npctimer2.txt b/doc/sample/npc_test_npctimer2.txt index 1bb856b13..b325c0c90 100644 --- a/doc/sample/npc_test_npctimer2.txt +++ b/doc/sample/npc_test_npctimer2.txt @@ -1,14 +1,14 @@ -//===== Hercules Script ======================================= +//===== Hercules Script ====================================== //= Sample: Attached NPC Timers //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20121003 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates attached NPC timer commands. //============================================================ -prontera,156,183,0 script NPCtimerTest::npctimerX0000 116,{ +prontera,156,183,0 script NPCtimerTest::npctimerX0000 4_F_KAFRA2,{ mes "What would you like to know?"; select("Tell me my level."); mes "I need time to think..."; diff --git a/doc/sample/npc_test_pcre.txt b/doc/sample/npc_test_pcre.txt index 09f65e607..1306d1798 100644 --- a/doc/sample/npc_test_pcre.txt +++ b/doc/sample/npc_test_pcre.txt @@ -1,14 +1,14 @@ //===== Hercules Script ======================================= //= Sample: PCRE //===== By: ================================================== -//= rAthena Dev Team +//= Hercules Dev Team //===== Current Version: ===================================== -//= 20100108 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates PCRE commands. //============================================================ -prontera,152,181,5 script MouseJstr 763,{ +prontera,152,181,5 script MouseJstr 4_M_JPN,{ // hello Lquote0: diff --git a/doc/sample/npc_test_quest.txt b/doc/sample/npc_test_quest.txt index 821c83739..fcf6b2a80 100644 --- a/doc/sample/npc_test_quest.txt +++ b/doc/sample/npc_test_quest.txt @@ -1,10 +1,10 @@ -//===== Hercules Script ======================================= +//===== Hercules Script ====================================== //= Sample: Quest Test //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20121227 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates quest commands. //============================================================ @@ -12,8 +12,9 @@ // 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. +prontera,90,95,1 script Jelly 2_F_MAGICMASTER,{ + if(checkquest(70000) == -1) { + // Quest not yet started. mes "[Jelly]"; mes "Hey there! Would you help me?"; next; @@ -29,18 +30,21 @@ prontera,90,95,1 script Jelly 123,{ setquest 70000; // Adds the quest to your Quest Window. close; } - } else if(checkquest(70000,HUNTING) == 2) { // All monsters killed. + } 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". + completequest 70000; // Sets quest status to "complete". close; - } else if(checkquest(70000) == 1) { // Quest is active. + } else if(checkquest(70000) == 1) { + // Quest is active. mes "[Jelly]"; mes "Keep going, almost there!"; close; - } else if(checkquest(70000) == 2) { // Quest finished. + } else if(checkquest(70000) == 2) { + // Quest finished. mes "[Jelly]"; mes "Thanks again for doing that for me!"; close; diff --git a/doc/sample/npc_test_setitemx.txt b/doc/sample/npc_test_setitemx.txt index 10d8daaaa..a06f0dc9f 100644 --- a/doc/sample/npc_test_setitemx.txt +++ b/doc/sample/npc_test_setitemx.txt @@ -1,49 +1,44 @@ -//===== Hercules Script ======================================= +//===== Hercules Script ====================================== //= Sample: Setiteminfo & Setitemscript //===== By: ================================================== //= Lupus //===== Current Version: ===================================== -//= 20121003 -//===== Description: ========================================= +//= 20131225 +//===== 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); +prontera,164,161,5 script Lupus WOLF,{ + mes "Please choose an option:"; + next; + switch (select("Make Knife[3] Edible", "Make Apple Equippable", "Edible Knife = Full SP", "Knife = Weapon + 3 Notes")) { + case 1: + mes "Ok. We made Knife[3] edible."; + setiteminfo(Knife, 2, IT_HEALING); //type = 0 : potion + setitemscript(Knife, "{dispbottom \"* You used Knife[3]\";}"); + break; + case 2: + mes "Ok. We made Apple equippable."; + setiteminfo(Apple, 2, IT_ARMOR); //item type -> headgear (type = 5 -> IT_ARMOR) + setiteminfo(Apple, 5, 512); //where to equip to (equip = 512) + setiteminfo(Apple, 11, 256); //set as headgear location (loc = 256) + setiteminfo(Apple, 14, 85); //set Headgear Sprite ID (view id = 85) + setitemscript(Apple, "{dispbottom \"* Other item's changed\";}", 0); + setitemscript(Apple, "{dispbottom \"* Equipped\";}", 1); + setitemscript(Apple, "{dispbottom \"* Unequipped\";}", 2); + break; + case 3: + mes "Ok. Now edible Knife[3] restores your SP."; + setitemscript(Knife, 2, 0); + setitemscript(Knife, "{dispbottom \"* You ate Knife[3] + Full SP\"; percentheal 0,100;}"); + break; + case 4: + mes "Ok. We made Knife a weapon, but added 3 notes."; + setiteminfo(Knife, 2, IT_WEAPON); //type = 4 -> IT_WEAPON + setitemscript(Knife, "{dispbottom \"* 1 Used\";}", 0); + setitemscript(Knife, "{dispbottom \"* 2 Equipped\";}", 1); + setitemscript(Knife, "{dispbottom \"* 3 Unequipped\";}", 2); + break; + } close; } diff --git a/doc/sample/npc_test_setmapflag.txt b/doc/sample/npc_test_setmapflag.txt index 681fbc43a..44137bef0 100644 --- a/doc/sample/npc_test_setmapflag.txt +++ b/doc/sample/npc_test_setmapflag.txt @@ -1,32 +1,32 @@ -//===== Hercules Script ======================================= +//===== Hercules Script ====================================== //= Sample: Mapflag Test //===== By: ================================================== //= Jbain //===== Current Version: ===================================== -//= 20121003 -//===== Description: ========================================= +//= 20131225 +//===== Description: ========================================= //= Demonstrates mapflag commands. //============================================================ -prontera,165,145,0 script EXPflagtest 123,{ +prontera,165,145,0 script EXPflagtest 2_F_MAGICMASTER,{ 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; + setmapflag "prontera",mf_jexp,.@rate; close; case 2: input .@rate; - setmapflag "prontera",MF_BEXP,.@rate; + setmapflag "prontera",mf_bexp,.@rate; close; case 3: - setmapflag "prontera",MF_PVP; + setmapflag "prontera",mf_pvp; close; case 4: - removemapflag "prontera",MF_BEXP; - removemapflag "prontera",MF_JEXP; - removemapflag "prontera",MF_PVP; + removemapflag "prontera",mf_bexp; + removemapflag "prontera",mf_jexp; + removemapflag "prontera",mf_pvp; close; } } diff --git a/doc/sample/npc_test_skill.txt b/doc/sample/npc_test_skill.txt index cc6de3bbc..c26ed1b62 100644 --- a/doc/sample/npc_test_skill.txt +++ b/doc/sample/npc_test_skill.txt @@ -3,7 +3,7 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20130426 +//= 20131225 //===== Description: ========================================= //= Demonstrates the 'skill' command. //============================================================ @@ -16,20 +16,20 @@ // 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,{ +prontera,157,182,0 script Skills 4_F_KAFRA2,{ mes "What skill would you like?"; switch(select("First Aid:Play Dead:Heal:Sight:None")) { case 1: - skill 142,1,0; // Permanently gives player level 1 First Aid + skill NV_FIRSTAID,1,0; // Permanently gives player level 1 First Aid close; case 2: - skill 143,1,0; // Permanently gives player level 1 Play Dead + skill NV_TRICKDEAD,1,0; // Permanently gives player level 1 Play Dead close; case 3: - skill 28,3,1; // Temporarily gives player level 3 Heal + skill AL_HEAL,3,1; // Temporarily gives player level 3 Heal close; case 4: - skill 10,1,3; // Permanently gives player level 1 Sight, even after skill resets/job changes + skill MG_SIGHT,1,3; // Permanently gives player level 1 Sight, even after skill resets/job changes close; case 5: close; diff --git a/doc/sample/npc_test_time.txt b/doc/sample/npc_test_time.txt index ffa6a5ca2..2af1dadd8 100644 --- a/doc/sample/npc_test_time.txt +++ b/doc/sample/npc_test_time.txt @@ -8,7 +8,7 @@ //= Demonstrates time commands. //============================================================ -prontera,157,181,6 script Time Sample 105,{ +prontera,157,181,6 script Time Sample 8W_SOLDIER,{ mes "[Time Sample]"; mes "System Tick : " + gettimetick(0); mes " Time Tick : " + gettimetick(1); diff --git a/doc/sample/npc_trader_sample.txt b/doc/sample/npc_trader_sample.txt index abc87f6b4..0d50af8c5 100644 --- a/doc/sample/npc_trader_sample.txt +++ b/doc/sample/npc_trader_sample.txt @@ -3,56 +3,56 @@ //===== By: ================================================== //= Hercules Dev Team //===== Current Version: ===================================== -//= 20131223 +//= 20131225 //===== Description: ========================================= //= Demonstrates NPC Trader. //============================================================ /* ordinary zeny trader */ -prontera,152,151,1 trader TestTrader 952,{ +prontera,152,151,1 trader TestTrader 4_F_EDEN_OFFICER,{ OnInit: - sellitem 2115; + sellitem Valkyrja's_Shield; end; } /* ordinary cash trader */ -prontera,152,152,1 trader TestTraderCash 952,{ +prontera,152,152,1 trader TestTraderCash 4_F_EDEN_OFFICER,{ OnInit: tradertype(NST_CASH); - sellitem 2115; + sellitem Valkyrja's_Shield; end; } /* custom npc trader */ -prontera,153,152,1 trader TestCustom2 952,{ +prontera,153,152,1 trader TestCustom2 4_F_EDEN_OFFICER,{ OnInit: tradertype(NST_CUSTOM); - sellitem 501,2; + sellitem Red_Potion,2; end; - + /* allows currency to be item 501 and 502 */ OnCountFunds: - setcurrency(countitem(501),countitem(502)); + setcurrency(countitem(Red_Potion),countitem(Orange_Potion)); end; /* receives @price (total cost) and @points (the secondary input field for cash windows) */ OnPayFunds: dispbottom "Hi: price="+@price+" and points="+@points; - if( countitem(502) < @points || countitem(501) < @price-@points ) + if( countitem(Orange_Potion) < @points || countitem(Red_Potion) < @price-@points ) end; - delitem 502,@points; - delitem 501,@price-@points; + delitem Orange_Potion,@points; + delitem Red_Potion,@price-@points; purchaseok(); end; } /* demonstrates Market Trader */ -prontera,150,160,6 trader HaiMarket 952,{ +prontera,150,160,6 trader HaiMarket 4_F_EDEN_OFFICER,{ OnInit: tradertype(NST_MARKET); - sellitem 501,-1,49; + sellitem Red_Potion,-1,49; end; - + OnClock0000://resupplies red potions on midnight OnMyResupply: - if( shopcount(501) < 20 ) - sellitem 501,-1,49; + if( shopcount(Red_Potion) < 20 ) + sellitem Red_Potion,-1,49; end; -}
\ No newline at end of file +} |