The online racing simulator
Searching in All forums
(966 results)
Gai-Luron
S3 licensed
idZone -> IdZone
Gai-Luron
S3 licensed
Release 5.9.0.6 RC available for test purpose.

send me feedback.

GO! GO! GO! with cruise Script, you have everything now


+-------------------------------+
|Changes from v5.904 to 5.906 |
+-------------------------------+
1. Add new player var TotDistMeter that is the distance in meter do by a player
this value is set to 0 when a player connect to the server
You can set this value by SetCurrentPlayerVar( "TotDistMeter" , 10000 );

2. Add new config var
$distToDo = 100;
it is the amount of meter that player must do to trigger new player event OnDistDone, see below

3. Add new event triggered when a player do a certain distance
$distToDo = 100;
Event OnDistDone( $userName ) # Player event
writeline( "100m dist done by " . $userName . " - total dist :" . GetCurrentPlayerVar("TotDistMeter") );
EndEvent

Last edited by Gai-Luron, .
Gai-Luron
S3 licensed
Sub removeMySched()
FOR( $i = 1; $i < 55;$i = $i + 1 )
$id = "RaceNight_" . strFormat("{0:00}",$i);
RemoveScheduleAction( $id );
ENDFOR
EndSub

Gai-Luron
S3 licensed
You have an infinite loop, or cross calling sub, you got a timeout
Last edited by Gai-Luron, .
Gai-Luron
S3 licensed
FOR( $i = 0; $i < 56;$i = $i + 1 )
RemoveScheduleAction( "Number_" . strFormat("{0:00}",$i));
ENDFOR

Fo info strFormat("{0:00}",$i) return 00 if $i = 0, 01 when 1 and so on.

Quote :Why do we need all those message lines shown in screenshots I posted when sending private messages?

You are rigth, i remove this uglys messages

My sub must be work, i write the code this morning at work without test it, perhaps i have make mistake . But the idea is that kind of code


Edit : code corrected

Sub rme( $ids )
$ar_id = SplitToArray( $ids,"&" );
FOREACH( $val IN $ar_id )
RemoveScheduleAction($val["value"]);
ENDFOREACH
EndSub


DosBox is the distance done by player, i removed it in the attached exe file, with privmsg fix. Change only your exe


Gai-Luron
Last edited by Gai-Luron, .
Gai-Luron
S3 licensed
Release 5.9.0.5 RC available for test purpose.

send me feedback.


+-------------------------------+
|Changes from v5.904 to 5.905 |
+-------------------------------+
1. Fix bug on scheduledAction


Gai-Luron
S3 licensed
what is message on log file?
Gai-Luron
S3 licensed
No,

thinking about, i know what's happened. Il div a loop by 2 to implement blinking button. In this case, 2 loop per second. In this case scheduled function are called 2 time in one second, not one. I correct this tonite

Thank's for report

Gai-Luron
Gai-Luron
S3 licensed
Strange, in my test i haven't this issue!! i take a look tonite, but can you try to see if there is 2 scheduled action are calling the same sub? or duplicate schedule action?

Gai-Luron
Gai-Luron
S3 licensed
Quote from Fire_optikz001 :i mean i can make a scedualed event but would need a way go save it to the file

Why do you want to save it to file? why don't you use stored value?

Quote :RemoveScheduleAction( "myTest1&myTest2&myTest3" );

not possible! it's very important to have multiple remove event for you? i can do that if you want or if you can't wait create a sub like this


Sub rme( $ids )
$ar_id = SpliToArray( $id$,"&" );
FOREACH( $val IN $ar_id )
RemoveScheduleAction($val["value"]);
ENDFOREACH
EndSub

Gai-Luron
Last edited by Gai-Luron, .
Gai-Luron
S3 licensed
Why don't you save data on a specific node or zone of the track. When a player finish lap. and then when a player leave server
Gai-Luron
S3 licensed
Hello,

