The online racing simulator
Quote from Stölzel :I can Create own Programs etc. but in LFs it is a complete other thing!

No it's not. If you know how to program in C# this shouldn't be difficult. If you're struggling with displaying a button you obviously don't even know the basics. The documentation is really straightforward and should get you moving along for quite some bit. You could also browse through the library and look for the method that creates buttons. Don't expect that everything will be done for you.
Quote from Stölzel :I Read it but i current dont understand it...

What exactly about it you don't understand? You can send packets to LFS to make it do stuff (restart race, reorder grid, display buttons, ...) and LFS can send packets to you to tell you what's going on in the game (player pitted, race was restarted, ...).

All you need to know is the kinds of packets InSim uses and what they are for. This is all described perfectly in InSim.txt. It doesn't matter if you use InSim.NET, CInSim, LFS_External or your own tools to talk to LFS through InSim. You always have to know what packets to send or get and how to read the data in them. InSim.NET makes this extremely easy because it turns raw InSim packets into C# objects that you can use naturally from your program.

FWIW, here's how you can display buttons with InSim.NET

using System;
using InSimDotNet;
using InSimDotNet.Packets;

namespace ISN_Example
{
class MainClass
{
public static void Main (string[] args)
{
InSimSettings settings = new InSimSettings();
InSim inSim = new InSim();

/* Tell InSim.NET that we are interested in incoming IS_BTC packets */
inSim.Bind<IS_BTC>(ISButtonClicked);

/* Set up connection parameters */
settings.Host = "127.0.0.1";
settings.Port = 29999;
settings.Admin = String.Empty;

/* Try to connect */
try {
inSim.Initialize(settings);
} catch (InSimException e) {
Console.WriteLine("There was a problem when trying to connect to InSim:");
Console.WriteLine(e.Message);
return;
}

/* Create an object that resembles IS_BTN InSim packet */
IS_BTN button = new IS_BTN();

/* Set up first button */
button.ClickID = 1;
button.ReqI = 1;
button.T = 5;
button.L = 5;
button.W = 50;
button.H = 15;
button.BStyle = ButtonStyles.ISB_CLICK | ButtonStyles.ISB_C1;
button.Text = "Click Me";
/* Hand it over to InSim.NET and let it do the magic */
inSim.Send(button);

/* Adjust some values to create another button */
button.Text = "Another click me";
button.T = 25;
button.ClickID = 2;
inSim.Send(button);

/* Notice that I do not have to create two objects ("button1" and "button2") to display
* two buttons. I can just change some values in "button" and send it again. */

/* Wait for any key */
Console.ReadKey();

/* Hang up and exit */
inSim.Disconnect();
Console.WriteLine("Connection to InSim closed...");
}

/* InSim.NET will call this method when it gets IS_BTC packet from LFS */
public static void ISButtonClicked(InSim inSim, IS_BTC clicked)
{
Console.WriteLine("Button ID: " + clicked.ClickID + " clicked");
}

}
}

@DarkTimes:
It's pretty cool that InSim.NET builds and runs on Linux. At least the example above works flawlessly on my Fedora 20 box with Mono 3.10.
Quote from MadCatX :
@DarkTimes:
It's pretty cool that InSim.NET builds and runs on Linux. At least the example above works flawlessly on my Fedora 20 box with Mono 3.10.

Yeah I improved the Mono support a lot in a recent release. It should work identically except that on Mono the string encoding is a bit slower. Glad it works anyway.
Thank you MadCatX now i understand it a bit more

But my Problem now is how i make there a kind of if-query? so:


IS_NCN newConn = new IS_NCN();
IS_MST welcMst = new IS_MST();
//here my script (Text Message) when a new player connect to the server... (if-query?)
...

the only lib i can find is this: http://en.lfsmanual.net/wiki/InSim#InSim_Libraries
Quote from Stölzel :Thank you MadCatX now i understand it a bit more

But my Problem now is how i make there a kind of if-query? so:


IS_NCN newConn = new IS_NCN();
IS_MST welcMst = new IS_MST();
//here my script (Text Message) when a new player connect to the server... (if-query?)
...

