How to go to next frame only after all hotspots clicked.

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

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

How to go to next frame only after all hotspots clicked.

Postby pennsteve » Mon Sep 01, 2008 6:51 pm

Hello. I want to make a "spot the difference" type game. How would I make it so they cant move to the next frame until all of the hotspots have been clicked?

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

Postby Lyberodoggy » Mon Sep 01, 2008 6:58 pm

Create an integer called hs_count
Let's say the differences are totally 8
In every hotspot place:
Code: Select all
hs_count=hs_count+1
If hs_count=8 then Action.GotoFrame "nextframe"

Then make the hotspots to disable themselves after the first click.
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Mon Sep 01, 2008 7:01 pm

Do you have the full version (sorry I don't keep track of who has it and who is using the free version) ?

If so, make a variable, e.g. difference1 (for differences on frame 1), and then add to the hotspot properties something like
Code: Select all
difference1 = difference1 + 1
If difference 1 = 5 (number of differences per frame) Then Action.GoToFrame "Name_of_NextFrame"


Then I would create variables for all frames (e.g. difference2, difference3 etc.).

Does this help?

EDIT
Lol, the dog was faster :lol:
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Mon Sep 01, 2008 7:17 pm

:lol: 8) Yes I was...
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby pennsteve » Mon Sep 01, 2008 7:24 pm

Lyberodoggy wrote:Create an integer called hs_count
Let's say the differences are totally 8
In every hotspot place:
Code: Select all
hs_count=hs_count+1
If hs_count=8 then Action.GotoFrame "nextframe"

Then make the hotspots to disable themselves after the first click.


Ok, I am quoting this so you know who I am answering. I'll actually answer you both. lol

Yes, I have the full version and......

Two different codes but will they both do the same thing? I would probably go with the shorter code (no offense) simply because it IS shorter.

Also, do I paste that only in the hotspots advanced section? Don't have to put it into the frame or anything?

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

Postby Lyberodoggy » Mon Sep 01, 2008 7:27 pm

No, just the hotspots. Each and every one of them will check for the right answer.

And remember that you have to go to actions and tick "Disable and Hide this Hotspot"
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby pennsteve » Mon Sep 01, 2008 7:31 pm

Lyberodoggy wrote:No, just the hotspots. Each and every one of them will check for the right answer.

And remember that you have to go to actions and tick "Disable and Hide this Hotspot"


Wait, I did this and it didnt work. Do I have to create variables also? I just pasted that line into every hotspot advanced section.

Edit: nevermind. I forgot to read teh part about the integer hs_count. It works now. lol.

Thanks!
Last edited by pennsteve on Mon Sep 01, 2008 7:34 pm, edited 1 time in total.
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby Lyberodoggy » Mon Sep 01, 2008 7:33 pm

Lyberodoggy wrote:Create an integer called hs_count

Yeah that's what I mean
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby pennsteve » Mon Sep 01, 2008 7:36 pm

I edited my last post. Thanks!
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby pennsteve » Tue Sep 02, 2008 1:09 am

Ugh. why is this acting buggy???

This is only working part of the time.

If I test from the intro screen, I find all of the differences in frame 1 and it goes to the next frame, but when I find all the differences in frame 2 it doesnt do anything......HOWEVER.......if I test it starting with frame 2 and find all the differences it goes to frame 3!!!!

Its also doing this if I start from other frames. It will work to the next frame but then that frame wont go to the next one. There is nothing mis-typed because every frame will work if I test it seperately.



