Author Topic: Real Timers in scripting  (Read 3752 times)

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Real Timers in scripting
« on: May 23, 2004, 08:05:58 PM »
I've used the in game timer command successfully in scipting but  have a question regarding "Real Timers".  For example:

RealSetGlobalTimer("Nightmare","GLOBAL",2200)

I'm assuming this expires after 3+ hours of real life play.  Question is - does that play have to be continuous or does the game remember how much time elapsed when I saved the game and then reloaded it to resume playing?  Does the script  (1) begin the countdown from when I reload or (2) does the timer start all over again i.e. being set back to 2200?

Thanks.

Offline Bons

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1237
  • Gender: Female
  • Glad Corvis Isn't Dead Club
Re: Real Timers in scripting
« Reply #1 on: May 23, 2004, 08:21:32 PM »
does the game remember how much time elapsed when I saved the game and then reloaded it to resume playing?  Does the script  (1) begin the countdown from when I reload

Yes. The savegame will include the status of your timer, so when you load, the realtimer countdown to expiration will resume from that point. Also, the timer is in seconds, so 2200 will amount to about 35 minutes of real life play.
Newt had always suspected that people who regularly used the word "community" were using it in a very specific sense that excluded him and everyone he knew.

             --Neil Gaiman, Terry Pratchett, "Good Omens"

Offline Galactygon

  • Modding since 2002
  • Planewalker
  • *****
  • Posts: 378
  • Gender: Male
  • Creator of spells
Re: Real Timers in scripting
« Reply #2 on: May 23, 2004, 11:00:25 PM »
I also beleieve that the RealTimer also ignores game pauses, meaning that it may elapse if you pause the game and leave it like that for the appropriate time.

I may be wrong, though. :)

-Galactygon

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Real Timers in scripting
« Reply #3 on: May 24, 2004, 12:03:57 AM »
I also beleieve that the RealTimer also ignores game pauses, meaning that it may elapse if you pause the game and leave it like that for the appropriate time.

I may be wrong, though. :)

-Galactygon

Nope, you're correct.
Earn Money Sleeping.

Offline Grim Squeaker

  • Fallen
  • Planewalker
  • *****
  • Posts: 1019
  • Gender: Male
Re: Real Timers in scripting
« Reply #4 on: May 24, 2004, 01:53:51 AM »
Yes, because that's REAL time.
"You alone can make my song take flight..."

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Re: Real Timers in scripting
« Reply #5 on: May 24, 2004, 07:04:51 AM »
Thanks all.  Since I've been playing more than 35 minutes and it HASN'T expired and activated the  block where the test is for its expiration I have to check and see what's gone wrong in the .BCS and the .D file

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Real Timers in scripting
« Reply #6 on: May 24, 2004, 01:31:49 PM »
That's why for testing one should use timers of about 1 second. :)  Or use the CLUAConsole:SetGlobal("MyTimer","GLOBAL",1) command to speed up the timer.
Earn Money Sleeping.

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Re: Real Timers in scripting
« Reply #7 on: May 24, 2004, 06:16:11 PM »
Call me super frustrated - and thanks for the test on how to check for the timer  - most of the documentation I've been reading wasn't so clear cut.

Anyhow - I cannot for the life of me figure why the second dream doesn't kick in:

From the .bcs file

IF
  PartyRested()
  IfValidForPartyDialogue("D#Silver")
  GlobalGT("SilverEvil","GLOBAL",0)
  Global("SilDream1","GLOBAL",0)
THEN
  RESPONSE #100
    SetGlobal("SilDream1","GLOBAL",1)
    Dialog(Player1)
    RealSetGlobalTimer("SilNightmer","GLOBAL",2200)
END

Comments - she makes her speech and after the coding in the J.D file Sildream1 Global was set to 2.

IF
  PartyRested()
  RealGlobalTimerExpired("SilNightmer","GLOBAL")
  IfValidForPartyDialogue("D#Silver")
  Global("SilDream1","GLOBAL",2)
