Skip to content

Commit

Permalink
Modernized syntax and fixed errors in the sample scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Haru <haru@dotalux.com>
  • Loading branch information
MishimaHaruna committed Dec 30, 2013
1 parent a9156de commit 21fa090
Show file tree
Hide file tree
Showing 29 changed files with 799 additions and 521 deletions.
2 changes: 1 addition & 1 deletion doc/item_db.txt
Expand Up @@ -139,7 +139,7 @@ Upper: Equippable upper-types. Uses the following bitmasks:

Gender: Gender restriction. 0 is female, 1 is male, 2 for both (default value).

Loc: Equipment's placement. A value needs to be spevified if the item is an
Loc: Equipment's placement. A value needs to be specified if the item is an
equipment piece. Values are:

2^0 001 = Lower Headgear
Expand Down
103 changes: 58 additions & 45 deletions doc/sample/bank_test.txt
Expand Up @@ -3,64 +3,77 @@
//===== 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]";
mes "Welcome to Prontera's Bank Test.";
mes "You can only deposit a minimal of";
mes "1000z. What do you want to do?";
next;
menu "Deposit",BANK_IN,"Withdraw",BANK_OUT,"Exit",B_EXIT2;
BANK_IN:
mes "[Bank Test]";
mes "You must deposit the same of less";
mes "amount of zeny that you carry.";
mes "How much do you want to deposit?";
next;
input @kafrabank;

if(@kafrabank<1000) goto B_EXIT2;
set @kafrabank2,@kafrabank*1/100;
if(@kafrabank+@kafrabank2>Zeny) goto BANK_F;
set Zeny,Zeny-@kafrabank-@kafrabank2;
set #kafrabank,#kafrabank+@kafrabank;
mes "You now have: ^135445" + @kafrabank2 + "z^000000";
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;
Expand Down
6 changes: 3 additions & 3 deletions doc/sample/basejob_baseclass_upper.txt
Expand Up @@ -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;
Expand Down
12 changes: 7 additions & 5 deletions doc/sample/checkoption.txt
Expand Up @@ -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;
}
28 changes: 14 additions & 14 deletions doc/sample/delitem2.txt
Expand Up @@ -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;
}
15 changes: 8 additions & 7 deletions doc/sample/getequipcardid.txt
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions doc/sample/getequipid.txt
Expand Up @@ -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;
}
8 changes: 4 additions & 4 deletions doc/sample/getiteminfo.txt
Expand Up @@ -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;

Expand All @@ -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;
}
8 changes: 4 additions & 4 deletions doc/sample/getmonsterinfo.txt
Expand Up @@ -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") {
Expand All @@ -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;
}
46 changes: 19 additions & 27 deletions doc/sample/gstorage_test.txt
Expand Up @@ -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;
}

0 comments on commit 21fa090

Please sign in to comment.