The online racing simulator
[Solved] HostDelayedCommand() does not work
I'm using the starlight and the HostDelayedCommand does not work for me to change the color of the semaphore, any help?
Thanks for answering!

Code:

<?php 
Event OnLapperStart
()
    
RegisterZoneActionSEMAFOROS1AU1 22 , -830 semaforo1,"" );
EndEvent
?>



<?php 
Sub semaforo1
$userName,$ZoneID)
    
startlightcontrol(5,149,22,1);
    
HostDelayedCommand5semaforo3 );
EndSub

Sub semaforo3
$userName,$ZoneID)
    
startlightcontrol(5,149,22,8);
EndSub
?>


When you call a sub routine with HostDelayedCommand(), be sure your Sub-routine does not have any variables.

When you open the error file, you see a line with Wrong amounts of variables or something.




<?php 
Sub semaforo1
$userName,$ZoneID)
    
startlightcontrol(5,149,22,1);
    
HostDelayedCommand5semaforo3 );
EndSub

Sub semaforo3
()
    
startlightcontrol(5,149,22,8);
EndSub
?>


It does not work for me, the lights are still red :s

Thank you very much for answering all my doubts and requests Bass-Driver!



Logs:

<?php 
7
/29/2017 12:23:55 PM -> Syntax error in cfg fileNumber of function argument not matche at line #56 in function 'semaforo3' script aborted
?>

The error means that an invalid number of arguments is send to function 'semaforo3' or that an invalid number of arguments is tried to receive in that function.
If you can't find that error, which is no problem, then it's best to show the whole script, so others might find the problem.
Quote from Yisc[NL] :The error means that an invalid number of arguments is send to function 'semaforo3' or that an invalid number of arguments is tried to receive in that function.
If you can't find that error, which is no problem, then it's best to show the whole script, so others might find the problem.

The code is the one published above
i made a small mistake.

But if you had used the search function on this forum and searched for 'hostdelayedcommand',you had found the issue with a fix.

https://www.lfs.net/forum/post/1921312#post1921312



<?php 
Sub semaforo1
$userName,$ZoneID)
    
#privmsg("Sub semaforo1"); #Debug message
    
startlightcontrol(5,149,22,1);
    
HostDelayedCommand5semaforo3 );
EndSub

Sub semaforo3
($keyflags#This is not a priv sub-routine anymore
    #globalmsg("Sub semaforo3"); #Debug message
    
startlightcontrol(5,149,22,8);
EndSub
?>


Let me know this works for you, so i can close this thread.
Thanks I worked perfect!
This thread is closed

FGED GREDG RDFGDR GSFDG