Jump to content



Photo
- - - - -

How to Delay the script?

Script Delay How to

  • Please log in to reply
17 replies to this topic

#1 mystman12

mystman12

    Enthusiast

  • Members
  • PipPipPip
  • 73 posts

  • Flag: ---------

  • Favorite Pinball: White Water

Posted 27 November 2013 - 07:26 PM

I was wondering how to delay the script. Like, make it so that when I shoot a scoop, it waits a second before shooting it out. I don't want to use timers, I just want a script command, and WScript.Sleep doesn't seem to work. Any Help?


"What is life anyway, when compared to the immortality of a high score?" - Soos, from Gravity Falls
tilt!tilt!tilt!3.gif
I'm working on a Future Pinball game, called Joe's Ultimate Bus Ride! Check out my blog if you want to know more!

#2 arngrim

arngrim

    DJ Force Feedback

  • VIP
  • 2,188 posts
  • Location:Charleroi, Belgium

  • Flag: Belgium

  • Favorite Pinball: Monster bash



Posted 27 November 2013 - 08:52 PM

Which script r u talking about??

#3 mystman12

mystman12

    Enthusiast

  • Members
  • PipPipPip
  • 73 posts

  • Flag: ---------

  • Favorite Pinball: White Water

Posted 27 November 2013 - 10:11 PM

Future Pinball uses VBScript.


"What is life anyway, when compared to the immortality of a high score?" - Soos, from Gravity Falls
tilt!tilt!tilt!3.gif
I'm working on a Future Pinball game, called Joe's Ultimate Bus Ride! Check out my blog if you want to know more!

#4 Bob5453

Bob5453

    I'm taking a nap

  • VIP
  • 3,896 posts
  • Location:Near Dayton, Ohio USA

  • Flag: United States of America

  • Favorite Pinball: Any table I can play while sitting in a rocking chair




  • Trophies:

Posted 27 November 2013 - 10:23 PM

Why wouldn't you want to use a timer? The Table logic is scripted in Visual Basic Scripting, not vbscript, I'm not a programmer, but maybe that is your problem.  Or maybe not. I don't know.


Posted Image

You have discovered an Easter egg. Pat yourself on the back.


#5 mystman12

mystman12

    Enthusiast

  • Members
  • PipPipPip
  • 73 posts

  • Flag: ---------

  • Favorite Pinball: White Water

Posted 27 November 2013 - 11:07 PM

We'll, it's just kind of annoying to use timers. It would be nice if I could just say:

 

Sub Kicker_Hit

   Wait 1000

   Kicker.SolenoidPulse

End Sub

 

instead of:

 

Sub Kicker_Hit

   KickerTimer.Set TRUE

End Sub

 

Sub KickerTimer_Expired

   Kicker.SolenoidPulse

   KickerTimer.Set FALSE

End Sub

 

It would just be a lot more convenient. Oh, and I also thought VBScript was the same as Visual Basic Script. Is there a difference?


"What is life anyway, when compared to the immortality of a high score?" - Soos, from Gravity Falls
tilt!tilt!tilt!3.gif
I'm working on a Future Pinball game, called Joe's Ultimate Bus Ride! Check out my blog if you want to know more!

#6 faralos

faralos

    VPF Veteran

  • Members
  • PipPipPipPipPipPip
  • 7,838 posts
  • Location:Eastern Pa,USA

  • Flag: United States of America

  • Favorite Pinball: Flash (Williams) 1979, Flash2 Updated




  • Trophies:

Posted 28 November 2013 - 03:42 AM

taken verbatim off the wikipedia site

VBScript (Visual Basic Scripting Edition) is an Active Scripting language developed by Microsoft

that is modeled on Visual Basic. It is designed as a “lightweight” language with a fast interpreter

for use in a wide variety of Microsoft environments. VBScript uses the Component Object Model

to access elements of the environment within which it is running; for example,

the FileSystemObject (FSO) is used to create, read, update and delete files.

 

VBScript has been installed by default in every desktop release of Microsoft Windows since Windows 98;[1]

in Windows Server since Windows NT 4.0 Option Pack;[2] and optionally with Windows CE (depending on the device it is installed on).


"Don’t let the noise of others’ opinions drown out your own inner voice.
And most important, have the courage to follow your heart and intuition.”
----Steve Jobs


#7 bob78954

bob78954

    Enthusiast

  • Platinum Supporter
  • 257 posts
  • Location:Round Top,Texas

  • Flag: United States of America

  • Favorite Pinball: Royal Flush,Fish Tales

Posted 28 November 2013 - 04:42 PM

USE A TIMER



#8 destruk

destruk

    VPF Veteran

  • VPF Staff
  • 6,338 posts
  • Location:Colorado Springs, CO

  • Flag: United States of America

  • Favorite Pinball: Ultrapin!



Posted 28 November 2013 - 05:10 PM

USE A LOOP! ...

Dim X

X=0

 

Sub Kicker_Hit

X=X+1

If X<999999999999999999999999999999999999 Then Kicker_Hit

   Kicker.SolenoidPulse

End Sub


Build a fire, vipers love the heat.


#9 bob78954

bob78954

    Enthusiast

  • Platinum Supporter
  • 257 posts
  • Location:Round Top,Texas

  • Flag: United States of America

  • Favorite Pinball: Royal Flush,Fish Tales

Posted 30 November 2013 - 02:29 AM

The only problem with a loop is, If you want add something fancy while the ball is in the scoop, your program is stuck in a loop.

But that's just me.

 

update:

 

After thought, but then again you don't want 500 timers on the editor screen either..lol


Edited by bob78954, 30 November 2013 - 02:39 AM.


#10 destruk

destruk

    VPF Veteran

  • VPF Staff
  • 6,338 posts
  • Location:Colorado Springs, CO

  • Flag: United States of America

  • Favorite Pinball: Ultrapin!



Posted 30 November 2013 - 04:27 PM

Well, if you want anything to happen on your computer during the loop, it won't, as it effectively takes all the cpu power your computer has to do the loop.


Build a fire, vipers love the heat.


#11 mystman12

mystman12

    Enthusiast

  • Members
  • PipPipPip
  • 73 posts

  • Flag: ---------

  • Favorite Pinball: White Water

Posted 01 December 2013 - 05:26 PM

Wait, wouldn't that mean different computers would finish loops at different speeds? I wasn't even going to mess with loops before, but, if that's true then loops are completely out of the question. I guess I'll just have to use timers, I can probably find some methods to use fewer timers.


"What is life anyway, when compared to the immortality of a high score?" - Soos, from Gravity Falls
tilt!tilt!tilt!3.gif
I'm working on a Future Pinball game, called Joe's Ultimate Bus Ride! Check out my blog if you want to know more!

#12 Les73gTx

Les73gTx

    Preschooler

  • Members
  • PipPipPipPip
  • 523 posts
  • Location:Maine

  • Flag: United States of America

  • Favorite Pinball: Power Play, BoP, JackBot, MM, AFM, CV, MB,Champions Pub, CftBL, ToM, and Many More

  • PS3 Gamer Tag: LCT0819, Les73gtx
  • 360 Gamer Tag: PissPoorShot

Posted 02 December 2013 - 03:12 AM

A loop is an amount of time. Faster computers do not count time faster.

Sent from my SAMSUNG-SGH-I747 using Tapatalk


les73gtx___atomicpin-pc.png
                                                                      


#13 destruk

destruk

    VPF Veteran

  • VPF Staff
  • 6,338 posts
  • Location:Colorado Springs, CO

  • Flag: United States of America

  • Favorite Pinball: Ultrapin!



Posted 03 December 2013 - 02:29 PM

Really?  Wow, you learn new misinformation every day.  This is why a looping GIF runs faster on a faster computer than a slower one.


Build a fire, vipers love the heat.


#14 bob78954

