Looping Procs won't work.

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

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

Looping Procs won't work.

Postby drdna » Thu Apr 28, 2011 8:36 am

Hi everyone,

I have a problem I hope someone can help with.

I'm attempting to make a "slot machine" type of routine. Not a slot game, but just a similar routine where I have several boxes that display fast random images in them for about 10 seconds then stop. Then depending on the order, displays another image in a different location. I'm using almost pure vbscrpt for this.

Everything works like a charm except my proceedure loop, which it won't do no matter what I do. Here's a sample of "just one" of my configurations. I've tried several different ones. This one uses the CreateTimedEvent to show an image every .2 seconds.

sub spin3
cdown = 5
Do While cdown > 0
cdown = cdown - 1
show11=1
Action.CreateTimedEvent .2, "show11=0 : show12=1"
Action.CreateTimedEvent .4, "show12=0 : show13=1"
Action.CreateTimedEvent .6, "show13=0 : show14=1"
Action.CreateTimedEvent .8, "show14=0"
Loop
End Sub

It runs once just fine, but will not loop back to repeat the proc. I have tried the DO UNTIL LOOP also and even the FOR NEXT routine. Nothing works.

I have also tried to use the action.loadapicture function but it wouldn't do anything after the first picture load.

Any ideas/help?
drdna
Member
 
Posts: 49
Joined: Fri Dec 29, 2006 10:16 pm

Postby reneuend » Thu Apr 28, 2011 12:38 pm

you're right...the loop in this case will do nothing. This is because when you use the "createtimedevent" it waits the alloted time and then updates the vars. The loop itself is working independently and would have finished long before even the first "createtimeevent" has been finished.

I'm at work and don't have time to figure it out right now, but I think you might be able to use the vba Timer command instead. Search for "countdown" on this forum. There should be code on how to do a countdown and adding events during the countdown. I think the idea is similar to this although you aren't really counting down.

Alternatively, you might be able to use one of the animator plugins and slow down the time between frames too.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby drdna » Thu Apr 28, 2011 12:52 pm

Ah! That answers another situation I'm running into. If I understand you correctly, the proceedure is executed all at once? I've also been playing around with trying to get things to run sequentialy, but can't do it.

Example: After all the images appear, and the routine ends, I'm trying to get a random image to appear in the boxes where the images are. But I can't do it. Probably because it's already run, like the above situation, before the timedevents end. Right?

I'll play around with the countdown idea. I was trying it earlier but didn't spend too much time on it. I'll try again.

What I'm trying to do is quite simple actually. It just sounds complex.
drdna
Member
 
Posts: 49
Joined: Fri Dec 29, 2006 10:16 pm

Postby drdna » Fri Apr 29, 2011 8:28 am

Wow, I think I'm losing it. I just can't for the life of me figure out how to get things to run sequencially. It's as clear as a bell in my mind and seems simple to do, but it won't work. I always thought that when you type the procedures in the advanced window they ran sequencially. Meaning when one is done, the next one runs. This is not the case.

How can I get procedures to run one after the other. Here's what I need:\

Procedure "Spin": scrambles a bunch of images for 10 seconds (solved)
Procedure "Randpic": Displays a random image from the bunch.
Procedure "Dopic": Goes to a ceretain frame when the player clicks the image.

If I type all three procedures in the window, the images shuffle then stop. Nothing else happens because "Randpic" comes and goes before "Spin" is complete. So there is nothing to click on.

I need to find a way to wait for "Spin" to complete before executing "Randpic".

Any suggestions? Or is this not possible the way I'm doing it?
drdna
Member
 
Posts: 49
Joined: Fri Dec 29, 2006 10:16 pm

Postby mercedes » Fri Apr 29, 2011 10:46 am

Not sure if this will help..

Take a look at this thread..;

http://www.adventuremaker.com/phpBB2/viewtopic.php?t=5758&highlight=randomize+pictures

EDIT** I wanted to add these 2 animation makers as well..In case you or someone else..wanted to try this route..

http://www.adventuremaker.com/phpBB2/viewtopic.php?t=5109&highlight=randomize+pictures
Last edited by mercedes on Fri Apr 29, 2011 11:25 pm, edited 3 times in total.
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby reneuend » Fri Apr 29, 2011 2:14 pm

lol. You're always good at finding related threads, Mercedes. :)
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby drdna » Fri Apr 29, 2011 9:32 pm

Thanks for the reply, but the randomization of the pics isn't the issue I'm stuck on. My random procedure works fine. The problem is I can't get it to run "AFTER" my spin code. I place it after my "spin" code and it still runs too soon, so when the spin code is finished, everything is already done.

To make things simple to understand, I "only" need to be able to run code sequencially, waiting for one to end, before the other starts, regardless of how long it takes the first one to run.

I hope this helps.
drdna
Member
 
Posts: 49
Joined: Fri Dec 29, 2006 10:16 pm


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests

cron