Jump to content
  • 0

If Condition Help


nasagnilac

Question


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

what is the best way to summarize this?

				if ($@members > 4) {
					set .@greward,1;							// 5-9 Members

					if ($@members > 9){
						set .@greward,2;						// 10-14 Members

						if ($@members > 14){
							set .@greward,3; set .@areward,1;			// 15-19 Members

							if ($@members > 19){
								set .@greward,4; set .@areward,2;		// 20-24 Members
		
								if ($@members == 25){
									set .@greward,5; set .@areward,3;	// 25 Members
								}
							}	
						}					
					}			

				}
Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   6
  • Joined:  06/16/13
  • Last Seen:  

use else if for condition 2 or more....

 

correct me if i'm wrong

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  151
  • Reputation:   5
  • Joined:  11/09/12
  • Last Seen:  

if ($@members >= 5) {
set .@greward,1;// 5-9 Members
	}else if ($@members >= 10){
			set .@greward,2; // 10-14 Members
		} else if($@members >= 15){
				set .@greward,3; 
				set .@areward,1; // 15-19 Members
			} else if($@members >= 20){
						set .@greward,4; 
						set .@areward,2; // 20-24 Members
					}else if($@members == 25){
									set .@greward,5; 
									set .@areward,3;	// 25 Members
								} else if ($@members >= 26) end;

like this.. but i think if that is a rewards system you must do all the thinks inside the condicional { } (getitem, delitem) all of this... instead used another script for get the rewards.. is my point of view only..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  89
  • Topics Per Day:  0.02
  • Content Count:  232
  • Reputation:   15
  • Joined:  11/02/13
  • Last Seen:  

im using it in guild package.. does my script is correct?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  151
  • Reputation:   5
  • Joined:  11/09/12
  • Last Seen:  

I don't have enough experience to say that you script is wrong but the script that i modify probably work

Edited by Dynasty
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  


if ($@members > 4) set .@greward,1;

else if ($@members > 9) set .@greward,2;

else if ($@members > 14) { set .@greward,3; set .@areward,1; }

else if ($@members > 19) { set .@greward,4; set .@areward,2; }

else if ($@members == 25) { set .@greward,5; set .@areward,3; }

else end;

Link to comment
Share on other sites


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

@Patskie

your way...doesnt work fully....especially when the member is more than 4 ....

everytime they will just stuck at this part 

if ($@members > 4) set .@greward,1;   // even they have 25 member..still it's MORE THAN 4..

it should be something like this

if( $@members >= 25 ){
	set .@greward,5; set .@areward,3;
}else if( $@members > 19 ){
	set .@greward,4; set .@areward,2;
}else if( $@members > 14 ){
	set .@greward,3; set .@areward,1;
}else if( $@members > 9 ){
	set .@greward,2; set .@areward,2;
}else if( $@members > 4 ){
	set .@greward,1; set .@areward,1;
}

normally i would do checking for highest to lowest ....

Edited by Capuche
Typo.
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

I just modify what the topic starter have posted. I realized now that it will stuck on the first if condition xD

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