every iteration to make sure all text and buttons finished exactly at the same time.
I have a couple of questions:
1. Is there a more elegant way of coding this?
2. Where abouts do I put this code so it will be visible between races? (races already restart automatically with $AutoRestartRaceSec = 10; )
Thanks for the heads up on the FOR loop.
I have tried several ways to create a delay but it seems you cannot break out of a loop to backcall a sub. The backcall still works but only AFTER the loop has finished.
Have messed about with DelayedCommand with no good results.
Ah yes , I should have thought of leaving all the buttons open during the count then close them all at the end. Was so wrapped up trying to get them all to timout at the same time I forgot about that feature :tired::doh:
The only reason I wasnt using global buttons for the test was that I didnt want to annoy the visitors on my test server with constant timers popping up, but still wanted them there to comment on other aspects of the lapper functions I had implemented.
I'm still struggling to delay the FOR loop so the countdown doesnt happen all at once tho'.
I do indeed have Z28.
Let me clarify whats happening.
When in race and the timer is NOT showing, the mouse remains hidden.
When in race and timer IS showing , because the countdown button has a backcall, the mouse becomes visible and the button is clickable until timer runs out, then the mouse returns to its hidden state. The mouse will not hide while the button is active.
SHIFT+Z shows and hides the mouse normally once the buttons are closed.
That's because buttons were initialy created to click on, so you need a mouse for that. In Lapper you can have buttons on which clicking isn't needed, so it would be nice if insim (that's something Scawen has to add) would have an option which indicates a button doesn't need clicking.
1: When a button is clickable ( when you use -1 ) and using a backcall you always get the mouse cursor.
2: I use the delayedcommand method in mine scripts and mostly it works ok, very some time it skips a number but mine server is not the fasted one.(P4 1.5Gz 512Mb) so maybe its that why it skips sometimes a number at mine server.
3: In case of using the Event OnFinish( $userName ) you have to use
Event OnResult( $userName,$flagConfirm ) # Player event IF(GetCurrentPlayerVar("FinishedPos")==1) THEN $delay=60; DelayedCommand( $delay, start_countdown ); ENDIF EndEvent
If you want to start the restart counter as the last driver finish the race you have to count all drivers at the start of race and when someone leave the race its number of drivers - 1 .
At the end of the race just count how many people are finisished the race and by the last start the restart counter. ( and set no mid race join )
I think a non clickable button (or a flag to state clickable on/off in global and private buttons that use backcalls) might be usefull, will post into the request thread.
I'm running a quad core 2.8Ghz with almost no unnecessary tasks running on startup and I still get the odd number missing or uneven timing in the countdown delay scripts or %cpt% functions . I think it has to do with the way lapper handles time.
Thank you for your replies, they are most welcome. I was close to getting it right, after finishing reading all the changelog.txt and playervars.txt. The only thing I was missing was the $flagconfirm , what is this for? I cannot find any reference to it in any of the files I have other than where it is used in lpr files.
If a player have a 30 second penalty the $flagConfirm must be 16 (CONF_PENALTY_30) + 2 (CONF_CONFIRMED) = 18
If a player have a 45 second penalty the $flagConfirm must be 32 (CONF_PENALTY_45) + 2 (CONF_CONFIRMED) = 34
Event OnResult( $userName,$flagConfirm ) # Player event
SWITCH( GetCurrentPlayerVar("FinishedPos") ) CASE 1: IF( $flagConfirm == 2 || $flagConfirm == 18 || $flagConfirm == 34 ) THEN show and give points