?????? :(
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby juhuwoorps » Tue Sep 02, 2008 2:14 am

You need another variable in each frame or set the variable from the previous frame to 0!
Because if you had in the first frame 8 points to klick and then go to the next frame the variable is just at 8 and not 0.
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby pennsteve » Tue Sep 02, 2008 2:30 am

The variable isnt in the frame properties, it is only in the hotspot properties on each frame. One frame shouldnt affect the next, should it?

And if I need a variable in each frame, how would I word it? I don't do programming. lol

Edit: wait, i figured it out. I need a variable name for each frame. I was using just one variable for all frames. lol. duh.
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby mercedes » Tue Sep 02, 2008 4:30 am

Then I would create variables for all frames (e.g. difference2, difference3 etc.).



Ya thats what Mystery said up there...but the dog had posted too..so you probably missed it..:P

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

Postby pennsteve » Tue Sep 02, 2008 5:48 am

Yes, I missed it. I wasnt really sure what it meant anyway until I tried it. lol
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby juhuwoorps » Tue Sep 02, 2008 7:50 am

you also can use the same variable. But you must change it to zero in every new frame( in the frame properties).
It's better you use different vars, in couse you have several numbers of differents in your pics! This is also better to debug!
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby pennsteve » Tue Sep 02, 2008 2:28 pm

juhuwoorps wrote:you also can use the same variable. But you must change it to zero in every new frame( in the frame properties).
It's better you use different vars, in couse you have several numbers of differents in your pics! This is also better to debug!


Each frame has a different number of hotspots, thats why I have to use a different variable. I think? lol
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby Lyberodoggy » Tue Sep 02, 2008 4:31 pm

When you declare a variable in AM it's like declaring a public variable in a programming language: It stays there forever unless the program is terminated.

I 'd suggest you added this code in the frames:

Code: Select all
hs_count=0


as the others have said because it will lower the risk of getting wrong results.
I would also suggest that you use only one variable. You just have to alter the code each time depending on the number of the differences on a frame
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby pennsteve » Tue Sep 02, 2008 9:19 pm

Lyberodoggy wrote:When you declare a variable in AM it's like declaring a public variable in a programming language: It stays there forever unless the program is terminated.

I 'd suggest you added this code in the frames:

Code: Select all
hs_count=0


as the others have said because it will lower the risk of getting wrong results.
I would also suggest that you use only one variable. You just have to alter the code each time depending on the number of the differences on a frame


Nope, tried using just one variable and it wouldnt work. I had to make hs_count, hs_count1, hs_count2 etc.

It works now that way.
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby mercedes » Tue Sep 02, 2008 9:49 pm

Actually i think the dog was thinking you had created a procedure as well...If you had created a Procedure...you could call that variable from anywhere in your project..I think that's what he was thinking..:P or you had created a Global Variable..?

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

Postby Mystery » Tue Sep 02, 2008 9:54 pm

No, I rather think that Lyberodoggy meant to add it to each frame, so that when the next frame loads, the variable is set back to 0, and then the counting on click on the hotspots "restarts". :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby mercedes » Tue Sep 02, 2008 10:10 pm

Ah yes of course...set the variable back to 0 in the "GoToFrame" --wherever you have this...Ta-Da..:P
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby pennsteve » Tue Sep 02, 2008 10:31 pm

I just created 7 variables. Works that way also.
pennsteve
Expert Member
 
Posts: 329
Joined: Wed Aug 06, 2008 3:55 pm

Postby Mystery » Tue Sep 02, 2008 10:34 pm

Yes, that was my first idea to create a variable for each frame :)
The 1-variable solution is just a different way with less variables - but as long as one solution works well, it's good :D
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Wed Sep 03, 2008 2:17 pm

Yeah, before the recent update, many variables caused a partial slow-down.


Mystery is right. I meant adding the code in the "Execute some vbs each time a frame is loaded" box in project properties.

But now there's no problem with even thousands of variables. The thing is, if you want to find and edit a variable, it will be difficult if you have lots of 'em
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Cat » Sun Feb 08, 2009 11:17 pm

I'm using the hs_count code with the hs_count=0 variable when a frame is loaded.

The frames have a 60 second timer, when time's up the 'time's up' frame appears and sends them back to the last frame they were working on.

This is the problem I'm having: once they go back to that frame and click the hotspots they missed, they no longer advance to the next frame. (As they do if they click all the hotspots within 60 seconds the first time around.)

Would anyone happen to know how I fix this?

Thanks for your time...
Cat
Member
 
Posts: 18
Joined: Thu Mar 06, 2008 8:34 pm

Postby mercedes » Mon Feb 09, 2009 2:52 am

Hi Cat..:D

Where are u setting the varible hs_count = 0...?
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Cat » Mon Feb 09, 2009 2:56 am

In "Frame Properties/Advanced/Execute vb code immediately after the frame has appeared." Wrong place? :D
Cat
Member
 
Posts: 18
Joined: Thu Mar 06, 2008 8:34 pm

Postby mercedes » Mon Feb 09, 2009 2:59 am

Put it there as well..but also add it to each frame, so that when the next frame loads, the variable is set back to 0, and then the counting on click on the hotspots "restarts".--quote i took from the thread..:D Or maybe just putting it in the hotspot that takes them back to the previous frame..might do it too..

but try that and see if that works..let us know..:D

Peace
Last edited by mercedes on Mon Feb 09, 2009 3:04 am, edited 1 time in total.
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Cat » Mon Feb 09, 2009 3:01 am

Will do - thanks very much for the help!
Cat
Member
 
Posts: 18
Joined: Thu Mar 06, 2008 8:34 pm

Postby Lyberodoggy » Mon Feb 09, 2009 12:55 pm

Action.ResetRemovedHotspots
This should help if you removed the hotspots
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Next

Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests