HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Forcing a command to not be shorted when using /register?  (Read 931 times)

AndrewE

  • General Accounts
  • *
  • Posts: 4
    • View Profile

Hi all,
When a command is registered with /register add, it will allow for a shortened version. For example, after registering /wave, the script will be called when someone types /wav or /wave.

It is possible to change the shortened length to be longer than the default three characters, or even the entire command? For example with the above, it is possible to not have /wav work and force the player to use /wave?

Thanks!
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Forcing a command to not be shorted when using /register?
« Reply #1 on: Mar 09, 13, 04:48:22 PM »

I think there might be a way to shorten or lengthen the amount of letters the string is compared to in the function, though I have not yet looked for it.
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Forcing a command to not be shorted when using /register?
« Reply #2 on: Mar 09, 13, 05:32:23 PM »

That is because the default code placed in the command template uses the keyword partialMatch.   It allows things shorter than the "to" values to match.  If you instead use a standard when-block, then the passed in value will have to match the "is" case exactly.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

AndrewE

  • General Accounts
  • *
  • Posts: 4
    • View Profile
Re: Forcing a command to not be shorted when using /register?
« Reply #3 on: Mar 09, 13, 05:48:52 PM »

I was looking for a way to change the behavior for only certain commands that are registered rather than all commands.

The problem I'm trying to solve is that I have a script that interprets the registered command and does stuff based on that command. That way I can use the script for multiple commands rather than having a unique script for each similar slash command that I register. I need the script to know the full command, but it seems that HE only passes the partial command to the script (exactly what the player types).

For example, I can register the command /shoot to call my script. Then in the script I can output information based on that input. I could use partialMatch for the checking within the script, but then I have to modify the script each time I want to add a new command that calls the script to change any partial match to the full command, which almost defeats the purpose of having a single script in the first place.

So ideally, it would be awesome if HE would take the input "/sho critter", modify it to the full input "/shoot critter" and then call the script with that input. But it doesn't seem to do that, unless I'm missing something, which is entirely possible.  :)
Logged