Jump to content
  • 0

Pots Converter random stuck


erick26

Question


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  24
  • Reputation:   0
  • Joined:  02/08/21
  • Last Seen:  

Hi everyone,

I am just wondering what is wrong with my script below as sometime randomly i get stuck at without a chance of inputting number or when someone just pressed enter and not inputting number. Below is my script.

vip_lounge,157,139,4    script    Potion Converter    100,{

   mes "Hi! I can convert your potions to your choice.";
   mes "Select which item you want to exchange.";
   next;
   switch(select("Segen White Potion 2x->Segen Blue Potion 1x:Segen Blue Potion 2x->Segen White Potion 1x:Siege White Potion 2x->Siege Blue Potion1x:Siege Blue Potion2x->Siege White Potion1x:Close")) {
    mes "How much?";
    input .@num;
    case 1:
        if(countitem(11503) >= .@num) {
            delitem 11503, .@num;
            getitem 11504, .@num/2;
        } else if ((.@weight) > 50){
            mes "Hmmmm... it seems you are overweight";
        } else if(countitem(11503) < .@num) {
            mes "Sorry You don't have the required item!";
        }
        close;
        break;
    case 2:
        if(countitem(11504) >= .@num) {
            delitem 11504, .@num;
            getitem 11503, .@num/2;
        } else if ((.@weight) > 50){
            mes "Hmmmm... it seems you are overweight";
        }  else if(countitem(11504) < .@num) {
            mes "Sorry You don't have the required item!";
        }
        close;
        break;
    case 3:
        if(countitem(32007) >= .@num) {
            delitem 32007, .@num;
            getitem 32008, .@num/2;
        } else if ((.@weight) > 50){
            mes "Hmmmm... it seems you are overweight";
        }  else if(countitem(32007) < .@num) {
            mes "Sorry You don't have the required item!";
        }
        close;
        break;
    case 4:
        if(countitem(32008) >= .@num) {
            delitem 32008, .@num;
            getitem 32007, .@num/2;
        } else if ((.@weight) > 50){
            mes "Hmmmm... it seems you are overweight";
        }  else if(countitem(32008) < .@num) {
            mes "Sorry You don't have the required item!";
        }
        close;
        break;
    case 5:
        close;

    }
OnInit:
    waitingroom "Convert pots here",0;
    
}

 

Edited by Mael
Use a codebox
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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

vip_lounge,157,139,4	script	Potion Converter	100,{

	mes "Hi! I can convert your potions to your choice.";
	mes "Select which item you want to exchange.";
	next;
	switch(select("Segen White Potion 2x->Segen Blue Potion 1x:Segen Blue Potion 2x->Segen White Potion 1x:Siege White Potion 2x->Siege Blue Potion1x:Siege Blue Potion2x->Siege White Potion1x:Close")) {
	
	case 1:
		mes "How much?";
		input .@num, 1, 30000;
		if(countitem(11503) >= .@num) {
			delitem 11503, .@num;
			getitem 11504, .@num/2;
		} else if ((.@weight) > 50){
			mes "Hmmmm... it seems you are overweight";
		} else if(countitem(11503) < .@num) {
			mes "Sorry You don't have the required item!";
		}
		break;
	case 2:
		mes "How much?";
		input .@num, 1, 30000;
		if(countitem(11504) >= .@num) {
			delitem 11504, .@num;
			getitem 11503, .@num/2;
		} else if ((.@weight) > 50){
			mes "Hmmmm... it seems you are overweight";
		}  else if(countitem(11504) < .@num) {
			mes "Sorry You don't have the required item!";
		}
		break;
	case 3:
		mes "How much?";
		input .@num, 1, 30000;
		if(countitem(32007) >= .@num) {
			delitem 32007, .@num;
			getitem 32008, .@num/2;
		} else if ((.@weight) > 50){
			mes "Hmmmm... it seems you are overweight";
		}  else if(countitem(32007) < .@num) {
			mes "Sorry You don't have the required item!";
		}
		break;
	case 4:
		mes "How much?";
		input .@num, 1, 30000;
		if(countitem(32008) >= .@num) {
			delitem 32008, .@num;
			getitem 32007, .@num/2;
		} else if ((.@weight) > 50){
			mes "Hmmmm... it seems you are overweight";
		}  else if(countitem(32008) < .@num) {
			mes "Sorry You don't have the required item!";
		}
	default:
		break;
	}
	close;
OnInit:
	waitingroom "Convert pots here",0;
	end;
}

just add a default minimum value to the input or add a checking to validate the minimum input amount.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  24
  • Reputation:   0
  • Joined:  02/08/21
  • Last Seen:  

how can i fix this guys? up...

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