Jump to content
  • 0

Check if party name for character contains "#"


Genesis

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   2
  • Joined:  12/01/11
  • Last Seen:  

Hi,

I was wondering if there is a way using 

strcharinfo(1) 

to determine if a party name has specific character (say "#") in the name. If so, do something.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 1

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

if (compare( strcharinfo(1), "#" )) {
 // ...
}

 

  • Upvote 1
Link to comment
Share on other sites

  • 1

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  864
  • Reputation:   115
  • Joined:  05/23/12
  • Last Seen:  

Now Im on my wiindows pc thereforce I can leave an example for you.

//.@string = are the input string
set .@string,strcharinfo(1); //Name of the party

for (set .@i,0; .@i<getstrlen(.@string); .@i++){
	if(charat(.@string[.@i]) == "#"){
		dispbottom "You have a # in your party name!";
		//Or call function
		//Or .@specialchar++;
	}
}
//if(.@specialchar){
//	mes "You have "+.@specialchar+" # in your party name.";
//}
end;

 

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  864
  • Reputation:   115
  • Joined:  05/23/12
  • Last Seen:  

U can use a for loop and charat to look to every letter of a string. 

Firstly getcharlen(.@s)

Then for loop every letter

And look at every character charat(.@s[.@i])

 

Im on mobile thereforce I cant give u a detailed answer. I hope it will help u a lot.

Rynbef~

Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   2
  • Joined:  12/01/11
  • Last Seen:  

8 hours ago, Rynbef said:

U can use a for loop and charat to look to every letter of a string. 

Firstly getcharlen(.@s)

Then for loop every letter

And look at every character charat(.@s[.@i])

 

Im on mobile thereforce I cant give u a detailed answer. I hope it will help u a lot.

Rynbef~

Hi,

Could you provide an example?

Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

Might this will help you as a script based.

Credits: AnnieRURU

prontera,156,188,5	script	kjdfhkshfs	100,{
	getpartymember getcharid(1), 1;
	getpartymember getcharid(1), 2;
	.@origin = getcharid(3);
	for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) {
			attachrid $@partymemberaid[.@i];
			.@online++;
			.@compare_job$ = .@compare_job$ +"#"+ class +"#";
		}
	}
	attachrid .@origin;
//	dispbottom .@online + .@compare_job$;
	if ( .@online < 5 )
		mes "your party needs at least 5 party member online";
	else if ( !compare( .@compare_job$, "#"+ Job_Paladin +"#" ) )
		mes "your party needs a Paladin in your party";
	else if ( !compare( .@compare_job$, "#"+ Job_High_Priest +"#" ) )
		mes "your party needs a High Priest in your party";
	else if ( countstr( .@compare_job$, "#"+ Job_High_Wizard +"#" ) + countstr( .@compare_job$, "#"+ Job_Assassin_Cross +"#" ) + countstr( .@compare_job$, "#"+ Job_Ninja +"#" ) + countstr( .@compare_job$, "#"+ Job_Sniper +"#" ) + countstr( .@compare_job$, "#"+ Job_Lord_Knight +"#" ) < 3 )
		mes "your party needs to have at least 3 Damage Dealer classes in your party";
	else
		mes "you are free the go";
	close;
}

 

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