CommandHelper

CommandHelper

46.5k Downloads

Wrong custom parameters in bind()

LadyCailinBot opened this issue ยท 0 comments

commented

CMDHELPER-2839 - Reported by VergilPrime

"Scope
Events have the same type of scope as functions, i.e. only variables passed in are assigned. This is what the custom params are for. If you need to have these values passed in to the event, you may do that with these extra parameters. The values are copied over at bind time, not at event run time. Though the values in the variables may be changed during the execution of the script, they are reset to the bind time values each time the function is triggered."

This is not the case. Here's my code:

  1. proc(_region_entry, @region,
  2.    broadcast(color(a)@region)
    
  3.    bind(player_move,null,null,@e,@region,
    
  4.            broadcast(color(c)@region)
    
  5.    )
    

5.)

_region_entry() is called 4 times:
_region_entry('region1')
_region_entry('region2')
_region_entry('region3')
_region_entry('region4')

Each time @region on line 2 is correct, however when the player moves the output is:
region4
region4
region4
region4

I have checked, and each time the event binds a new ID, but @region gets reset each time a new bind is made.