Jump to content
  • 0

Check if party name for character contains "#"


Question

Posted

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.

5 answers to this question

Recommended Posts

  • 0
Posted

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~

  • -1
Posted
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?

  • 1
Posted

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~

  • -1
Posted

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;
}

 

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