Some Help with Timed Events

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Some Help with Timed Events

Postby John4 » Thu Aug 14, 2008 8:25 pm

Hey,

Can I have some help with Timed Events? I would like to know a way to go to different frame while a Timed Event is on, and still have the Timed Event running. Is that possible?
Your help is appreciated, thanks

~John
John4
Member
 
Posts: 23
Joined: Sun Apr 06, 2008 7:06 pm

Postby mercedes » Fri Aug 15, 2008 12:06 am

Is this what u are looking for...two timed events ..?


Code: Select all
Action.CreateTimedEvent 4.5 , "VAR1=8 : Action.CreateTimedEvent 4.5 , ""Action.Quit"""


You change the actions to fit your needs..:) \\

This is one that creates another timed event right after the first one..within seconds..

Is that what u are looking for...or 2 timed events..?

Or do u mean like a countdown ...
Sorry i'm french and takes me a minute..lol..if not i'm sure someone will know what u mean..:)

Actually I think u want a recursive timed events..There is a demonstration in the Help documents..:)

http://www.adventuremaker.com/help/contents.htm


Peace~
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Mystery » Fri Aug 15, 2008 12:20 am

I think what John means is that if you have a timed event, but - while it's still running - you click on a hotspot to go to another frame, the timed event won't be executed.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Fri Aug 15, 2008 7:10 pm

There is workaround for that.
Create an integer variable called timer_count and another called timer_set
Create a timed event that does what you want and another one that increases timer_count by 1 every second.
Ex:
Code: Select all
timer_set=10
Action.CreateTimedEvent timer_set, "Actions"
Action.CreateTimedEvent timer_set, "timer_count=timer_count+_1"

Then in the next frame add this code:

Code: Select all
if timer_count>0 then
Action.CreateTimedEvent (timer_set-timer_count), "Actions"
end if


Hope this helps
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby John4 » Sat Aug 16, 2008 7:56 pm

Alright, thanks.
John4
Member
 
Posts: 23
Joined: Sun Apr 06, 2008 7:06 pm

Postby pennsteve » Fri Sep 12, 2008 2:25 am

Ok, I'm not understanding this. I figured I would search posts.......

Here is what I need. I need my entire game to be a timed event, no matter where you click. I assume I will have to add some VBS code to my project properties.

I want my game to last for 10 minutes. (600 seconds). If its not solved within 10 minutes, they must start over. How would I do that?

Thanks :)
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby mercedes » Fri Sep 12, 2008 4:39 am

Hi Steve...I beleive this is what you want..

Create a new Global Integer variable named "Counter" (without the quotes).
3. Copy/paste the following code into the "VBScript Global Procedures" window:

Code: Select all
Sub DecreaseCounter
   If Counter > 0 Then
      Counter = Counter - 1
   ElseIf Counter <> -999 Then
      Msgbox "The time is up!"
      Counter = -999
   End If
   ShowCounter
End Sub


Sub ShowCounter
   text_index = Action.GetMergedTextIndex
   If Counter > 0 Then
      Text(text_index) = Counter
   Else
      Text(text_index) = "Time Is Up"
   End If
End Sub


Put this in the Advanced Tab of the Project Properties--- "When the project starts or a savegame is loaded" area copy/paste the following code ("20" is the value at which the countdown should start):

Code: Select all
If Counter = 0 Then Counter = 20


In the same Tab put this "Every time that a frame is loaded", and copy/paste the following code:
Code: Select all
If Counter > 0 then
   Action.CreateTimedEvent 1,"DecreaseCounter",True
End If
ShowCounter


Now close the Project Properties (click OK), then create a new frame named "CountDownFrame" (it doesn't matter what the background is).

Edit the frame "CountDownFrame" and add a text object at the top-left corner of the frame - it doesn't matter what text you enter.

Now go back to the PROJECT MENU and click "Runtime Frames Merging...". Select all the frames and merge with "CountDownFrame"


I think this is what u want...I grabbed this from the Help files..:)

Peace
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby pennsteve » Fri Sep 12, 2008 2:28 pm

Is that counter in seconds? Im lost. Where do I create a global integer? Cant find it in project properties.

