i've got a major problem,involving mah day and night thing...
here's mah code:
area/outside
recheck
sleep(50)
if (night == 1)
src.luminosity = 0
else if (night == 0)
src.luminosity = 1
goto recheck
here's mah errors:
Areas.dm:5:error:50:value not allowed here
Areas.dm:6:error:night:duplicate definition
Areas.dm:6:error:1:duplicate definition
Areas.dm:6:error:== :instruction not allowed here
Areas.dm:6:error::empty type name (indentation error?)
Areas.dm:7:error:src.luminosity:undefined var
Areas.dm:7:error::empty type name (indentation error?)
Areas.dm:8:error:night:duplicate definition
Areas.dm:8:error:0:duplicate definition
Areas.dm:8:error:== :instruction not allowed here
Areas.dm:8:error::empty type name (indentation error?)
Areas.dm:9:error:src.luminosity:undefined var
Areas.dm:9:error::empty type name (indentation error?)
Areas.dm:10:error:goto recheck:instruction not allowed here
and here's what i'm trying to do:
every 5 seconds,i want each and every area,known as 'outside',to check if it's nighttime or not.if it's not,set luminosity to 1.if it is,set luminosity to 0.
any suggestions?
ID:148900
Aug 20 2002, 10:51 am
|
|
Roara wrote:
any suggestions? 1. Don't use goto in this case. 2. Your code is not inside a proc. 3. See [link] and discussion. It's very similar. 4. Why not set/reset luminosity of all outside areas whenever the change from day to night (or night to day) occurs? This ought to be much more efficient than every area checking every 5 seconds. |
recheck should be used as a proc not a var
recheck() //then tab and do your code here |
In response to Air Mapster
|
|
your way's da best,Air Mapster ^_^
|
In response to Roara
|
|
Why not have the day/night cycle take place within the outside area's proc?
|
None of this is inside a proc. Also, the goto is completely pointless. It should be something like...
area/outside
New()
spawn() DayNight()
proc/DayNight()
sleep(50)
src.luminosity = 1 - src.luminosity //A helpful equasion, toggles between 1 and 0
spawn() DayNight()