I've been wondering how I would attach a named function to a button. I've received answers in that I should declare the function in onLoad, and then run it from there, but that's not ideal and it looks like the Nexus client should be able to handle it normally.
For example, I'm trying to have a button named "Test". In it, for a script, I have
Run_function(HelloWorld)
Where HelloWorld is a function defined in the Reflexes Tab (it's got its own checkmark box) with the following.
Send_command("Hello, World",1)
What exactly am I missing?
The error I get is
ReferenceError: HelloWorld is not defined<br>
Thanks!
Comments
What you can do, though - what I just immediately did when I first encountered that very same issue - is create a (function) onLoad in your package. The function will execute when you load in. You can define functions in javascript there, and call them from a script box anywhere else. Here's an example...
You can, of course, define functions in any "script" box, but I use an onLoad function since it executes right when I log in so those functions are defined and ready to be used right away. You can also make an alias ("reload" for example) and set the action to "call function" and select onLoad, if you want to simulate a load while testing.
Hopefully that helps.
Currently available: Abs, Cnote, Keepalive, Lootpet, Mapmod