Can you be more specific? Thanks :)
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby pennsteve » Fri Sep 12, 2008 3:32 pm

Ok I figured I would try this on the start screen. When I open the screen for the global procedure it wont allow me to paste. I even tried ctrl P.
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby Mystery » Fri Sep 12, 2008 7:22 pm

Yes, the timer is in seconds.

Just go to the "VBS Variables (advanced)"on the Project Menu window, and create an integer variable with the name counter (hit "new integer variable").

I don't know why you can't copy-paste, this is strange.

Did you go to the "VBS Procedures" on the Project Menu window, and tried to paste there the code from here? http://www.adventuremaker.com/help/vbsc ... #countdown
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby pennsteve » Fri Sep 12, 2008 7:32 pm

I just went to the help file and read it.

Where it says enlarge to put the code, when I make the window bigger it wont allow me to paste.

I'll be back later and try it. I have to go to an appointment.

Thanks :)
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby Mystery » Fri Sep 12, 2008 7:35 pm

Ummm, have you tried to put it in the Frame properties :?:
Just asking because if I click the "VBS Procedures" on the Project Menu window, there is no option for me to enlarge, the window is already "big".

But anyway you should be able to copy-paste code there.
Maybe if you close AM and re-open it, it will work? :?
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Fri Sep 12, 2008 8:42 pm

It's ctrl+V not P... :P
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby pennsteve » Fri Sep 12, 2008 11:23 pm

Ok, for my game. I want it to be 5 minutes long. Thats 300 seconds. Here is what I have to do........
Im taking this right from the help page.


1. Load a project or create a new one.
2. Create a new global Integer variable named "Counter" (without the quotes). <---where do i create this? In the first frame?

3. Copy/paste the following code into the "VBScript Global Procedures" window: <----where do i do this? In the first frame also? It seems the project properties doesnt have a vbsglobal procedures box. Do I have to put this in every frame?.

Sub DecreaseCounter
If Counter > 0 Then
Counter = Counter - 1
ElseIf Counter <> -999 Then
Msgbox "The time is up!"
Counter = -999
End If
ShowCounter
End Sub

Sub ShowCounter
text_index = Action.GetMergedTextIndex
If Counter > 0 Then
Text(text_index) = Counter
Else
Text(text_index) = "Time Is Up"
End If
End Sub


I'll stop here for now and see if anyone answers. Thanks!


EDIT
Ok I figured it out. I had it set to 20 seconds. It counts down but then says "times up" but the game doesnt quit.

If I want it to go to another frame, should I change this part......Instead of else text(text_index) = "Time is up".........should I make it Else action.gotoframe "explode"? (explode is one of the frame names)

Sub ShowCounter
text_index = Action.GetMergedTextIndex
If Counter > 0 Then
Text(text_index) = Counter
Else
Text(text_index) = "Time Is Up"
End If
End Sub


(Posts merged by moderation, please edit your posts instead of double posting)
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby Lyberodoggy » Fri Sep 12, 2008 11:35 pm

Create a new global Integer variable named "Counter" (without the quotes). <---where do i create this? In the first frame?


Go to VBS Variables
New Integer
input the name Counter

Copy/paste the following code into the "VBScript Global Procedures" window: <----where do i do this? In the first frame also? It seems the project properties doesnt have a vbsglobal procedures box. Do I have to put this in every frame?.


On the side bar, where you will find the VBS VAriables too, there's alink that says "VBS Procedures". This is where this code goes.
It was also wrong so I had to fix it... Here is the right code:

Code: Select all
Sub DecreaseCounter
If Counter > 0 Then
Counter = Counter - 1
Else If Counter <> -999 Then
Msgbox "The time is up!"
Counter = -999
End If
ShowCounter
End Sub

Sub ShowCounter
text_index = Action.GetMergedTextIndex
If Counter > 0 Then
Text(text_index).caption = cstr(Counter)
Else
Text(text_index).caption = "Time Is Up"
End If
End Sub
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby pennsteve » Fri Sep 12, 2008 11:37 pm

I made a post at the same time as you. Its just before yours.

Nevermind my last post. I got it to work to go to a new frame. lol

I know where everything is located. I got it done in about 30 seconds.

I'll leave it at 5 minutes.
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests