Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by AndrewAMD. 12/05/23 10:56
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 622 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
freeze_mode == 2 #128405
05/06/07 20:17
05/06/07 20:17
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
I am making a pause feature for my game, and I noticed that I need to set freeze_mode to 2 instead of 1. This, however, is dangerous

It seems every function is paused at the next wait() function when freeze_mode is set to 2, then resumed again when freeze_mode is reset to 0. The only functions active are those executed by "on_" events and they only run for one frame, even if it has a wait(1) command.
For my game, I need to make a scene with a glowing pause image and stuff like that, but this is not possible since the function with the loop only runs for one frame.

Is there a workaround to make a loop run during freeze_mode? Is there a way to isolate a function from the freeze list? My loop is "while(freeze_mode == 2)", with a "wait(1)" command in it, and after that wait(1) it stops. This is frustrating!

Re: freeze_mode == 2 [Re: sheefo] #128406
05/06/07 20:31
05/06/07 20:31
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
what calls that function?

did you try:
my = null;
at the beginning of the function?

Re: freeze_mode == 2 [Re: Xarthor] #128407
05/06/07 21:55
05/06/07 21:55
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
Thanks, but it does not work. It's called by "on_p = onPause;". It does not use the my pointer, it's just got some code to toggle between 0 and 2, and then a loop "while(freeze_mode == 2)" and in there is the code to make the pause panel visible and make it glow using a sin wave, then after the loop is the code to disable the panels visibility.

I think that there is no support for this. Conitec needs to add support for removing functions from the paused list or something. If anyone know anything...

Re: freeze_mode == 2 [Re: sheefo] #128408
05/06/07 22:17
05/06/07 22:17
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Quote:


0 - All functions are running (default)
1 - Entity functions (my != NULL) and particle functions are suspended, all other functions are running
2 - All functions are suspended.





Okay, why not use freeze_mode=1 and set the my pointer of the functions which shall run to anything else than null?

Re: freeze_mode == 2 [Re: Xarthor] #128409
05/06/07 23:02
05/06/07 23:02
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline
User
JazzDude  Offline
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
jcl had this to say in bug hunt

Quote:

freeze_mode 1 freezes all functions that started while the my entity pointer was nonzero - and as this pointer can have a random state while pressing a key or button, the problem occurs. Try the following workaround: add a "my = NULL" at the beginning of all functions that should continue to run when freeze_mode is 1.

This will be fixed in the next update.





Re: freeze_mode == 2 [Re: JazzDude] #128410
05/07/07 03:17
05/07/07 03:17
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
freeze_mode = 1.5; lol...

The only solution I see is to use freeze_mode = 1; and adjust all your functions to work around that...

You can also use enable_key/mouse = 0; to disable those "on_xxx" events, and then in your while loop use "while (!key_p)"...


xXxGuitar511
- Programmer
Re: freeze_mode == 2 [Re: xXxGuitar511] #128411
05/07/07 15:00
05/07/07 15:00
Joined: Apr 2006
Posts: 265
V
vartan_s Offline
Member
vartan_s  Offline
Member
V

Joined: Apr 2006
Posts: 265
Or create your own freeze code. First, define your own pause variable, e.g. var pause_mode. Just inside all while(1) loops (of functions that you want to pause) put an if(pause_mode == 0). There. It may be a pain in the a**, but this way you have more control over your functions.

It shouldn't slow down your code either. I don't recall extra ifs being able to do that.

Re: freeze_mode == 2 [Re: vartan_s] #128412
05/08/07 09:45
05/08/07 09:45
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline OP
User
sheefo  Offline OP
User

Joined: Jul 2006
Posts: 783
London, UK
Thanks everyone.

I've tried Thunder's way, but it is a big buggy. I am going to mess with it until it works


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1