The online racing simulator
Searching in All forums
(446 results)
Krayy
S2 licensed
Quote from Andy King :Hi Krayy,
Sorry about this but its still giving me player_1_remove and not username. The button code is....
openPrivButton ("player_".$i."_remove",$topleft_x+31,$topleft_y+1,4,5,5,-1,16,"^3X",Remove_Registered);

I want the SUB to....
RemoveUserFromGroup( "Events_Reg" , $uName);
UserGroupToFile( "Events_Reg", "./Text_Files/Events_Reg.txt" );

Would it be possible for you to write this as I have battled for 2 days and its silly lol, cannot get my head around it.

You'll need to post the whole Sub that creates the GUI buttons so I can see the context
Krayy
S2 licensed
Quote from Andy King :Hi Kray,
I still can't get this to work $uName is giving me player_9_remove not a UserName.

Thanks in Advance

Substitute the split line with:

$uName = $user_array[ToNum(split( $id,"_",1 )),1];

(unless it's using the RacerArray in which case:
$uName = $RacerArray[ToNum(split( $id,"_",1 )),$raUserName];
)
Krayy
S2 licensed
You could even use this system to set the initial Lapper vars instead of editing them in the LFSLapper.lpr file, so that the lapper file isn't touched as much. Eg:

Lapper.ini

<?php 
[LapperGlobals]
$GripDatabase "./GripPB";
$adminEmail "";
$smtpServer "";
$loginMail "";
$passMail "";
$VoteRestart = -1;
$DefaultTopCar "XFG+XRG";
...
?>

Other uses: swear words, Track names & codes, etc
Krayy
S2 licensed
Quote from Andy King :Hi Guys.
How can I make this button carry forward the UserName to a SUB called Remove_Registered which will delete the UserName from a UserGroup

openPrivButton ("player_".$i."_username",$topleft_x+6,$topleft_y+1,25,5,5,-1,80,$currUserName,"UserName");

Thanks in advance

That looks like part of the code from my !who function. Basically what I did in that the $i in the button name ( "player_".$i."_username") is the username that I parse in the called function (btw your code sample isn't correct, it should be as below):


<?php 
...
openPrivButton ("player_".$i."_remove",$topleft_x+6,$topleft_y+1,25,5,5,-1,80,"Remove",Remove_Registered);
...

Sub Remove_Registered$KeyFlags,$id )
    IF (
$id != "")
    
THEN
        
# use the Split command to extract the uname from the $id which should be "player_<username>_remove"
        
$uName split$id,"_",);
        
# Do something with the extracted username
    
ENDIF
EndSub

?>


Good luck
Krayy
S2 licensed
Quote from Fire_optikz001 :u heard of sarcasm?

Apparently not in Holland...Ishint dat veeerdt? I love Goooooooolllllld!!!!


P.S You want a schmoke and a pancake? How bout a shigar and a waffle?
Krayy
S2 licensed
Quote from Fire_optikz001 :hmm i like that but only one problem... no way to add to file ingame

Easy as...just write a IniFileWrite function that will dumpo the nominated hashtable in an .ini section format.
Krayy
S2 licensed
As an addendum to this topic, how about writing a generic .ini load function that we could use to load ini files into queryable arrays. Not only for race config but also for things like UserGroups e.g.

UserGroups.ini

<?php 
[admin]
krayy
gai
-luron
fred
barney

[superusers]
krayy
gai
-luron
wilma

[banned]
barney
?>


Add a new Class (IniFile) thats a Hastable of Hashtables, initialise an instance as LFSLapper.IniFile, then initialise it like:
IniFileRead("UserGroups", "./UserGroups.ini");

and access it by reading all entries as an array:

$array = GetIniFiledata ("UserGroups", "admin", GetCurrentPlayerVar("UserName"));

This would not only be for usergroups but also track data, race config etc.
Krayy
S2 licensed
Might I make a suggestion that 5.853 be renamed as 5.901 and divorced from the 5.8* line, as it (to my mind anyway) represents a HUGE change in the scripting language that will require rewrites of pretty much every Lapper file out there. It might be better to leave those be and start the new fork so people dont get confused (or p**ded off)
Krayy
S2 licensed
Quote from Fire_optikz001 :wow that's cruel a 3 day ban for just because they haven't drove 40 laps

Hell it takes me 2 days to do 20 laps in an RAC, so why not?
Krayy
S2 licensed
sort of like this....

GLScript.cs:

<?php 
                
case "splittoarray":
                    if (
nbArgs != 2)
                        throw new 
GLScriptException("Incorrect args number in function " val.nameFunction);
                    
val.typVal GLScript.typVal.setOfVar;
                    
val.setVars = new GLScript.SetOfVars();
                    
string tmpSc = (string)args[1];
                    
char splitChar tmpSc[0];
                    
string[] splited = (args[0] as string).Split(splitChar);
                    for (
int i 0splited.Lengthi++)
                    {
                        
val.setVars.Set(i.ToString(), new unionVal(0"\"" splited[i] + "\""typVal.str));
                    }
                    return;
?>

LFSLapper.lpr:

<?php 
        
CASE "!ta":
                    
$Racers "gul,4aged,krayy,kumarakid,steala";
                    
$RacerList SplitToArray($Racers",");
                    
dumpvar($RacerList);
                    FOREACH ( 
$ra IN $RacerList )
                        
# Do something with the entire list of vars like check membership etc
                        
privMsg $ra["value"] );
                    ENDFOREACH
                    BREAK;
?>

Last edited by Krayy, .
Krayy
S2 licensed
Quote from Gai-Luron :Hello,

Can you give me an example, i don't understand what you say

Currently if I have a list with a know separator, you need to iterate through a number of splits to process all items in that list. i.e:


<?php 
$racers 
4aged,krayy,kumarakid,steala;
    
$IsNotBlank 1;
    
$GroupIndex 0;
    WHILE (
$IsNotBlank == 1)
        
$racer=split$racers,",",$GroupIndex );
        IF ( 
$racer!= ""THEN
            privMsg 
($racer);
            
$GroupIndex $GroupIndex 1;
        ELSE
            
$IsNotBlank 0;
        ENDIF
    ENDWHILE
?>

if we were able to conver that string to an array like the .NET split function does, then we can use the FOREACH loop:


<?php 
$racers 
4aged,krayy,kumarakid,steala;
    FOREACH( 
$racer IN split$racers,","))
            
privMsg ($racer);
    ENDFOREACH
?>

Krayy
S2 licensed
Now that GLScript can pass arrays back to your lapper scripts, is there any chance of modifying the GL function "split" to return a multi value array that's split on the splitChar instead of a single string?
Krayy
S2 licensed
Quote from Gai-Luron :Hello,

i think there is a misunderstanding on how work http request. When you send a request to a web server LFSLapper attemps to receive a GLScript code and execute it.

Example
if i use you web call: you send a request to know if player is allowed, http("http://www.demourl.nl/lfs_plugin.php?u=". GetCurrentPlayerVar("UserName") );
and GetCurrentPlayerVar("UserName") -> "gai-luron"
...

Ahhhh...I wondered why it was creating the WebReturnFunction function dynamically. Very clever and flexible to boot.

Let me know if my "suggestions" start get annoying
Krayy
S2 licensed
I've sent a patch to Gai-Luron which should make http handling a lot more useful. Hopefully he will include it in the next update.
Krayy
S2 licensed
Quote from Gai-Luron : in my opinion XML it's not very easy to read or write by human.

Hell I have trouble reading and writing my address

I'm fine either way. An INI parser is easy to write (I've done many of them in PERL), and yes, being human editable is probably a bonus.
Krayy
S2 licensed
Or better still, do it as XML that allows .NET to read natively and also allows us to integrate it with our websites easier:



<?php 
<LFSLapperRaceConfig>

<
PointsSystems>
    <
points>
        <
name>poinType1</name>
        <
Pos1>20</Pos1>
        <
Pos2>20</Pos2>
        <
Pos3>20</Pos3>
        <
RelativeToPlayer>true</RelativeToPlayer>
        <
FastestLap>1</FastestLap>
        <
PolePosition>1</PolePosition>
        <
MostImprovedGrid>2</MostImprovedGrid>
    </
points>
</
PointsSystems>

<
RaceSeries>
    <
name>champ1</name>
    <
title>First championship</title>
    <
points>poinType1</points>
    <
HandicapDefault>20:0</HandicapDefault>
    <
SaveReplays>yes</SaveReplays>
    <
MailResults>krayy0@gmail.com</MailResults>
    <
race>
        <
sequence>1</sequence>
        <
date>dd/mm/yyyy</date>
        <
Time>hh:mm</Time>
        <
Car>XFG+XRG</car>
        <
Track>SO6</Track>
        <
qualifyTime>0</qualifyTime>
        <
Laps>10</Laps>
        <
HandicapUsers>krayy:20:0,4aged:30:0</HandicapUsers>
        <
Allowresets>yes</Allowresets>
    </
race>
    <
race>
        <
sequence>2</sequence>
        <
date>dd/mm/yyyy</date>
        <
Time>hh:mm</Time>
        <
Car>RB4</car>
        <
Track>SO1</Track>
        <
qualifyTime>0</qualifyTime>
        <
Laps>10</Laps>
        <
HandicapUsers>krayy:30:0,4aged:25:0</HandicapUsers>
        <
Allowresets>yes</Allowresets>
    </
race>
</
RaceSeries>
</
LFSLapperRaceConfig>

?>

Krayy
S2 licensed
Hi GL,