THEN
  RESPONSE #100
    SetGlobal("SilDream1","GLOBAL",3)
    Dialog(Player1)
    RealSetGlobalTimer("SilNightmer","GLOBAL",2200)
END

This is my problem - I'm never getting the block above to execute though Sildream1 is 2.  Somehow the RealSetGlobalTimer isn't working!

IF
  PartyRested()
  RealGlobalTimerExpired("SilNightmer","GLOBAL")
  IfValidForPartyDialogue("D#Silver")  // D#Silver
  Global("SilDream1","GLOBAL",4)
THEN
  RESPONSE #100
    SetGlobal("D#SilDream1","GLOBAL",5)
    Dialog(Player1)
END

The "J.D" file

IF WEIGHT #0 ~Global("SilDream1","GLOBAL",1)~ THEN DSildream1
  SAY @112
  IF ~~ DO ~SetGlobal("SilDream1","GLOBAL",2)~ GOTO Sildream2
END

IF ~~ Sildream2
  SAY @113
  IF ~!InParty("Edwin")~ REPLY @116 EXIT
  IF ~!InParty("Edwin")~ REPLY @117 EXIT
  IF ~InParty("Edwin")~ EXTERN BEdwin Sildream3
END

Comments - She says her @113 and exits the dialog because Edwin not in party.  SilDream1 is set to 2.

IF ~~ Sildream4
  SAY @115
  IF ~~ REPLY @116 EXIT
  IF ~~ REPLY @117 EXIT
END

IF WEIGHT #0 ~Global("SilDream1","GLOBAL",3)~ Sildream5
  SAY @118 = @119 = @120 = @121 = @122
  IF ~InParty("Edwin")~ REPLY @123 DO ~SetGlobal("SilDream1","GLOBAL",4)~ EXTERN BEdwin Sildream6
  IF ~!InParty("Edwin")~ REPLY @125 DO ~SetGlobal("SilDream1","GLOBAL",4)~ EXIT
END

IF WEIGHT #0 ~Global("SilDream1","GLOBAL",5)~ Sildream7
  SAY @126 = @127
  IF ~~ REPLY @128 DO ~SetGlobal("SilDream1","GLOBAL",6)~ EXIT
END

APPEND Bedwin

IF ~~ Sildream6
  SAY @124
  IF ~~ EXIT
END

IF ~~ Sildream3
  SAY @114
  IF ~~ EXTERN D#Silver Sildream4
END
END

I hate to ask it - but what am I doing wrong?????

Offline Kismet

  • Devil's Minion #5
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 653
  • Gender: Female
  • Veni; Vidi; Velcro.
    • Pocket Plane Group
Re: Real Timers in scripting
« Reply #8 on: May 24, 2004, 06:56:28 PM »
Try setting the timer before you start the dialog.

 RESPONSE #100
    SetGlobal("SilDream1","GLOBAL",3)
    RealSetGlobalTimer("SilNightmer","GLOBAL",2200)
    Dialog(Player1)
Cailean - An archer NPC for the insatiably nosy!  Guaranteed more fun than shampooing cats!

Offline Grim Squeaker

  • Fallen
  • Planewalker
  • *****
  • Posts: 1019
  • Gender: Male
Re: Real Timers in scripting
« Reply #9 on: May 25, 2004, 05:16:23 AM »
Try setting the timer before you start the dialog.

 RESPONSE #100
    SetGlobal("SilDream1","GLOBAL",3)
    RealSetGlobalTimer("SilNightmer","GLOBAL",2200)
    Dialog(Player1)


Yeah, I think that should do it.  I think engine 'forgets' any actions it was meant to perform after the dialogue is resolved.
"You alone can make my song take flight..."

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Re: Real Timers in scripting
« Reply #10 on: May 25, 2004, 12:36:21 PM »
Thanks - I'll give it a try after work.

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Re: Real Timers in scripting
« Reply #11 on: May 30, 2004, 01:11:16 PM »
Thanks all....it works!

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: