The online racing simulator
Great!

byte Size; // 4 + NumP * 6 (PLUS 2 if needed to make it a multiple of 4)

its not important?

Think about this nodelap[plid], compcar[plid]. Need memory. How clear if car leave track? Remember that it internal function and it not use fix value (like plid in table). All data from compcarArr need treat with external script. Or not.
It's only the size of the packet so it shouldnt matter.. if I'm reading it correctly. I'm still feeling a bit wobbly from last night though so please correct me if I'm wrong
I don't know lua language. I only small learn it.
I'm certainly no expert either
First script for drag on demo server StartLine. I use area (4 coordinates). If car into this area (s = sa[s, sa - square area] => car in area) all see text You crossed starting line.


+ svetofor script. type /i start
Attached files
startline.zip - 875 B - 340 views
svetofor.zip - 659 B - 377 views
scroll line

function scroll_line(imsg)
luaLFS.sleep(3)
local i
local str = "^2TEST ^8Scroll Line For Info"

for i = 1, 200, 1 do
luaLFS:btn(1, 255, 1, 0, 32, 0, 0, 100, i, 10, str)
luaLFS.sleep(0.0001)
end
luaLFS.sleep(5)
for i = 200, 1, -1 do
luaLFS:btn(1, 255, 1, 0, 32, 0, 200-i, 100, i, 10, str)
luaLFS.sleep(0.0001)
end
luaLFS:bfn(0, 255, 1, 0)
end
evt_bind(EVT_CONNECTED, scroll_line)

test this
Quote from the_angry_angel :function luaLFS:reo(...)
if (table.maxn(arg) == 1) then
-- Receiving IS_REO
local n, psize, pty, reqi, nump, plid = bunpack(arg[1], "bbbbb32")
return { nump = nump, plid = plid }
elseif (table.maxn(arg) == 3) then
-- Sending IS_REO
[/code]

how use CPP? i try with function of api

-- CAMERA CONTROL
-- XXX: Needs to be finished
function luaLFS:cpp(...)
if (table.maxn(arg) == 1) then
local n, psize, pty, reqi, zero, x, y, z, h, p, r, viewplid, ingamecam, fov, time, flags = bunpack(arg[1], "bbbblllHHHbbfHH")
return { x = x, y = y, z = z, h = h, p = p, r = r, viewplid = viewplid, ingamecam = ingamecam, fov = fov, time = time, flags = flags }
end
end

use script


function l_init(imsg)
luaLFS:small(0, SMALL_NLI, 1000)
luaLFS:tiny(1, TINY_NPL)
end
evt_bind(EVT_CONNECTED, l_init)

function ttest(imsg)
print("ok")
local cpp = luaLFS:cpp(imsg)
luaLFS:btn(1, 255, 1, 0, 0, 0, 172, 15, 28, 10, "PLID="..cpp.viewplid)
luaLFS:btn(2, 255, 1, 0, 0, 0, 172, 25, 28, 10, "X="..cpp.x)
luaLFS:btn(3, 255, 1, 0, 0, 0, 172, 35, 28, 10, "Y="..cpp.y)
luaLFS:btn(4, 255, 1, 0, 0, 0, 172, 45, 28, 10, "Z="..cpp.z)

luaLFS:btn(5, 255, 1, 0, 0, 0, 172, 55, 28, 10, "H="..cpp.h)
luaLFS:btn(6, 255, 1, 0, 0, 0, 172, 65, 28, 10, "P="..cpp.p)
luaLFS:btn(7, 255, 1, 0, 0, 0, 172, 75, 28, 10, "R="..cpp.r)

luaLFS:btn(8, 255, 1, 0, 0, 0, 172, 85, 28, 10, "FOV="..cpp.fov)
luaLFS:btn(9, 255, 1, 0, 0, 0, 172, 95, 28, 10, "Time="..cpp.time)
end
evt_bind(ISP_CPP, ttest)

function tre(imsg)
luaLFS:tiny(1, TINY_SCP)
end
evt_bind(ISP_MCI, tre)

nothing
my first big script DRAG on BL1. For demo players useful for fun race.

for help type /i help

start line after S-turn where end right-curb (in this place, you see the texture change of track)

include: scripts + api
require: luaLFS-0.8
Attached files
drag_eng.zip - 5.7 KB - 340 views
im new to lua coding and i was wanting to see an example of a script and is there a place i can read about it?
If you want a general introduction to Lua then this website is useful;
http://lua-users.org/wiki/LuaTutorial

However, if you're looking to do things specifically with luaLFS then let us know and we'll put together a few words to describe how to use luaLFS
like i want to make a money system for like a cruise server.
anyone?
There are probably about 3 people who are with enough knowledge (at this point in time, there are probably many others who can figure it out by looking at the source of the application and associated core scripts) to write a nice tutorial for luaLFS. Myself, Kada_CZ and A.Fedorov. Unfortunately I'm too busy with work for the next few days, to put anything together in sufficient detail for an absolute beginner. I may have the opportunity on Saturday afternoon or evening - but I can't make any promises at the moment
u have msn or somthing?
with good description that must do script at items was much easier its write
Local buttons not working?
hi there~ i cannot get the local buttons to work with luaLFS 0.8, SHIFT+B in the game does not triggle an ISP_BFN event (SHIFT+I does).

i've tried setting 'flags' with LOCAL(4) in config.lua but nothing happened.

i see these lines in the C src:

p = conf_gettable_str(L, "flags");
I->lfs.flags = p[0];

does this mean that the 'flags' value is a string instead of a number like 'port'?
Quote from icyocean :I''ve tried setting 'flags' with LOCAL(4) in config.lua but nothing happened.

i see these lines in the C src:

p = conf_gettable_str(L, "flags");
I->lfs.flags = p[0];

does this mean that the 'flags' value is a string instead of a number like 'port'?

Since the flag should only be a 1 unsigned char, rather than a number I cheat and read in a string, and then only make sure I only use the first character.

If you're using the bitwise library it should only produce a single char anyway.. Mind if I see how you're setting the flags?
Quote from the_angry_angel :Since the flag should only be a 1 unsigned char, rather than a number I cheat and read in a string, and then only make sure I only use the first character.

If you're using the bitwise library it should only produce a single char anyway.. Mind if I see how you're setting the flags?

i used: flags = 4 + 32 to set the flags
and then: flags = bit.bor(ISF_LOCAL, ISF_MCI)

SHIFT+B didn't work in either case

IIRC Lua thinks all numbers are float/double type values, could that be an issue here?
Quote from icyocean :i used: flags = 4 + 32 to set the flags
and then: flags = bit.bor(ISF_LOCAL, ISF_MCI)

SHIFT+B didn't work in either case

IIRC Lua thinks all numbers are float/double type values, could that be an issue here?

It shouldn't be as, if I remember correctly, bit.bor should return a character array, not a number. I'll have a dive into the code when I finish work this evening, but it should be fine as I'm fairly sure I tested it quickly with setting the ISP_MCI and NLP flags...

Bear in mind that I didn't test the BTN code at all
Quote from the_angry_angel :It shouldn't be as, if I remember correctly, bit.bor should return a character array, not a number. I'll have a dive into the code when I finish work this evening, but it should be fine as I'm fairly sure I tested it quickly with setting the ISP_MCI and NLP flags...

Bear in mind that I didn't test the BTN code at all

thanks in advance
for future
[!] api of BFN incomplete
bit.* functions do indeed return both unsigned and signed ints. Not sure how I missed that but

Some of the button flags, etc. were also missing from the event_id.lua file.

I've written up some docs and included them in this release as well, under DOCUMENTATION.

There an also an example local buttons in ./scripts/examples.
Quote from A.Fedorov :for future
[!] api of BFN incomplete

It should be finished now, along with an untested cpp.
i've added/modified these api functions

function luaLFS:scc(viewid, ingamecam)
local omsg = bpack("bbbbbbbb", 8, ISP_SCC, 0, 0, viewid, ingamecam, 0, 0)
luaLFS.sendmsg(omsg, string.len(omsg))
end

and

function luaLFS:bfn(...)
if(table.maxn(arg) == 1) then
local imsg = arg[1]
local n, psize, pty, reqi, subt, ucid, clickid, inst, sp3 = bunpack(imsg, "bbbbbbbb")
return {reqi = reqi, subt = subt, ucid = ucid, clickid = clickid, inst = inst}
elseif(table.maxn(arg) == 4) then
local subt, ucid, clickid, inst = arg[1], arg[2], arg[3], arg[4]
local omsg = bpack("bbbbbbbb", 8, ISP_BFN, 0, subt, ucid, clickid, inst, 0)
luaLFS.sendmsg(omsg, string.len(omsg))
end
end


FGED GREDG RDFGDR GSFDG