The online racing simulator
Searching in All forums
(63 results)
YamaSuba.NL
S3 licensed
Thanks! This seems to have done the tric!
Have to test this with more racers on track, but the messages show the already present values are preserved now.
YamaSuba.NL
S3 licensed
Having another problem... I have been trying, testing and changing my butt off to get this working, but it doesn't seem to be willing to listen to me..

The following is the case:
I define an array in the OnLapperStart:
GlobalVar $a_user_array;

In the OnRaceStart I initialize this array:
FOR ($l=1;l<=4;$l=$l+1)
$a_user_array[$l, "username")="X";
$a_user_array[$l, "finishedpos")=0;
ENDFOR

(The "X" is chosen to show things)

So far so good. I have been entering some 'cmdLFS("/msg ")'s at various spots (OnLap, OnFinish etc.) to show what's in the array, and I actually see those "X"s and zeroes in those messages.
Even at the start of the OnResult, where I actually start to use the array.

Anyway, here's were the happening of strange things starts. What do I want to do? Well, in the OnResult I'd like to add the player in question to the array. So I lookup the first available spot in the array and put in the user-data. For testing purposes I entered a "Y" in the first spot, so the lookup should be forced to determine the second spot as the first one available. For the outcome of the array-filling this one doesn't really matter, things also go wrong without this action.
Here's the code I'm using:

$x = 0;
$a_user_array[1,"username"] = "Y";
cmdLFS("/msg A " . $a_user_array[1, "username"]);
cmdLFS("/msg A " . $a_user_array[1, "finishedpos"]);
cmdLFS("/msg A " . $a_user_array[2, "username"]);
cmdLFS("/msg A " . $a_user_array[2, "finishedpos"]);
cmdLFS("/msg A " . $a_user_array[3, "username"]);
cmdLFS("/msg A " . $a_user_array[3, "finishedpos"]);
$for_ready = 0;
FOR ($l=1;$l<=4;$l=$l+1)
IF ($for_ready == 0)
THEN
IF ($a_user_array[$l, "username"] == "X")
THEN
cmdLFS("/msg Forloop " . $a_user_array[$l, "username"]);
cmdLFS("/msg Forloop " . $a_user_array[$l, "finishedpos"]);
cmdLFS("/msg Forindex " . $l);
$x = $l;
$for_ready = 1;
ENDIF
ENDIF
ENDFOR
$a_user_array[$x, "username"] = $userName;
$a_user_array[$x, "finishedpos"] = GetCurrentPlayerVar("FinishedPos");
cmdLFS("/msg B " . $a_user_array[1, "username"]);
cmdLFS("/msg B " . $a_user_array[1, "finishedpos"]);
cmdLFS("/msg B " . $a_user_array[2, "username"]);
cmdLFS("/msg B " . $a_user_array[2, "finishedpos"]);
cmdLFS("/msg B " . $a_user_array[3, "username"]);
cmdLFS("/msg B " . $a_user_array[3, "finishedpos"]);

When I execute this code, I get the following results on screen:

A Y
A 0
A X
A 0
A X
A 0
Forloop X
Forloop 0
Forindex 2

Nothing wrong there yet, but then the mayhem starts:


B
B
B yamasuba.nl
B 1
B
B

To cut things short, the adding to the array of the player at hand seems to have caused the rest of the array being blanked out. And that I don't understand... Might I have come across some mystical bug, or am I doing something terribly wrong myself??
YamaSuba.NL
S3 licensed
Quote from YamaSuba.NL :Already done, as I see.. Super, many thanks!

Working like a charm now!

@Kravy: also implemented your method of race completion determination. Have yet to test all possibilities, but for now also working AOK.
YamaSuba.NL
S3 licensed
Quote from nesrulz :Can not set to display results from both DEMO servers in one tables...

Forget this one, just have both servers point to the same database-path..
YamaSuba.NL
S3 licensed
Quote from Krayy :Here's a starting point for you.

Thanks, will definitely have a look at it!
YamaSuba.NL
S3 licensed
Quote from Gai-Luron :Yes and that's a bug, sorted soon

Already done, as I see.. Super, many thanks!
Last edited by YamaSuba.NL, . Reason : typo
YamaSuba.NL
S3 licensed
Quote from Gai-Luron :If you have player username, lapPB, you can use setUserStoredValue with this value in a delayed command.

