Jump to content
  • 0

Help for Guild Party and Online members checking


friomixx

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  03/02/12
  • Last Seen:  

Hi,

Can anyone help me check my error?
the goal of my script is to check if all members of the party are online and members of the same guild
.
as you can see in the screenshot
, I'm able to reload the script, but whenever i tried to click the NPC, it now gives the error message.

 

 

image.png.a024501b113d6631580e263b9f701a5f.png

Edited by friomixx
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

if(getcharid(2,$@partymembername$[.@i] != getarg(0))) {

Has to be:

if(getcharid(2,$@partymembername$[.@i]) != getarg(0)) {

 

Edited by Winterfox
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

1 hour ago, friomixx said:

Hi,

Can anyone help me check my error?
the goal of my script is to check if all members of the party are online and members of the same guild
.
as you can see in the screenshot
, I'm able to reload the script, but whenever i tried to click the NPC, it now gives the error message.

 

prontera,194,181,5	script	Room Manager	415,{
	
	.@partyId = getcharid(1);
	.@guildId = getcharid(2);
	.@partyMember = 2;
	getpartymember(.@partyId,0);
	getpartymember(.@partyId,1);
	getpartymember(.@partyId,2);
	
	callsub S_GuildParty,.@guildId;
	
	dispbottom "You passed the checks.";
	end;

S_GuildParty:
	for(.@i = 0; .@i < $@partymembercount; .@i++) {
		if (isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] )) {
			.@partyMemberOnline++;
			if(getcharid(2,$@partymembername$[.@i] != getarg(0))) {
				dispbottom $@partymembername$[.@i] +" is not a member of your guild.";
				.@partyMemberNotInGuild++;
			}
		}
	}
	if (.@partyMemberNotInGuild || .@partyMemberOnline < $@partymembercount) {
		dispbottom "All party members should be online and member of same guild";
		end;
	}
return;
}

image.png.a024501b113d6631580e263b9f701a5f.png

Another suggestion I have would be to improve readability by using continue, to jump to the next iteration of the loop to minimize nesting.

for(.@i = 0; .@i < $@partymembercount; .@i++) {
    if(!isloggedin($@partymemberaid[.@i], $@partymembercid[.@i])) continue;

    .@partyMemberOnline++;
                                      
    if(getcharid(2, $@partymembername$[.@i]) != getarg(0)) {
    	dispbottom $@partymembername$[.@i] + " is not a member of your guild.";
     	.@partyMemberNotInGuild++;
    }
}

 

Edited by Winterfox
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  03/02/12
  • Last Seen:  

thank you Winterfox for your help, will consider your suggestion in my scripts.

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