That's pretty close to what we were looking at. Your config file does break some parsing rules for .ini files, so heres a slightly modified version that makes the following changes:
1. The race series has a name
2. The races in that sequence are linked via the "series =" line with their sequence in the series indicated by the "sequence =" line. This way the races are tied to a series
3. Some extra points given for things like fatsest lap, top qualifier, most improved grid position
4. Add in default handicaps (mass:irest) and player specific handicaps (we modify these based on results, so might need to allow for adding handicaps in points system)

Lastly we should make sure that the system is flexible enough to allow for extra settings like driving aids allowed, registered drivers only etc.


<?php 
[points]
name "poinType1"
20
18
16
...
RelativeToPlayer true;
FastestLap 1
PolePosition 
1
MostImprovedGrid 
2

[series]
name="champ1"
title "First championship";
points "poinType1";
HandicapDefault "20:0";
 
SaveReplays yes
MailResults 
krayy0@gmail.com

[race]
series="champ1"
sequence=1
date 
dd/mm/yyyy;
Time hh:mm;
Car XFG+XRG;
Track SO6;
qualifyTime 0// in minute
// qualify = no; <- specifying qualify time overrides
Laps 10
HandicapUsers 
"@krayy:20:0,4aged:30:0";
Allowresets yes

[race]
series="champ1"
sequence=2
date 
dd/mm/yyyy;
Time hh:mm;
qualifyTime 30// in minute
Car RB4;
Track SO1;
points "poinType2"// override championship point
Laps 20
HandicapUsers 
"@krayy:40:0,4aged:20:0";
Allowresets no
?>


Krayy
S2 licensed
Do you mean ranking as in what team drivers are highest ranked in server/wr times and/or in seniority within the team?

Or are you talking about a race points system?

Because I actually see both of those as linked. We have had some discussions within my regular race team as to how we should handle a points system, and have sort of decided that certain types of races require different points systems from others.

That being said, what I was looking at doing was to customise Lapper to enable us to parse a file with multiple points configurations (sort of like a simple .ini file format), and then enable a GUI in GLScript to select which points system will be used for that race, or race series. This ties in with a Race Manager GUI that I'm working on which will enable us to tie Lapper in to our website so that we can create a rcae series there, send it to Lapper, and then use a GL GUI to fine tune it. We'll look at having race points, as well as points for most improved during series (to encourage different driver skill levels), fastest laps in quali, practice etc and some special situations.

So flexibility is what I'm after.
Krayy
S2 licensed
Slow down!!

haven't had time to send through some suggestions before a new update is out!

PS: Huge thanks for putting arrays into GLScript...that'll make life a lot easier.
Last edited by Krayy, .
Krayy
S2 licensed
Quote from Bass-Driver :thx krayy it works now
weird bug but it works

when u do !listgroup blablabla
then it shows the users in grey color
can i change this color??

Just add colour code where it does the privMsg in the PrintUserGroup Sub as thats the output like this:

IF ( $GroupUser != "") THEN
privMsg ("^3" . $GroupUser . "^8");
$GroupIndex = $GroupIndex + 1;
ELSE
Krayy
S2 licensed
Found the problem....at the end of the line that says EndSub of the PrintUserGroup function, you have got some extra control characters that are breaking the script. You cannot see them normally, so if you position the cursor at the end of the word EndSub, use Shift+Down arrow to select the end of that line and a couple of blank lines below it and delete them then it runs ok.

Make sure that you are using a text editor that can save the file in a plain text format like Notepad+++ or PSPad Editor.

Also, you can call the !listgroup function (i change it to !lg) using:
!listgroup UserAdmin
Last edited by Krayy, .
Krayy
S2 licensed
From what i recall, FireOptiks had the same problem and we found that the parameter "$username" in the !listgroup command had a different case in his lapper file and was actullay "$UserName". Check yours and see if thats the same.
Krayy
S2 licensed
Quote from Andy King :Thanks for your response but already did that

Hey there Andy,

If you are using !who, you need to maek sure (in the current Lapper anyway) that "pitboard.lpr" is in the includes file and that pitboards are set to True in the includes.lpr file. This becasue the !who command uses the user_array data structure that is defined in the pitboard.lpr. I moved it out of there to stop being dependant on it.

About the voting data structures, I did a large rewrite of the stored values database that I'll post the latest version into the forum topic dedicated to that function. It will allow setting the var on individuals rather than in a genral storage area and allow fro bulk updates.
Krayy
S2 licensed
Quote from Victor :atm you can use the teams action to get the entire teams list. Hmm I could improve that though.
I'll think about the pst option.

Hi Victor,

Thanks for considering this. I had contemplated getting the whole team info, but that is a LOT of data to request from the stats site as well as parse.
Krayy
S2 licensed
Is there any way currently of determining what team a racer belongs to, or more importantly, can it be added to the pst request output for the next version?
FGED GREDG RDFGDR GSFDG