The online racing simulator
Searching in All forums
(921 results)
DarkTimes
S2 licensed
Quote from sicotange :Cool improvement Thumbs up

• A very old bug you are probably aware of is IS_BTN special characters problem. Some special characters result in a bugged output. I forgot how to reproduce it easily (I think it was a combination of special characters).
Either way, it's not a big nuisance.


If you could try and give me an example of the kinds of characters that cause the problem that would be helpful.

Quote :• A fool proof packet buffer (mainly concerning IS_BTN's): insim.NET would deal appropriately with the many buttons sent so you wouldn't have to worry about overflows etc. For IS_AXM I use the safe LFS system for example (wait for packet arrival, then send new packet).

Again, not sure what you mean. Could you explain what you mean by overflow and can you give me an example of how you currently need to deal with them?

Quote :• A button manager: I made a far from ideal button manager where I group buttons (parent -> child). Maybe you know the perfect way to deal cleanly with buttons (clickID & text updates)?

I've thought about doing something like this before, basically I would add a new ButtonHelper to the helpers namespace. I'll see what I can do.

Quote :• Improving the socket loss detection (the error I mailed you) to improve our chances to catch the reason of the disconnection.

I don't really know what I can do about this. "An existing connection was forcibly closed by the remote host" basically means that LFS closed the connection. As I said before it would be nice to know if LFS says anything when this is happening. Alternatively maybe Scawen might be able to answer in what scenarios LFS would just close the connection.

Quote :• An event manager: it seems to be a pain to maintain 8 InSim connections with all packet events bound. Maybe you have some clearer thought about this?

This falls into the same category as ButtonHelper. It's not something I would add to the main library but could be added to the helpers section.
DarkTimes
S2 licensed
Bah.

I'll need to go back to the drawing board.
DarkTimes
S2 licensed
I have done a few small things today, most notably I have changed the InSim.Send(IEnumerable<ISendable>) method to be InSim.Send(params ISendable[]) instead.

This makes sending packets in batches simpler. Now you can just do this:

<?php 
insim
.Send(
    new 
IS_TINY ReqI=1SubT=TinyType.TINY_NCN }, 
    new 
IS_TINY ReqI=1SubT=TinyType.TINY_NPL }, 
    new 
IS_MST Msg="Hello, world!" }
);
?>

Sending multiple packets in a single Send call uses less bandwidth than sending them individually. You should always look for ways to batch send your packets.

This is a slight breaking change as that method used to accept IEnumerable<ISendable>, which meant you could pass pretty much any .NET collection into it, however I think this new syntax is much neater. If you want to pass in an List<ISendable> or whatever you can just call its List<ISendable>.ToArray() LINQ method.

<?php 
var packets = new List<ISendable>();
packets.Add(new IS_TINY ReqI=1SubT=TinyType.TINY_NCN }); 
packets.Add(new IS_MST Msg="Hello, world!" });
insim.Send(packets.ToArray());
?>

Aside from that just some minor updates. I rewrote the TrackHelper class, as I was adding Rockingham it was very confusing as I had to add the new configs in four different places. Now I've simplified it so there is only one track list and the reversed/open stuff is worked out programmatically.

As I am in the mood to update the library let me know of any features you want added or bugs you want fixed.
DarkTimes
S2 licensed
I have updated InSim.NET for LFS 6K12. It now requests InSim version 7 when connecting. I also added TINY_ALC and SMALL_ALC to their respective enums.

In addition I fixed a bug where if you called InSim.IsConnected from inside the InSim.Disconnected event it would return true, which didn't make much sense.

Lastly I have changed it so that you no longer need to create a new instance of the InSim object each time you want to connect to LFS. Instead you can just create one object and reuse that. I was working on a small app and it was so annoying to have to undo all your bindings and redo them again each time you wanted to connect. Now you don't need to do that.
DarkTimes
S2 licensed
Quote from ab12 :but don't work

foreach(clsConnection Conn in Connections)
{
Conn.NoColPlyName = CPR.PName;
}

insim don't show me the message

EDIT: and I have this problem too

It looks like you are updating the connection list, you want to change the name in your player list instead. Also you want to only change name of that one player, so you would need to check that the player has the correct PLID before updating them.
DarkTimes
S2 licensed
I have updated the GitHub repo for LFS 6K11.
  • IS_MSO, IS_III, and IS_ACR are now variable sized packets.
  • IS_BFN can be used to delete a range of buttons.
DarkTimes
S2 licensed
Quote from LFS Marius LFS :How to update player name in IS_CON packet if he change his name ?
In my insim if he change the name and hit/crash someone the name is same.

The IS_CON packet doesn't contain the player name, you need to watch for the IS_CPR (Connection / Player Rename) packet and then update the player's name in your list of active players.
DarkTimes
S2 licensed
Added the new IS_JRR packet to the repository on GitHub.

I won't create a release for it at the moment as Scawen is still testing the packet.

