@go command

Hi Mumbles, I'm having a small problem with the nowarp mapflag. The command is still usable even if the map is set with a 'nowarp' mapflag.
Hi Kong,

Thanks for the feedback. I'll push an update when I get back to my desk; for now, you can add this block of code at line 62 to accommodate your needs:

} else if (getmapflag(getarg(0), mf_nowarp)) { message strcharinfo(0), "You are not authorised to warp to this map.";
Hi Mumbles, unfortunately this didn't solve the problem. I was still able to use the @go command even if my current map has a mapflag 'nowarp'. I think the problem is with the argument, it gets the value which is the one set for each @go towns. It doesn't read the mapflag of your current map location.

 
Hi Mumbles, unfortunately this didn't solve the problem. I was still able to use the @go command even if my current map has a mapflag 'nowarp'. I think the problem is with the argument, it gets the value which is the one set for each @go towns. It doesn't read the mapflag of your current map location.
Hi Kong,

Per mf_nowarp's documentation (see nowarp.txt), mf_nowarp prevents the use of @go to a map, not from it. There is currently no mapflag (that I'm aware of) that prevents warping from the map, but you can circumvent this by either adding your own blacklist/filter of disabled maps. This is an example of a blacklist injection (though I wouldn't recommend punching this into this script exactly as it is written):

Code:
setarray .@blacklist$[0], "payon", "prontera", "izlude";for (.@i = 0; .@i < getarraysize(.@blacklist$); .@i++) {	if (strcharinfo(3) == .@blacklist$[.@i])) {		message strcharinfo(0), "You may not warp from this map.";		end;	}}
 
Sorry Mumbles, I think you have a wrong interpretation to nowarp mapflags.

I decided to revert back to the original @go command for you to see the difference. Here's a screenshot: 1.png

I tried to use @go command on the map where I have a 'nowarp' mapflag and as you can see, the failed message text says that "You are not authorized to warp from your current map" and that's exactly how nowarp mapflags work. This is the mapflag used for most pvp and gvg maps.

Afaik.

