Jump to content
  • 0

Help


Lukas

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  01/19/12
  • Last Seen:  

Can someone help me,I did a script and I dont know whats wrong.



prontera,93,97,5 script Larry 953,{
mes "[Larry]";
mes "Hello stranger,who are you?";
next;
switch(select("I am "+strcharinfo(0)+":Your friend Tom sent me here")) {
case 1:
mes "[Larry]";
mes "Hello"+strcharinfo(0)+" what do you want?";
next;
switch(select("Buy items:Nothing.Bye")) {
case 1:
mes "[Larry]";
mes "Well, I have a sword and an armor.What do you want?";
next;
switch(select("I want the sword:I want the armor")) {
case 1:
mes "[Larry]";
mes "The sword costs 1000000.Do you want to buy?";
next;
switch(select("Yes….I do:No,sorry")) {
case 1:
mes "[Larry]";
mes "Ok here you have your sword.";
next;
getitem 13062,1;
set Zeny,Zeny-1000000;
next;
mes "[Larry]";
mes "Ok good bye.";
close;
case 2:
mes "[Larry]";
mes "Oh….Well.So good bye.";
close;
case 2:
mes "[Larry]";
mes "The armor costs 2000000.Do you want to buy it?";
next;
switch(select("Yes,I do:No sorry")) {
case 1:
mes "[Larry]";
mes "Ok.Here you have your armor.";
next;
getitem 2751,1;
set Zeny,Zeny-2000000;
next;
mes "[Larry]";
mes "Ok good bye.";
close;
case 2:
mes "[Larry]";
mes "Oh…Well I will find someone else.Bye";
close;
case 2:
mes "[Larry]";
mes "Ok.Goodbye";
close;
case 2:
mes "[Larry]";
mes "Ahhh yes you are"+strcharinfo(0)+" what do you want?";
next;
switch(select("Buy items:Nothing.Bye")) {
case 1:
mes "[Larry]";
mes "Well, I have a sword and an armor.What do you want?";
next;
switch(select("I want the sword:I want the armor")) {
case 1:
mes "[Larry]";
mes "The sword costs 500000.Do you want to buy?";
next;
switch(select("Yes….I do:No,sorry")) {
case 1:
mes "[Larry]";
mes "Ok here you have your sword.";
next;
getitem 13062,1;
set Zeny,Zeny-500000;
next;
mes "[Larry]";
mes "Ok good bye.";
close;
case 2:
mes "[Larry]";
mes "Oh….Well.So good bye.";
close;
case 2:
mes "[Larry]";
mes "The armor costs 1000000.Do you want to buy it?";
next;
switch(select("Yes,I do:No sorry")) {
case 1:
mes "[Larry]";
mes "Ok.Here you have your armor.";
next;
getitem 2751,1;
set Zeny,Zeny-1000000;
next;
mes "[Larry]";
mes "Ok good bye.";
close;
case 2:
mes "[Larry]";
mes "Oh…Well I will find someone else.Bye";
close;
case 2:
mes "[Larry]";
mes "Ok.Goodbye";
close;
}
}
}
}
}
}
}
}
}
}
[/codeBOX]

Edited by Lukas
Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  32
  • Reputation:   1
  • Joined:  12/07/11
  • Last Seen:  

switch(select("Yes….I do:No,sorry")) {

case 1:

mes "[Larry]";

mes "Ok here you have your sword.";

next;

getitem 13062,1;

set Zeny,Zeny-1000000;

next;

mes "[Larry]";

mes "Ok good bye.";

close;

case 2:

mes "[Larry]";

mes "Oh….Well.So good bye.";

close;

case 2:

mes "[Larry]";

mes "The armor costs 2000000.Do you want to buy it?";

Check your map server, error it's write and you know what's don't works.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  341
  • Reputation:   43
  • Joined:  01/10/12
  • Last Seen:  

Wow..! :)

You must close your cases with "}", right after it ends.

Look at this, hope it helps to explain:

switch ( select ( "Case 1:Case2" ))
{
Case 1:
 switch ( select ( "Case 1:Case 2" ))
 {
  Case 1:
   break;

  Case 2:
   break;
 }
 break;

Case 2:
 switch ( select ( "Case 1:Case 2" ))
 {
  Case 1:
   break;

  Case 2:
   break;
 }
 break;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

Well how to say:

Each switch() has to end their own block, you can't add the "}" at the end of the file.

Look at the modified script of mine:

prontera,93,97,5    script    Larry    953,{
mes "[Larry]";
mes "Hello stranger,who are you?";
next;
switch(select("I am "+strcharinfo(0)+":Your friend Tom sent me here")) {
   case 1:
   mes "[Larry]";
   mes "Hello"+strcharinfo(0)+" what do you want?";
   next;
   switch(select("Buy items:Nothing.Bye")) {
       case 1:
       mes "[Larry]";
       mes "Well, I have a sword and an armor.What do you want?";
       next;
       switch(select("I want the sword:I want the armor")) {

           case 1:
           mes "[Larry]";
           mes "The sword costs 1000000.Do you want to buy?";
           next;
           switch(select("Yes….I do:No,sorry")) {
               case 1:
               mes "[Larry]";
               if(Zeny < 1000000) {
                   mes "You don't have the required amount of Zeny.";
                   close;
               }
               mes "Ok here you have your sword.";
               next;
               getitem 13062,1;
               set Zeny,Zeny-1000000;
               next;
               mes "[Larry]";
               mes "Ok good bye.";
               close;

               case 2:
               mes "[Larry]";
               mes "Oh….Well.So good bye.";
               close;
           }
           case 2:
           mes "[Larry]";
           mes "The armor costs 2000000.Do you want to buy it?";
           next;
           switch(select("Yes,I do:No sorry")) {
               case 1:
               mes "[Larry]";
               if(Zeny < 2000000) {
                   mes "You don't have the required amount of Zeny.";
                   close;
               }
               mes "Ok.Here you have your armor.";
               next;
               getitem 2751,1;
               set Zeny,Zeny-2000000;
               next;
               mes "[Larry]";
               mes "Ok good bye.";
               close;

               case 2:
               mes "[Larry]";
               mes "Oh…Well I will find someone else.Bye";
               close;
           }
       }
       case 2:
       mes "[Larry]";
       mes "Ok.Goodbye";
       close;
   }
   case 2:
   mes "[Larry]";
   mes "Ahhh yes you are"+strcharinfo(0)+" what do you want?";
   next;
   switch(select("Buy items:Nothing.Bye")) {
       case 1:
       mes "[Larry]";
       mes "Well, I have a sword and an armor.What do you want?";
       next;
       switch(select("I want the sword:I want the armor")) {
           case 1:
           mes "[Larry]";
           mes "The sword costs 500000.Do you want to buy?";
           next;
           switch(select("Yes….I do:No,sorry")) {
               case 1:
               mes "[Larry]";
               if(Zeny < 500000) {
                   mes "You don't have the required amount of Zeny.";
                   close;
               }
               mes "Ok here you have your sword.";
               next;
               getitem 13062,1;
               set Zeny,Zeny-500000;
               next;
               mes "[Larry]";
               mes "Ok good bye.";
               close;

               case 2:
               mes "[Larry]";
               mes "Oh….Well.So good bye.";
               close;
           }
           case 2:
           mes "[Larry]";
           mes "The armor costs 1000000.Do you want to buy it?";
           next;
           switch(select("Yes,I do:No sorry")) {
               case 1:
               mes "[Larry]";
               if(Zeny < 1000000) {
                   mes "You don't have the required amount of Zeny.";
                   close;
               }
               mes "Ok.Here you have your armor.";
               next;
               getitem 2751,1;
               set Zeny,Zeny-1000000;
               next;
               mes "[Larry]";
               mes "Ok good bye.";
               close;

               case 2:
               mes "[Larry]";
               mes "Oh…Well I will find someone else.Bye";
               close;
           }
       }
   case 2:
   mes "[Larry]";
   mes "Ok.Goodbye";
   close;
   }
}
}

Also you forgot to check if the player has the required amount of Zeny for these items.

"if(Zeny < xxxx) {"

Regards,

Chris

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  01/19/12
  • Last Seen:  

THanks you everyone. Can you do this one too? It's a friends and he asked if I could check it and I have no idea! And explain what you put and why :) Thaaanks :D



new_1-1,54,114,4 script Novice Shop/Quest 729,{
mes "[John]";
mes "Hello there Newbie!";
mes "How are you this fine day?";
next;
mes "[John]";
mes "I'm very well! Happy, entertained and so much more!";
next;
mes "[John]";
mes "Do you want to access the Newbie Shop or do you want to quest the Newbie Items?!";
next;
switch(select("Shop:Quest")) {
case 1:
warp "new_1-1" ,114,49;
close;
case 2:
mes "[John]";
mes "Well then, please choose which side you will be on!";
mes "Evil";
mes "or";
mes "Good";
mes "You Choose!";
next;
switch(select("Evil:Good")) {
case 1:
mes "[John]";
mes "For the Evil side, you, "+strcharinfo(0)+" accept to join the Evil in hands of the great Satan Morocc.";
next;
mes "Do you accept or do you deny?";
next;
switch(select("I Accept:I Deny")) {
case 1:
mes "[John, the Evil]";
mes "Okay. Since you decided to join the evil side, you will be given at the end of the quest, two very powerful blades.";
next;
mes "[John, the Evil]";
mes "They were once used by the great and dark Naght Sieger.";
mes "They are the Naght Sieger Blades";
next;
mes "[John, the Evil]";
mes "To get these evil blades, you must bring me the following items:";
next;
mes "[John, the Evil]";
mes "10 Feather of Birds";
mes "20 Cyfar";
next;
mes "[John, the Evil]";
mes "You must go get these items.";
mes "Do you have them with you in this moment?";
next;
switch(select("Yes, I do:No, I don't")) {
case 1:
mes "[John, the Evil]";
mes "Okay then, give me those items!";
next;
if((countitem(7053) > 20) || (countitem(916) > 10) goto L_ItemYes;
mes "[John, the Evil]";
mes "You don't have my items, please go get them.";
close;
L_ItemYes:
mes "[John, the Evil]";
delitem 7053,20;
delitem 916,10;
getitem 13412,1;
getitem 13413,1;
mes "There you have your items. You have joined the Evil Force.";
next;
mes "Until your next visit, Evil Citizen.";
close;
case 2:
mes "[John, the Evil]";
mes "If you wish to get the blades, you must first bring me the items!";
close;
case 2:
mes "[John, the Evil]";
mes "If you deny, then you can join the Good Forces.";
mes "Do not make yourself a fool.";
close;
case 2:
mes "[John, the Good]";
mes "Do you, "+strcharinfo(0)" accept to join the Good Force?";
next;
switch(select("I Accept:I Deny")) {
case 1:
mes "[John, the Good]";
mes "Ahhhhh, you have wished to join the Good Forces!";
next;
mes "[John, the Good]";
mes "Congratulations! Well...let's get to the point of our whole conversation please!";
next;
mes "[John, the Good]";
mes "To get the items of the good, you must first bring me the items necessary.";
next;
mes "[John, the Good]";
mes "The items I will give you are two different kinds. One is a dagger named Star Dust Blade and another is a whip named Blade Whip, it will be better since you have more chances and more jobs!";
next;
mes "[John, the Good]";
mes "For these very special items, you will need to bring me the following items:";
mes "40 Decayed Nails";
mes "50 Sticky Mucus";
next;
mes "That's all!";
next;
mes "[John, the Good]";
mes "Have you got my items?";
next;
switch(select("I Do!:I Don't")) {
case 1:
mes "[John, the Good]";
mes "Well then! May I have them?";
next;
if((countitem(957) > 50) || (countitem(938) > 40) goto L_ItemsCheck;
mes "[John, the Good]";
mes "You do not have my required items! You lied!";
next;
mes "[John, the Good]";
mes "Such behaviour is not accepted here. I will give you a second chance.";
close;
L_ItemsCheck:
mes "[John, the Good]";
mes "Oh! You have my items!";
delitem 957,50;
delitem 938,40;
getitem 1969,1;
getitem 1148,1;
next;
mes "[John, the Good]";
mes "Well Done!";
mes "Thank you for using my services!";
next;
mes "[John, the Good]";
mes "Goodbye!";
close;
}
case 2:
mes "[John, the Good]";
mes "Aww. Well, can you please go get them?";
close;
}
case 2:
mes "[John, the Good]";
mes "You deny to join the good forces?!";
next;
mes "[John, the Good]";
mes "Oh, that's such a pitty...";
close;
}
}
}
}
}
[/codeBOX]

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  341
  • Reputation:   43
  • Joined:  01/10/12
  • Last Seen:  

Line 56 and Line 112:

Missing one ")"


if((countitem(7053) > 20) || (countitem(916) > 10)[color=#ff0000])[/color] goto L_ItemYes;

if((countitem(957) > 50) || (countitem(938) > 40)[color=#ff0000])[/color] goto L_ItemsCheck;

Line 70 - 82:

Cases close up with "}" and missing one "+"


case 2:
mes "[John, the Evil]";
mes "If you wish to get the blades, you must first bring me the items!";
close; [color=#ff0000]}[/color]
case 2:
mes "[John, the Evil]";
mes "If you deny, then you can join the Good Forces.";
mes "Do not make yourself a fool.";
close; [color=#ff0000]}[/color]
case 2:
mes "[John, the Good]";
mes "Do you, "+strcharinfo(0)[color=#ff0000]+[/color]" accept to join the Good Force?";
next;

Line 108-133:

You have 2 options but only 1 case.

Line 135-146:

Same thing, close cases with "}". Add it yourself.

case 2:
mes "[John, the Good]";
mes "Aww. Well, can you please go get them?";
close;
}
case 2:
mes "[John, the Good]";
mes "You deny to join the good forces?!";
next;
mes "[John, the Good]";
mes "Oh, that's such a pitty...";
close;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  01/19/12
  • Last Seen:  

Still doesen´t work.It says that the error is on line 142 and sometimes on 141 can you help me.

I put the right curlys and still doesn´t work.

Edited by Lukas
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

you should show your edited scripts......

we dont know which part of your script is wrong if you dont show us...

saying line error doesnt help in solving your problems due to we cant read your mind....:)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  01/19/12
  • Last Seen:  

Oh! Okay.

Edited Script:


new_1-1,54,114,4 script Novice Shop/Quest 729,{
mes "[John]";
mes "Hello there Newbie!";
mes "How are you this fine day?";
next;
mes "[John]";
mes "I'm very well! Happy, entertained and so much more!";
next;
mes "[John]";
mes "Do you want to access the Newbie Shop or do you want to quest the Newbie Items?!";
next;
switch(select("Shop:Quest")) {
case 1:
warp "new_1-1" ,114,49;
close;
case 2:
mes "[John]";
mes "Well then, please choose which side you will be on!";
mes "Evil";
mes "or";
mes "Good";
mes "You Choose!";
next;
switch(select("Evil:Good")) {
case 1:
mes "[John]";
mes "For the Evil side, you, "+strcharinfo(0)+" accept to join the Evil in hands of the great Satan Morocc.";
next;
mes "Do you accept or do you deny?";
next;
switch(select("I Accept:I Deny")) {
case 1:
mes "[John, the Evil]";
mes "Okay. Since you decided to join the evil side, you will be given at the end of the quest, two very powerful blades.";
next;
mes "[John, the Evil]";
mes "They were once used by the great and dark Naght Sieger.";
mes "They are the Naght Sieger Blades";
next;
mes "[John, the Evil]";
mes "To get these evil blades, you must bring me the following items:";
next;
mes "[John, the Evil]";
mes "10 Feather of Birds";
mes "20 Cyfar";
next;
mes "[John, the Evil]";
mes "You must go get these items.";
mes "Do you have them with you in this moment?";
next;
switch(select("Yes, I do:No, I don't")) {
case 1:
mes "[John, the Evil]";
mes "Okay then, give me those items!";
next;
if((countitem(7053) > 20)) || (countitem(916) > 10) goto L_ItemYes;
mes "[John, the Evil]";
mes "You don't have my items, please go get them.";
close;
L_ItemYes:
mes "[John, the Evil]";
delitem 7053,20;
delitem 916,10;
getitem 13412,1;
getitem 13413,1;
mes "There you have your items. You have joined the Evil Force.";
next;
mes "Until your next visit, Evil Citizen.";
close;
case 2:
mes "[John, the Evil]";
mes "If you wish to get the blades, you must first bring me the items!";
close;
}
case 2:
mes "[John, the Evil]";
mes "If you deny, then you can join the Good Forces.";
mes "Do not make yourself a fool.";
}
close;
case 2:
mes "[John, the Good]";
mes "Do you, "+strcharinfo(0)+" accept to join the Good Force?";
next;
switch(select("I Accept:I Deny")) {
case 1:
mes "[John, the Good]";
mes "Ahhhhh, you have wished to join the Good Forces!";
next;
mes "[John, the Good]";
mes "Congratulations! Well...let's get to the point of our whole conversation please!";
next;
mes "[John, the Good]";
mes "To get the items of the good, you must first bring me the items necessary.";
next;
mes "[John, the Good]";
mes "The items I will give you are two different kinds. One is a dagger named Star Dust Blade and another is a whip named Blade Whip, it will be better since you have more chances and more jobs!";
next;
mes "[John, the Good]";
mes "For these very special items, you will need to bring me the following items:";
mes "40 Decayed Nails";
mes "50 Sticky Mucus";
next;
mes "That's all!";
next;
mes "[John, the Good]";
mes "Have you got my items?";
next;
switch(select("I Do!:I Don't")) {
case 1:
mes "[John, the Good]";
mes "Well then! May I have them?";
next;
if((countitem(957) > 50)) || (countitem(938) > 40) goto L_ItemsCheck;
mes "[John, the Good]";
mes "You do not have my required items! You lied!";
next;
mes "[John, the Good]";
mes "Such behaviour is not accepted here. I will give you a second chance.";
close;
L_ItemsCheck:
mes "[John, the Good]";
mes "Oh! You have my items!";
delitem 957,50;
delitem 938,40;
getitem 1969,1;
getitem 1148,1;
next;
mes "[John, the Good]";
mes "Well Done!";
mes "Thank you for using my services!";
next;
mes "[John, the Good]";
mes "Goodbye!";
close;
}
case 2:
mes "[John, the Good]";
mes "Aww. Well, can you please go get them?";
close;
}
case 2:
mes "[John, the Good]";
mes "You deny to join the good forces?!";
next;
mes "[John, the Good]";`
mes "Oh, that's such a pitty...";
close;
}
}
}
[/codeBOX]

Error in map-server:

oVoca.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  1315
  • Reputation:   372
  • Joined:  12/10/11
  • Last Seen:  

Recheck your switches. You used multiple of them but some of them are missing. I was gonna attempt to correct it but there were just too much in your script. Your script being unorganized doesn't help either.

I've found some problems though.

switch(select("Shop:Quest")) {
case 1:
warp "new_1-1" ,114,49;
close;

You need to replace close with end

if((countitem(957) > 50)) || (countitem(938) > 40) goto L_ItemsCheck;

There's two instances of that. Instead of using labels, you can just replace goto L_ItemCheck; with { script here }

Remove the right curly on line 136 because your switch prior to that won't have a case 2.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  221
  • Reputation:   12
  • Joined:  12/18/11
  • Last Seen:  

Something's wrong with your switches. Check you have all the right curlys and left curlys in the right place.

You've probably misplaced them.

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