Modernized syntax and fixed errors in the sample scripts. (Hercules 21fa090)

Signed-off-by: Euphy <euphy.raliel@rathena.org>
This commit is contained in:
Euphy 2014-02-08 16:34:26 -05:00
parent de46393592
commit 2fff785894
15 changed files with 227 additions and 227 deletions

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= rAthena Dev Team //= rAthena Dev Team
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20070315 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Contains commands needed for a basic bank. //= Contains commands needed for a basic bank.
//============================================================ //============================================================
@ -16,51 +16,64 @@ prontera,162,188,1 script Bank Test 112,{
mes "You can only deposit a minimal of"; mes "You can only deposit a minimal of";
mes "1000z. What do you want to do?"; mes "1000z. What do you want to do?";
next; next;
menu "Deposit",BANK_IN,"Withdraw",BANK_OUT,"Exit",B_EXIT2; switch (select("Deposit","Withdraw","Exit")) {
BANK_IN: case 1:
mes "[Bank Test]"; 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?"; mes "How much do you want to deposit?";
next; next;
input @kafrabank; input .@kafrabank;
if(@kafrabank<1000) goto B_EXIT2; if (.@kafrabank < 1000) {
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 "[Bank Test]";
mes "You can only withdraw equally or below this quantity:"; mes "The minimum deposit is 1000z";
mes "^135445" + #kafrabank + "^000000z"; 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?"; mes "How much do you want to withdraw?";
next; next;
input @kafrabank; input .@kafrabank;
if(@kafrabank<1) goto B_EXIT2; if (.@kafrabank < 1)
if(@kafrabank>#kafrabank) goto BANK_F; break;
set #kafrabank,#kafrabank-@kafrabank; if (.@kafrabank > #kafrabank) {
set Zeny,Zeny+@kafrabank;
goto B_EXIT;
BANK_F:
mes "[Bank Test]"; mes "[Bank Test]";
mes "You can't withdraw more than ^135445"+ #kafrabank + "^000000z."; mes "You can't withdraw more than ^135445"+ #kafrabank + "^000000z.";
goto B_EXIT2; next;
BANK_F2: break;
}
#kafrabank -= .@kafrabank;
Zeny += .@kafrabank;
mes "[Bank Test]"; mes "[Bank Test]";
mes "Your account is empty, you may not withdraw at this time."; mes "You now have ^135445" + Zeny + "z^000000";
goto B_EXIT2; 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!"; mes "Good bye!";
cutin "kafra_06",255; cutin "kafra_06",255;
close; close;

View File

@ -3,15 +3,17 @@
//===== By: ================================================== //===== By: ==================================================
//= rAthena Dev Team //= rAthena Dev Team
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20070315 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Demonstrates the 'checkoption' command. //= Demonstrates the 'checkoption' command.
//============================================================ //============================================================
prontera,156,89,6 script test_checkoption 117,{ prontera,156,89,6 script test_checkoption 117,{
mes "Please enter a value of type!"; mes "Please enter a value of type!";
input @value; input .@value;
if(checkoption(@value) == 1) mes "True!"; if (checkoption(.@value) == 1)
else if(checkoption(@value) == 0) mes "False!"; mes "True!";
else if (checkoption(.@value) == 0)
mes "False!";
close; close;
} }

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= rAthena Dev Team //= rAthena Dev Team
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20070315 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Demonstrates the 'delitem2' command. //= Demonstrates the 'delitem2' command.
//============================================================ //============================================================
@ -11,29 +11,29 @@
prontera,160,182,5 script Delitem2 51,{ prontera,160,182,5 script Delitem2 51,{
mes "Item ID?"; mes "Item ID?";
next; next;
input @nameid; input .@nameid;
mes "Amount?"; mes "Amount?";
next; next;
input @amount; input .@amount;
mes "Identified? (0:no, 1:yes)"; mes "Identified? (0:no, 1:yes)";
next; next;
input @iden; input .@iden;
mes "Refined how many times?"; mes "Refined how many times?";
next; next;
input @ref; input .@ref;
mes "Attribute? (0:normal, 1:broken)"; mes "Attribute? (0:normal, 1:broken)";
next; next;
input @attr; input .@attr;
mes "4 cards (one after another)..."; mes "4 cards (one after another)...";
next; next;
input @c1; input .@c1;
input @c2; input .@c2;
input @c3; input .@c3;
input @c4; input .@c4;
mes "Your command is:"; 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; 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"; mes "And here is the moment when your item should disappear! :P";
close; close;
} }

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= Lupus //= Lupus
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20121003 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Demonstrates the 'getequipcardid' command. //= Demonstrates the 'getequipcardid' command.
//============================================================ //============================================================
@ -11,10 +11,11 @@
prontera,155,177,4 script Check My Hat 810,{ prontera,155,177,4 script Check My Hat 810,{
mes "Checking your head..."; mes "Checking your head...";
if (getequipisequiped(1)) { if (getequipisequiped(1)) {
set @id,getequipid(1); .@id = getequipid(1);
set @ref,getequiprefinerycnt(1); .@ref = getequiprefinerycnt(1);
mes "Your hat is... "+getitemname(@id)+"..."; mes "Your hat is... " + getitemname(.@id) + "...";
if(@ref) mes "It has been refined "+@ref+" times."; if (.@ref)
mes "It has been refined " + .@ref + " times.";
mes "Card Slot 0:" + getequipcardid(1,0) + " 1:" + getequipcardid(1,1); mes "Card Slot 0:" + getequipcardid(1,0) + " 1:" + getequipcardid(1,1);
mes "Card Slot 2:" + getequipcardid(1,2) + " 3:" + getequipcardid(1,3); mes "Card Slot 2:" + getequipcardid(1,2) + " 3:" + getequipcardid(1,3);
close; close;

View File

@ -3,14 +3,13 @@
//===== By: ================================================== //===== By: ==================================================
//= rAthena Dev Team //= rAthena Dev Team
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20121003 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Demonstrates the 'getequipid' command. //= Demonstrates the 'getequipid' command.
//============================================================ //============================================================
prontera,161,181,6 script GetEquipID Sample 105,{ prontera,161,181,6 script getequipid sample 105,{
mes "[GetEquipID Sample]"; for (.@i = 1; .@i < 11; .@i++)
for(set .@i,1; .@i<11; set .@i,.@i+1) mes "getequipid(" + .@i + ") : " + getequipid(.@i);
mes "GetEquipID(" + .@i + ") : " + getequipid(1);
close; close;
} }

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= Lupus //= Lupus
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20121003 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Demonstrates the 'getiteminfo' command. //= Demonstrates the 'getiteminfo' command.
//============================================================ //============================================================
@ -17,7 +17,7 @@ prontera,156,179,6 script test_getiteminfo 117,{
mes "Item ID: " + .@value + " ^nItemID^" + .@value; mes "Item ID: " + .@value + " ^nItemID^" + .@value;
mes "Current item info:"; 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); mes " getiteminfo(" + .@value + "," + .@id + ") = " + getiteminfo(.@value,.@id);
close; close;
} }

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= Lupus //= Lupus
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20131106 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Demonstrates the 'getmonsterinfo' command. //= Demonstrates the 'getmonsterinfo' command.
//============================================================ //============================================================
@ -17,7 +17,7 @@ prontera,156,179,6 script test_getmonsterinfo 117,{
} }
mes "Monster ID: "+.@value+" '"+getmonsterinfo(.@value,MOB_NAME)+"'"; mes "Monster ID: "+.@value+" '"+getmonsterinfo(.@value,MOB_NAME)+"'";
mes "Current Monster info:"; mes "Current Monster info:";
for(set .@i,0; .@i<23; set .@i,.@i+1) for (.@i = 0; .@i < 23; .@i++)
mes " getmonsterinfo("+.@value+","+.@i+") = "+getmonsterinfo(.@value,.@i); mes " getmonsterinfo("+.@value+","+.@i+") = "+getmonsterinfo(.@value,.@i);
close; close;
} }

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= rAthena Dev Team //= rAthena Dev Team
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20130325 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Contains commands needed for a guild warehouse NPC. //= Contains commands needed for a guild warehouse NPC.
//============================================================ //============================================================
@ -15,30 +15,22 @@ prontera,165,188,4 script Guild Warehouse 112,{
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."; mes "You will not receive zeny for this is a test.";
next; next;
menu "Access Guild Warehouse", GS_OPEN, "Exit", GS_EXIT3; if (select("Access Guild Warehouse","Exit") != 1) {
GS_OPEN:
set @flag,guildopenstorage();
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 "[Guild Warehouser]";
mes "Come back whenever you want."; mes "Come back whenever you want.";
cutin "kafra_06", 255;
GS_EXIT4: close;
}
.@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; cutin "kafra_06",255;
close; close;
} }

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= rAthena Dev Team //= rAthena Dev Team
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20070315 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Example of a localized NPC. //= Example of a localized NPC.
//= //=
@ -37,7 +37,7 @@
/// Sets the language of the player account. /// Sets the language of the player account.
/// @param langid Languange identifier (0 for default) /// @param langid Languange identifier (0 for default)
function script setlang { function script setlang {
set ##_langid_, getarg(0); ##_langid_ = getarg(0);
return; return;
} }
@ -54,15 +54,15 @@ function script getlang {
/// @param langid Language identifier (0 for default) /// @param langid Language identifier (0 for default)
/// @param text Text message /// @param text Text message
function script setmes2 { function script setmes2 {
set $@mes2_name$, getarg(0); .@mes2_name$ = getarg(0);
set $@mes2_langid, getarg(1); .@mes2_langid = getarg(1);
set $@mes2_text$, getarg(2); .@mes2_text$ = getarg(2);
set $@mes2_var$, "$@__"+ $@mes2_name$ +"_"+ $@mes2_langid +"$"; .@mes2_var$ = "$@__"+ .@mes2_name$ +"_"+ .@mes2_langid +"$";
//debugmes "setmes2 \""+ $@mes2_var$ +"\", \""+ $@mes2_text$ +"\";"; //debugmes "setmes2 \""+ .@mes2_var$ +"\", \""+ .@mes2_text$ +"\";";
// set the localized text // set the localized text
setd $@mes2_var$, $@mes2_text$; setd .@mes2_var$, .@mes2_text$;
return; return;
} }
@ -73,14 +73,14 @@ function script setmes2 {
/// @param langid Language identifier (0 for default) /// @param langid Language identifier (0 for default)
/// @return Text message /// @return Text message
function script getmes2 { function script getmes2 {
set $@mes2_name$, getarg(0); .@mes2_name$ = getarg(0);
set $@mes2_langid, getarg(1); .@mes2_langid = getarg(1);
set $@mes2_var$, "$@__"+ $@mes2_name$ +"_"+ $@mes2_langid +"$"; .@mes2_var$ = "$@__"+ .@mes2_name$ +"_"+ .@mes2_langid +"$";
set $@mes2_text$, getd($@mes2_var$); .@mes2_text$ = getd(.@mes2_var$);
//debugmes "getmes2(\""+ $@mes2_var$ +"\")=\""+ $@mes2_text$ +"\""; //debugmes "getmes2(\""+ .@mes2_var$ +"\")=\""+ .@mes2_text$ +"\"";
return $@mes2_text$; return .@mes2_text$;
} }
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
@ -89,23 +89,22 @@ function script getmes2 {
/// that are valis as a variable name /// that are valis as a variable name
/// @param index Message identifier /// @param index Message identifier
function script mes2 { 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 return; // invalid index
// print localized text // print localized text
set @mes2_text$, callfunc("getmes2",@mes2_index$,##_langid_); .@mes2_text$ = callfunc("getmes2",.@mes2_index$,##_langid_);
if( getstrlen(@mes2_text$) == 0 ) if( getstrlen(.@mes2_text$) == 0 ) {
{ if( ##_langid_ != 0 ) {
if( ##_langid_ != 0 ) // revert to default language
{// revert to default language .@mes2_text$ = callfunc("getmes2",.@mes2_index$,0);
set @mes2_text$, callfunc("getmes2",@mes2_index$,0); if( getstrlen(.@mes2_text$) != 0 )
if( getstrlen(@mes2_text$) != 0 ) mes .@mes2_text$; // default text
mes @mes2_text$; // default text
} }
} else } else
mes @mes2_text$; // localized text mes .@mes2_text$; // localized text
return; return;
} }
@ -113,8 +112,8 @@ function script mes2 {
/// Sample localized NPC /// Sample localized NPC
prontera,155,183,4 script LocalizedNPC 705,{ prontera,155,183,4 script LocalizedNPC 705,{
// Get text for specific languages // Get text for specific languages
set @menu1$, callfunc("getmes2","LNPC_lang",0); .@menu1$ = callfunc("getmes2","LNPC_lang",0);
set @menu2$, callfunc("getmes2","LNPC_lang",1); .@menu2$ = callfunc("getmes2","LNPC_lang",1);
do { do {
// get text that fallbacks to language 0 // get text that fallbacks to language 0
callfunc "mes2", "LNPC_name"; callfunc "mes2", "LNPC_name";
@ -123,7 +122,7 @@ prontera,155,183,4 script LocalizedNPC 705,{
callfunc "mes2", "LNPC_text"; callfunc "mes2", "LNPC_text";
next; next;
switch(select(@menu1$,@menu2$,"Cancel")) switch(select(.@menu1$,.@menu2$,"Cancel"))
{ {
case 1: case 1:
case 2: case 2:
@ -144,6 +143,6 @@ OnInterIfInitOnce:
callfunc "setmes2", "LNPC_lang", 0, "EN"; callfunc "setmes2", "LNPC_lang", 0, "EN";
callfunc "setmes2", "LNPC_lang", 1, "PT"; callfunc "setmes2", "LNPC_lang", 1, "PT";
callfunc "setmes2", "LNPC_text", 0, "Something in english"; callfunc "setmes2", "LNPC_text", 0, "Something in english";
callfunc "setmes2", "LNPC_text", 1, "Algo em portugu<EFBFBD>s"; callfunc "setmes2", "LNPC_text", 1, "Algo em português";
end; end;
} }

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= Lance //= Lance
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20101219 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Contains commands needed for a dynamic shop. //= Contains commands needed for a dynamic shop.
//============================================================ //============================================================
@ -17,65 +17,63 @@ prontera,181,200,4 script Dynamic Shop 123,{
end; end;
OnSellItem: OnSellItem:
for(set @i, 0; @i < getarraysize(@sold_nameid); set @i, @i + 1){ for (.@i = 0; .@i < getarraysize(@sold_nameid); .@i++) {
if(countitem(@sold_nameid[@i]) < @sold_quantity[@i] || @sold_quantity[@i] <= 0){ if (countitem(@sold_nameid[.@i]) < @sold_quantity[.@i] || @sold_quantity[.@i] <= 0) {
mes "omgh4x!"; mes "omgh4x!";
close; close;
} else if(@sold_nameid[@i] == 501){ } else if (@sold_nameid[.@i] == 501){
delitem 501, @sold_quantity[@i]; delitem 501, @sold_quantity[.@i];
set $@rpotsleft, $@rpotsleft + @sold_quantity[@i]; set $@rpotsleft, $@rpotsleft + @sold_quantity[.@i];
set Zeny, Zeny + @sold_quantity[@i]*20; set Zeny, Zeny + @sold_quantity[.@i]*20;
} else { } else if (@sold_nameid[.@i] == 502){
if(@sold_nameid[@i] == 502){ delitem 502, @sold_quantity[.@i];
delitem 502, @sold_quantity[@i]; $@opotsleft += @sold_quantity[.@i];
set $@opotsleft, $@opotsleft + @sold_quantity[@i]; set Zeny, Zeny + @sold_quantity[.@i]*100;
set Zeny, Zeny + @sold_quantity[@i]*100;
} else { } else {
mes "Sorry, I don't need your items."; mes "Sorry, I don't need your items.";
close; close;
} }
} }
}
deletearray @sold_quantity, getarraysize(@sold_quantity); deletearray @sold_quantity, getarraysize(@sold_quantity);
deletearray @sold_nameid, getarraysize(@sold_nameid); deletearray @sold_nameid, getarraysize(@sold_nameid);
mes "Deal completed."; mes "Deal completed.";
close; close;
OnBuyItem: OnBuyItem:
for(set @i, 0; @i < getarraysize(@bought_nameid); set @i, @i + 1){ for (.@i = 0; .@i < getarraysize(@bought_nameid); .@i++){
if(@bought_quantity[@i] <= 0){ if (@bought_quantity[.@i] <= 0){
mes "omgh4x!"; mes "omgh4x!";
close; close;
} else if(@bought_nameid[@i] == 501){ } else if (@bought_nameid[.@i] == 501){
if(@bought_quantity[@i] > $@rpotsleft){ if (@bought_quantity[.@i] > $@rpotsleft){
if ($@rpotsleft > 0){ if ($@rpotsleft > 0){
set @bought_quantity[@i], $@rpotsleft; @bought_quantity[.@i] = $@rpotsleft;
} else { } else {
mes "We are out of red potions!"; mes "We are out of red potions!";
close; close;
} }
} }
if(Zeny >= 40*@bought_quantity[@i]){ if (Zeny >= 40*@bought_quantity[.@i]){
set Zeny, Zeny - 40*@bought_quantity[@i]; set Zeny, Zeny - 40*@bought_quantity[.@i];
getitem 501, @bought_quantity[@i]; getitem 501, @bought_quantity[.@i];
set $@rpotsleft, $@rpotsleft - @bought_quantity[@i]; $@rpotsleft -= @bought_quantity[.@i];
} else { } else {
mes "You have insufficient cash."; mes "You have insufficient cash.";
close; close;
} }
} else { } else /*if (@bought_nameid[.@i] == 502)*/ {
if(@bought_quantity[@i] > $@opotsleft){ if (@bought_quantity[.@i] > $@opotsleft){
if ($@opotsleft > 0){ if ($@opotsleft > 0){
set @bought_quantity[@i], $@opotsleft; @bought_quantity[.@i] = $@opotsleft;
} else { } else {
mes "We are out of orange potions!"; mes "We are out of orange potions!";
close; close;
} }
} }
if(Zeny >= 200*@bought_quantity[@i]){ if (Zeny >= 200*@bought_quantity[.@i]){
set Zeny, Zeny - 200*@bought_quantity[@i]; set Zeny, Zeny - 200*@bought_quantity[.@i];
getitem 502, @bought_quantity[@i]; getitem 502, @bought_quantity[.@i];
set $@opotsleft, $@opotsleft - @bought_quantity[@i]; $@opotsleft -= @bought_quantity[.@i];
} else { } else {
mes "You have insufficient cash."; mes "You have insufficient cash.";
close; close;
@ -89,7 +87,7 @@ OnBuyItem:
OnInit: OnInit:
npcshopitem "dyn_shop1", 501,40,502,200; npcshopitem "dyn_shop1", 501,40,502,200;
set $@rpotsleft, 10; $@rpotsleft = 10;
set $@opotsleft, 10; $@opotsleft = 10;
end; end;
} }

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= Lupus //= Lupus
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20130905 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= An example of an NPC with live dialogue. //= An example of an NPC with live dialogue.
//= Note: This relies on Global_Functions.txt to run. //= Note: This relies on Global_Functions.txt to run.
@ -20,7 +20,12 @@ prontera,167,177,5 script Luppy 1107,{
mes callfunc("F_Sex","What a beautiful lady!","What a handsome man!"); mes callfunc("F_Sex","What a beautiful lady!","What a handsome man!");
// Add some random greeting and goodbye into the menu // 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]"; mes "[Luppy]";
// Give a random prize from set list of items // Give a random prize from set list of items
@ -34,21 +39,15 @@ prontera,167,177,5 script Luppy 1107,{
} }
// We set a temp var to give present just once. Player can get more by relogging. // 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 // Get item ID from the list of presents: Apple, Mastela Fruit, Yggdrasil Seed or Orange Juice
set @itemIDfromList, callfunc("F_Rand",512,522,608,620); .@itemIDfromList = callfunc("F_Rand",512,522,608,620);
// Again, say stuff according to player's gender // 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 // Get the item from the list
getitem @itemIDfromList,1; getitem .@itemIDfromList,1;
close;
M_BYE:
mes "[Luppy]";
// Add some random goodbye from Global_Functions.txt
mes callfunc("F_Bye");
close; close;
} }

View File

@ -3,47 +3,42 @@
//===== By: ================================================== //===== By: ==================================================
//= Lupus //= Lupus
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20121003 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Demonstrates 'setiteminfo' and 'setitemscript' commands. //= Demonstrates 'setiteminfo' and 'setitemscript' commands.
//============================================================ //============================================================
prontera,164,161,5 script Lupus 1013,{ prontera,164,161,5 script Lupus 1013,{
menu mes "Please choose an option:";
"Make Knife[3] Edible",M_1, next;
"Make Apple Equippable",M_2, switch (select("Make Knife[3] Edible", "Make Apple Equippable", "Edible Knife = Full SP", "Knife = Weapon + 3 Notes")) {
"Edible Knife = Full SP",M_3, case 1:
"Knife = Weapon + 3 Notes",M_4;
close;
M_1:
mes "Ok. We made Knife[3] edible."; mes "Ok. We made Knife[3] edible.";
setiteminfo(1201,2,0); //type = 0 : potion setiteminfo(Knife, 2, IT_HEALING); //type = 0 : potion
setitemscript(1201,"{dispbottom \"* You used Knife[3]\";}"); setitemscript(Knife, "{dispbottom \"* You used Knife[3]\";}");
close; break;
case 2:
M_2:
mes "Ok. We made Apple equippable."; mes "Ok. We made Apple equippable.";
setiteminfo(512,2,5); //item type -> headgear (type = 5) setiteminfo(Apple, 2, IT_ARMOR); //item type -> headgear (type = 5 -> IT_ARMOR)
setiteminfo(512,5,512); //where to equip to (equip = 512) setiteminfo(Apple, 5, 512); //where to equip to (equip = 512)
setiteminfo(512,11,256); //set as headgear location (loc = 256) setiteminfo(Apple, 11, 256); //set as headgear location (loc = 256)
setiteminfo(512,14,85); //set Headgear Sprite ID (view id = 85) setiteminfo(Apple, 14, 85); //set Headgear Sprite ID (view id = 85)
setitemscript(512,"{dispbottom \"* Other item's changed\";}",0); setitemscript(Apple, "{dispbottom \"* Other item's changed\";}", 0);
setitemscript(512,"{dispbottom \"* Equipped\";}",1); setitemscript(Apple, "{dispbottom \"* Equipped\";}", 1);
setitemscript(512,"{dispbottom \"* Unequipped\";}",2); setitemscript(Apple, "{dispbottom \"* Unequipped\";}", 2);
close; break;
case 3:
M_3:
mes "Ok. Now edible Knife[3] restores your SP."; mes "Ok. Now edible Knife[3] restores your SP.";
setitemscript(1201,2,0); setitemscript(Knife, 2, 0);
setitemscript(1201,"{dispbottom \"* You ate Knife[3] + Full SP\"; percentheal 0,100;}"); setitemscript(Knife, "{dispbottom \"* You ate Knife[3] + Full SP\"; percentheal 0,100;}");
close; break;
case 4:
M_4:
mes "Ok. We made Knife a weapon, but added 3 notes."; mes "Ok. We made Knife a weapon, but added 3 notes.";
setiteminfo(1201,2,4); //type = 4 : weapon again setiteminfo(Knife, 2, IT_WEAPON); //type = 4 -> IT_WEAPON
setitemscript(1201,"{dispbottom \"* 1 Used\";}",0); setitemscript(Knife, "{dispbottom \"* 1 Used\";}", 0);
setitemscript(1201,"{dispbottom \"* 2 Equipped\";}",1); setitemscript(Knife, "{dispbottom \"* 2 Equipped\";}", 1);
setitemscript(1201,"{dispbottom \"* 3 Unequipped\";}",2); setitemscript(Knife, "{dispbottom \"* 3 Unequipped\";}", 2);
break;
}
close; close;
} }

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= Jbain //= Jbain
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20121003 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Demonstrates mapflag commands. //= Demonstrates mapflag commands.
//============================================================ //============================================================
@ -11,22 +11,23 @@
prontera,165,145,0 script EXPflagtest 123,{ prontera,165,145,0 script EXPflagtest 123,{
mes "[EXPflagtest]"; mes "[EXPflagtest]";
mes "Set up the map rates:"; mes "Set up the map rates:";
next;
switch(select("Job EXP:Base EXP:PVP on:Reset all flags")) { switch(select("Job EXP:Base EXP:PVP on:Reset all flags")) {
case 1: case 1:
input .@rate; input .@rate;
setmapflag "prontera",MF_JEXP,.@rate; setmapflag "prontera",mf_jexp,.@rate;
close; close;
case 2: case 2:
input .@rate; input .@rate;
setmapflag "prontera",MF_BEXP,.@rate; setmapflag "prontera",mf_bexp,.@rate;
close; close;
case 3: case 3:
setmapflag "prontera",MF_PVP; setmapflag "prontera",mf_pvp;
close; close;
case 4: case 4:
removemapflag "prontera",MF_BEXP; removemapflag "prontera",mf_bexp;
removemapflag "prontera",MF_JEXP; removemapflag "prontera",mf_jexp;
removemapflag "prontera",MF_PVP; removemapflag "prontera",mf_pvp;
close; close;
} }
} }

View File

@ -3,7 +3,7 @@
//===== By: ================================================== //===== By: ==================================================
//= rAthena Dev Team //= rAthena Dev Team
//===== Last Updated: ======================================== //===== Last Updated: ========================================
//= 20121003 //= 20140208
//===== Description: ========================================= //===== Description: =========================================
//= Demonstrates the 'skill' command. //= Demonstrates the 'skill' command.
//============================================================ //============================================================
@ -17,15 +17,16 @@
prontera,157,182,0 script Skills 116,{ prontera,157,182,0 script Skills 116,{
mes "What skill would you like?"; mes "What skill would you like?";
next;
switch(select("First Aid:Play Dead:Heal:None")) { switch(select("First Aid:Play Dead:Heal:None")) {
case 1: 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; close;
case 2: 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; close;
case 3: case 3:
skill 28,3,1; // Temporarily gives player level 3 Heal skill "AL_HEAL",3,1; // Temporarily gives player level 3 Heal
close; close;
case 4: case 4:
close; close;

View File

@ -7021,7 +7021,7 @@ Example:
*atoi("<string>") *atoi("<string>")
*axtoi("<string>") *axtoi("<string>")
*strol("<string>", base) *strtol("<string>", base)
These commands are used to convert strings to numbers. 'atoi' will interpret These commands are used to convert strings to numbers. 'atoi' will interpret
given string as a decimal number (base 10), while 'axtoi' interprets strings as given string as a decimal number (base 10), while 'axtoi' interprets strings as