I have already a count meter for each player ( in meter ). But do you need an event to do a specific action? What do you want to do with this info?

How do you want to use it? in fact i don't know on how work cruise insim ^^

Thank's for your answer

Gai-Luron
Gai-Luron
S3 licensed
privMsg( username,message )
privMsg( message )
privMsg can be used with userName or no



CASE "!pm":
$tmp = splitToArray( $argv,"," )
privMsg( $tmp[0], "You have received a private message from" . GetCurrentPlayer("UserName" ) );
privMsg( $tmp[0], $tmp[1] );

BREAK;


in chat just type
!pm gai-luron,hello my friend

or if you want absolutely this function create a sub like
in this case you haven't to change anything in your code

Sub userMsg( $userOrig,$userDest,$msg )
PrivMsg($userDest,"You have receive a message from " . $userOrig );
PrivMsg($userDest, $msg );
EndSub

Last edited by Gai-Luron, .
Gai-Luron
S3 licensed
Quote from Fire_optikz001 :cool u added some of the stuff i needed for my cruise addon

The zone id, i think and the player var idZone. Very strange no? Yes it's only for your dev i have added this feature. I hope you release your cruise script to the community when you finish it . Please use catchevent and catchsub to have a standalone script.

@Yisc[NL]
Not many things are changed, the most important are the userName var passed to all event players, some modification in defaults script to use catchevent and catchsub, improvement of arrayvar and some builtin function can return array.

I modify some internal code too. Not visible for you, but better for me !

Thank's
Last edited by Gai-Luron, .
Gai-Luron
S3 licensed
Release 5.9.0.4 RC available for test purpose.

send me feedback.


+-------------------------------+
|Changes from v5.903 to 5.904 |
+-------------------------------+
1. Add blinking button feature on button, value is 8 or use ISB_BLINK const
Example:
openPrivButton( "clos",78,120,20,10,10,-1,ISB_DARK | ISB_BLINK,langEngine("%{main_accept}%"),OnConnectClose );
or
openPrivButton( "clos",78,120,20,10,10,-1,32 + 8,langEngine("%{main_accept}%"),OnConnectClose );

Better use const for more lisibility

2. new arg in functions
RegisterScheduleAction
RegisterScheduleAction
RegisterZoneAction
DelayedCommand
PrivDelayedCommand
accept a newArg that is an unique id for this Action.
this id is usefull when you want remove a RegisterScheduleAction, RegisterScheduleAction, RegisterZoneAction,DelayedCommand,PrivDelayedCommand
You can also still continue use this function without this arg

Example:
RegisterScheduleAction( "myTest","* * * * * * *", SA_test );
RegisterNodeAction( "MyNode", "SO6" , 337 , SA_Test2 );
RegisterZoneAction( "MyZone", "SO6" , 337 , SA_Test3 );
DelayedCommand( "MyCommand", SA_Test3 );
PrivDelayedCommand( "MyCommand", SA_Test3 );


3. new functions
RemoveScheduleAction( idSched );
RemoveNodeAction( idSched, track );
RemoveZoneAction( idSched, track );
RemoveDelayedCommand( idSched );
RemovePrivDelayedCommand( idSched );

this functions allow to remove a previous registered action
Example:
RemoveScheduleAction( "myTest" );
RemoveNodeAction("MyNode","SO6");
RemoveZoneAction("MyZone","SO6");
RemoveDelayedCommand( "MyCommand" );
RemovePrivDelayedCommand( "MyCommand" );

4. Add a new player Var to know in witch zone the player is
if not in zone value is "NONE" else it's the id of the zone event, identifi you zoneaction now.
usefull when you want command available only in specific zone
Example
CASE "!buyfood":
IF( GetCurrentPlayerVar( "idZone") == "MyZone" ) THEN
... do what you want ...
ELSE
privmsg( "Command not available here");
ENDIF



Gai-Luron
S3 licensed
DefaultTopCar not set correctly


