View previous topic :: View next topic |
Author |
Message |
CloudX
Joined: 08 Jan 2004 Posts: 25
|
Posted: Sun Apr 11, 2004 12:16 pm Post subject: making hours go by through global variabals and looping. |
|
|
This is what i have so far for my hour changing script.
script,hourchange,begin
if(check tag(tag:daybegin) == on)
then, begin
set global variable(hours == 6)
wait (600)
increment (hours, 1)
set tag(tag:daybegin) == off
end
end
i would like to know how i loop this so it keeps incrementing till 12.
the wait 600 is what i think is around 45 sec through a calc. this is one of my important parts because this is what changes helps change days and
other things. |
|
Back to top |
|
 |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Sun Apr 11, 2004 12:29 pm Post subject: |
|
|
First of all...
Code: | script,hourchange,begin
if(check tag(tag:daybegin) == on)
then, begin
hours := 6
wait (600)
increment (hours, 1)
set tag(tag:daybegin,off)
end
end |
That will actually compile.
Second of all, use a while loop.
Code: | script,hourchange,begin
hours := 0
while (true)
do,begin
wait (600)
increment (hours, 1)
if (hours == 6)
then (set tag(tag:daybegin,on))
if (hours == 12)
then (set tag(tag:daybegin,off))
end
end |
Also, I'm not sure, but the "wait" might keep it from the player being able to do anything. If that is the case, I'll show you how to do that with a for loop. |
|
Back to top |
|
 |
Me HI.

Joined: 30 Mar 2003 Posts: 870 Location: MY CUSTOM TITLE CAME BACK
|
Posted: Sun Apr 11, 2004 2:09 pm Post subject: |
|
|
The wait command won't affect player control. Unless there's a "suspend player" or a text box being shown, player control shouldn't be impeded. _________________ UP DOWN UP DOWN LEFT LEFT RIGHT RIGHT A B START |
|
Back to top |
|
 |
*Worthy* Critical Thinker

Joined: 11 Aug 2003 Posts: 186
|
Posted: Sun Apr 11, 2004 2:13 pm Post subject: |
|
|
I would strongly advise against making a "while (true)" statement. If you use that, the script will run forever, which I highly doubt you will want.
Also, don't worry about the "wait (600)" command preventing the player from doing anything; it won't have any affect on that.
Throw in an "if" statement to reset the global to 0 after it reaches 12.
~Worthy _________________ You can do whatever you want...but prison is full of people who make bad decisions. |
|
Back to top |
|
 |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Mon Apr 12, 2004 5:21 pm Post subject: |
|
|
Well, it looks like he wants to do an endless loop, since it's a day/night thing... Unless he only wants it on certain maps, that is. |
|
Back to top |
|
 |
*Worthy* Critical Thinker

Joined: 11 Aug 2003 Posts: 186
|
Posted: Tue Apr 13, 2004 4:25 am Post subject: |
|
|
You are right. But what if he wants to make a scene during the night in which the night continues on forever until the player completes the scene? But, as you said, if he wants the day/night cycle to continue throughout the game forever, the "while (true)" statement won't mess anything up.
~Worthy _________________ You can do whatever you want...but prison is full of people who make bad decisions. |
|
Back to top |
|
 |
Me HI.

Joined: 30 Mar 2003 Posts: 870 Location: MY CUSTOM TITLE CAME BACK
|
Posted: Tue Apr 13, 2004 5:46 pm Post subject: |
|
|
Just use a global or a tag instead of just "true":
while(check tag(blah)) do(time stuff)
or
while(time:=1) do(time stuff)
Then if you wanted a night scene, you could change that tag/global to false, thus suspending time. _________________ UP DOWN UP DOWN LEFT LEFT RIGHT RIGHT A B START |
|
Back to top |
|
 |
Ysoft_Entertainment VB Programmer

Joined: 23 Sep 2003 Posts: 810 Location: Wherever There is a good game.
|
Posted: Tue Apr 13, 2004 6:43 pm Post subject: |
|
|
yo me, I hate to be a smartass but while(time:=1) would declare the time to equal one, and not check if the time is equals to 1. and since it isn't allowed, you gonna end up with an error message, so instead it should be while(time==1) or while(time) if you wanna just check the true/false condition of time. _________________ Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Apr 13, 2004 8:57 pm Post subject: |
|
|
Actually, such a thing would not generate an error message, because it is perfectly allowed. That's why you have to watch out for such things.
I want to know, what would be the point of "while(time==1) do(time stuff)" anyway? But Me is otherwise right. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
|