Jump to content
  • 0

Script Error [ Help ]


SlashGeeGee

Question


  • Group:  Members
  • Topic Count:  111
  • Topics Per Day:  0.02
  • Content Count:  573
  • Reputation:   20
  • Joined:  11/19/11
  • Last Seen:  

When I Click the NPC it shows the menu but when i click any of the two the shop doesnt pop out :D

BTW , here's the error at the server :

308xl3d.jpg

Script


prontera,97,66,6 script Quest NPC 997,{
mes "Choose your Shop";
switch (select ("Headgears:Armors")) {
Case 1: doevent "Shop5::OnShop"; end;
Case 2: doevent "Shop6::OnShop"; end;
}

}




// -- ***************************************** F I R S T    S H O P **********************************************

- shop quest_shop5 -1,501:50
- script Shop5 -1,{
set @i,0;
mes "[Equipment Quest Collector]";
mes "Which item do you wish to obtain?";
mes "Select only one.";
callshop "quest_shop5",1;
npcshopattach "quest_shop5";
end;

OnBuyItem:
if(.Buildquests) {
for(set .e,0; !compare(getarg(.e+1)+"", "Zeny"); set .e,.e+2) {}
npcshopadditem "quest_shop65",getarg(.e+2),getarg(.e)*compare(getarg(.e+1),"SZeny");
setarray .Shop[.i],getarg(.e+2);
set .i,.i+1;
goto quests_Setup;
}
if(.Shop[@i]!=@bought_nameid) for(set @i,1; 1; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set .i,@i; callsub quests_Setup; }
for(set @i,1; !@e; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set @e,1; set .i,@i; callsub quests_Setup; }
mes "[shop quests NPC]";
mes "I require the following:";
for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) mes "^FF0000" + ((countitem(getarg(@i))>=getarg(@i+1))? "^00FF00":"") + "" + getarg(@i+1) + " " + getitemname(getarg(@i)) + " [" + countitem(getarg(@i)) + "/" + getarg(@i+1) + "]";
if(getarg(@i)) mes "^FF0000" + ((Zeny>=getarg(@i))? "^00FF00":"") + "" + getarg(@i) + " Zeny";
mes "^000000In exchange, I will give you:^0000FF";
for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
switch(select("Exchange:" + (((((getiteminfo(@bought_nameid,5) & 1) || (getiteminfo(@bought_nameid,5) & 256) || (getiteminfo(@bought_nameid,5) & 512)) && @equip==0))? "Preview Item":"") + ":No thanks")) {
case 1:
for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) if(countitem(getarg(@i)) < getarg(@i+1)) {
next;
mes "You have " + countitem(getarg(@i)) + " " + getitemname(getarg(@i)) + ", while I require " + getarg(@i+1) + ".";
mes "Please obtain ^FF0000" + (getarg(@i+1)-countitem(getarg(@i))) + " more " + getitemname(getarg(@i)) + "^000000.";
close;
}
if(Zeny < getarg(@i)) {
next;
mes "You do not have enough Zeny.";
mes "Please obtain ^FF0000" + (getarg(@i)-Zeny) + " more Zeny^000000.";
close;
}
for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) delitem getarg(@i),getarg(@i+1);
set Zeny,Zeny-getarg(@i);
for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) getitem getarg(@i),getarg(@i+1);
if (compare(getarg(@i,0),"announce")) announce strcharinfo(0) + " has just obtained " + getitemname(@bought_nameid) + "!",bc_all;
close;
case 2:
set @bottomview, getlook(3);
set @topview, getlook(4);
set @midview, getlook(5);
addtimer 1000, strnpcinfo(3)+"::On_Leave";
set @equip,getiteminfo(@bought_nameid, 5);
set @view, getiteminfo(@bought_nameid, 11);
if(@equip != -1 && @view > 0) {
if(@equip & 1) atcommand "@changelook 3 " + @view;
if(@equip & 256) atcommand "@changelook 1 " + @view;
if(@equip & 512) atcommand "@changelook 2 " + @view;
}
next;
goto OnBuyItem;
case 3:
close;
}
On_Leave:
atcommand "@changelook 1 " + @topview;
atcommand "@changelook 2 " + @midview;
atcommand "@changelook 3 " + @bottomview;
set @equip,0;
set @view,0;
set @topview,0;
set @midview,0;
set @bottomview,0;
end;
OnInit:
npcshopitem "quest_shop5",0,0;
set .Buildquests,1;
set .i,1;
quests_Setup:
switch(.i) {
default: set .Buildquests,0; set .e,0; set .i,0; end;
case 1: callsub OnBuyItem,7227,20,7069,300,978,1,7094,100,50000000,"SZeny",2357,1;
case 2: callsub OnBuyItem,7227,15,2106,1,1095,50,7094,75,50000000,"SZeny",2115,1;
case 3: callsub OnBuyItem,7227,15,916,150,947,150,7094,60,50000000,"SZeny",2524,1;
case 4: callsub OnBuyItem,7227,15,916,100,949,100,7094,50,50000000,"SZeny",2421,1;

}
}




// -- ***************************************** S E C O N D    S H O P **********************************************

- shop quest_shop6 -1,501:50
- script Shop6 -1,{
set @i,0;
mes "[Headgear Quest Collector]";
mes "Which item do you wish to obtain?";
mes "Select only one.";
callshop "quest_shop6",1;
npcshopattach "quest_shop6";
end;

OnBuyItem:
if(.BuildQuest) {
for(set .e,0; !compare(getarg(.e+1)+"", "Zeny"); set .e,.e+2) {}
npcshopadditem "quest_shop6",getarg(.e+2),getarg(.e)*compare(getarg(.e+1),"SZeny");
setarray .Shop[.i],getarg(.e+2);
set .i,.i+1;
goto Quest_Setup;
}
if(.Shop[@i]!=@bought_nameid) for(set @i,1; 1; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set .i,@i; callsub Quest_Setup; }
for(set @i,1; !@e; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set @e,1; set .i,@i; callsub Quest_Setup; }
mes "[shop Quest NPC]";
mes "I require the following:";
for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) mes "^FF0000" + ((countitem(getarg(@i))>=getarg(@i+1))? "^00FF00":"") + "" + getarg(@i+1) + " " + getitemname(getarg(@i)) + " [" + countitem(getarg(@i)) + "/" + getarg(@i+1) + "]";
if(getarg(@i)) mes "^FF0000" + ((Zeny>=getarg(@i))? "^00FF00":"") + "" + getarg(@i) + " Zeny";
mes "^000000In exchange, I will give you:^0000FF";
for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
switch(select("Exchange:" + (((((getiteminfo(@bought_nameid,5) & 1) || (getiteminfo(@bought_nameid,5) & 256) || (getiteminfo(@bought_nameid,5) & 512)) && @equip==0))? "Preview Item":"") + ":No thanks")) {
case 1:
for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) if(countitem(getarg(@i)) < getarg(@i+1)) {
next;
mes "You have " + countitem(getarg(@i)) + " " + getitemname(getarg(@i)) + ", while I require " + getarg(@i+1) + ".";
mes "Please obtain ^FF0000" + (getarg(@i+1)-countitem(getarg(@i))) + " more " + getitemname(getarg(@i)) + "^000000.";
close;
}
if(Zeny < getarg(@i)) {
next;
mes "You do not have enough Zeny.";
mes "Please obtain ^FF0000" + (getarg(@i)-Zeny) + " more Zeny^000000.";
close;
}
for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) delitem getarg(@i),getarg(@i+1);
set Zeny,Zeny-getarg(@i);
for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) getitem getarg(@i),getarg(@i+1);
if (compare(getarg(@i,0),"announce")) announce strcharinfo(0) + " has just obtained " + getitemname(@bought_nameid) + "!",bc_all;
close;
case 2:
set @bottomview, getlook(3);
set @topview, getlook(4);
set @midview, getlook(5);
addtimer 1000, strnpcinfo(3)+"::On_Leave";
set @equip,getiteminfo(@bought_nameid, 5);
set @view, getiteminfo(@bought_nameid, 11);
if(@equip != -1 && @view > 0) {
if(@equip & 1) atcommand "@changelook 3 " + @view;
if(@equip & 256) atcommand "@changelook 1 " + @view;
if(@equip & 512) atcommand "@changelook 2 " + @view;
}
next;
goto OnBuyItem;
case 3:
close;
}
On_Leave:
atcommand "@changelook 1 " + @topview;
atcommand "@changelook 2 " + @midview;
atcommand "@changelook 3 " + @bottomview;
set @equip,0;
set @view,0;
set @topview,0;
set @midview,0;
set @bottomview,0;
end;
OnInit:
npcshopitem "quest_shop6",0,0;
set .BuildQuest,1;
set .i,1;
Quest_Setup:
switch(.i) {
default: set .BuildQuest,0; set .e,0; set .i,0; end;
case 1: callsub OnBuyItem,7227,3,7063,50,982,1,5172,1,5000000,"SZeny",5170,1;
case 2: callsub OnBuyItem,7227,3,1019,100,978,1,5000000,"SZeny",5579,1;
case 3: callsub OnBuyItem,7227,3,1059,75,907,75,975,1,5000000,"SZeny",5467,1;
case 4: callsub OnBuyItem,7227,3,916,100,7063,1,982,1,5000000,"SZeny",5372,1;

}
}

