Jump to content
  • 0

Help for Guild Party and Online members checking


Question

Posted (edited)

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

3 answers to this question

Recommended Posts

  • 0
Posted (edited)
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

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