Jump to content
  • 0

Fix this please?


Question

Posted



que_moc_16,70,88,3 script Coin Trader 908,{
set .@npc$,"^0000FFCoin Trader^000000";
set .@eventmulti, "+@event+" * 10;
set .@goldmulti, "+@gold+" * 5;
set .@mithrilmulti, "+@mithril+" * 8;

mes .@npc$;
mes "Welcome, honey!";
mes "I am ^0000FFJoann, the Coin Trader^000000!";
next;
mes .@npc$;
mes "My services are available 24 Hours a Day, 7 Days a Week and 365 Days of the Year!";
menu "Continue Talking",-,"Quit",l_quit;
next;
mes .@npc$;
mes "Which coins do you wish to trade?";
next;
menu "Hollow Coin > Event Coin",l_hollowtoevent,"Poring Coin > Gold Coin",l_poringtogold,"Gold Coin > Mithril Coin",l_goldtomithril;

l_hollowtoevent:
if(countitem(21037) <10) {
mes .@npc$;
mes "You do not have enough Hollow Coins to continue with the procedure.";
next;
mes .@npc$;
mes "Please, get at least 10 Hollow Coins to be able to trade.";
close;
} else {
mes .@npc$;
mes "^FF000010 Hollow Coins^000000 = ^00FF001 Event Coin^000000";
next;
mes .@npc$;
mes "How many ^00FF00Event Coins^000000 would you like to have?";
next;
l_eventcoin:
input @event;
if(@event=="0") {
mes .@npc$;
mes "You cannot trade 10 Hollow Coins into 0 Event Coins.";
mes "Select a value higher than 0 to continue.";
next;
goto l_eventcoin;
} else {
mes .@npc$;
mes "To get your "+@event+" Event Coins, you must trade in " + .@eventmulti + " Hollow Coins.";
next;
mes .@npc$;
mes "Do you have that amount of Hollow Coins?";
next;
menu "Yes",l_yeseventcoin,"No",l_noeventcoin;

l_yeseventcoin:
if(countitem(21037) <"+@eventmulti+") {
mes .@npc$;
mes "You do not have my "+@eventmulti+" Hollow Coins.";
mes "Come back when you do.";
close;
} else {
mes .@npc$;
mes "Converting your Hollow Coins into Event Coins...";
next;
sleep 5000;
delitem 21037,"+@eventmulti+";
getitem 19344,"+@event+";
mes "I have succesfully converted your Hollow Coins into Event Coins.";
next;
mes .@npc$;
mes "Have a nice day, "+(Sex?"Mr.":"Mrs.")+" "+strcharinfo(0)+"";
close;

l_noeventcoin:
mes .@npc$;
mes "Oh well. Come back If you do have them!";
close;

l_poringtogold:
if(countitem(7539) <5) {
mes .@npc$;
mes "You do not have enough Poring Coins to continue with the procedure.";
next;
mes .@npc$;
mes "Please, get at least 10 Poring Coins to be able to trade.";
close;
} else {
mes .@npc$;
mes "^FF00FF5 Poring Coins^000000 = ^FFA5001 Gold Coin^000000";
next;
mes .@npc$;
mes "How many ^FFA500Gold Coins^000000 would you like to have?";
next;
l_goldcoin:
input @gold;
if(@gold=="0") {
mes .@npc$;
mes "You cannot trade 5 Poring Coins into 0 Gold Coins.";
mes "Select a value higher than 0 to continue.";
next;
goto l_goldcoin;
} else {
mes .@npc$;
mes "To get your "+@gold+" Gold Coins, you must trade in " + .@goldmulti + " Poring Coins.";
next;
mes .@npc$;
mes "Do you have that amount of Poring Coins?";
next;
menu "Yes",l_yesporingcoin,"No",l_noporingcoin;

l_yesporingcoin:
if(countitem(7539) <"+@goldmulti+") {
mes .@npc$;
mes "You do not have my "+@goldmulti+" Poring Coins.";
mes "Come back when you do.";
close;
} else {
mes .@npc$;
mes "Converting your Poring Coins into Gold Coins...";
next;
sleep 5000;
delitem 7539,"+@goldmulti+";
getitem 7517,"+@gold+";
mes "I have succesfully converted your Poring Coins into Gold Coins.";
next;
mes .@npc$;
mes "Have a nice day, "+(Sex?"Mr.":"Mrs.")+" "+strcharinfo(0)+"";
close;

l_noporingcoin:
mes .@npc$;
mes "Oh well. Come back If you do have them!";
close;

l_goldtomithril:
if(countitem(7517) <8) {
mes .@npc$;
mes "You do not have enough Gold Coins to continue with the procedure.";
next;
mes .@npc$;
mes "Please, get at least 8 Gold Coins to be able to trade.";
close;
} else {
mes .@npc$;
mes "^FFA50010 Gold Coins^000000 = ^808080 Mithril Coin^000000";
next;
mes .@npc$;
mes "How many ^808080Mithril Coins^000000 would you like to have?";
next;
l_mithrilcoin:
input @mithril;
if(@mithril=="0") {
mes .@npc$;
mes "You cannot trade 8 Gold Coins into 0 Mithril Coins.";
mes "Select a value higher than 0 to continue.";
next;
goto l_mithrilcoin;
} else {
mes .@npc$;
mes "To get your "+@mithril+" Mithril Coins, you must trade in " + .@mithrilmulti + " Gold Coins.";
next;
mes .@npc$;
mes "Do you have that amount of Gold Coins?";
next;
menu "Yes",l_yesgoldcoin,"No",l_nogoldcoin;

l_yesgoldcoin:
if(countitem(7517) <"+@mithrilmulti+") {
mes .@npc$;
mes "You do not have my "+@mithrilmulti+" Gold Coins.";
mes "Come back when you do.";
close;
} else {
mes .@npc$;
mes "Converting your Gold Coins into Mithril Coins...";
next;
sleep 5000;
delitem 7517,"+@mithrilmulti+";
getitem 674,"+@mithril+";
mes "I have succesfully converted your Gold Coins into Event Coins.";
next;
mes .@npc$;
mes "Have a nice day, "+(Sex?"Mr.":"Mrs.")+" "+strcharinfo(0)+"";
close;

l_nogoldcoin:
mes .@npc$;
mes "Oh well. Come back If you do have them!";
close;

l_quit:
close;
}
}
}
}
}
}
}
}
}
}
[/codeBOX]

