meko

Deprecation Notice

4 posts in this topic

As of June 3rd, the specialeffect() command has been upgraded and it now allows to use effects on any kind of unit (player, npc, mob, homunculus, ...) and to show it to any player. This allowed us to deprecate specialeffect2() and misceffect() so now there is a single command for effects instead of 3 different ones, making things simpler for everyone. You can still use specialeffect2() and misceffect() but they will trigger a warning every time, since they will be removed in the future.

 

 

 

Here's how the updated specialeffect() command works:

 

specialeffect(effect number{, send target{, unit id{, account id ]}})

 

effect number is the effect to use.
see effect_list.txt for a list of all effects

 

send target is to whom the effect should be sent. The most common values are:

AREA will show the effect to every player in the area
SELF will show the effect to one player only

see constants.md for a list of possible send targets

 

unit id is the unit on which the effect should be centered
it can be a mob id, an account id, a npc id or the id of any other kind of unit

 

account id is the player to which the effect should be sent if SELF was specified as send target

 

 

 

 

To migrate from specialeffect2 to specialeffect:
 

specialeffect2(effect➜ specialeffect(effect, AREA, playerattached())


specialeffect2(effect, target, "player name"➜ specialeffect(effect, target, getcharid(CHAR_ID_ACCOUNT, "player name"))

 

 

 

 

To migrate from misceffect to specialeffect:

Because the behaviour of this command varies depending on if the npc has a sprite or not, what you want is either one of the two:


misceffect(effect➜ specialeffect(effect)

misceffect(
effect) ➜ specialeffect(effect, AREA, playerattached())

 

 

 

If you are using vanilla Hercules then all your scripts should already be converted.

See also http://herc.ws/board/topic/14847-deprecation-pow/

Share this post


Link to post
Share on other sites

As of June 3rd, the pow() command has been superseded by the exponentiation operator (**). You can still use pow() but it will trigger a warning every time, as this command will be removed in the future.

 

The exponentiation operator has higher precedence than any other operator.

This means (a * b ** c) is equivalent to (a * (b ** c)) and not ((a * b) ** c)

 

 

 

Here's how to migrate your scripts:

 

pow(a, b) ➜ (a ** b)

 

 

In combination with other operators:

 

pow(a * b, c) ➜ ((a * b) ** c)

pow(a, b * c) ➜ (a ** (b * c))

 

 

 

To automatically convert your scripts:

# from the Hercules root folder:
find npc db -type f -exec sed -i -r 's/pow\((.+),[ ]*(.+)\)/((\1) ** (\2))/g' {} +

 

 

If you are using vanilla Hercules then all your scripts should already be converted.

See also http://herc.ws/board/topic/14848-deprecation-specialeffect2-misceffect/

Share this post


Link to post
Share on other sites

As of September 18 2017, the useatcmd() command has been deprecated.



If you were using useatcmd() for built-in @commands you can simply replace it with atcommand():

useatcmd("@command") ➜ atcommand("@command")

 

 

If you were using useatcmd() for custom @commands (registered with bindatcmd()) you can use doevent() instead:

useatcmd("@custom") ➜ doevent("MyNPC::OnUseCommand");

MyNPC is the name of the NPC in which you used bindatcmd()
OnUseCommand is the event you registered with bindatcmd()

 


Edge cases:
useatcmd(), unlike atcommand(), uses the group id of the attached player rather than running with admin privileges. If you need to check whether or not a player should be able to use a command, use can_use_command()

if (can_use_command("@foobar")) {
	atcommand("@foobar");
} else {
	dispbottom("You cannot use this command!");
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now