I'm using an evented sorting functions that requires me to to only save the highest value out of several values, but to save the variable ID of the highest value. I haven't seen a way of doing this in VX Ace.
Is there perhaps a script call that can be used, or am I missing something basic?
Please show us screenshots of that event sort function.
It depends on how you identify the highest variable.
I apologize, I am unaware of how to attach a photo. Do I need to upload it to another site and the reference it through the "Image Button"?
You can upload a picture to image hosting sites such as Imgur then just using bbcode (you have that option above text editor) and paste the link of that picture.
Thank you, I didn't know you could use the .each function in a script call - I figured it would throw me an error.
The main issue I'm having though is being able to save the variable ID number so that I know which variable was the highest, and also be able to iterate through the variables and accessing their individual values.
Try this in the same script call:
n1 and n2 would be the same as the first numbers you want
(n1..n2).each {|i| if $game_variables == a.last #then i must be the id of the game variable that has the highest value end }What this would do is if the variable id equals the last value in the a array (which is the highest value) then i must be the id with the highest value. (you could for instance print i to the console and you would get the id of the variable with value a.last).
The script command can take virtually any ruby argument that you could do in a script (as it uses eval which can make it very unsafe).
Awesome, this is exactly what I need, thank you very much.
I also found a round about way of simulating having the variable ID thus fixing my issue, but your method is much faster and cleaner