The online racing simulator
Searching in All forums
(446 results)
Krayy
S2 licensed
Quote from Yisc[NL] :$count = 0

Could it have anything to do with running a server on my local pc?
I've been using that for testing.
I start a full version of LFS and select "Start new host" and then select Internet for visibility.

I just tried the same code and got:

<?php 
>---- Dump of list ----
$list[0] = "krayy"
---- End Dump of list ----

---- 
Dump of count ----
$count 1
---- End Dump of count ----
?>

Can you check your code and make sure that the variable $list has not already been defined. Also check the error log file in your Lapper insatnce directory (like c:\lfslapper\default\logs\*ERR.log) to see if there are any helpful messages there
Krayy
S2 licensed
The rewrite is proving to be a real pain in the a... so what I might end up doing is post a minor update to 6.0.1.2 which incorporates a lot of the changes I had made to make CIF work correctly and then release a rewrite in the future.

That being said, my league has dorpped off quite a bit as we're getting pissed off about the lack of an S3 release which would get us back on the track. hence most of the mods I make I cannot test adequately.

Stay tuned, I should have the minor update up in a week or so
Krayy
S2 licensed
Quote from LFSMasterMan :The defPitInfo.lpr has its own file? should i just delete that ?

Each of the .lpr files in the includes directory are specifically included by a line in the "addonsused.lpr" file. If you delete the defPitInfo.lpr file without removing or commenting out the line in the addonsuder.lpr file, then Lapper will most likely fail on startup
Krayy
S2 licensed
If you are using the default installation, it will be in the defPitInfo.lpr file in the OnSpbSplit* functions. Either remove the file from the addonsused.lpr or just comment out the openProvButton statement in the functions.
Krayy
S2 licensed
Found this that covers most of it: http://weblogs.asp.net/lhunt/attachment/591275.ashx


Extract:

2.1 General Guidelines
  1. Always use Camel Case or Pascal Case names.
  2. Avoid ALL CAPS and all lowercase names. Single lowercase words or letters are acceptable.
  3. Do not create declarations of the same type (namespace, class, method, property, field, or parameter) and
    access modifier (protected, public, private, internal) that vary only by capitalization.
  4. Do not use names that begin with a numeric character.
  5. Do add numeric suffixes to identifier names.
  6. Always choose meaningful and specific names.
  7. Always err on the side of verbosity not terseness.
  8. Variables and Properties should describe an entity not the type or size.
  9. Do not use Hungarian Notation! Example: strName or iCount
  10. Avoid using abbreviations unless the full name is excessive.
  11. Avoid abbreviations longer than 5 characters.
  12. Any Abbreviations must be widely known and accepted.
  13. Use uppercase for two-letter abbreviations, and Pascal Case for longer abbreviations.
  14. Do not use C# reserved words as names.
  15. Avoid naming conflicts with existing .NET Framework namespaces, or types.
  16. Avoid adding redundant or meaningless prefixes and suffixes to identifiers. Example:
    // Bad!
    public enum ColorsEnum {…}
    public class CVehicle {…}
    public struct RectangleStruct {…}
  17. Do not include the parent class name within a property name. Example: Customer.Name NOT Customer.CustomerName
  18. Try to prefix Boolean variables and properties with “Can”, “Is” or “Has”.
  19. Append computational qualifiers to variable names like Average, Count, Sum, Min, and Max where appropriate.
  20. When defining a root namespace, use a Product, Company, or Developer Name as the root. Example: LanceHunt.StringUtilities
[Dev Discussion] Updating and cleaning up Lapper
Krayy
S2 licensed
Well I'm going to drag myself away from BF3 (until Back to Karkand gets released anyway) to start hacking into the code in order to add all of the updated InSim packet support and other features.

To that end, I reckon it's about time we discussed things like coding standards and feature sets. These discussions will directly affect the existing code base in that it would be good to clean it up considerably, as some of it is quite hacky and confusing with a lot of vars called the same.

Firstly, I'd like to suggest that we use a naming convention like the PRISM project does in the thread http://www.lfsforum.net/showthread.php?t=70147. Their convention is to:
  1. Use tabs for white space, and the tab width should be equal to 4 spaces.
  2. All objects, classes and references use Camel cased naming and:
    1. Variables, instances and Functions start with a Lowercase character e.g. $thisVar, $newClassInstance or thisFunc()
    2. Classes start with an Upper case char e.g. ThisClass
  3. Constants or Enums use upper case e.g THISENUM
  4. We ask that you make the function names as clear and as concise as possible, not matter how wordy e.g. $leftRearTyrePressure or ConvertIntToString()
  5. Source code formattingcan be at the coders discretion with the exception of tab spacing, however keep in mind that splitting over lines may help readability.
Those guidelines actually affect about 60% of the codebase in that a lot of variable and function names are not quite concise enough or the incorrect case. Fixing the big ones isn't a major problem and can be done in a few hours, although this brings us to the next point...

Code repository...Gai has already set up a Sourceforge page along with the requisite SVN repo although only he has access to do updates. Any changes would need to be forwarded as diff files to him for upload. I'll email him asking for other possible update methods. I'll ask him to set up a Beta branch if he's willing to so that 6.0.1.2 would remain as the base until a new version is ready.

The other issue is getting quality coders on board, so we may have to limit access to those who are able to show familiarity with the codebase, C# in general and an ability to actually add value to the project. Maybe we'll run something like C# Survivor where you can get voted off

Feature sets...Once the code has been cleaned up, there is a lot of stuff in the 'todo' list to look at adding or updating so we'd most likely need some sort of issues register. I have no experience in using any of these, so if someone has a suggestion, please do.

Thoughts?
Krayy
S2 licensed
Quote from CodeLyoko1 :great LFSLapper Development

It's more to the point that it's occupied me FROM doing Lapper development...we will return to our scheduled program soon (I hope)
Krayy
S2 licensed
Quote from Dygear :I know the feeling man.

Whats your handle and we can meet up to shoot each other and say hello !!!
Last edited by Krayy, .
BF3 is ruining my gaming life!!
Krayy
S2 licensed
So much for doing all the code updates I had planned...I just can't not boot my gaming rig without trying to kill some poor schmuck.

I'll need to do an intense weekend of shooting people so I can get it out of my system and resume with the Lapper updates.

Anyone else addicted to something?

P.S. I'm also addicted to Pepsi Max, which is probably not doing me any favours.
Krayy
S2 licensed
Quote from LFSCruise :No no no I need it to be width.
Sliding bar after 0:50 nnes length of 50 Health.

If thats the case you will need to use the health as a divisor of whatever the max health is to make a percentage.

i.e. If the max length the health bar can be is 50 units, then the calculation would be:


<?php 
$HealthbarLength 
50 * (GetCurrentPlayerVar"Health" ) / $MaxHealth
?>

Krayy
S2 licensed
Quote from LFSCruise :

<?php 
$Health 
strFormat("{0:0}",GetCurrentPlayerVar"Health" ) );
PrivMsg("".$Health."");
?>

Do you know why not work?


<?php 
openPrivButton
"Health",51,6,$Health,3,3,-1,16,"");
Or
openPrivButton"Health",51,6,strFormat("{0:0}",GetCurrentPlayerVar"Health" ) ),3,3,-1,16,"");
?>


Because you have the parameters out of order. The 4th field is the button width. make it 10 or something like:



<?php 
openPrivButton
"Health",51,6,10,3,3,-1,16,$Health);
Or
openPrivButton"Health",51,6,10,3,3,-1,16,strFormat("{0:0}",GetCurrentPlayerVar"Health" ) ));
?>

Krayy
S2 licensed
Quote from Bass-Driver :
$Node has the value : Array , and the not 1 single value from that Array
For test i have set a bunch of nodes:
$SplitNodes Values: ,479,482,483,484,485,487,489,490,491,492
it should be shown as:

479
482
483
etc...........

and it gives a error:

11/11/2011 6:32:18 PM -> Syntax error in cfg file "./includes/[TI]SpeedTrap.lpr" at line #62
'RegisterNodeAction' parameter #1(Array) is wrong type at line #
Function 'splitnodeload' script aborted

Problem is the FOREACH (told you it was buggy).

It should be:

<?php 
     
FOREACH ($Node IN $Nodes)
            
RegisterNodeActiongetLapperVar"ShortTrackName" ), $Node["value"], DisplaySpeed"");
  
globalMsg($Node); 
    ENDFOREACH
?>

...I think ;-) The FOREACH puts each entry into an array, so you need to deference using ["value"].

You can also use the dumpvar function to see what the contents of an array are
Last edited by Krayy, .
Krayy
S2 licensed
That's a safeguard against adding a node that already exists. Essentially if you park you car in a sport and then type !setnode (or whatever u call it) the code looks in the list of existing nodes (comma separated). If it finds it's already there, then it skips it.

Of course, you would need to put code in to be able to delet nodes so that if you reposition one, then you can remove or update it, so yes, there is a lot more to do to make it a workable system. But since it's something that I'd probably use, I might throw some time into getting a workable system up with a GUI interface etc to enable node modification or deletion.
Krayy
S2 licensed
Quote from Bass-Driver :k thx it works

i'm trying to set the speedtrap manually ingame.
i have this so far , after alot of debugging.
i have no errors ( YAAY ) but it doesnt work.

it shows the value when i set the speedtrap.


The first problem is that you are using one variable name for all of the nodes, so if you go to use SetStoredValue, the next time you run the command it will overwrite the value. Better to use a variable name that's based on the track short name and then store the nodes as a comma delimited list. Then you can use split to turn them into an array and use a FOREACH to go through all of them.


<?php 
Sub DisplaySpeed
$userName )
    
PrivMsglangEngine"%{main_speedtrap}%" ToPlayerUnit(  GetCurrentPlayerVar"InstantSpeed" ) ),GetCurrentPlayerVar("UnitSpeed")  ) );
EndSub

CatchEvent OnLapperStart
()
   
Globalvar $SplitNodes;
EndCatchEvent

CatchEvent OnNewPlayerJoin 
$username# Lapper event
    
SplitNodeLoad();
EndCatchEvent

Sub SplitNodeLoad 
()
    
$SplitNodes GetStoredValuegetLapperVar"ShortTrackName" ) . "SplitNodes");
    
$Nodes SplitTOArray$SplitNodes "," );
    FOREACH 
$Node in $Nodes
        RegisterNodeAction
getLapperVar"ShortTrackName" ), $NodeDisplaySpeed""); 
    ENDFOREACH
EndSub

Sub SplitNodeSet 
$NewNode)
    IF ( 
indexOf$SplitNodes$NewNode) < THEN
        $SplitNodes 
$SplitNodes "," $NewNode;
        
RegisterNodeActiongetLapperVar"ShortTrackName" ), $NewNodeDisplaySpeed""); 
        
privMsg"Set Speedtrap " $NewNode);
        
SetStoredValuegetLapperVar"ShortTrackName" ) . "SplitNodes"$SplitNodes);
    ENDIF
EndSub

CASE "!setspeedtrap":
CASE 
"!ssp1":
    
SplitNodeSet (GetCurrentPlayerVar"CurrNode" ));
BREAK;
?>

This code is by no means complete so should require a bit of testing, but essentially the main stuff is in there. I just use OnPlayerJoin as it will load all nodes each time a player leaves pits.
Krayy
S2 licensed
Just genrate random numbers from 1 to 26 and use them to map to a letter i.e. 1 = A, 2= B etc
Krayy
S2 licensed
Probably the easiest way to do this in the current code base would be to replace the UCID variable (currently an integer) in the InfoiPlayer oject with an object of class InfoConnection.

I have most of the code written now, but it does touch about 70% of the other source files as they need to be changed dependng on if they reference a UCID or PLID variable.

Gai, I have a lot of changed code in my Lapper version, so how can we handle merging the code bases if mine is quite a bit moved from 6.0.1.2?

By that I mean I have done a bit of cleanup as well as additions like the new packet types, a new handler for REOrder packets, and I started on reworking how Lapper does its configuration to simplify deployments (lots of config info in the database, not in .ini files)
[Dev Discussion] UCID and PLID handling
Krayy
S2 licensed
Currently the InfoPlayer object in Lapper that stores information about a Player is a monolithic object and includes data for bothe the connection and the player on the racetrack. This is why when you have AIs on the track tat you get spammed with race messages as these messages are using a PLID that maps to the InfoPlayer object with the AI owners UCID instead of an individual PLID based object.

This is also proving to be a bit of an issue when trying to implement some of the new InSim functions and also when doing a car takeover.

What I would propose is to create a new InfoConnection object that contains UCID specific information and then when the player joins a race, it instances a new InfoPlayer object that is then associated with the InfoConnection object. This would only really entail splitting the current InfoPlayer object into 2 to split off the Connection specific vars and then adding handlers to do things like create InfoPlayer objects when player joins a race, receive PLID based InSim packets and other bits.

Does anyone have any arguments or opinions on doing or not doing this? My opinion is that it would make Lapper a lot more versatile, particularly if we could use AIs as race participants and treat them as unique Players with no interference with the spawners connection.
Krayy
S2 licensed
SQLite is a DLL and doesn't have a listener, so it wouldn't be able to be linked directly to a MySQL db. Essentially they would both be standalone.

As we could support both at the same time, this would mean that if there are apps that use the .elp files, they would remain the same. The MySQL db gives us the opportunity to have a web based front end that is referencing real time race and user data, sort of like what CTRA did.

The schema and engine would need to be worked through to see what features and data we want to cappture and support.

I for one want to not only store race data, but also capture a number of races and a qualifying session as an Event, so I would want to add tables to support that.

I have a coilleague who was keen on writing a front end to display the race data and I know that there are a few other things out there like LFSStats and Gai had a web frontend that I managed to get going locally a while back, so we can pull together a lot of samples to start with.

