Jump to content
  • 0

Could somebody check out my donation npc script..


Question

Posted (edited)

Hi, i was just wondering if someone could take a look on my script because the npc doesn't show himself.. but i dont get errors at all..


- shop Emistry_Shop1 -1,512:100

prontera,102,81,4 script Donate Custom 811,{
// NPC Name
set .name$,"[^FF0000 AsaRO Shop ^000000]";

mes .name$;
mes "Each Shop Buy Item Using Different Items.";
mes "Which shop you like to look at it";
next;
select("New Donate Custom Upper:New Donate Custom Mid: New Donate Lower");

callsub CaseCH,@menu;
npcshopitem "Emistry_Shop1",512,1;
npcshopdelitem "Emistry_Shop1",512;
for(set .@i,0; .@i < getarraysize( @ItemLists ); set .@i,.@i+1)
npcshopadditem "Emistry_Shop1",@ItemLists[.@i],@ItemPrice[.@i];
mes "Okay...wait awhile";
mes "This Shop use ^FF0000"+getitemname( @Currency )+"^000000 to buy the Items.";
close2;
callsub CaseCH,@menu;
callshop "Emistry_Shop1",1;
npcshopattach "Emistry_Shop1";
dispbottom "You currently have "+countitem( @Currency )+" "+getitemname( @Currency )+".";
end;

OnBuyItem:
callsub CaseCH,@menu;
for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1)
for(set @j,0; @j < getarraysize( @ItemLists ); set @j,@j+1)
if( @ItemLists[@j] == @bought_nameid[@i] )
set @TotalCost,@TotalCost + ( @ItemPrice[@j] * @bought_quantity[@i] );
if( countitem( @Currency ) < @TotalCost ){
for( set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1 ){
mes "Item : ^0000FF"+getitemname( @bought_nameid[@i] )+"^000000";
mes "Quantity : ^0000FF"+@bought_quantity[@i]+"^000000";
}
mes "^00FF00____________________________^000000";
mes "Total Cost : ^0000FF"+@TotalCost+" x "+getitemname( @Currency )+"^000000";
mes "^00FF00____________________________^000000";
mes "[ ^FF0000X^000000 ] You do not have enough ^0000FF"+getitemname( @Currency )+"^000000 to purchase this.";
}else{
for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1){
getitem @bought_nameid[@i],@bought_quantity[@i];
message strcharinfo(0),"Purchased "+getitemname( @bought_nameid[@i] );
}
delitem @Currency,@TotalCost;
mes "Thank you for shopping.";
mes "You now have ^FF0000"+countitem( @Currency )+" "+getitemname( @Currency )+"^000000 left.";
}
set @TotalCost,0;
deletearray @bought_nameid[0],getarraysize( @bought_nameid );
deletearray @bought_quantity[0],getarraysize( @bought_quantity );
deletearray @ItemLists[0],getarraysize( @ItemLists );
deletearray @ItemPrice[0],getarraysize( @ItemPrice );
close;

CaseCH:
deletearray @ItemLists[0],getarraysize( @ItemLists );
deletearray @ItemPrice[0],getarraysize( @ItemPrice );
switch( getarg(0) ){

case 1:
// Item Currency
set @Currency,7179;
// Item ID Lists
setarray @ItemLists[0],18730,18729,18726,18725,18723,18721,18718,18717,18714,18715,18713,18709,18708,18707,18705,18706,18701,18699,18695,18696,18694,18693,18692,18691,18681,18680,18673,18672,18669;
// Item Price
setarray @ItemPrice[0],350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350,350;
return;

case 2:
// Item Currency
set @Currency,7179;
// Item ID Lists
setarray @ItemLists[0],18720,18711,18682,18676;
// Item Price
setarray @ItemPrice[0],350,350,350,350;
return;

case 3:
// Item Currency
set @Currency,7179;
// Item ID Lists
setarray @ItemLists[0],18712,18710,18716,18703,18702,18698,18697,18683,18679,18678,18677,18670,18666;
// Item Price
setarray @ItemPrice[0],350,350,350,350,350,350,350,350,350,350,350,350,350;
return;

// case 4,5,6.....etc...
default:
mes "Wrong Selection / Configurations";
close;
}
}
Edited by Emistry
codebox

1 answer to this question

Recommended Posts

Posted

I can't see here, but are you using TABs where it should be (and not space)?

prontera,102,81,4 script Donate Custom 811,{

I mean

prontera,102,81,4<TAB>script<TAB>Donate Custom<TAB>811,{

Check on wiki for further info.

  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...