Trying to store enemy Id in game variable, but it's crashing.

The command I'm using is
$game_variables[17] = $game_troop.members
[0].enemy_id
But, immediately as it's called to store it gives me the error
undefined method 'enemy_id' for [0]:array
Where and how are you using that script?
The issue is likely that it is split into two lines at a point where it should not be split.
$game_variables[17] = $game_troop.members[0].enemy_id
This works.
Sorry for my mistake, I copy and pasted directly from the script tab, which has an auto line break, after a certain amount of characters are there. It should be being run as one line.
I am using this script inside of a skill, with a common event inside. It's intended function is to be a sort of check skill, with different flavor text depending on the enemy, and user.
then give us a screenshot of the skill, and a screenshot of the console during the error message.
I copy and pasted directly from the script tab, which has an auto line break, after a certain amount of characters are there.
What are you talking about? What script tab? The script editor does not have a line break.
Script commands in the editor for common events or troop pages do have line breaks if you're too long but the code your running is not that long.
The only places that is that short is the script entry for variables and conditional branch. (unless I'm missing something)

Even pasting the full line into the note box for an actor doesn't break it where you have shown it.
$game_variables[17] =
$game_troop.members[0].enemy_id
Ron, I changed the script to how you formatted it, and it started working. Thanks!
Ron, I changed the script to how you formatted it, and it started working. Thanks!
That's fine, but you still didn't show any images.
And based on this issue, and my experience, I would say you have a pirated version of the program.
It is a common situation with people that have a pirated version. You will also run into many other issues in the future if you use scripts.
The actually good program does not have the issues you have.
If you didn't want to buy the program at the full price, I understand. Practically everybody has waited for a sale.
Check out https://isthereanydeal.com/game/rpg-maker-vx-ace/info/
when it goes on sale you can get it then.

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-store-enemy-id-in-game-variable-but-its-crashing.170815/