Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

making hours go by through global variabals and looping.

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
CloudX




Joined: 08 Jan 2004
Posts: 25

PostPosted: Sun Apr 11, 2004 12:16 pm    Post subject: making hours go by through global variabals and looping. Reply with quote

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
View user's profile Send private message
Uncommon
His legend will never die




Joined: 10 Mar 2003
Posts: 2503

PostPosted: Sun Apr 11, 2004 12:29 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Me
HI.




Joined: 30 Mar 2003
Posts: 870
Location: MY CUSTOM TITLE CAME BACK

PostPosted: Sun Apr 11, 2004 2:09 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
*Worthy*
Critical Thinker




Joined: 11 Aug 2003
Posts: 186

PostPosted: Sun Apr 11, 2004 2:13 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
Uncommon
His legend will never die




Joined: 10 Mar 2003
Posts: 2503

PostPosted: Mon Apr 12, 2004 5:21 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address
*Worthy*
Critical Thinker




Joined: 11 Aug 2003
Posts: 186

PostPosted: Tue Apr 13, 2004 4:25 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
Me
HI.




Joined: 30 Mar 2003
Posts: 870
Location: MY CUSTOM TITLE CAME BACK

PostPosted: Tue Apr 13, 2004 5:46 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Ysoft_Entertainment
VB Programmer




Joined: 23 Sep 2003
Posts: 810
Location: Wherever There is a good game.

PostPosted: Tue Apr 13, 2004 6:43 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Apr 13, 2004 8:57 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group