Use GET_LAST outside button events?
fogled@mizzou
Posts: 549
I'm using arrays of button numbers in BUTTON_EVENTs with GET_LAST(Button_Array) to pass indexes off to calls and functions. But there are a couple of places where I'd really like to use that same functionality inside a call or a function (i.e. I end up with the button number in a call but I need an index for it).
Am I stuck using a FOR loop to get this info when I can't rely on GET_LAST, or is there another function like "GET_INDEX" that I can't figure out? Can I do something inside a call to access the array like BUTTON_EVENT does, so that I can immediately use GET_LAST to retrieve the index?
Thanks,
Am I stuck using a FOR loop to get this info when I can't rely on GET_LAST, or is there another function like "GET_INDEX" that I can't figure out? Can I do something inside a call to access the array like BUTTON_EVENT does, so that I can immediately use GET_LAST to retrieve the index?
Thanks,
0
Comments
First, pass the index as well as the button number to your function.
Second, put the index value into a global variable inside the event code.
GET_LAST works with BUTTON_EVENTS and CHANNEL_EVENTS, but not with LEVEL_EVENTS
GET_LAST() can not be used outside of Events
My solution is to simply create a variable, and use GET_LAST within the event to assign a value to that variable. You can then pass this variable to any outside function you desire; since it's your own variable, you have full control over what can modify it and insure it's OK when you are actually using it.
altough my experience is contradictory to this.
works perfectly and I have been using for more than a year.
but: make sure to use Levels 1-10 or somethin on each port, and if not try SET_VIRTUAL_LEVEL_COUNT to something
Very interesting! You're either lucky or I'll be able to replicate.
I ran a test with this function:
And it worked when called from a button event.
If that doesn't do it for you then just set a global var in the event and then call it where ever it's needed as previuously suggested.