Jump to content

Question

Posted

In the following script even if i choose case 2, i get the msg'es from case 1, what should i change?

Thanks in advice

Spoiler

        Armors:    //Armors
        next;
                    if(select("Armor1:Armor2")){
                Case1:
                    if (countitem(7117) >= 20 && countitem(7711) >= 100 && countitem(607) >= 5 && countitem(505) >= 5) {
                    mes    "[Celine]";
                    mes    "Here you go!";
                    delitem 7117,20;
                    delitem 7711,100;
                    delitem 607,5;
                    delitem 505,5;
                    getitem 5208,1;
                    cutin "",255;
                    close;
                    }            

                else {
                    mes    "[test npc]";
                    mes    "What a lovely choice my dear!";
                    mes    "I need the following Items:";
                    mes    "- 20 Torn Magic Book";        //7117
                    mes    "- 100 Event Ticket";        //7711
                    mes    "- 5 Yggdrasil Berry";        //607
                    mes    "- 5 Blue Potion";        //505
                    cutin "",255;
                    close;
                    }
                Case2:
                    if (countitem(7117) >= 20 && countitem(7711) >= 100 && countitem(607) >= 5 && countitem(505) >= 5) {
                    mes    "[test npc]";
                    mes    "Here you go!";
                    delitem 7117,20;
                    delitem 7711,100;
                    delitem 607,5;
                    delitem 505,5;
                    getitem 5208,1;
                    cutin "",255;
                    close;
                    }
                    
                else {
                    mes    "[test npc]";
                    mes    "Armor 2 requirements";
                    cutin "",255;
                    close;
                    }
            }
            
 

 

11 answers to this question

Recommended Posts

  • 0
Posted

Try this. :))

switch(select("Armor1:Armor2")){
	case 1:
		if(countitem(7117) > 19 || countitem(7711) > 99 || countitem(505) > 4){
			cutin "123.bmp",255;
			mes "[Celine]";
			mes "Here you go!";
			delitem 7117,20;
			delitem 7711,100;
			delitem 607,5;
			getitem 5208,1;
			end;
	} else {
			cutin "122.bmp",255;
			mes "[Celine]";
			mes "What a lovely choice my dear";
			mes "I need the following items";
			mes "20 Torn Magic Book (7117)";
			mes "100 Event Ticket (7711)";
			mes "5 Yggdrasil Berry (607)";
			mes "5 Blue Potion (505)";
			close;
			}
	case 2:
		if(countitem(7117) > 19 || countitem(7711) > 99 || countitem(505) > 4){
			cutin "123.bmp",255;
			mes "[Celine]";
			mes "Here you go!!!!";
			delitem 7117,20;
			delitem 7711,100;
			delitem 607,5;
			getitem 5209,1;
			end;
	} else {
			cutin "122.bmp",255;
			mes "[Celine]";
			mes "You still have missing requirements";
			mes "I need the following items";
			mes "20 Torn Magic Book (7117)";
			mes "100 Event Ticket (7711)";
			mes "5 Yggdrasil Berry (607)";
			mes "5 Blue Potion (505)";
			close;
			}
		}

 

  • 0
Posted
2 minutes ago, Emistry said:

 if(select("Armor1:Armor2")){

change to


switch(select("Armor1:Armor2")){

 

I've already tried that, but ive got the same effect. Im paste the full script, maybe theres something wrong outside of this function?

Spoiler

    mes    "As of now, I can offer you the following Items.";
        menu "Headgears",Hats,"Armors",Armors,"Costume Wild Rose",CWR,"Costume Vanaguard Helm",CVH,"Costume Devil Whisper",CDW,"Costume Polar Bear Cap",CPBC,"Costume King Poring Hat",CKPH,"Nothing",Exit;
        Hats:    //Headgears
        next;
        switch(select("Top")){
                Top:
                    switch(select("Rideword Hat")){
                    Rideword_Hat:
                        if ($celine_c1 == 0) {
                    if (countitem(7117) >= 20 && countitem(7711) >= 100 && countitem(607) >= 5 && countitem(505) >= 5) {
                    mes    "[Celine]";
                    mes    "Here you go!";
                    delitem 7117,20;
                    delitem 7711,100;
                    delitem 607,5;
                    delitem 505,5;
                    getitem 5208,1;
                    cutin "",255;
                    close;
                    }

                    else {
                    mes    "[Celine]";
                    mes    "What a lovely choice my dear!";
                    mes    "I need the following Items:";
                    mes    "- 20 Torn Magic Book";        //7117
                    mes    "- 100 Event Ticket";        //7711
                    mes    "- 5 Yggdrasil Berry";        //607
                    mes    "- 5 Blue Potion";        //505
                    cutin "",255;
                    close;
                    }}
                }
                }
        
        Armors:    //Armors
        next;
                    switch(select("Armor1:Armor2")){
                Case1:
                    if (countitem(7117) >= 20 && countitem(7711) >= 100 && countitem(607) >= 5 && countitem(505) >= 5) {
                    mes    "[Celine]";
                    mes    "Here you go!";
                    delitem 7117,20;
                    delitem 7711,100;
                    delitem 607,5;
                    delitem 505,5;
                    getitem 5208,1;
                    cutin "",255;
                    close;
                    }            

                else {
                    mes    "[test npc]";
                    mes    "What a lovely choice my dear!";
                    mes    "I need the following Items:";
                    mes    "- 20 Torn Magic Book";        //7117
                    mes    "- 100 Event Ticket";        //7711
                    mes    "- 5 Yggdrasil Berry";        //607
                    mes    "- 5 Blue Potion";        //505
                    cutin "",255;
                    close;
                    }
                Case2:
                    if (countitem(7117) >= 20 && countitem(7711) >= 100 && countitem(607) >= 5 && countitem(505) >= 5) {
                    mes    "[test npc]";
                    mes    "Here you go!";
                    delitem 7117,20;
                    delitem 7711,100;
                    delitem 607,5;
                    delitem 505,5;
                    getitem 5208,1;
                    cutin "",255;
                    close;
                    }
                    
                else {
                    mes    "[test npc]";
                    mes    "Armor 2 requirements";
                    cutin "",255;
                    close;
                    }
            }

and so on by the menu

 

  • 0
Posted
2 hours ago, crazyarashi said:

Try this. :))


