Explorar el Código

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

Signed-off-by: Euphy <euphy.raliel@rathena.org>
Euphy hace 11 años
padre
commit
2fff785894

+ 56 - 43
doc/sample/bank_test.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //= rAthena Dev Team
 //===== Last Updated: ========================================
-//= 20070315
+//= 20140208
 //===== Description: ========================================= 
 //= 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 "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;

+ 6 - 4
doc/sample/checkoption.txt

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

+ 12 - 12
doc/sample/delitem2.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //= rAthena Dev Team
 //===== Last Updated: ========================================
-//= 20070315
+//= 20140208
 //===== Description: ========================================= 
 //= Demonstrates the 'delitem2' command.
 //============================================================
@@ -11,29 +11,29 @@
 prontera,160,182,5	script	Delitem2	51,{
 	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;
 }

+ 8 - 7
doc/sample/getequipcardid.txt

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

+ 4 - 5
doc/sample/getequipid.txt

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

+ 4 - 4
doc/sample/getiteminfo.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //= Lupus
 //===== Last Updated: ========================================
-//= 20121003
+//= 20140208
 //===== Description: ========================================= 
 //= Demonstrates the 'getiteminfo' command.
 //============================================================
@@ -14,10 +14,10 @@ prontera,156,179,6	script	test_getiteminfo	117,{
 
 	// This line uses an INTERNAL function of your client to show item name by its ID!
 	// ^nItemID^XXXX -> Item Name
-	mes "Item ID: "+.@value+" ^nItemID^"+.@value;
+	mes "Item ID: " + .@value + " ^nItemID^" + .@value;
 
 	mes "Current item info:";
-	for(set .@id,0; .@id<14; set .@id,.@id+1)
-		mes " getiteminfo("+.@value+","+.@id+") = "+getiteminfo(.@value,.@id);
+	for(.@id = 0; .@id < 14; .@id++)
+		mes " getiteminfo(" + .@value + "," + .@id + ") = " + getiteminfo(.@value,.@id);
 	close;
 }

+ 2 - 2
doc/sample/getmonsterinfo.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //= Lupus
 //===== Last Updated: ========================================
-//= 20131106
+//= 20140208
 //===== Description: ========================================= 
 //= 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 "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);
 	close;
 }

+ 16 - 24
doc/sample/gstorage_test.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //= rAthena Dev Team
 //===== Last Updated: ========================================
-//= 20130325
+//= 20140208
 //===== Description: ========================================= 
 //= 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 "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();
-	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;
 }

+ 28 - 29
doc/sample/localized_npc.txt

@@ -3,7 +3,7 @@
 //===== By: ================================================== 
 //= rAthena Dev Team
 //===== Last Updated: ========================================
-//= 20070315
+//= 20140208
 //===== Description: ========================================= 
 //= Example of a localized NPC.
 //= 
@@ -37,7 +37,7 @@
 /// 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,23 +89,22 @@ 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;
 }
 
@@ -113,8 +112,8 @@ function	script	mes2	{
 /// Sample localized NPC
 prontera,155,183,4	script	LocalizedNPC	705,{
 	// Get text for specific languages
-	set @menu1$, callfunc("getmes2","LNPC_lang",0);
-	set @menu2$, callfunc("getmes2","LNPC_lang",1);
+	.@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 portugus";
+	callfunc "setmes2", "LNPC_text", 1, "Algo em português";
 	end;
 }

+ 33 - 35
doc/sample/npc_dynamic_shop.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //= Lance
 //===== Last Updated: ========================================
-//= 20101219
+//= 20140208
 //===== Description: ========================================= 
 //= Contains commands needed for a dynamic shop.
 //============================================================
@@ -17,23 +17,21 @@ prontera,181,200,4	script	Dynamic Shop	123,{
 	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] == 501){
+			delitem 501, @sold_quantity[.@i];
+			set $@rpotsleft, $@rpotsleft + @sold_quantity[.@i];
+			set Zeny, Zeny + @sold_quantity[.@i]*20;
+		} else if (@sold_nameid[.@i] == 502){
+			delitem 502, @sold_quantity[.@i];
+			$@opotsleft += @sold_quantity[.@i];
+			set Zeny, 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] == 501){
+			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]){
+				set Zeny, Zeny - 40*@bought_quantity[.@i];
+				getitem 501, @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] == 502)*/ {
+			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]){
+				set Zeny, Zeny - 200*@bought_quantity[.@i];
+				getitem 502, @bought_quantity[.@i];
+				$@opotsleft -= @bought_quantity[.@i];
 			} else {
 				mes "You have insufficient cash.";
 				close;
@@ -89,7 +87,7 @@ OnBuyItem:
 
 OnInit:
 	npcshopitem "dyn_shop1", 501,40,502,200;
-	set $@rpotsleft, 10;
-	set $@opotsleft, 10;
+	$@rpotsleft = 10;
+	$@opotsleft = 10;
 	end;
 }

+ 12 - 13
doc/sample/npc_live_dialogues.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //= Lupus
 //===== Last Updated: ========================================
-//= 20130905
+//= 20140208
 //===== Description: ========================================= 
 //= An example of an NPC with live dialogue.
 //= Note: This relies on Global_Functions.txt to run.
@@ -20,11 +20,16 @@ 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!");
 
@@ -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.
-	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_Rand",512,522,608,620);
+	.@itemIDfromList = callfunc("F_Rand",512,522,608,620);
 
 	// Again, say stuff according to player's gender
-	mes "Hey, "+callfunc("F_Sex","sister!","brother!")+" I have "+getitemname(@itemIDfromList)+" for you!";
+	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;
 }

+ 32 - 37
doc/sample/npc_test_setitemx.txt

@@ -3,47 +3,42 @@
 //===== By: ==================================================
 //= Lupus
 //===== Last Updated: ========================================
-//= 20121003
+//= 20140208
 //===== 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);
+	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;
 }

+ 8 - 7
doc/sample/npc_test_setmapflag.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //= Jbain
 //===== Last Updated: ========================================
-//= 20121003
+//= 20140208
 //===== Description: ========================================= 
 //= Demonstrates mapflag commands.
 //============================================================
@@ -11,22 +11,23 @@
 prontera,165,145,0	script	EXPflagtest	123,{
 	mes "[EXPflagtest]";
 	mes "Set up the map rates:";
+	next;
 	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;
 	}
 }

+ 5 - 4
doc/sample/npc_test_skill.txt

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

+ 1 - 1
doc/script_commands.txt

@@ -7021,7 +7021,7 @@ Example:
 
 *atoi("<string>")
 *axtoi("<string>")
-*strol("<string>", base)
+*strtol("<string>", base)
 
 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