Jump to content
  • 0

Map checks using array variables


Mumbles

Question


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

So I'm trying to write a condition where if your character is not on one of these maps:

 

        // Town Definitions    
        setarray .@mapname$[0],"prontera","morocc","geffen","payon","alberta","izlude","aldebaran","xmas","comodo","yuno","amatsu","gonryun","umbala","niflheim","louyang","lunette","in_moc_16","jawaii","ayothaya","einbroch","lighthalzen","einbech","hugel","rachel","veins","moscovia","schenberg";  

 

 

you will be undisguised:

 

    OnPCLoadMapEvent:
        for(set .@i,0; .@i < getarraysize(.@mapname$); set .@i,.@i+1) {
            if( "+.@mapname$[.@i]+" == strcharinfo(3))
                set .@a,1;
            if(!.@a) {
                undisguise;
                end;
           }

 

 

As written, it's not quite confirming that you are not on the maps in the array. What am I doing wrong?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Yes, every single map needs the loadevent mapflag in order to trigger OnPCLoadMapEvent ... unless you did one of these source edits

1) when maps are loaded, loadevent mapflag is added to every map

2) change OnPCLoadMapEvent to trigger on all maps, even if they don't have the loadevent mapflag

It looks like (almost) all your maps in .@mapname$[] are already listed in trunk/conf/mapflag/town.txt right? Then you could just check mapflag#town.

-	script	undisguise_me	-1,{
OnPCLoadMapEvent:
	if (!getmapflag(strcharinfo(3), mf_town)) {
		undisguise;
	}
	end;
}
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

try to change the 

 

 

if( "+.mapname$[.@i]+" == strcharinfo(3) )

 

to

 

if(strcharinfo(3) == .mapname$[.@i] )

and btw. did u add loadmapevent mapflag on your map's?

Edited by TrojanWorm
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

Does that even matter? I've used the OnPCLoadMapEvent label before on maps without the loadevent mapflag; what makes towns any different? In any case, I want the script to check if the map you loaded on was not in the array, so wouldn't that require every single map that isn't a town to have the loadevent mapflag?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

Thanks Brian; contrary to what I originally requested, what you suggested works much better.

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