It says the error is in the [b]set .@eventmulti, "+@event+" * 10[/b][b][i].[/i][/b]

Map-Server says

[code]
[Error]: script:op_2: invalid data for operator C_MUL
[Debug]: Data: string value="+@event+"
[Debug]: Data: number value=10
[Debug]: Source (NPC): Coin Trader at que_moc_16 (70,88)
[/code]

Help is appreciated :) Thanks

7 answers to this question

Recommended Posts

Posted

if(@event=="0") {

it should be a integer...

why you compare it using string ?

when you compare a String with an Integer....obviously..it wont work...

unless you convert the string into integer...

the correct 1 should be

if( @event == 0 ) {

Posted (edited)

que_moc_16,70,88,3 script Coin Trader 908,{
set .@npc$,"^0000FFCoin Trader^000000";

mes "[ "+.@npc$+" ]";
mes "Welcome, honey!";
mes "I am ^0000FFJoann, the Coin Trader^000000!";
next;
mes "[ "+.@npc$+" ]";
mes "My services are available 24 Hours a Day, 7 Days a Week and 365 Days of the Year!";
menu "Continue Talking",-,"Quit",l_quit;
next;
mes "[ "+.@npc$+" ]";
mes "Which coins do you wish to trade?";
next;
menu "Hollow Coin > Event Coin",l_hollowtoevent,"Poring Coin > Gold Coin",l_poringtogold,"Gold Coin > Mithril Coin",l_goldtomithril;
l_hollowtoevent:
if( countitem(21037) < 10 )
{

mes "[ "+.@npc$+" ]";
mes "You do not have enough Hollow Coins to continue with the procedure.";
next;
mes "[ "+.@npc$+" ]";
mes "Please, get at least 10 Hollow Coins to be able to trade.";
close;

} else {

mes "[ "+.@npc$+" ]";
mes "^FF000010 Hollow Coins^000000 = ^00FF001 Event Coin^000000";
next;
mes "[ "+.@npc$+" ]";
mes "How many ^00FF00Event Coins^000000 would you like to have?";
next;
l_eventcoin:
input .@event;

}
if( .@event == 0 )
{

mes "[ "+.@npc$+" ]";
mes "You cannot trade 10 Hollow Coins into 0 Event Coins.";
mes "Select a value higher than 0 to continue.";
next;
goto l_eventcoin;

} else {

set .@eventmulti, .@event * 10;
mes "[ "+.@npc$+" ]";
mes "To get your "+.@event+" Event Coins, you must trade in "+.@eventmulti+" Hollow Coins.";
next;
mes "[ "+.@npc$+" ]";
mes "Do you have that amount of Hollow Coins?";
next;
menu "Yes",l_yeseventcoin,"No",l_noeventcoin;

}
l_yeseventcoin:
if( countitem(21037) < .@eventmulti )
{

mes "[ "+.@npc$+" ]";
mes "You do not have my "+@eventmulti+" Hollow Coins.";
mes "Come back when you do.";
close;

} else {

mes "[ "+.@npc$+" ]";
mes "Converting your Hollow Coins into Event Coins...";
next;
sleep2 5000;
delitem 21037,.@eventmulti;
getitem 19344,.@event;
mes "I have succesfully converted your Hollow Coins into Event Coins.";
next;
mes "[ "+.@npc$+" ]";
mes "Have a nice day, "+(Sex?"Mr.":"Mrs.")+" "+strcharinfo(0)+"";
close;

}
l_noeventcoin:
mes "[ "+.@npc$+" ]";
mes "Oh well. Come back If you do have them!";
close;
l_poringtogold:
if( countitem(7539) < 5 )
{

mes "[ "+.@npc$+" ]";
mes "You do not have enough Poring Coins to continue with the procedure.";
next;
mes "[ "+.@npc$+" ]";
mes "Please, get at least 10 Poring Coins to be able to trade.";
close;

} else {

mes "[ "+.@npc$+" ]";
mes "^FF00FF5 Poring Coins^000000 = ^FFA5001 Gold Coin^000000";
next;
mes "[ "+.@npc$+" ]";
mes "How many ^FFA500Gold Coins^000000 would you like to have?";
next;
l_goldcoin:
input .@gold;

}
if( .@gold == 0 )
{

mes "[ "+.@npc$+" ]";
mes "You cannot trade 5 Poring Coins into 0 Gold Coins.";
mes "Select a value higher than 0 to continue.";
next;
goto l_goldcoin;

} else {

set .@goldmulti, .@gold * 5;
mes "[ "+.@npc$+" ]";
mes "To get your "+@gold+" Gold Coins, you must trade in "+.@goldmulti+" Poring Coins.";
next;
mes "[ "+.@npc$+" ]";
mes "Do you have that amount of Poring Coins?";
next;
menu "Yes",l_yesporingcoin,"No",l_noporingcoin;
}

l_yesporingcoin:
if( countitem(7539) < .@goldmulti )
{

mes "[ "+.@npc$+" ]";
mes "You do not have my "+@goldmulti+" Poring Coins.";
mes "Come back when you do.";
close;

} else {

mes "[ "+.@npc$+" ]";
mes "Converting your Poring Coins into Gold Coins...";
next;
sleep2 5000;
delitem 7539,"+@goldmulti+";
getitem 7517,"+@gold+";
mes "I have succesfully converted your Poring Coins into Gold Coins.";
next;
mes "[ "+.@npc$+" ]";
mes "Have a nice day, "+(Sex?"Mr.":"Mrs.")+" "+strcharinfo(0)+"";
close;

}
l_noporingcoin:
mes "[ "+.@npc$+" ]";
mes "Oh well. Come back If you do have them!";
close;
l_goldtomithril:
if( countitem(7517) < 8 )
{

mes "[ "+.@npc$+" ]";
mes "You do not have enough Gold Coins to continue with the procedure.";
next;
mes "[ "+.@npc$+" ]";
mes "Please, get at least 8 Gold Coins to be able to trade.";
close;

} else {

mes "[ "+.@npc$+" ]";
mes "^FFA50010 Gold Coins^000000 = ^808080 Mithril Coin^000000";
next;
mes "[ "+.@npc$+" ]";
mes "How many ^808080Mithril Coins^000000 would you like to have?";
next;
l_mithrilcoin:
input .@mithril;

}
if( .@mithril == 0 )
{

mes "[ "+.@npc$+" ]";
mes "You cannot trade 8 Gold Coins into 0 Mithril Coins.";
mes "Select a value higher than 0 to continue.";
next;
goto l_mithrilcoin;

} else {

set .@mithrilmulti, .@mithril * 8;
mes "[ "+.@npc$+" ]";
mes "To get your "+@mithril+" Mithril Coins, you must trade in " + .@mithrilmulti + " Gold Coins.";
next;
mes "[ "+.@npc$+" ]";
mes "Do you have that amount of Gold Coins?";
next;
menu "Yes",l_yesgoldcoin,"No",l_nogoldcoin;
}

l_yesgoldcoin:
if( countitem(7517) < .@mithrilmulti )
{
mes "[ "+.@npc$+" ]";
mes "You do not have my "+@mithrilmulti+" Gold Coins.";
mes "Come back when you do.";
close;

} else {

mes "[ "+.@npc$+" ]";
mes "Converting your Gold Coins into Mithril Coins...";
next;
sleep2 5000;
delitem 7517,.@mithrilmulti;
getitem 674,.@mithril;
mes "I have succesfully converted your Gold Coins into Event Coins.";
next;
mes "[ "+.@npc$+" ]";
mes "Have a nice day, "+(Sex?"Mr.":"Mrs.")+" "+strcharinfo(0)+"";
close;

}
l_nogoldcoin:
mes "[ "+.@npc$+" ]";
mes "Oh well. Come back If you do have them!";
close;
l_quit:
close;
}

Some point you need to know:

1.

> do not use sleep 'cause:

*sleep {<milliseconds>}; pause the script for x seconds and ditch the RID (so no player is attached anymore)

> use sleep2 'cause:

sleep2 {<milliseconds>}; pause the script for x seconds, and continue with the RID attached.

--------------------

2.

Check post #2 ( Emistry ) and #6 ( Joseph )

--------------------

3.

^o^~ hope it help.

Edited by Arcenciel
Codeboxed

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...