Been there, done that.. ;-)
I've tried this before and that would be my preferred call, but Lapper tells me the setUserStoredValue can't be used in a lapper-event..
YamaSuba.NL
S3 licensed
Quote from Krayy :Using a delayed event would never work as a player might just stop halfway around or crash etc and never finish.

That's not a problem.. This delayed command is only launched by the first player that crosses the finishline, or rather: that is getting a result. The fastest lap is saved per lap, so that's still available at the moment the delay expires.

Quote from Krayy :You either need to choose an arbitrary point

The delay started at the moment the first result comes in, provides for that. A restart wouldn't be a good point, I think, because there might not be one. If everyone logs off after finishing the race, for instance..

Quote from Krayy :use a counter.

Loads of work.. Also disconnects, spectates, pit etc. should be taken in account then.

Quote from Krayy :PS: I use the SetStoredValue instead of setUserToredValue, as this will exists even when a user has disconnected

Me too, but that one has the drawback that no easy !top-like list can be derived of that. And that's exactly the reason for my question..
YamaSuba.NL
S3 licensed
Quote from Krayy :Now the stored var RacePB will contain the PB and username, seperated with a semi-colon. Now you can query that to display the fastest time when doing a race restart or other event.

That definitely would work for determining the fastest racelap and the player that drove it, but it's not quite what I need..
This determination should be followed by adding a point to this player's score, which is stored in the database. And that won't be possible in a following lapperevent like the next racestart, when using the SetUserStoredValue.
For that to work one should know who's the last finisher in order to make the fastest-racelap final, and that's a bit hard to determine.
That's the reason I chose to use a delayed command..
YamaSuba.NL
S3 licensed
Quote from Gai-Luron :I don't understand why you can't use userStoredValue. Can you explain me more and why private delayed command. Maybe there is an another solution to your problem if you explain it accurately.

It's just like I already said, I actually have used the userStoredValue and experienced a problem with that.
It's like this: in order to award a point to the racer that did the fastest racelap, I saved the laptime and username everytime someone completed a lap and was faster than the previously saved laptime.
Because I couldn't determine the player that drove the fastest racelap when the first one finished (after that one there still could finish a player with a new fastest lap), I had to use a delayed command with a delay of about a laplength.

I used a PrivDelayedCommand for that purpose, storing the points-info in the fi_user_value, this PrivDelayedCommand was launched at the OnResult for the first finished player (finishedpos = 1).
The problem that occured was that when this first finished player was in the pitbox at the time the delayed command was due to be executed, nothing happened, i.e. this command wasn't executed. Did this player get out of the pitbox before the expiry of the delaytime, everything resumed as planned. But not when being IN the box...

After that I also tried to use a DelayedCommand in stead of a PrivDelayedCommand, using SetUserStoredValue with the usage of the userName-option, but that didn't work because that was only usable in a playerevent, whilest the DelayedCommand issued a lapperevent.
And that forced me to store the data in the fi_stored table..

This however could create a possible solution I guess, when this command would also be usable in a lapperevent.Since you have to provide the userName, it would be perfectly suited to be used in a non-playerevent..
If that could be made possible (or if this pitbox-issue could be easily resolved/avoided, of course) that would make me very happy.
YamaSuba.NL
S3 licensed
Since it's gone quiet on this subject all of a sudden: Is there any chance it will be possible to create an ArrayList (ordered by value) from the fi_stored table in the near future?
YamaSuba.NL
S3 licensed
Quote from YamaSuba.NL :
I could change it to using the SetUserStoredValue by means of a PrivDelayedCommand, but that makes the fastest-lap determination player-dependent. Or am I missing something?

Besides (forgot to mention that): that triggered me to change it to a lapperevent using DelayedCommand, because the playerevent didn't work correctly when someone wasn't on the track anymore.
YamaSuba.NL
S3 licensed
Quote from Gai-Luron :All what you need is here, function exist since 5.837

