making a loading wait

Posted By: MMike

making a loading wait - 07/01/10 15:33

hello
i tried ti make a function that waits for something and then return, and keep the function going.

function load_wait(int* a){
wait(-2);
*a=2;
}


function main(){
int evl;
load_wait(&evl);
while(evl!=2){wait(1);}
error("ok");
}

the problem is you never see the ok message.
Posted By: Widi

Re: making a loading wait - 07/01/10 15:41

Why not using wait_for()?

wait_for(load_wait);
Posted By: MMike

Re: making a loading wait - 07/01/10 15:43

where is that? on the manual?
Posted By: Widi

Re: making a loading wait - 07/01/10 15:47

Yeah, search for it, you will get 2 results. wait_for() is a macro and waiting till all instances of this function are finished.
Posted By: MMike

Re: making a loading wait - 07/01/10 15:49

tryed

wait_for(load_wait(300,300,200));
error("ok");

but the ok appear immediatly which is not true because my real load_wait function is this:

Code:
function load_wait(short a, short b, var time){
PANEL* ar=pan_create("bmap=loading_map;",5);
var timex=0;
fade_pan_in(ar);
pan_set(ar,a,b);
pan_setcenter(ar); //middle rotation point default


while(timex<time){
ar.angle-=2.3;
timex++;
wait(1);}
fade_pan_out(ar); 
ptr_remove(ar);
}



PS: Some commands make part of my own Function library, so it wont work on your side.
Posted By: Widi

Re: making a loading wait - 07/01/10 15:51

wrong:
wait_for(load_wait(300,300,200));

use:
load_wait(300,300,200);
wait_for(load_wait);

Posted By: MMike

Re: making a loading wait - 07/01/10 15:53

like this? :
load_wait(300,300,200);
wait_for(load_wait);

next to each right? (since i have to call the load_wait with the right parameters.
Posted By: MMike

Re: making a loading wait - 07/01/10 15:54

Thanks it worked.

Off-topic, your speak pT?
Posted By: Widi

Re: making a loading wait - 07/01/10 15:54

You was faster then my edit wink
© 2024 lite-C Forums