Jump to content
  • 0

multiple if else


wakefield21

Question


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  115
  • Reputation:   4
  • Joined:  08/14/16
  • Last Seen:  

Hello rAthena i just want to ask how to enable multiple if else scenario.

 

if(select("Change Hairstyle:Don't Change") == 1) {
		if (countitem(6707) > 0) {
			mes "[Kaniki]";
			mes "Great, you brought";
			mes "a New Kaniki Hair Style Coupon!";
			mes "Alright, which hairstyle";
			mes "did you want to have?";
			next;
			if (Sex == SEX_MALE) {
				if(select("Emergency Heal Perm:Aura Blade Cut:Jupon Katana:Jupitel Thunder:Deadly Poison:Earth Spike") == 1) {
					delitem 6707,1;	// New_Style_Coupon
					setlook 1,24;
				}else{
					delitem 6707,1;	// New_Style_Coupon
					setlook 1,25;
				}else{
					delitem 6707,1;	// New_Style_Coupon
					setlook 1,26;
				}else{
					delitem 6707,1;	// New_Style_Coupon
					setlook 1,27;
				}else{
					delitem 6707,1;	// New_Style_Coupon
					setlook 1,28;
				}else{
					delitem 6707,1;	// New_Style_Coupon
					setlook 1,29;
				}

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  116
  • Reputation:   18
  • Joined:  09/08/17
  • Last Seen:  

else if(){
...
}
else if(){
...
}
else{
...
}

Better if you use switch

switch(select(...)){
	case 1: ... break;
	case 2: ... break;
	case 3: ... break;
	case 4: ... break;
}
end;

 

Edited by OppaiDragon
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  411
  • Reputation:   260
  • Joined:  04/25/12
  • Last Seen:  

I think he wants something like this:



    if( SEX == SEX_MALE )
    {
        setarray .@hair_name$[1],"Emergency Heal Perm",
                                 "Aura Blade Cut",
                                 "Jupon Katana",
                                 "Jupitel Thunder",
                                 "Deadly Poison","
                                  Earth Spike";
        
        setarray .@hair_style[1],24,
                                 25,
                                 26,
                                 27,
                                 28,
                                 29;
    }
    
    .@option = select( implode( .@hair_name$, ":" ) );
    .@option--;
    
    delitem 6707,1;
    setlook 1,.@hair_style[.@i];
{/code]
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  115
  • Reputation:   4
  • Joined:  08/14/16
  • Last Seen:  

thanks @OppaiDragon and @Zell now i don't know how which one am i gonna pick. ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  116
  • Reputation:   18
  • Joined:  09/08/17
  • Last Seen:  

10 hours ago, wakefield21 said:

thanks @OppaiDragon and @Zell now i don't know how which one am i gonna pick. ?

Both will work just fine, whichever will suit your taste.

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