Gai-Luron
Gai-Luron
S3 licensed
Give me some example like
player 1 enter in zone1
Command available
player2(admin) enter in zone1
Command available

player 1 enter in zone2
Command available
player2(admin) enter in zone2
Command available

player 1 enter not in zone
Command available
player2(admin) not in zone
Command available


i don't know how work cruise server. for me it's new

Gai-Luron
Gai-Luron
S3 licensed
if i remember it is in one include, defpit.lpr. you must add in this file the part of lang definition used

Gai-Luron
Gai-Luron
S3 licensed
Hello,

I say i don't understand what do you want to do on LFSLapper. Explain more. I can't help you with this poors infos
Gai-Luron
S3 licensed
Release 5.9.0.3 RC available for test purpose.

send me feedback.


+-------------------------------+
|Changes from v5.902 to 5.903 |
+-------------------------------+
1. Improve number of simultaneus button allowed on screen to 240 ( LFS limit ) instead 170.

2. Add a timeout feature in script to stop infinite loop. Default is 2000ms
you can set your own value in LFSServers.cfg

timeOutScript=2000; # Time out in ms

3. Add player var retreiveid from Pubstat
PSDistance, // online statistics of one racer - distance in metres
PSFuel, // online statistics of one racer - fuel burnt in cl
PSLaps, // online statistics of one racer - laps
PSHostsJoined, // online statistics of one racer - hosts joined
PSWins, // online statistics of one racer - Wins
PSSecond, // online statistics of one racer - Second
PSThird, // online statistics of one racer - third
PSFinished, // online statistics of one racer - finished
PSQuals, // online statistics of one racer - quals
PSPole, // online statistics of one racer - pole
PSDrags, // online statistics of one racer - drags
PSDragWins, // online statistics of one racer - drag wins
PSCountry, // online statistics of one racer - country

4. Add a Sub fonction in LFSLapper.lpr script PstInfo, this function display the pubstat info for one player

5. Add new chat command !ps to display your pubstat info or !ps username to display the pubstat info for
a player present on server

6. Add new .lpr file consts.lpr, containing some const usefull to write script


Gai-Luron
S3 licensed
Yes..., but what's the question?
Gai-Luron
S3 licensed
Hello,

Take a look if it crash if LFSLapper.exe still running looking at process. Because you think lapper is crashed but it is in infinite loop and work. In this case it can take 100% cpu and second Lapper started take very much time to start because .NET is very busy with the first one.

i hope this can help you!

Gai-Luron
Gai-Luron
S3 licensed
Hello,

Take a look on what is the process who take 100% of cpu. Take a look also in your script if there is an infinite loop in one of this. In next release i can try to make an timeout on each event or sub to limit this crash possibility.

Without the log for view the error, i can't do anything

Gai-Luron
Gai-Luron
S3 licensed
Hello,

The crash is not a CPU usage's consequence but CPU usage is crash's consequence. When LFSLapper crash, C# release all memory, release all thread , then it restart and C# allocate all things. This is why the 100 cpu usage.
Normaly, the cpu usage slow down after reload of lapper


Gai-Luron
Gai-Luron
S3 licensed
Release 5.9.0.2 beta available for test purpose.

send me feedback.


+-------------------------------+
|Changes from v5.901 to 5.902 |
+-------------------------------+
1. new command const, you can put it in sub/event or outside sub to define const
Const are preproced when reading config file, not on execution

const MY_CONST 12; # it's global const
const MY_CONST2 1 + 23; # it's global const
Sub mySub()
const LOCAL_CONST 13; # it's local const const only available in sub
const MY_CONST2 2 + 89; # This override the global const only in this sub;

$i = 12 + MY_CONST + LOCAL_CONST + MY_CONST2; # This is replaced by $i = 12 + 12 + 13 + 2 + 89;

EndSub

2. Fix Bug when setting a local var with global var and global var with localvar


FGED GREDG RDFGDR GSFDG