Subbing a variable for a hard number in a script call

Hello, everyone. I've been trying at this for days now but can't seem to figure it out but I'm sure it's probably something simple. I am using Theolized's Text on Screen script to show text on a special map I'm making. I hope that any solution provided would also work for other scripts but that's not imporant The script works fine when using the script calls in the instructions. This is the script call in question :

text(key,x,y,text,z,show,width,height,color1,color2)

What I would like to do is within that script call use $game_variables[1] and [2] instead of putting in a static number for x and y, essentially so that I can move the displayed text around with variables, in the same way you can do with pictures via the editor. I've tried dozens of combinations most of which I only learned about while trying to google for answers.
$game_variable[1]
$game_variables[1]
$game_variables[1].to_i
$game_variables[1]

TL; DR - Is there anyway to plug a variable into a script call where it wants a number?

Here's the script :



http://theolized.blogspot.com/2013/08/theo-anywhere-texts-on-screen.html
Actually, through total buzz killing trial and error I figured it out, and learned something new in the process that I suspect may be useful with other scripts. This is the reason for the double post, krosis. In the event someone else searches for something similar I'll leave it here, but delete/close if you think it's necessary. It's suprisingly simple, as I expected, but it's super useful and not so obvious to those of us who don't know scripting (I feel like I'm cheating on RM2K3 by even fiddling with VX Ace).

For those who want to know, and you'll have to excuse my terminology here, it seems to you can 'bind' 'tags' within script call boxes. You can then substitute the numbers the script call requires with the tags you made. For my purpose, I made xvar and yvar and set them to be equal to two variables. So, using the script call from above. Note that color, height, width, show and z can all be omitted from this script.

text(key,x,y,text,z,show,width,height,color1,color2)

text(1,30,15,"Example",100,60,24,18,1,2)

text(1,30,15,"Example")

Instead of putting in a number for x or y (or presumably any of these for any script I'd imagine), you can put in your own 'tag' after you designate it to something. Based on some cursory experiments it seems like you need to make these designations in the same text box with the actual script call and each designation needs to be on it's own line. In my case, my script call now literally reads :

xvar = $game_variables[1]
yvar = $game_variables[2]

text(1, xvar, yvar, "Example")

This way, the script call will use the tags where I typed them in and the tags will represent the value of the variables designated to them. That's it!

Now, for this script in particular you'll need to delete the displayed text and use the script call again after changing the variables in order for it's position to be updated. But overall, I must say if it's possible to use this method with any script call that inputs number this way then VX Ace is vastly more flexible than I had realized. An eye opener and a literal game changer.

Original thread: https://forums.rpgmakerweb.com/threads/subbing-a-variable-for-a-hard-number-in-a-script-call.80106/