Edit: I also added Rockingham to the TrackHelper.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
I updated the original .zip to add the new tracks to the Tracks.xml file. I don't have the source code for this any more so it's all I can do. Thanks for the fixes!
DarkTimes
S2 licensed
That's not really a bug, the Send method formats your message with any arguments you pass in, internally it just calls String.Format(). I think the issue here isn't that there is a bug in those methods but that the documentation for them doesn't mention the formatting. If you want to you can avoid using the convenience method altogether and just send the packet directly:

insim.Send(new IS_MTC { UCID=con.UCID, Msg="{" });

That does the same thing while avoiding the string formatting stuff.
DarkTimes
S2 licensed
I can't be bothered explaining why this is happening, just make everything in CarPack an int and it should work:

public struct CarPack
{
public int AngVel;
public int Direction;
public int Heading;
public CompCarFlags Info;
public int Lap;
public int Node;
public int Speed;
public int PLID;
public int Position;
public int X;
public int Y;
public int Z;
}

DarkTimes
S2 licensed
Quote from ab12 :http://postimg.org/image/9g92j9w1j/

Does anyone know what is the problem ? I have never seen that..

You need to change the namespace to something else - the InSim in the namespace is clashing with the object type.
DarkTimes
S2 licensed
Quote from Lexanom :DarkTimes
no, see my code and result, I try different line:
https://www.lfs.net/forum/post/1894656#post1894656

OK - I'll need to look into it. I can't promise anything, strings in LFS are really hard to deal with, especially if you use a framework like .NET that only deals in unicode.
DarkTimes
S2 licensed
Quote from Lexanom :In 1 screen all ok, i get "Lexanom русский текст" when I type "^C".
But if japan/korean/chinease text before my "русский текст", I can not get the "русский текст" in any way.
And 3, if my nickname contains ^, insim.NET turns it to mush.

Sorry for the delay in replying.

You shouldn't need to add ^C yourself, InSim.NET should insert those automatically. Does the text appear correctly if you leave out the ^C?
DarkTimes
S2 licensed
Could you explain what the problem is? I don't know what I'm supposed to be looking at in those screenshots.
DarkTimes
S2 licensed
I have moved pyinsim onto GitHub and am in the process of updating it to LFS 0.6H.

I plan on doing three things:
  • Updating pyinsim 2 for LFS 0.6H (completed)
  • Updating pyinsim 3 for LFS 0.6H (in progress)
  • Adding both libraries to PIP (in planning)
Once I add both libraries to PIP I won't need to bother making Windows binary releases or any of that stuff.

https://github.com/alexmcbride/pyinsim
DarkTimes
S2 licensed
Yeah, sounds good!
DarkTimes
S2 licensed
Sorry bit late on this. Basically yes, you need to create a new instance of the InSim class each time you want to connect to LFS. If you have an existing InSim object then you would need to unhook all event handlers and unbind all packets before you dispose of the reference to it, otherwise you could end up with a memory leak.

If I was going to rewrite the library now I would not do it this way as it's a lot of unnecessary hassle, but that's how it was written at the time.
DarkTimes
S2 licensed
I managed to break the NuGet package. I uploaded a new one that fixes things but it won't let you reuse a version number, so I made it 2.2.0.1 instead. It's the same bits as the one on GitHub just with a slightly different version.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
I put out a new release on both GitHub and NuGet.

InSim.NET 2.2.0
  • Updated library for LFS 0.6H (added IS_NCI packet, added TINY_NCI, updated IS_REO/IS_NLP, added IS_NCI to PacketFactory).
  • Fixed bug in PitWorkFlags (thanks to MariusMM for fix)
  • Added new Westhill configurations to TrackHelper (thanks to NeOn_sp)
  • Added new objects to ObjectHelper (thanks to NeOn_sp)
DarkTimes
S2 licensed
I've updated the main repository with changes for LFS 0.6H and a few other bug fixes. I'll release a new binary and NuGet package in the near future, the version will be InSim.NET 2.2.0. If any one has a bug or a feature request now is the time to suggest it!
DarkTimes
S2 licensed
OK thanks, I'll take a look at it. Thumbs up
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Sorry I've been very busy this last week. I'm sure you're right about missing a value in that enum - I'll look into it when I have time. Feel free to create a pull request on GitHub and fix it yourself.
DarkTimes
S2 licensed
OK - I think I've fixed it, but it will still need some testing. In the mean time you should be able to work around it by just ignoring the Caption property and setting the zero bytes yourself.

IS_BTN button = new IS_BTN {
T = 80,
L = 45,
W = 120,
H = 20,
BStyle = ButtonStyles.ISB_CLICK | ButtonStyles.ISB_LIGHT,
Text = Char.MinValue + "^4Spauskite čia" + Char.MinValue + "^4Įrašykite čia",
TypeIn = 30,
ClickID = 1,
ReqI = 1,
UCID = 0
};

I'll try and get a proper fix out soon.
DarkTimes
S2 licensed
I just tested this on my machine and as far as I can tell it seems to work OK as it is. I have attached two images to show how it looks on my computer. I changed the font color to make it more readable.

Can I ask, what language is your version of Windows and your version of LFS set to?
FGED GREDG RDFGDR GSFDG