[Resolved][XP]What is wrong with my code?

Started by iJaco, June 17, 2009, 06:17:15 pm

Previous topic - Next topic

iJaco

June 17, 2009, 06:17:15 pm Last Edit: June 18, 2009, 12:38:40 pm by iJaco
Okay, so I am using Legacy Class Change script, and I want to add a Class level using events to the current class my actor is. So I used this code:
$game_actors[1].class_levels[$game_actors[1].class_id] += 1


When I run the game and run the script in the event I get a syntax error. What am I doing wrong?

I tested:
$game_actors[1].class_levels[X] += 1

where X is a regular integer. So I know I am doing somthing wrong when I input
$data_actors[1].class_id

and
$game_actors[1].class_id

But I have no Idea what I'm doing wrong

The error message I get is: "SyntaxError occured while running the script"

Aqua

It's $game_actors[1], not $data_actors[1]

iJaco

I just tried that too, still getting the same error message :(

Ryex

check the lines above and see if your forgot to close anything like []'s or ()'s
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

legacyblade

I'm not quite sure what you're trying to do with this system, but I think it would be easier just to call a level up. If you use the level up event command, it will also increase the current class level by one. As far as I can see, your code SHOULD be working. The script call command acts a bits screwy though, so play around with it (where each line break is) a bit, that might fix the problem.

BTW, glad you're using my system ^_~

Aqua

Oh!  Your script probably gets cut off in the script call and goes to another line.
You have to make sure that it gets cut off in the right place.

Make sure the line above it ends in something that signifies that the script is still the same one, like a . or [ or (

So try this...

$game_actors[1].
class_levels[$game_actors[
1].class_id] += 1

iJaco

Quote from: Aqua on June 18, 2009, 11:13:02 am
Oh!  Your script probably gets cut off in the script call and goes to another line.
You have to make sure that it gets cut off in the right place.

Make sure the line above it ends in something that signifies that the script is still the same one, like a . or [ or (

So try this...

$game_actors[1].
class_levels[$game_actors[
1].class_id] += 1



Thank you so much! it works now :D

BTW what I was trying to do was level up the current class my character is without acutally leveling up the character.

legacyblade

Quote from: Aqua on June 18, 2009, 11:13:02 am
Oh!  Your script probably gets cut off in the script call and goes to another line.
You have to make sure that it gets cut off in the right place.

Make sure the line above it ends in something that signifies that the script is still the same one, like a . or [ or (

So try this...

$game_actors[1].
class_levels[$game_actors[
1].class_id] += 1



that's what I was telling yah to do, I just didn't know exactly how to do it.

And ok, that sounds reasonable, the class level up without a regular one. I can think of a few uses for that. Anyways. good luck with your project.