I know this question has been asked a thousand times and ive read many many forums posts on this in the past two days trying to get this to work but with no recourse. Mostly because there is no visual evidence of what I need to do and im tired of beating my head on a rock. So here we go.
Things I have tried:
Created my own onLoad function in my numpad/button package to load things
Used only the main package onload to create my function and call it from another package using different notation or even the run+script() function
Calling functions in onLoad that were defined in the same package
Here is the code I have used so far in both ways: all of these were in the Code portion of the onLoad Function in Nexus --main package--
let up_down = ['UP','DOWN']
let left_right = ['LEFT','RIGHT']
let compass = ['NORTH','SOUTH','EAST','WEST','SOUTHWEST','SOUTHEAST','NORTHWEST','NORTHEAST']
function random_output(input){
let RandListNum = Math.floor(Math.random()*input.length);
return input[RandListNum]
}
I also tried this relating to this question:
http://forums.achaea.com/discussion/5577/attaching-named-functions-to-buttons(function) onLoad:
let up_down = ['UP','DOWN']
let left_right = ['LEFT','RIGHT']
let compass = ['NORTH','SOUTH','EAST','WEST','SOUTHWEST','SOUTHEAST','NORTHWEST','NORTHEAST']
function random_output(input){
let RandListNum = Math.floor(Math.random()*input.length);
return input[RandListNum]
}
so if I wanted to do a CompassSlash to someone via keybind, alias, or however I would want to the inside of the code part should resemble
send_command("Compassslash "+ random_output(compass))
But I receive nothing but input is not defined. I even tried the whole (function) onLoad in the script body of the send_commands as well with no avail. Any help please?
Sorry if I seem a bit annoyed, this should be fairly simple.
Comments
random_output = function(input){
let RandListNum = Math.floor(Math.random()*input.length);
return input[RandListNum]
}