Which begs the question, what sort of stuff would you want to see in web based stats displays?
[Dev Discussion] Databases
Krayy
S2 licensed
I thought it would be a good idea to create a series of threads that can be used for LFSLapper Development Discussions where aspiring or contributing developers can raise issues or suggest potential improvements or additions and get feedback from other devs to help move the process along.

Please note that most of these discussions will be targetted at Developers who are familiar with the Lapper source code and have a working knowledge of its internals and C#. These threads are not the place to ask how to run Lapper or download it etc.

You can however, contribute if you feel that your post has relevance to the topic at hand and can be deemed of use, i.e. a suggestion on how to improve a feature that we are discussion or how it can be integrated into scripts that you are writing.

I thought I'd start with the subject of Databases...

SQLite is a great tool for local storage. Lapper can export .eps files to make data imports a little easier, although for real time web based stats displays it does have its limitations.

To that end, I have been looking at integrating suport for MySQL as an optional addon for Lappper. Essentially there would be branching code to support a number of different database options. This would make it possible to keep using the local SQLite database, while at the same time connecting to an external MySQL database and storing data there as well.

So you could write to a local SQLIte db, a remote MySQL one or both at the same time.

It's quite a bit of work, so I need to ask if this would be a feature that people would actually use? If so, then I'll work out a schema and what kind of data would be stored.
Krayy
S2 licensed
If we add a User table to the Lapper database to record Users login information, what info would be of use? This stuff can be shown on Player Info screens and updated to allow for quick stats generation.

So far I have:

LFS UserName
PlayerName (Can change due to Options->Rename)
Member Type (Guest, Returning, Affilliate, Member, Admin)
Last Login time
Last Full Race time
email (optional - for member or admin only use)
Races completed
Races won
Podium finishes
DNFs
Racer rank (based on point wins to rate racer status)
Allowed Cars (not only for cruise but also other series stuff)
Krayy
S2 licensed
Quote from Bass-Driver :...

<?php 
CASE "!t1":
privMsg"IdleWarning: " $OnIdleTimeout1);
privMsg"TotalIdleTime: " $OnIdleTimeout2);
BREAK;
?>

But it already gives the warning after 20 sec.
Did i missed something??

I missed something actually...

You need to use the SetConfigVar command to set an internal variable and GetConfigVar to read it like this:


<?php 
CASE "!t1":
privMsg"IdleWarning: " GetConfigVar ("OnIdleTimeout1");
 
privMsg"TotalIdleTime: " GetConfigVar("OnIdleTimeout2");
 
SetConfigVar("OnIdleTimeout1"500);
SetConfigVar("OnIdleTimeout2"600);

privMsg"IdleWarning: " GetConfigVar ("OnIdleTimeout1");
privMsg"TotalIdleTime: " GetConfigVar("OnIdleTimeout2");
BREAK;
?>

Give that a try. (you may need to quote the values for the SetConfigvar command)
Krayy
S2 licensed
Yes, I had omitted the seconds as I writing it freehand as pseudo-code
Krayy
S2 licensed
Quote from Bass-Driver :hi its me (AGAIN )

i was working with the foreach statement , but it only works with one IDbutton:
my idea was:

to make 1 IDbutton with the nickname and the other IDbutton to check if you are on the track or not.

the last one works but the IDbutton with the nicknames doesnt work.

question: how to make 2 differend ID buttons with the foreach statement

You're creating 2 buttons with the same name, so they won't be able to display at the same time. Add a description before or after the username to differentiate them like this:


<?php 
$RL_HT1 
100;
$Racers getListOfPlayers("N");
FOREACH( 
$maVar IN $Racers )
    
openGlobalButton("name_" $maVar["value"],1,$RL_HT1,17,4,5,-1,32,GetPlayerVar($maVar["value"],"NickName"));
    IF (
GetPlayerVar($maVar["value"], "OnTrack"))
    
THEN
        openGlobalButton
("ontrack_" $maVar["value"],18,$RL_HT1,3,4,1,-1,32,"^2#");
    ELSE
        
openGlobalButton("ontrack_" $maVar["value"],18,$RL_HT1,3,4,1,-1,32,"^1#");
    ENDIF
$RL_HT1=$RL_HT1+4;
ENDFOREACH
?>

Krayy
S2 licensed
I've been in touch with the admins of 500servers about how they use Lapper and it will remain a console app. I've been looking at using the TCP stack for remote control, so this addon looks like a fantastic starting point.

Thanks for that one...

BTW, I've checked the compatability of the additional resource dlls that I'm looking at using and the are fully compatible with Mono, so Linux will still be a target platform.
Krayy
S2 licensed
The command is removeprivdelayedcommand used like this:


<?php 
PrivDelayedCommand
("delcom1"DoThisFunction() );
...
...
RemovePrivDelayedCommand("delcom1");
?>

FGED GREDG RDFGDR GSFDG