2018-01-14 12:28:38

Hi.
I can or can't import user text for example 100 to wait(); in bgt?
If i can, how?

Mao!
--
TD programs website available under new address.
https://tdprograms.ovh/

2018-01-14 13:09:58

Hi,
Excuse me, but I did not understand your question properly. the wait() is a function in bgt which will pause your game for the specified time. the time it takes is in miliseconds. the ways a function can be used in general programming is to either give it values by hand each time or make a variable which holds your value and pass it each time to the function. if you store your waiting in a variable, you are following a nice programming approach; since now you can just change  the value your waiting variable has to increase or decrease the amount of time your wait functions are using. you can make variables for different waiting things like footsteps and so on. then you just pass those variables.
I hope this was the thing you wanted. One more approach is to use something like this:
string text="hello";
wait(text.length());
remember that a string is also an aray. the length method will return the length of the string; in our case, the string "hello" has 5 characters, thus it will return 5. so the wait function call becomes wait(5);
Regards,
Amit

There once was a moviestar icon.
Who prefered to sleep with the light on.
They learnt how to code, devices sure glowed,
and lit the night using python.

2018-01-14 21:58:13

#OP please don't use google translate, as it makes no sense whatsoever. Consider using bing instead if you have trouble.

I too am unable to gleam the root of your question, but know this, if you force the script to wait, you're pausing the entire thing, that means that during that time, your game or whatever you're making in BGT is doing nothing, it cannot execute code at all. This is essential in infinite loops, because without it, your CPU will trend upwards to 100%, because BGT will then be stealing all the CPU cycles, and other apps that need those resources will have to fight to get them.

If you need to have something happened after a certain amount of time has passed, but you don't want your script to pause, this is where timers come in.

timer my_timer; // declaring the timer variable
void main() // defining the main function
{
// do stuff
while (true) // infinite loop
{
  if (my_timer.elapsed >= 5000) // don't do anything until the timer reaches 5 seconds or 5000 milliseconds
  {
    show_game_window("My Game"); // shows the game window with the string as the name in the title Bar
    my_timer.restart(); // vital for things that need to be timed more than once, this resets the timer to 0ms and starts it running.
  }
wait(5); // allow other programs to use CPU cycles
}
} // end main function

If I wrote that out correctly, which who knows... but yeah, I don't know why you'd want to wait 5 seconds to show the game window, but you could use this for anything. The example is pointless other than to show syntax.

Facts with Tom MacDonald, Adam Calhoun, and Dax
End racism
End division
Become united