switch(select("Armor1:Armor2")){
	case 1:
		if(countitem(7117) > 19 || countitem(7711) > 99 || countitem(505) > 4){
			cutin "123.bmp",255;
			mes "[Celine]";
			mes "Here you go!";
			delitem 7117,20;
			delitem 7711,100;
			delitem 607,5;
			getitem 5208,1;
			end;
	} else {
			cutin "122.bmp",255;
			mes "[Celine]";
			mes "What a lovely choice my dear";
			mes "I need the following items";
			mes "20 Torn Magic Book (7117)";
			mes "100 Event Ticket (7711)";
			mes "5 Yggdrasil Berry (607)";
			mes "5 Blue Potion (505)";
			close;
			}
	case 2:
		if(countitem(7117) > 19 || countitem(7711) > 99 || countitem(505) > 4){
			cutin "123.bmp",255;
			mes "[Celine]";
			mes "Here you go!!!!";
			delitem 7117,20;
			delitem 7711,100;
			delitem 607,5;
			getitem 5209,1;
			end;
	} else {
			cutin "122.bmp",255;
			mes "[Celine]";
			mes "You still have missing requirements";
			mes "I need the following items";
			mes "20 Torn Magic Book (7117)";
			mes "100 Event Ticket (7711)";
			mes "5 Yggdrasil Berry (607)";
			mes "5 Blue Potion (505)";
			close;
			}
		}

 

Worked, awesome thanks! 

  • 0
Posted
1 hour ago, Sunset said:

Worked, awesome thanks! 

ugh, almost good, ive just noticed it now :v
It works almost properly, the issue is: If i got even one ready from the 6 requirements, the npc takes it as i got every item, and not directing the player to the "else".

A shorter script is here below

So even if i got 1 pc 7711 item, i stuck at case 1, and not going to else

Spoiler

case 1:
        if(Zeny >= 25000000 || countitem(7711) > 999 || countitem(6395) > 150 || countitem(6557) > 150 || countitem(983) > 99 || countitem(7166) > 249){
            cutin "123.bmp",255;
            mes "[Celine]";
            mes "Here you go!";
            delitem 7711,1000;
            delitem 6395,250;
            delitem 6557,250;
            delitem 983,100;
            delitem 7166,250;
            set Zeny, Zeny-25000000;
            getitem 2589,1;
            end;
    } else {
            cutin "122.bmp",255;
            mes "[Celine]";
            mes "What a lovely choice my dear";
            mes "I need the following items";
            mes "250 Angel Magic Powder";
            mes "100 Event Ticket (7711)";
            mes "5 Yggdrasil Berry (607)";
            mes "5 Blue Potion (505)";
            close;
            }
 

 

  • 0
Posted

Hmmmm works fine on my npc. well try this then :))

case 1:
	if(Zeny < 25000000 || countitem(7711) < 1000 || countitem(6395) < 150 || countitem(6557) < 150 || countitem(983) < 100 || countitem(7166) < 250) goto MItems;
            cutin "123.bmp",255;
            mes "[Celine]";
            mes "Here you go!";
            delitem 7711,1000;
            delitem 6395,250;
            delitem 6557,250;
            delitem 983,100;
            delitem 7166,250;
            set Zeny, Zeny-25000000;
            getitem 2589,1;
            end;

MItems:   //missing items
	cutin "122.bmp",255;
	mes "[Celine]";
	mes "What a lovely choice my dear";
	mes "I need the following items";
	mes "100 Event Ticket (7711)";
	mes "5 Yggdrasil Berry (607)";
	mes "5 Blue Potion (505)";
  	close;

 

  • 0
Posted
6 minutes ago, crazyarashi said:

Hmmmm works fine on my npc. well try this then :))


case 1:
	if(Zeny < 25000000 || countitem(7711) < 1000 || countitem(6395) < 150 || countitem(6557) < 150 || countitem(983) < 100 || countitem(7166) < 250) goto MItems;
            cutin "123.bmp",255;
            mes "[Celine]";
            mes "Here you go!";
            delitem 7711,1000;
            delitem 6395,250;
            delitem 6557,250;
            delitem 983,100;
            delitem 7166,250;
            set Zeny, Zeny-25000000;
            getitem 2589,1;
            end;

MItems:   //missing items
	cutin "122.bmp",255;
	mes "[Celine]";
	mes "What a lovely choice my dear";
	mes "I need the following items";
	mes "100 Event Ticket (7711)";
	mes "5 Yggdrasil Berry (607)";
	mes "5 Blue Potion (505)";
  	close;

 

It's working fine now, thank you! :)

  • 0
Posted (edited)
4 minutes ago, 15peaces said:

lol... it's because he missed a blank space between case and the number...

Case1: -> case 1:

Case2: -> case 2:

 

that's all xD

Check it again, there is blank space (in the corrected but not perfectly working script) ?

Edited by Sunset
  • 0
Posted
14 minutes ago, 15peaces said:

I mean in your first post, this was the cause of the bug. ^^

Oh, hehe right. :) 
But i still wonder why wasnt working perfectly the corrected one, only with goto.

I find this weird :o 

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