How do I tell a script command to reference an in-game variable?

For example, let's say I have a script that someone made that came with commands to use. The script makes a character appear at this spot on the map [x,y]

so perhaps the command looks something like this

$game_something.show_character(x, y, range)

But I want the x and y to be tied to in-game variables 0001 and 0002. If I write $game_something.show_character(1, 2, range), that would just show the character at the coordinates (1 ,2) everytime.

So how do I tell it to use the values in variable 0001 and 0002 instead? Thanks
Most of those script options are referenced in the help file.


You can also find many references by just looking at the scripts in the script editor.


In this case, it would be:


$game_variables[1]
$game_something.show_character($game_variables[1], $game_variables[2], range)

In script, don't use 0001 or 0002 - use 1 or 2 instead. 000 will make it do funny conversion stuff.

And if you don't want to have to put the location of the player or the event into those variables first, you can do this:

Code:
$game_something.show_character($game_player.x, $game_player.y, range)$game_something.show_character($game_map.events[id].x, $game_map.events[id].y, range)
where id is the number of the event (again without leading 000)
Thank you, this is the answer I was looking for.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-tell-a-script-command-to-reference-an-in-game-variable.16533/