Problem:
1. Every second the timer is supposed to execute, it only executes once on lapper start.
2. $mList - It reports as 0 entries even though I'm online.
3. Even if I remove every line except the first one ( to report the time ) it only runs once.
#. Error logs say nothing
Has anyone encountered this problem before? it works for me for scheduled actions of 1 minute tho...
Temp fix: wrote a RegisterScheduleAction for every second from 00 to 59 T_T
1. Every second the timer is supposed to execute, it only executes once on lapper start.
2. $mList - It reports as 0 entries even though I'm online.
3. Even if I remove every line except the first one ( to report the time ) it only runs once.
#. Error logs say nothing
Has anyone encountered this problem before? it works for me for scheduled actions of 1 minute tho...
CatchEvent OnLapperStart()
# Some functions ... #
RegisterScheduleAction( "* * * * * * *", Second_Timer ); # Execute every second.
EndCatchEvent
Sub Second_Timer() # Timer #
writeline( "RSB_Time timer " . GetLapperVar( "longtime" ) );
$mList = GetListOfPlayers();
$mListCount = arrayCount( $mList ); # Reports as 0 entries.
writeline( "RSB_Time $mList: " . $mListCount . " entries: " . $mList[0] . ", " . $mList[1] . "." );
FOREACH ( $maVar IN $mList )
writeline( "RSB_Time FOREACH" );
IF ( GetPlayerVar( $maVar["value"] , "UserName" ) != "" ) # Not Host #
THEN
# DO SOMETHING #
writeline( "RSB_Time Username exists" );
IF ( GetPlayerVar( $maVar["value"] , "Delivery" ) != "" )
THEN
$distance = ToNum( trackuserdistance( GetPlayerVar( $maVar["value"] , "Delivery" ) , $maVar["value"] ));
IF ( $distance < 5 )
THEN
SetPlayerVar( $maVar["value"] , "DeliveryTick" , ToNum( GetPlayerVar( $maVar["value"] , "DeliveryTick" ) + 1 ) );
$TickCount = ToNum(GetPlayerVar( $maVar["value"] , "DeliveryTick" ));
IF ( $TickCount >= 3 )
THEN
SetPlayerVar( $maVar["value"] , "DeliveryStatus" , "1" );
$DeliverToUserID = GetPlayerVar( GetPlayerVar( $maVar["value"] , "Delivery" ) , "UserID" ); #Get Receiving Player UCID.
FOREACH ( $CompanyArray IN $Companies )
$OrderVar = ToString( "UserName_Order_" . $CompanyArray["value"] . "_" . $DeliverToUserID );
$OrderCompany = ToString( $CompanyArray["value"] );
IF ( GetStoredValue( $OrderVar ) != "" )
THEN
$DeliverToNickName = GetPlayerVar( GetStoredValue( "UserName_Number_" . $DeliverToUserID ) , "NickName" );
PrivMsg( $maVar["value"] , "^7You have ^2successfully delivered ^7to " . $DeliverToNickName );
Delivery_Order_Delivered( $OrderCompany , $DeliverToUserID );
ENDIF
ENDFOREACH
ENDIF
ENDIF
ENDIF
ENDIF
ENDFOREACH
EndSub
Temp fix: wrote a RegisterScheduleAction for every second from 00 to 59 T_T