Regrettably not.. The data I need to show is not in the UserStoredValue table, so I can't use the default top-list.
I had to store the data in de other table (with SetStoredValue) because it's produced in a lapper event (oh well, in fact it's a DelayedCommand, but that behaves like a lapper event.. ).
I could change it to using the SetUserStoredValue by means of a PrivDelayedCommand, but that makes the fastest-lap determination player-dependent. Or am I missing something?
YamaSuba.NL
S3 licensed
Quote from Gai-Luron :What do you want to read? put an example. Anyway you can use GetListOfPlayer, then read value.
Can you explain more?

Isn't the GetListOfPlayers for the racers that are online at that moment?
What I want is get the stored users/points that are in the storedvalue database in order to make a top-list out of it. So a list of all users present in the database with the points they scored up to this moment.
In this case from the StoredValue table in stead of the UserStoredValue.
YamaSuba.NL
S3 licensed
Quote from YamaSuba.NL :The way you used it in the example is new to me, but very usable.. For the time being I will be using this one

Working like a charm now..

One thing though (here I am again.. ).. I'm launching a DelayedCommand from the OnResult now to make the delayed command as player-independent as possible. That also implied I couldn't use the UserStoredValues anymore in this delayed sub, since it isn't a playerevent anymore. No problem in itself, the StoredValue works just as well for storing the data.
One can't however show "!top"-like lists from that schema, but when building such a list myself, I would need to be able to read all StoredValue-data. Is there any means to do this (sequential reading) at this moment?
YamaSuba.NL
S3 licensed
Can't do anything in the Control Panel also. 4 Of the 5 servers (UK-based) are down for some time now, so I guess they ran into some trouble during the planned maintenance.
YamaSuba.NL
S3 licensed
Quote from Gai-Luron :it's not l$ but $l, var are prefixed. Work fine on 5.9.2.0 now

I knew it had to be something stupid..


Quote from Gai-Luron :EDIT: Why don't you use a multidimensional array mixing indexed et associative index? Code is more clear and clean

Didn't want to use two indexes, that wouldn't be very self-explanatory. The way you used it in the example is new to me, but very usable.. For the time being I will be using this one, until:

Quote from Gai-Luron :And Why don't you use playerVar instead array?, no need to have global array

I had the complete procedure changed using $CurrPly but ran into major problems after which I changed back to this method. I will be trying this method again, but first wanted to get things running OK.

Thanks again for the help and hints!
YamaSuba.NL
S3 licensed
Sometimes Lapper drives me crazy.. ;-)

In an include-file I have in a
CatchEvent OnLapperStart:

GlobalVar $a_username_array;
GlobalVar $a_nickname_array;
GlobalVar $a_finishedpos_array;
GlobalVar $a_points_total_array;
GlobalVar $a_license_array;
GlobalVar $a_race_points_array;

And in a
CatchEvent OnRaceStart:

cmdLFS("/msg Hier ben ik er nog 1");
FOR (l$=1;l$<=32;l$=l$+1)
cmdLFS("/msg Hier ben ik er nog 2");
$a_username_array[l$] = "";
$a_nickname_array[l$] = "";
$a_finishedpos_array[l$] = 0;
$a_points_total_array[l$] = 0;
$a_license_array[l$] = "";
$a_race_points_array[l$] = 0;
ENDFOR
cmdLFS("/msg Hier ben ik er nog 3");

Then Lapper aborts, showing only the first "debug"-message:

Object reference not set to an instance of an object.
LFSLapper
at GLScript.SetOfVars.globalExist(String id) in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\GLScript\SetOfVars.cs:line 49
at GLScript.Parseur.assignValueToVar(unionVal val, unionVal retValue, SetOfVars GVAR, SetOfVars LVAR, executeParsedFunction BC) in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\GLScript\ParseExpr.cs:line 898
at GLScript.Parseur.getval(SetOfVars GVAR, SetOfVars LVAR, executeParsedFunction BC) in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\GLScript\ParseExpr.cs:line 627
at GLScript.GLApp.retrieveEvalVar(String funcName, TokenParse tkparse, TokenBuffer currTokenBuffer, SetOfVars GVAR, SetOfVars LVAR, Boolean breakFunc, Char& breakCar) in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\GLScript\GLScript.cs:line 1034
at GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end) in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\GLScript\GLScript.cs:line 254
at GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end) in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\GLScript\GLScript.cs:line 660
at GLScript.GLApp.privExecuteFunction(String funcName, String[] argsVals) in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\GLScript\GLScript.cs:line 173
at GLScript.GLApp.executeFunction(String funcName, String[] argsVals) in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\GLScript\GLScript.cs:line 144
at Configurator.lexConfigurator.executeFunction(String funcName, infoPlayer pcurrInfoPlayer, String[] par) in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\cfgParser\readCfg.cs:line 346
at LFSLapper.LFSClient.managePacket(RST rst) in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\LFSClient\managePacket.cs:line 602
at LFSLapper.LFSClient.Loop(Connect insimConnection) in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\LFSClient\loop.cs:line 1032
at LFSLapper.LFSClient.doloop() in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\LFSClient\lfsclient.cs:line 551
at LFSLapper.LFSListen.Listen.goWorkMode() in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\LFSListen\Listen.cs:line 88
at LFSLapper.LFSListen.Listen.startStbMode() in D:\Dev\DevInsim\lapper\LFSLapper\LFSLapper\src\LFSListen\Listen.cs:line 288
Boolean globalExist(System.String)
Closing Instance...

Dunno what's going wrong. What I do seems pretty straight-forward and still it breaks up.. Any ideas??
YamaSuba.NL
S3 licensed
Quote from Gai-Luron :What is his userName, delayed command is bugged in previous version, take the last version, put your code here

The guy in question is the notorious "Mad Dog"..
For the newest version I'll have to consult Dean, to have it installed at 500servers. I understand there's a lot of changed stuff in there, so I'll have to get some work done there.. I'll be feedbacking after all that is done..
YamaSuba.NL
S3 licensed
At this moment it's a one-player problem. I'm using a delayed Sub (PrivDelayed) from within the OnResult-event.
YamaSuba.NL
S3 licensed
I managed to solve the problem above by using the OnLap-event, but that doesn't explain why the OnSpbLast-event doesn't work for this user..

Came across another puzzle in this OnResult-delay.. Yesterday it happened twice that the commands in the delayed-Sub weren't executed when the player in question pitted before the delayed commands were executed and came out of the pit after the delay had expired. If he came back on track before expiry everything worked OK..
Could it be this delay doesn't work while in the pitbox?
YamaSuba.NL
S3 licensed
Quote from YamaSuba.NL :After somewhat of a struggle with variables I moved from the OnResult-event to the delayed Sub, I managed to get this working. Thanks for the hint!

Still having one little problem with this solution, but that's a very strange one..
I'm saving the fast lap in the OnSpbLast-event. Normally that works out OK, but there's one player on my server that seems to never enter that event. I've put some debugging /msg's at the start of that event, but these messages never appear when this player crosses the finishline, where they always are displayed when other players complete a lap.. This is kinda stupid, for I can't imagine a reason for this behaviour of Lapper.
Only thing in this player's data is that there's a space in his UserName, but I can't imagine that to be the cause...
YamaSuba.NL
S3 licensed
Quote from Gai-Luron :Use a delayed command to display fastest lap later.

After somewhat of a struggle with variables I moved from the OnResult-event to the delayed Sub, I managed to get this working. Thanks for the hint!
YamaSuba.NL
S3 licensed
Still having some problems with this one..
I managed to get this working, but with some limitation.
Am using the saved fastest lap in the OnResult event, but this works out the wrong way when someone drives a fastest lap after the player which lap was saved has finished. In that case there are two players (or more for that matter.. ) with a best lap result.. Am I missing something or is the OnResult not the best suited event to do this?
YamaSuba.NL
S3 licensed
Hi Tim,

Quote from Tim NL :
I dont want money , but here is a point system for 12 players if you want more its not so hard to expand.

Am trying this one, but am puzzled with something.
Yesterday a player that came in first, was disqualified (DT).
That appeared to be messing up the assigned point to the players that had a normal finish. Any idea what may be causing this, or how I could solve this easily?

<edit> In the meantime I found this might be partly caused by not using the $flagConfirm when determining the ps_race_points. However I think this disqualified player will still be in the Finished Positions. Could that be solved by spectating the guy/gal in the OnFinish event? <endedit>
Last edited by YamaSuba.NL, .
FGED GREDG RDFGDR GSFDG