Thank You for Helping :)

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  351
  • Reputation:   52
  • Joined:  11/15/11
  • Last Seen:  

That's because there is no OnShop label within the NPC Shop5 or Shop6.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  111
  • Topics Per Day:  0.02
  • Content Count:  573
  • Reputation:   20
  • Joined:  11/19/11
  • Last Seen:  

Sir , it's still not working here's what i've edited :

-  script  Shop5::OnShop  -1,{

Edited by SlashGeeGee
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  130
  • Reputation:   43
  • Joined:  12/11/11
  • Last Seen:  

-<tab>script<tab>Shop5<tab>-1,{
...
OnShop:
...
}

*doevent "<NPC object name>::<event label>";

This command will start a new execution thread in a specified NPC object at the

specified label. The execution of the script running this command will not stop.

No parameters may be passed with a doevent call.

The script of the NPC object invoked in this manner will run as if it's been

invoked by the RID that was active in the script that issued a 'doevent'.

place' date='100,100,1%TAB%script%TAB%NPC%TAB%53,{

mes "This is what you will see when you click me";

close;

OnLabel:

mes "This is what you will see if the doevent is activated";

close;

}

doevent "NPC::OnLabel";[/quote']

Edited by plankt
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  111
  • Topics Per Day:  0.02
  • Content Count:  573
  • Reputation:   20
  • Joined:  11/19/11
  • Last Seen:  

-<tab>script<tab>Shop5<tab>-1,{
...
OnShop:
...
}

*doevent "<NPC object name>::<event label>";

This command will start a new execution thread in a specified NPC object at the

specified label. The execution of the script running this command will not stop.

No parameters may be passed with a doevent call.

The script of the NPC object invoked in this manner will run as if it's been

invoked by the RID that was active in the script that issued a 'doevent'.

place' date='100,100,1%TAB%script%TAB%NPC%TAB%53,{

mes "This is what you will see when you click me";

close;

OnLabel:

mes "This is what you will see if the doevent is activated";

close;

}

doevent "NPC::OnLabel";[/quote']

it isi already in tab sir but still doesnt work :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  351
  • Reputation:   52
  • Joined:  11/15/11
  • Last Seen:  

:D read correctly please all information has been given to you.

This would be a script example:

http://upaste.me/4ad115389e74d41

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  111
  • Topics Per Day:  0.02
  • Content Count:  573
  • Reputation:   20
  • Joined:  11/19/11
  • Last Seen:  

still doenst open shop sir :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  130
  • Reputation:   43
  • Joined:  12/11/11
  • Last Seen:  

What you're looking for could be:

*callshop "<name>",<option>;

These are a series of commands used to create dynamic shops.

The callshop function calls a invisible shop (view -1) as if the player clicked on it.

For the options on callShop:

0 = The normal window (buy, sell and cancel)

1 = The buy window

2 = The sell window

Example(s):

callshop "DaShop",1; //Will call the shop named DaShop and opens the buy menu.

It will open a normal shop. You need to have that shop as a script already.

Link to comment
Share on other sites

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.

×
×
  • Create New...