Script Call: Am I doing something wrong?

Hi everyone,

I'm really stuck. I've spent god knows how many hours on this day-based turn system, yet no matter what I do I get this:

Untitled_zps33c39de2.png


The thing is that I don't know why and I'm not even sure what it means... it means that there is an ''else'' somewhere where it's not supposed to be, right?

Anyway, I've spend, again, I don't even know how much time looking at the common event that is causing the trouble and yet no matter what I do I can't locate the mistake...

If anyone knows what's up I'd be really, really grateful as I just don't know what's going on.



(The normal flow control comment so that it stands out)Comment: X#---Birth Chance Bonuses$game_variables[37] = 0#---Birth Chance Penalties$game_variables[38] = 0Comment: X#---Turn all Event switches OFF$game_switches[101] = false$game_switches[102] = false$game_switches[103] = falseA ton of switches here, move along...$game_switches[116] = falseComment: X#---Hygiene:#---Hygiene: Base Tower Bonus $game_variables[8] = 5#---Hygiene: Homesteads $game_variables[8] += ($game_variables[102]*2)#---Pollution:#---Pollution: Base no. of citizens $game_variables[9] = $game_variables[20]#---Compare the two and behave accordinglyIf $game_variables[8] >= $game_variables[9] $game_variables[46] = $game_variables[8] - $game_variables[9] if $game_variables[46] >= 25 $game_variables[37] += 25 else $game_variables[37] += $game_variables[46] endelse $game_switches[113] = true $game_variables[46] = $game_variables[9] - $game_variables[8] if $game_variables[46] >= 25 $game_variables[38] += 25 else $game_variables[38] += $game_variables[46] endend#---Check for the gravity of the pollution, turn on switches.if $game_switches[113] = true if $game_variables[46] >= 75 $game_switches[101] = true else end if $game_variables[46] >= 50 $game_switches[102] = true else end if $game_variables[46] >= 25 $game_switches[103] = true else endelseendComment: X#---Happiness:#---Happiness: Base Tower Bonus $game_variables[10] = 5#---Happiness: Inns $game_variables[10] += ($game_variables[108]*2)#---Unrest:#---Unrest: Base no. of citizens $game_variables[11] = $game_variables[20]#---Compare the two and behave accordinglyIf $game_variables[10] >= $game_variables[11] $game_switches[114] = true $game_variables[47] = $game_variables[10] - $game_variables[11]else $game_switches[115] = true $game_variables[47] = $game_variables[11] - $game_variables[10end#---Check for the gravitiy of the happiness, turn on switches.if $game_switches[114] = true if $game_variables[46] >= 75 $game_switches[104] = true else end if $game_variables[46] >= 50 $game_switches[105] = true else end if $game_variables[46] >= 25 $game_switches[106] = true else endelseend#---Check for the gravitiy of the unrest, turn on switches.if $game_switches[115] = true if $game_variables[46] >= 75 $game_switches[107] = true else end if $game_variables[46] >= 50 $game_switches[108] = true else end if $game_variables[46] >= 25 $game_switches[109] = true else endelseendComment: X#---Security:#---Security: Base Tower Bonus $game_variables[19] = 5#---Security: Homesteads $game_variables[19] += ($game_variables[102]*2)#---Danger:#---Danger: Hunter's Camps $game_variables[18] = ($game_variables[110]*2)#---Compare the two and behave accordinglyIf $game_variables[18] >= $game_variables[19] $game_switches[116] = true $game_variables[48] = $game_variables[18] - $game_variables[19]elseend#---Check for the gravitiy of the danger, turn on switches.if $game_switches[116] = true if $game_variables[48] >= 75 $game_switches[110] = true else end if $game_variables[48] >= 50 $game_switches[111] = true else end if $game_variables[48] >= 25 $game_switches[112] = true else endelseend

Sorry about the size, but after having read it countless times I still can't anything.

Any idea what's the problem?

Thanks a ton!  🙂  
You have many else's with no commands after them. The way I understand them, if there is nothing after the else, the interpreter becomes confused. Either put a command there, or get rid of all the

else

end

you have in your code.
You have many else's with no commands after them. The way I understand them, if there is nothing after the else, the interpreter becomes confused. Either put a command there, or get rid of all the

else

end

you have in your code.
I tried that, but I still get the same error message... weird.
Quick question. If you take the script out does everything function normally?
Quick question. If you take the script out does everything function normally?
Yeah, I tried using them one at a time, had some more mistakes but fixed the ones present in the other ones.

The event is pretty much 7 common events in a row, this is the 2nd one. Everything works when I take it out, except of course for the other things dependent on it.
Edit- nvm I think I misunderstood. And yeah cremnophobia is right, it has to be if not If.
If has to be if. Case-sensitivity matters. The superfluous else's don't. You're also confusing = (assignment) with == (comparison).


By the way, why do you even use Ruby scripting? I could be missing something, but it looks like that everything can be achieved with event commands.
If has to be if. Case-sensitivity matters. The superfluous else's don't. You're also confusing = (assignment) with == (comparison).

By the way, why do you even use Ruby scripting? I could be missing something, but it looks like that everything can be achieved with event commands.
Haha, I knew it has to be something so simple - thanks a bunch, you really saved me from rewriting everything!  🤣

I know that they're different, I just haven't wrote anything in a long, long time so I keep forgetting - thanks for the reminder.

And yeah, it would be possible and probably more bug-proof, but this is just so, so much faster and it's much easier when it comes to changing things afterwards.

Original thread: https://forums.rpgmakerweb.com/threads/script-call-am-i-doing-something-wrong.34302/