Gamestudio Links
Zorro Links
Newest Posts
FXCM demo test failed
by qin. 01/13/26 13:53
Camera always moves upwards?
by NeoDumont. 01/12/26 09:39
Alpaca Plugin v1.5.2 Release
by kzhao. 01/11/26 13:42
Alpaca Plugin v1.4.0
by kzhao. 01/11/26 13:38
separating groups of 3 digits by a comma
by joe_kane. 01/11/26 00:01
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (Quad, TipmyPip), 6,316 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
promfast, joe_kane, Namitha_NN, Syndrela, agasior
19190 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
wait_for(function) #450098
04/06/15 17:50
04/06/15 17:50
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
I am trying to use as little lines of code as possible, as anyone would. So instead of having two lines of code for wait_for() i combined it into 1 like so:

Example A:
Code:
function wait_time(var text_time){
	var i;
	for(i=text_time;i > 0;i--){wait(1);}	
}

wait_time(150);
wait_for(wait_time);
ent_remove(me);



Example B:
Code:
wait_for(wait_time(150));
ent_remove(me);



but example B doesn't work. It just skips to the next line of code and immediately removes the entity.

Any thoughts? .. Or is this just not allowed, even with lite-c.


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: wait_for(function) [Re: DLively] #450099
04/06/15 18:00
04/06/15 18:00
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Have you tried using normal 'while' loop instead of 'for' one? Also, try to set '150' inside of the function, just to make sure everything works at the first place (var i = 150;).

Greets


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: wait_for(function) [Re: 3run] #450101
04/06/15 18:12
04/06/15 18:12
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
I had it as a while loop before this. I was trying to save myself 2 lines of code (no i -= 1, and no wait will be needed when I add the actual code to it).

It works in example A. So Im sure Its not the for loop...

Last edited by DLively; 04/06/15 18:13.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: wait_for(function) [Re: DLively] #450102
04/06/15 18:21
04/06/15 18:21
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Originally Posted By: DLively
I had it as a while loop before this. I was trying to save myself 2 lines of code (no i -= 1, and no wait will be needed when I add the actual code to it).

It works in example A. So Im sure Its not the for loop...
I miss understood you at the first place. And I think it's not going to work, cause you have to know how 'wait_for' actually looks like:
Quote:
#define wait_for(f) while (proc_status(f)) wait(1)
#define wait_for_my(f) while (proc_status(f,my)) wait(1)
As you can see, it just checks if there is any running functions with the given function pointer (f), so your idea isn't going to work anyway. Cause having multiply running 'wait_time(150)' functions will stop all those 'wait_for', waiting till all 'wait_time' functions will end. Better insert 'while(i > 0)' loop right before the 'ent_remove', don't make thing too complicated where they should be simple laugh

Greets

Edit: two lines grin
Code:
while(my.skill99 < 3){ my.skill99 -= time_step / 16; wait(1); }
ent_remove(my);


Last edited by 3run; 04/06/15 18:23. Reason: ***

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: wait_for(function) [Re: 3run] #450104
04/06/15 18:36
04/06/15 18:36
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Thanks 3Run laugh
I noticed it likely wasn't going to work when the engine ignored my command, but was not issuing an error.
Either way, as long as it works laugh

I like your approach, in your example.


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com

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

Gamestudio download | 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