The online racing simulator
Searching in All forums
(132 results)
A.Fedorov
No longer welcome
here is
A.Fedorov
No longer welcome
1. I not finded function in lua like pause()/wait()/sleep(). My function pause() - brake server

function pause(time)
local time0 = os.time()
while (os.difftime(os.time(), time0) < time) do
end
end

2. How can i get position of all cars? Please give me example.
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
I use lapper in LAN and not have access to internet for WR. Lapper crash.

Loading WR...The following error occurred:
Unable to connect to the remote server
System
at System.Net.HttpWebRequest.GetResponse()
at LFSLapper.wr.load(String user, String pass, String idk)
at LFSLapper.LFSClient..ctor(String scriptfilename, Boolean debugmode)
at LFSLapper.LFSLapper.Main(String[] Args)
System.Net.WebResponse GetResponse()

with internet connection - ok
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
Certainly. You need use some program. Like "cmdLFS" (not for InSim v4) or other who send command to server.
A.Fedorov
No longer welcome
if you use only LFSLapper try

stop: /insim=0
run: /exec path\lfslapper.exe lfslapper.cfg
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
what about new verson of luaLFS?

api updated - http://www.lfsforum.net/showthread.php?p=468523#post468523
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
if run in server luaLFS and use my script you will see Yellow flag
thread - http://www.lfsforum.net/showthread.php?p=470981#post470981
A.Fedorov
No longer welcome
Print Yellow Flag.

require last api
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
Update lapslog (above). Now all work fine it seems.
A.Fedorov
No longer welcome
Hey, look at image. It make with InSim (ISP_BTN). I used luaLFS for do that
api
A.Fedorov
No longer welcome
Updated

not yet full api, but more functions
NEED TESTING all functions

API 0.1X10

[*] fix ISP_SMALL, ISP_MOD
----------------------------------------------------------
API 0.1X3
[+] TINY_AXI, TINY_AXC (file event_id.lua)
[+] ISP_AXI, ISP_AXO

[*] ISP_NPL (byte Model)
----------------------------------------------------------
API 0.1X
[+] ISP_BTN (tested), ISP_BTC, ISP_BTT

all variables look into InSim.txt
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
I try test with 2 players. Only last connected player data put in laps.log
Please test (if you can).
like laps.log from RaceManager
A.Fedorov
No longer welcome
Updated

This is almost complete script. It use new api function and some small fix old api.

work with AI
work with more than one player
Last edited by A.Fedorov, . Reason : small update script
A.Fedorov
No longer welcome
i find only one way how get uname because uname not linked with plid. create table

local t = luaLFS:ncn(imsg)
n = { [t.pname] = t.uname }


then insert

local t = luaLFS:npl(imsg)
s[t.plid].user = n[t.pname]


something else way how get uname?

Tables more and more with connecting new people. If people are disconnected it is necessary to clean unused tables. As this do?
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
i do some script. Program RaceManager (python scripts) do laps.log file which contain data

20070508 16:24:19,SAtaN,BL1,SAtaN666,XRR,338,3:35.380,2:43.840,3:12.120
20070511 10:56:39,demon,BL1,,FXR,4,1:31.340,0:33.520,1:02.520
20070511 11:11:36,demon,BL1,,FXR,5,11:05.160,0:33.130,1:02.960
20070511 11:13:00,demon,BL1,,FXR,6,1:23.600,0:29.140,0:58.430
20070511 19:58:15,UnDeAD,BL1,835,RB4,1,2:08.780,1:01.040,1:36.670
20070512 14:44:49,MDK,BL1,373,FXR,28,1:33.110,0:35.860,1:06.050

construction
date time,uname (not pname),track,plate,cname,lapsdone,ltime,sp1[,sp2,sp3]

I maked stats (php) using this file. Now i have all without uname and track (lapsdone left stats). This is my script (not accomplished)


function ca(imsg)
luaLFS:tiny(1, TINY_NPL)
end

evt_bind(EVT_CONNECTED, ca)




function put_massive(imsg)
local t = luaLFS:npl(imsg)
s = { [t.plid] = { user = "", track = "", plate = t.plate, car = t.cname, sp1 = 0, sp2 = 0, sp3 = 0} }
print("Car: "..s[t.plid].car)
print("Plate: "..s[t.plid].plate)
end

evt_bind(ISP_NPL, put_massive)



function l_split(imsg)
local t = luaLFS:spx(imsg)
if (t.split == 1) then
s[t.plid].sp1 = t.stime
print ("SP1="..s[t.plid].sp1)
end

if (t.split == 2) then
s[t.plid].sp2 = t.stime
print ("SP1="..s[t.plid].sp1)
print ("SP2="..s[t.plid].sp2)
end
if (t.split == 3) then
s[t.plid].sp3 = t.stime
print ("SP1="..s[t.plid].sp1)
print ("SP2="..s[t.plid].sp2)
print ("SP3="..s[t.plid].sp3)
end
end

evt_bind(ISP_SPX, l_split)



function l_lap(imsg)
local t = luaLFS:lap(imsg)
local file_w = io.open("D:/Downloads/LFS/luaLFS-0.7/scripts/laps.log","a")
file_w:write(os.date('%x %X').." "..s[t.plid].plate.." "..s[t.plid].car.." "..t.ltime.." "..s[t.plid].sp1.." "..s[t.plid].sp2.."\n")
file_w:close()

end

evt_bind(ISP_LAP, l_lap)

A.Fedorov
No longer welcome
can i know what event started my function?

i want start one function with event NPL,RST,SPX and LAP.

if (event = ISP_RST) then
...
...
end
if (event = ISP_LAP) then
...
...
end
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
may you give me example how get splits time when laps done (IS_LAP event)?

I want create file and append data like this

20061025 16:43:10,repeat,BL1,repeat,XFG,6,2:10.540,0:34.850,1:35.580
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
2the_angry_angel
how i can get IS_SPX data when I get IS_LAP? I want write result lap with split data into file.
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
i suggest in api use name data from insim documentation to not mix up

example

struct IS_CPR // Conn Player Rename
{
byte Size; // 36
byte Type; // ISP_CPR
byte ReqI; // 0
byte UCID; // unique id of the connection

char PName[24]; // new name
char Plate[8]; // number plate - NO ZERO AT END!
};

function luaLFSapi:cpr(imsg)
local n, psize, pty, reqi, ucid, pnameU, plate = bunpack(imsg, "bbbb24A8A")
local n, pname = bunpack(pnameU, "z")
return { ucid = ucid, pname = pname, plate = plate }
end


I try to do this in future.
A.Fedorov
No longer welcome
Quote from alex95sang :Yes, I see and what can i do ?

Sorry if i speake too bad english.

do this

#QualUsers = &./your_file.flt
A.Fedorov
No longer welcome
I do my first test script. In LAN we too may set gandicaps

function ver_gand(imsg)
local t = luaLFS:npl(imsg)
local car = "BF1"
local h_tres = 18
local h_mass = 53
if ((t.cname == car) and ((t.h_tres ~= h_tres) or (t.h_mass ~= h_mass))) then
luaLFS:mst("/spec "..t.pname)
luaLFS:mtc(t.ucid, 0, "^C^1------------------------------------")
luaLFS:mtc(t.ucid, 0, "^C^Wrong data in setup!!!")
luaLFS:mtc(t.ucid, 0, "^C^3Correct:")
luaLFS:mtc(t.ucid, 0, "^C^2Restriction - ^618%")
luaLFS:mtc(t.ucid, 0, "^C^2Added Mass - ^653kg")
end
end

evt_bind (ISP_NPL, ver_gand)
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
in api.lua wrong some data. I correct this.

function luaLFSapi:npl(imsg)
print("Parsing NPL")
local n, psize, pty, reqi, plid, ucid, ptype, pflags, pnameU, plate, vehiclenameU, skinnameU, tyres, hmass, htres, spare, passengers, spare2, spare3, playernum, spare4, spare5 = bunpack(imsg, "bbbbbbhA24A8A4A16A4bbbbibbbb")
print("NPL parsed")
local n, pname = bunpack(pnameU, "z")
local n, cname = bunpack(vehiclenameU, "z")
local n, sname = bunpack(skinnameU, "z")
return { plid = plid, ucid = ucid, ptype = ptype, flags = pflags, pname = pname, plate = plate, cname = cname, sname = sname, tyres = tyres, h_mass = hmass, h_tres = htres, passengers = passengers, nump = playernum }
end
A.Fedorov
No longer welcome
see in config
QualUsers = &./your_file.flt
A.Fedorov
No longer welcome
i found my mistake. Need function testing(imsg)
Last edited by A.Fedorov, .
A.Fedorov
No longer welcome
how i may use IS_LAP data and all other?
FGED GREDG RDFGDR GSFDG