MV Action sequence eval issue

Hey there game makers. I made a skill that forces an actor to use a random skill based on a variable but when I ran it it didn't work...
Here's my code


<target action>
action animation: user
wait for animation
if ($gameVariables(34) === 1)
var skl =($gameVariables.value(33) + 7)
eval: $gameActors.actor(1).forceAction((skl), -1);
eval:
Battlemanager.forceAction($gameActors.actor(1));
end
</target action>
I know the problem is not with the if statement nor the force action eval cause it tested both and they worked fine even though the force action happened twice for some reason I don't understand and would like to fix at a later date...

Anyway that only means the problem is in the var statement either the statement itself or when I call it in the force action.

So what am I doing wrong?
Action Sequences aren't JavaScript, so that var line will not be interpreted correctly.

You can put the eval on one line, e.g. try one of these:

eval: var sk = $gameVariables.value(33) + 7, su = $gameActors.actor(1); su.forceAction(sk, -1); BattleManager.forceAction(su);
BattleManager.queueForceAction($gameActors.actor(1), $gameVariables.value(33) + 7, -1);
(queueForceAction is added by YEP Battle Engine Core.)

Also, <target action> runs once per target. Maybe try <whole action> instead to see if that fixes the "double action" thing.
Okay I'll give it a try and see if it works
I didn't test it, but hopefully it works!
I didn't test it, but hopefully it works!
Okay both the var and the whole action worked perfectly thank you so much for your help.
Great! 😂

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/action-sequence-eval-issue.145918/