The online racing simulator
Pop-up message
Hello!I have tried to find something about pop-up message but i couldnt find anything,im trying to learn lapper and manged to tweak it a bit.(spec comannds and public kick and ban messages)now i want people can like my Facebook page and i want to make a pop-up massage that will show like once in 5 minutes please help!
You need to use the RegisterScheduleAction expression, along with a sub-routine, such as;

RegisterScheduleAction( "0 5 * * * * *", SR_Facebook );

Sub SR_Facebook()
# message here # (this bit has been edited)
EndSub

Alternatively, you can have a message appear when someone passes a certain point on the track (a "node") with the RegisterNodeAction expression, such as;

RegisterNodeAction ( "KY1" , 4 , SR_Facebook,"" );

Sub SR_Facebook()
openPrivButton( "facebook_text",50,10,100,6,6,1,0,"Visit my Facebook page at https://www.facebook.com/richard.curran.129?fref=ts";
EndSub

Check the syntax, as I haven't tested it.
Thank you so much for the quick response,i want the pop up message to upeer in the chat like something with "/msg dont forget to visit us on Facebook(and then the page) I kinda noobish at coding so can you tell at which file i can put the code if there is one?
The code you want to use goes in the lfslapper.lpr file, which can be found in the /bin/default/ directory.

As for the pop-up message, you can have whatever you want between the quotes ("") in your sub-routine, and either on one line, or on multiple lines, such as;


<?php 
RegisterScheduleAction
"0 5 * * * * *"SR_Facebook );
?>

Above piece of code goes beside all the other pieces of RegisterScheduleAction code within the OnLapperStart Event.
ok i put the one with the on lapper start but now there is not even a welcome message i did it like this

<?php 
###################################
#Event triggered when lapper start#
###################################
Sub DisplaySpeed$userName )
    
PrivMsglangEngine"%{main_speedtrap}%" ToPlayerUnitGetCurrentPlayerVar"InstantSpeed" ) ),GetCurrentPlayerVar("UnitSpeed") ) );
EndSub

Sub ExitDisplaySpeed
$userName )
#    PrivMsg( "Exiting of displaySpeed" );
EndSub

Event OnLapperStart
()
#    RegisterScheduleAction( "0 0 0 * * * *", SA_mid );
#    RegisterScheduleAction( "0 0 0 * 1 1 *", SA_newyear );
    
#    RegisterNodeAction( "BL1" , 140 , DisplaySpeed,ExitDisplaySpeed );
#    RegisterNodeAction( "BL1R" , 245 , DisplaySpeed,ExitDisplaySpeed );
#    RegisterZoneAction( "BL1" , -60,106, 5 , DisplaySpeed,ExitDisplaySpeed );
EndEvent

Sub SA_mid
() # Lapper Event
    
globalRcmlangEngine"%{main_midnight}%" ) );
EndSub

Sub SA_newyear
() # Lapper Event
    
globalRcmlangEngine"%{main_newyear}%" ) );
EndSub

Event OnButtonFunction
($userName$SubT# Player Event When Player push shift+I or Shift+B
#    DEBUG ("Button SubT for " . $userName . " is " . $SubT);

EndEvent

Event OnLapperStart
()

RegisterScheduleAction"0 5 * * * * *"SR_Facebook );  

Sub SR_Facebook()
openGlobalButton"facebook_text_line1",50,10,100,6,6,1,0,"A message from our sponsor:";
openGlobalButton"facebook_text_line2",50,17,100,6,6,1,0,"Visit my Facebook  page at";
openGlobalButton"facebook_text_line3",50,24,100,6,6,1,0,"https://www.facebook.com/richard.curran.129?fref=ts";

EndSub

EndEvent
?>


can you please give me the whole thing im the worst at undestating codeing sorry to bother you
You were supposed to put the RegisterScheduleAction beside the other events of the same type, not to have 2 Event OnLapperStart() sections.