bob78954

    Enthusiast

  • Platinum Supporter
  • 257 posts
  • Location:Round Top,Texas

  • Flag: United States of America

  • Favorite Pinball: Royal Flush,Fish Tales

Posted 03 December 2013 - 09:08 PM

A loop is an amount of time. Faster computers do not count time faster.

Sent from my SAMSUNG-SGH-I747 using Tapatalk

A loop in this case is a counter, and I agree with destruk. A loop will run faster on a faster machine than a slower one.



#15 Les73gTx

Les73gTx

    Preschooler

  • Members
  • PipPipPipPip
  • 523 posts
  • Location:Maine

  • Flag: United States of America

  • Favorite Pinball: Power Play, BoP, JackBot, MM, AFM, CV, MB,Champions Pub, CftBL, ToM, and Many More

  • PS3 Gamer Tag: LCT0819, Les73gtx
  • 360 Gamer Tag: PissPoorShot

Posted 03 December 2013 - 10:02 PM

Thank you destruk, I read that we were talking about counting time. If we are talking about a looping animation then I am wrong and you are right. I still do not read anything in the other posts that we are talking about looping GIF untill you mentioned it. If I did not understand the question then that is my fault and I am sorry. My intent was not to give out misinformation.
Bob, are you saying that time, milliseconds, are going faster on your computer compared to a older pc with slower hardware?

Sent from my SAMSUNG-SGH-I747 using Tapatalk


les73gtx___atomicpin-pc.png
                                                                      


#16 Slydog43

Slydog43

    Pinball Wizard

  • Platinum Supporter
  • 3,008 posts
  • Location:Hackettstown, NJ

  • Flag: United States of America

  • Favorite Pinball: Addams Family, All Williams 90's Games

Posted 04 December 2013 - 12:04 PM

a loop like a for/next loop will execute quicker on a fast machine 

 

for x=1 to 100

next x

----------------------------

a loop that waits a specific amount of time is the same on all computers

 

t=now()

do

while t+now() < 10 seconds

 

this is just pseudocode.  In windows or any other os you need to tell the os to catch up on other message queues with a do.events or something similar as to not to halt the os in this loop though.



#17 UltraPeepi

UltraPeepi

    Enthusiast

  • Platinum Supporter
  • 216 posts
  • Location:Redmond, WA

  • Flag: United States of America

  • Favorite Pinball: Mary Shelly's Frankenstein

Posted 04 December 2013 - 07:45 PM

You can have a single timer which updates a "tick count".  With that, you could use a loop like Slydog has above.

 

Make a timer with an update every 100ms.  In the timer event callback, all you do is increment your global "tickCount" variable by 100.  Now anywhere you want to loop, remember the startingTickCount in a local variable, then check (tickCount - startingTickCount), and when it is greater than your exit criteria (in milliseconds), exit the loop.


ultradmd_splash.png


#18 mystman12

mystman12

    Enthusiast

  • Members
  • PipPipPip
  • 73 posts

  • Flag: ---------

  • Favorite Pinball: White Water

Posted 24 April 2014 - 11:51 PM

Okay, so I tried doing a loop that would keep going until my iTicks variable was greater than 3000, (I reset it to 0 before the loop) buuut I crashed my computer. How do I get the timer to keep on going and the loop not to crash everything? Do I just use the DoEvent command, or am I doing something wrong?

 

Code:

 

iTicks = 0 'I have a timer going off every 100ms. Each time it increments the iTicks valur by 100. This command resets it so all I have to do is enter the amount of time I want it to loop for instead of having to remember the starting value and 'then subtracting and stuff like that

Do Until iTicks > 3000
Loop

"What is life anyway, when compared to the immortality of a high score?" - Soos, from Gravity Falls
tilt!tilt!tilt!3.gif
I'm working on a Future Pinball game, called Joe's Ultimate Bus Ride! Check out my blog if you want to know more!





Also tagged with one or more of these keywords: Script, Delay, How to