Post new topic    
King Slime
Send private message
Two Faced Compiler 
 PostThu Feb 23, 2012 10:21 pm
Send private message Reply with quote
Thread named for the compiler, asking for one thing, then I fix it, then it demands yet another fix that requires me undoing the first thing.

Code:
plotscript,time of day variable, begin
   increment(time of day,1)
   
   if (time of day == 50, then
   set morning
   if (time of day == 100, then
   set daytime
   if (time of day == 150, then
   set sunset
   if (time of day == 200, then
   set nighttime

   if (time of day == (200) then
   reset time
   
   else
   
   end


It says I have an extra begin. I know I do, but if I take them out, the compiler starts complaining about not being able to identify my global variable. Mad
Liquid Metal Slime
Send private message
 
 PostThu Feb 23, 2012 10:31 pm
Send private message Reply with quote
You have to close your parentheses. You're gonna keep getting all sorts of conflicting errors until you do.

Remember:

if ( condition ) then(
stuff
)

works better than:

if (condition then(
stuff
)

or:

if (condition) then(
stuff

ALWAYS CLOSE YOUR PARENTHESES!

Only then will you see:

scripts compiled!
Place Obligatory Signature Here
Slime Knight
Send private message
Re: Two Faced Compiler 
 PostThu Feb 23, 2012 10:44 pm
Send private message Reply with quote
I will help you fix this! (I'm determine today dammit!)

Code:
plotscript,time of day variable, begin
   increment(time of day,1)
   
   if (time of day == 50) then(
   set morning)
   if (time of day == 100) then(
   set daytime)
   if (time of day == 150) then(
   set sunset)
   if (time of day == 200) then(
   set nighttime)

   if (time of day == 200) then(
   reset time)
   
   else
   
   end


This should do the trick, if not then I've made a boo-boo elsewhere. Basically it's throwing errors due to the amount of ('s and )'s being unbalanced. A way to get around this is to always put in your parenthesise in first then fill in the parameters afterwards, that way you block out your code better and it means less backtracking.
If the way I did it hasn't worked then rebalance the brackets again (making sure there numbers still add up) and try adding an extra "end" at the end failing that, some combination of correctly balanced ()'s is the key really.

EDIT: DAMMIT NINJA'D by Pepsi! When will you stop being awesome man :'(
Metal King Slime
Send private message
 
 PostFri Feb 24, 2012 2:49 am
Send private message Reply with quote
Also remove the "else". It'll compile with that left in, but frankly that's a bug in HSpeak.
Display posts from previous: