The online racing simulator
How to make buttons work in multiplayer [LFSLib.NET 0.13b]
Hello Guys,

I've been playing with LFSLib.NET 0.13b a little bit, trying to create a very simple fuel warning thing for LFS, and can't make the buttons work at all in multiplayer. In singleplayer, I didn't have a problem with them, but in multiplayer, they just won't appear on the screen.

I've tried to use both overloads of InSimHandler.SetButton method, either setting the "local" boolean to true, or sending the correct connectionId. Nothing worked.

Any ideas anyone?
Thanks!
Rado
You are connecting to the local running LFS, aren't you? Did you try sending the buttons to Connection 0 with local flag?
Quote from GeForz :You are connecting to the local running LFS, aren't you? Did you try sending the buttons to Connection 0 with local flag?

Thanks for your idea, just tried now, it didn't work.
And yes I'm connecting to the local running LFS. When I request the RaceTrackPlayer event, I get the list of players, with myself having "Remote" flag set to false so I can get my own connection ID. But sending the button to this ID doesn't work either.
Ok, this ought to work:

handler.SetButton(myButton,true);

but it does not.

I'm going to dig into my code and see what I may be doing wrong, but here is some behavior that makes me think it's either not allowed or a bug in LFS:
  1. Create a button in the main menu
  2. Join a multiplayer server
  3. The button will still be visible
  4. Disconnect your insim program
  5. The button will still be visible
  6. Leave the server and the button will disappear
That doesn't seem like intended behavior.

Scawen, can you clarify if local buttons are legal in a multiplayer game? I'll dig into my code and make sure I'm not screwing something else up.
Here's a test packet. If i send it anywhere except during multiplayer (including multiplayer connect screen) it works, but nothing happens in multiplayer:


20 Bytes:
14 2d 03 00 01 00 11 00
0a 0a 0a 0a 41 00 00 00
00 00 00 00

or

Size = 20
Type = 45
ReqI = 3
UCID = 0
ClickID = 1
Inst = 0
BStyle = 17
TypeIn = 0
L = 10
T = 10
W = 10
H = 10
Text = [A \0 \0 \0 \0]

If someone else not using my Lib could test this button packet in and out of multiplayer to see if they can see the same problem, I'd appreciate it.
Quote from sdether :I'm going to dig into my code and see what I may be doing wrong, but here is some behavior that makes me think it's either not allowed or a bug in LFS:
  1. Create a button in the main menu
  2. Join a multiplayer server
  3. The button will still be visible
  4. Disconnect your insim program
  5. The button will still be visible
  6. Leave the server and the button will disappear

Similar to what you mention here, I also got some unexpected behavior - buttons created during singleplayer remained on screen when I switched to multiplayer, but were frozen (i.e. I was unable to update the text).

On the other hand, I'm a big fan of http://www.livetocruise.net mod, and they're using custom buttons in their server side insim mod (it's a cruising server and the buttons are used to display current cash and license levels). I know they use PHP + MySQL, but it's been all down for a few days - waiting to upgrade server.
Are you using ISF_LOCAL in the ISI pakcet?

From InSim.txt:

// The ISF_LOCAL flag is important if your program creates buttons.
// It should be set if your program is not a host control system.
// If set, then buttons are created in the local button area, so
// avoiding conflict with the host buttons and allowing the user
// to switch them with SHIFT+B rather than SHIFT+I.
Quote from Peptis :Are you using ISF_LOCAL in the ISI pakcet?

Doh! I was so fixated on checking my button logic, that i forgot about that. Yeah, didn't set that and once i did, it worked just fine.

For LFSLib.NET reference, InSimHandler.Configuration.Local must be set to true if you want to display local buttons during multiplayer.
Quote from sdether :Doh! I was so fixated on checking my button logic, that i forgot about that. Yeah, didn't set that and once i did, it worked just fine.

For LFSLib.NET reference, InSimHandler.Configuration.Local must be set to true if you want to display local buttons during multiplayer.

Thank you guys for all your help! With Configuration.Local set to true, it works nicely

Thanks again,
Rado
insim lessons please
is there any one out there that would be willing to teach me how to program ..... PLEASE XXXXXX



No one here can teach you how to program, if you want someone to teach you then you would need to find a professional teacher, by taking a class or something.

If you want to teach yourself to program then there is a thread on the forum already which starts off with some useful learning resources, but then sort of descends into the lively bickering you always find when programmers get together.

http://www.lfsforum.net/showthread.php?t=28234
Quote from joelbarton1987 :is there any one out there that would be willing to teach me how to program ..... PLEASE XXXXXX

Yes, its called "school".
Quote from joelbarton1987 :is there any one out there that would be willing to teach me how to program ..... PLEASE XXXXXX

What language? What experience? Whats your goal?

Quote :These are the things I need to know

Quote from the_angry_angel :What language? What experience? Whats your goal?

ok change of plan i need a java connection program for a java script . please
#17 - vane
i would also like to get into programming insims, what is the most common language used in such servers as the popular cruise servers and lx month servers. c# and c++ are popular at my dad's work, dont know why they'd need it there, if i told you anymore id have to kill you :nol2:

FGED GREDG RDFGDR GSFDG