the only lib i can find is this: http://en.lfsmanual.net/wiki/InSim#InSim_Libraries

Again, read the InSim.txt file in LFS/docs You cannot create IS_NCN packet because it is an "Info" packet. LFS will send you IS_NCN when a new player connects to your server. You cannot send IS_NCN to LFS - there's no reason why you would want to do it anyway.

When you receive IS_NCN, you can send IS_MTC to display the welcome message.


...

inSim.Bind<IS_NCN>(on_IS_NCN);

...

void on_IS_NCN(InSim inSim, IS_NCN ncn) {
IS_MTC message = new IS_MTC();

message.UCID = ncn.UCID;
message.PLID = 0;
message.Msg = "Hello " + ncn.PName;

inSim.Send(message);
}

Now... Thank you for your help MadCatX. Now i understand it as far as i can create my first little Working InSim

But currently i have 1 Question. I cant find it so how i can display a Big Text on the Screen and set the Position of it?

And i have found 1 Bug?... Since the 2.1.2 Version the InSim disconnects when i connect to the Server with "InSim quest closed : INSIM". The same InSim Code works perfectly with the 2.1.1 Version.
OK - that is a bug, thanks! I've fixed it and uploaded a new release to NuGet and GitHub.
Quote from Stölzel :Now... Thank you for your help MadCatX. Now i understand it as far as i can create my first little Working InSim

But currently i have 1 Question. I cant find it so how i can display a Big Text on the Screen and set the Position of it?

Display it in a button. If you set appropriate "Style" flag for the button it should look like a text.
All links broken.
You shouldn't be using this anyway.

InSim.NET is up-to-date and should be used.
How would I have to do to add a random time from one button to another?

else if (C.DragStage == 4)
{
C.DragStage = 5;
InSim.Send_BTN_CreateButton("^3•", Flags.ButtonStyles.ISB_C1, 21, 21, 113, 174, 23, C.UniqueID, 2, false); //LUZ3-IZQUIERDA - GRANDE
InSim.Send_BTN_CreateButton("^3•", Flags.ButtonStyles.ISB_C1, 21, 21, 113, 185, 24, C.UniqueID, 2, false); //LUZ3-DERECHA - GRANDE
}
else if (C.DragStage == 5)
{
C.DragStage = 6;
InSim.Send_BTN_CreateButton("^2•", Flags.ButtonStyles.ISB_C1, 21, 21, 123, 174, 25, C.UniqueID, 2, false); //LUZ4-IZQUIERDA - GRANDE
InSim.Send_BTN_CreateButton("^2•", Flags.ButtonStyles.ISB_C1, 21, 21, 123, 185, 26, C.UniqueID, 2, false); //LUZ4-DERECHA - GRANDE
}
Quote from Popughini :How would I have to do to add a random time from one button to another?

else if (C.DragStage == 4)
{
C.DragStage = 5;
InSim.Send_BTN_CreateButton("^3•", Flags.ButtonStyles.ISB_C1, 21, 21, 113, 174, 23, C.UniqueID, 2, false); //LUZ3-IZQUIERDA - GRANDE
InSim.Send_BTN_CreateButton("^3•", Flags.ButtonStyles.ISB_C1, 21, 21, 113, 185, 24, C.UniqueID, 2, false); //LUZ3-DERECHA - GRANDE
}
else if (C.DragStage == 5)
{
C.DragStage = 6;
InSim.Send_BTN_CreateButton("^2•", Flags.ButtonStyles.ISB_C1, 21, 21, 123, 174, 25, C.UniqueID, 2, false); //LUZ4-IZQUIERDA - GRANDE
InSim.Send_BTN_CreateButton("^2•", Flags.ButtonStyles.ISB_C1, 21, 21, 123, 185, 26, C.UniqueID, 2, false); //LUZ4-DERECHA - GRANDE
}

up !

.NET - LFS External (InSim/OutSim/OutGauge SDK Library)
(538 posts, started )
FGED GREDG RDFGDR GSFDG