The sub-routine to go beside the other sub-routines, just outside the Event.
Hello again! ok i have been wating for this message to pop up but...nothing.. no message and not even a sign that this script is there.what am i doing wrong please tell me!!!i'll post the file here below
Attached files
LFSLapper.rar - 17 KB - 216 views
Please disregard my previous posts in this topic.

If you're reading this then I apologise - I was wrong on how to use RegisterScheduleAction.

It would appear that you can NOT use buttons with this command.

Try the following;


<?php 
Event OnLapperStart
()
RegisterScheduleAction"05 * * * * * *"SR_facebook1 );
RegisterScheduleAction"10 * * * * * *"SR_facebook2 );
RegisterScheduleAction"15 * * * * * *"SR_facebook3 );
EndEvent
?>



<?php 
Sub SR_facebook1
()
    
globalRcm("A message from our sponsor:");
EndSub 

Sub SR_facebook2
()
    
globalRcm("Visit my Facebook page at.....");
EndSub

Sub SR_facebook3
()
    
globalRcm("https://www.facebook.com/DfhDriversFromHellLfs?fref=ts");
EndSub
?>


Facebook message split into 3 as only a certain number of characters from a RCM message will appear on the screen.

The first part of the message (SR_facebook1) will appear 5 seconds past the minute (based on the clock on your computer or server), followed by the 2nd message 5 seconds later, then 3rd message 5 seconds after the 2nd. This will repeat after every minute.

I tried
Quote :RegisterScheduleAction( "05 5 * * * * *", SR_facebook1 );

which I thought would show message 5 mins and 5 seconds apart, but it didn't. I suspect that it will show message once 5 mins and 5 seconds after each and every hour.

I didn't have patience to test more than 10 minutes, so can't confirm!

One thing about using globalRcm messages - they appear in top middle of your screen in a large font size, which a lot of drivers will find annoying if they are on track.

If it was my server, and I wanted to show the facebook message, I'd do it with buttons and trigger to appear when drivers spectated. That way the message wouldn't upset someone's concentration when driving.
Attached files
LFSLapper.zip - 16.2 KB - 210 views
i did those buttons at the top above the drift meter but now when someone want to make his mouse to dissapper it's won't let it.what should i do ?
Bump!
Please help me when someone drives with mouse the mouse wont disappear even if he take off the connection list and press shift+z and shift+c or so ...
and the pop up messages won't show if the time set to above 5 seconds or so .
I believe whenever there are InSim buttons on the screen, the mouse can't go away.
I can confirm the statement made by Bose321.
But only for buttons with an onclick event attached.
When a button isn't clickable, there is no problem displaying them on screen and using a mouse to drive.
See my Pitboard as good example.
well then i should make pop up messages but for some reason it won't really show up if i put more then 5 seconds which sinanju posted . and a message the shows up after 5 second that just annoying ans useless spam
When working with RegisterScheduleAction, it's useful to remember which value does what:

Quote :
RegisterScheduleAction( "0 0 0 * * * *", SA_mid );
You can register a subfunction to call when a time is reached
Firts arg = cron format ss mm hh dayOfWeek dd MM YYYY
dayOfWeek start at 0 = Sunday
Second arg = Sub to call when player type this text

If you don't want to set a specific value, you can use * as that will count for any value.
So if you want a message to be displayed every minute at 0 seconds of that minute, you will have to set:

RegisterScheduleAction( "0 0 * * * * *", SA_mid );
RegisterScheduleAction( "0 1 * * * * *", SA_mid );
RegisterScheduleAction( "0 2 * * * * *", SA_mid );
RegisterScheduleAction( "0 3 * * * * *", SA_mid );

ect. etc.

If you want to display a message, followed by one or more messages, you could set:

RegisterScheduleAction( "0 0 * * * * *", SA_message_1 );
RegisterScheduleAction( "20 1 * * * * *", SA_message_2 );
RegisterScheduleAction( "40 2 * * * * *", SA_message_3 );

With this settings, a message will be displayed at 1 minute 0 seconds, a 2nd message at 1 minute 20 seconds and a 3rd message at 1 minute 40 seconds.
Thank you very much for your help .
i will try it and let you know if it works

FGED GREDG RDFGDR GSFDG