Variable in Script (simple question)

$game_variables[1] = $game_actors[1].mp

works in call per event. But, in script?  what the command?
same thing 🙂

You'd put it before you need to call it or after the actor's mp changes so it updates to the current value. It just depends on what your intent is
I've moved this thread to RGSSx Script Support (as you're not asking for a script to be made/found). Please be sure to post your threads in the correct forum next time. Thank you.


What you do in the Script event command is pretty much what you do in scripts - since what you're putting into the command IS a script.
Added this way, and this error appeared (Attachments)

1.jpg

2.jpg
Ok it is right, but you need to set those up in a class and a method. Right now it's trying to set them before any of the game scripts are called, so it doesn't know what a game variable is.

A little bit more information about what you are doing might help with suggestions of where to put it. You can always store it in the Game_Interpreter, like this:

class Game_Interpreter def tiagoms $game_variables[1] = $game_actors[1].mp $game_variables[2] = $game_actors[1].hp $game_variables[3] = $game_actors[1].tp $game_variables[4] = $game_actors[1].mp $game_variables[5] = $game_actors[1].hp $game_variables[6] = $game_actors[1].tp end endThat will work for most cases since the game interpreter is almost always running. The exception is when you are in menus in which case you might want to stick it in Window_Base.

You'll then need to call your method to set the information.
Thanks again Venka.

======= EDIT ========

It does not work

see the demo.

ps- Sorry if I have done something very wrong.
I'm trying to learn gradually.

test.rar

Original thread: https://forums.rpgmakerweb.com/threads/variable-in-script-simple-question.37484/