Nowarp prevents you from using @warp and @go commands on the specified map (meaning you can't use these commands on the map where the mapflag is set to nowarp). On the other hand, we have the Nowarpto mapflag. This however, prevents you from warping to the specified map.

Ex:

You are in Prontera. You have a mapflag of Nowarp

That means you cannot use @warp and @go commands while you are in Prontera

Another example, when you have mapflag of Nowarpto in Izlude and you are in Prontera

That means there's no way you can use @go / @warp command to go to Izlude other than maybe, an npc or warp portal.

Thanks in advance

Edit:

I have fixed it now.

function go { getmapxy(.@map$, .@x, .@y, 0); if (.deadlock && !Hp) { message strcharinfo(0), "You may not use @go when you are dead."; } else if (getmapflag(.@map$, mf_nowarp)) { message strcharinfo(0), "You are not authorized to warp from your current map."; } else if (.town && !getmapflag(strcharinfo(3), mf_town)) { message strcharinfo(0), "You may only use @go in towns."; } else if (.delay && @go_delay > gettimetick(2)) { message strcharinfo(0), "You must wait "+ (@go_delay - gettimetick(2)) +" seconds before warping again."; } else if (BaseLevel < getarg(3)) { message strcharinfo(0), "You must be at least level "+ getarg(3) +" to warp to this map."; } else if (getgroupid() < getarg(4) || getmapflag(getarg(0), mf_nowarp)) { message strcharinfo(0), "You are not authorized to warp to this map."; } else if (.charge && Zeny < getarg(5)) { message strcharinfo(0), "You must have at least "+ getarg(5) +" zeny to warp to this map."; } else { if (.delay) { @go_delay = gettimetick(2) + .delay; } if (.charge) { Zeny -= getarg(5); } warp getarg(0), getarg(1), getarg(2); end; } message strcharinfo(0), "@go failed."; end; }
 
Changes:

  • replaced mf_nowarp from line 72 to mf_nowarpto since that's most likely how it should work
  • added getmapxy script to get current location at line 60
  • added new script from line 64 that will check for current location if it has mf_nowarp thus preventing the use of @go.
 
Last edited by a moderator:
Changes:

[*]replaced mf_nowarp from line 72 to mf_nowarpto since that's most likely how it should work

[*]added getmapxy script to get current location at line 60

[*]added new script from line 64 that will check for current location if it has mf_nowarp thus preventing the use of @go.
You could probably do without getmapxy() since the script is attached to a player when run; strcharinfo(3) will return the attached player's map name. I'd say you were correct in changing mf_nowarp to mf_nowarpto, should the function of nowarpto be that players cannot warp to the map (duh; though sometimes the documentation isn't tell-all).

Someone should really update the documentation for both mapflags, as they are either lacking in information or documented incorrectly. /swt

 
Got it, thank you very much Mumbles! ~

Edit:

Code:
	function go {		if (.deadlock && !Hp) {			message strcharinfo(0), "You may not use @go when you are dead.";		} else if (getmapflag(strcharinfo(3), mf_nowarp)) {			message strcharinfo(0), "You are not authorized to warp from your current map.";		} else if (.town && !getmapflag(strcharinfo(3), mf_town)) {			message strcharinfo(0), "You may only use @go in towns.";		} else if (.delay && @go_delay > gettimetick(2)) {			message strcharinfo(0), "You must wait "+ (@go_delay - gettimetick(2))  +" seconds before warping again.";		} else if (BaseLevel < getarg(3)) {			message strcharinfo(0), "You must be at least level "+ getarg(3) +" to warp to this map.";		} else if (getgroupid() < getarg(4) || getmapflag(getarg(0), mf_nowarp)) {			message strcharinfo(0), "You are not authorized to warp to this map.";		} else if (.charge && Zeny < getarg(5)) {			message strcharinfo(0), "You must have at least "+ getarg(5) +" zeny to warp to this map.";		} else {			if (.delay) {				@go_delay = gettimetick(2) + .delay;			}					if (.charge) {				Zeny -= getarg(5);			}					warp getarg(0), getarg(1), getarg(2);			end;		}				message strcharinfo(0), "@go failed.";		end;	}
 
Last edited by a moderator:
Got it, thank you very much Mumbles! ~
Can you please confirm (via in-game test) that nowarpto prevents this version of @go from warping to a map flagged with nowarpto, and that nowarp prevents warping from a map flagged with nowarp?

I am unable to test any in-game behaviours at this time.

 
Last edited by a moderator:
Got it, thank you very much Mumbles! ~
Can you please confirm (via in-game test) that nowarpto prevents this version of @go from warping to a map flagged with nowarpto, and that nowarp prevents warping from a map flagged with nowarp?

I am unable to test any in-game behaviours at this time.
Actually this nowarpto mapflag is designed for @warp command and not @go since you only have limited maps available for @go and you can simply remove the map if you don't want to allow people from warping to that town. 

 
Last edited by a moderator:
Actually this nowarpto mapflag is designed for @warp command and not @go since you only have limited maps available for @go and you can simply remove the map if you don't want to allow people from warping to that town. 

Edit:

I have another problem though, the script does not bypass the nowarp mapflag even if your GM level is high.
So the documentation for nowarpto is correct, then; lost track of what the original issue was for a sec lol.

In your last reply, you mentioned replacing mf_nowarp with mf_nowarpto:

} else if (getgroupid() < getarg(4) || getmapflag(getarg(0), mf_nowarp)) {

However, the intent of this line is to prevent warping if the player's Group ID isn't high enough OR if the destination has a nowarp flag, regardless of Group ID. You can bypass this for GMs by changing the expression a little (I'm sure there's a prettier way to do it, but I'm not feeling up to it):

} else if (getgroupid() < getarg(4) || getmapflag(getarg(0), mf_nowarp) && getgroupid() < getarg(4)) {


In regard to your original inquiry, the behaviour of nowarp is to prevent the use of @go to a destination; to prevent the use of @go from a map flagged with nowarp (despite this not being the intent of the nowarp flag), you can still prevent warping by adding an expression similar to my original suggestion:

} else if (getmapflag(strcharinfo(3), mf_nowarp)) { message strcharinfo(0), "You are not authorised to warp from this map.";

If you would like to prevent warping from specific maps, I would recommend moving forward with the filter/blacklist route — hell, you could even prevent both nowarp-flagged and specific maps from being warped to if you wanted to.

 
Last edited by a moderator:
Actually this nowarpto mapflag is designed for @warp command and not @go since you only have limited maps available for @go and you can simply remove the map if you don't want to allow people from warping to that town. 

Edit:

I have another problem though, the script does not bypass the nowarp mapflag even if your GM level is high.
So the documentation for nowarpto is correct, then; lost track of what the original issue was for a sec lol.

In your last reply, you mentioned replacing mf_nowarp with mf_nowarpto:

} else if (getgroupid() < getarg(4) || getmapflag(getarg(0), mf_nowarp)) {

However, the intent of this line is to prevent warping if the player's Group ID isn't high enough OR if the destination has a nowarp flag, regardless of Group ID. You can bypass this for GMs by changing the expression a little (I'm sure there's a prettier way to do it, but I'm not feeling up to it):

} else if (getgroupid() < getarg(4) || getmapflag(getarg(0), mf_nowarp) && getgroupid() < getarg(4)) {


In regard to your original inquiry, the behaviour of nowarp is to prevent the use of @go to a destination; to prevent the use of @go from a map flagged with nowarp (despite this not being the intent of the nowarp flag), you can still prevent warping by adding an expression similar to my original suggestion:

} else if (getmapflag(strcharinfo(3), mf_nowarp)) { message strcharinfo(0), "You are not authorised to warp from this map.";

If you would like to prevent warping from specific maps, I would recommend moving forward with the filter/blacklist route — hell, you could even prevent both nowarp-flagged and specific maps from being warped to if you wanted to.
i tried it but still any gm lvl cant .@go 0 on castles

 
I want to know if I must remove @go command from src or this will replace the current functionality that @go does in src...

 
I want to know if I must remove @go command from src or this will replace the current functionality that @go does in src...
This code might be deprecated. If it does still work, it should overwrite the existing functionality of @go. When this was written, you did not need to make any src changes, as bindatcmd binded @go to the specified label within the script.

 
Waiting for @warp like this
default_smile.png


 
I created the code for glast_01

        } else if (alias("36", "glast")) {
            go("glast", 370, 304, 0, 0, .cost);

        } else {
            message strcharinfo(0), "36: Glast";
            message strcharinfo(0), "@go failed.";
        }
        
        end;
But seems not work ? I replaced the @go command on src\map\atcommand 

 
Last edited by a moderator:
But seems not work ? I replaced the @go command on src\map\atcommand 


Well...this was your first mistake. This is a script-based atcommand utility; it should be loaded as a custom .txt script. Copy the original file I provided and add its location to npc/scripts_custom.conf; doing this will override the src-based atcommand when your server initializes.

I created the code for glast_01




        } else if (alias("36", "glast")) {
            go("glast", 370, 304, 0, 0, .cost);

        } else {
            message strcharinfo(0), "36: Glast";
            message strcharinfo(0), "@go failed.";
        }
        
        end;


I think you might have misunderstood the way the script functions. Aliases included in the alias() function serve to allow a player to type multiple different variants of a phrase to arrive at the same location.

An example in your case:

alias("36", "glast", "gh")


...would allow the player to type:

@go "36"
@go "glast"
@go "gh"


...and still arrive at the same map and coordinates that you set for that alias.

You seem to have added the alias name in the go() function instead of the map name. The correct way to add an @go point for glast_01 would be to include the map_name in the go() function. Try this:

go("glast_01", 370, 304, 0, 0, .cost);






Hope this resolves your issue. Please note that I wrote this script-based atcommand utility several years ago; I have not kept up with Hercules's progress, so this information may be entirely deprecated. However, if you are running a version of Hercules where this script was still compatible, my corrections should suffice.

Good luck!

 
Back
Top