The online racing simulator
The MSO packet works correctly, you need to use the TextStart property to get where the text starts. This is not InSim.NET, this is how the packet is sent by LFS.

var cmd = mso.Msg.SubString(mso.TextStart);

Am I correct in assuming that the unit of OutSim Delay is ms and that I should expect approx 1000 events per sec from InSim.Net with an OutSim Delay of 1?

I have no idea what the internal Physics rate of LFS is, or what the rate of the outputs are. 1000Hz seems a bit unlikely
Quote from DarkTimes :The MSO packet works correctly, you need to use the TextStart property to get where the text starts. This is not InSim.NET, this is how the packet is sent by LFS.

var cmd = mso.Msg.SubString(mso.TextStart);


So "nickname : " is part of the msg.. Okok

Sorry for the error. I thought that mso.Msg was supposed to be just the msg without nick and : separator..
I've pushed out a release for InSim.NET 2.0.8.

Changes
  • Support for InSim 5, added IS_CON etc.. (now supports both InSim 4 and 5)
  • Fixed several bugs related to sending strings containing double-byte characters
  • Updated documentation help file with new packets
I've flagged it as a beta for now, in-case anyone finds more pressing bugs that need to be fixed.

As always you can get the latest release on CodePlex.
Great work! Thanks
Quote from DarkTimes :OK, I think I've fixed the bug with the BTN text. What was happening is the BTN code wasn't correctly taking into account the NULL terminator when figuring out the length of the string. Because there was no NULL terminator LFS was discarding the string and not showing it, which is why some buttons appeared to not be sent.

Although Scawen has fixed this bug in the latest LFS patch, I'm not going to change it in InSim.NET for the moment, as that would break backwards compatibly with old LFS versions (which still have the bug). For the time being the maximum length of the BTN text field will remain 239 bytes.
well now im out this new insimdotnet 2.0.8

thats start crash when player name contain japan fonts

i get this

Press Ctrl+Z to exit...
InSim Error: System.IndexOutOfRangeException: Index was outside the bounds of th
e array.
at InSimDotNet.EncodingHelper.GetBytes(String value, Byte[] buffer, Int32 ind
ex, Int32 length) in C:\Users\Alex\Documents\Visual Studio 2010\Projects\InSimDo
tNet\InSimDotNet\EncodingHelper.cs:line 89
at InSimDotNet.PacketWriter.Write(String value, Int32 length) in C:\Users\Ale
x\Documents\Visual Studio 2010\Projects\InSimDotNet\InSimDotNet\PacketWriter.cs:
line 121
at InSimDotNet.Packets.IS_MST.GetBuffer() in C:\Users\Alex\Documents\Visual S
tudio 2010\Projects\InSimDotNet\InSimDotNet\Packets\IS_MST.cs:line 49
at InSimDotNet.InSim.Send(ISendable packet) in C:\Users\Alex\Documents\Visual
Studio 2010\Projects\InSimDotNet\InSimDotNet\InSim.cs:line 231
at InSimDotNet.InSim.Send(String message, Object[] args) in C:\Users\Alex\Doc
uments\Visual Studio 2010\Projects\InSimDotNet\InSimDotNet\InSim.cs:line 266
at SparkCruise.CruiseApp.Message(String message, Object[] args) in C:\Documen
ts and Settings\Janne\Työpöytä\NCRCruise\NCRCruise\CruiseApp.cs:line 12286
at SparkCruise.CruiseApp.ClickId(InSim insim, IS_BTC btc) in C:\Documents and
Settings\Janne\Työpöytä\NCRCruise\NCRCruise\CruiseApp.cs:line 3905
at InSimDotNet.PacketBinding`1.ExecuteCallback(InSim insim, IPacket packet) i
n C:\Users\Alex\Documents\Visual Studio 2010\Projects\InSimDotNet\InSimDotNet\Pa
cketBinding~.cs:line 14
at InSimDotNet.BindingManager.ExecuteCallbacks(InSim insim, IPacket packet) i
n C:\Users\Alex\Documents\Visual Studio 2010\Projects\InSimDotNet\InSimDotNet\Bi
ndingManager.cs:line 85
at InSimDotNet.InSim.RaisePacketEvent(IPacket packet) in C:\Users\Alex\Docume
nts\Visual Studio 2010\Projects\InSimDotNet\InSimDotNet\InSim.cs:line 432
at InSimDotNet.InSim.mainSocket_PacketDataReceived(Object sender, PacketDataE
ventArgs e) in C:\Users\Alex\Documents\Visual Studio 2010\Projects\InSimDotNet\I
nSimDotNet\InSim.cs:line 416
at InSimDotNet.TcpSocket.OnPacketDataReceived(PacketDataEventArgs e) in C:\Us
ers\Alex\Documents\Visual Studio 2010\Projects\InSimDotNet\InSimDotNet\TcpSocket
.cs:line 274
at InSimDotNet.TcpSocket.HandlePackets(SocketState state) in C:\Users\Alex\Do
cuments\Visual Studio 2010\Projects\InSimDotNet\InSimDotNet\TcpSocket.cs:line 22
8
at InSimDotNet.TcpSocket.ReceiveCallback(IAsyncResult asyncResult) in C:\User
s\Alex\Documents\Visual Studio 2010\Projects\InSimDotNet\InSimDotNet\TcpSocket.c
s:line 208


any idea what is wrong and where

my code work nice and smooth if player name is normal letters
-
(DarkTimes) DELETED by DarkTimes
Quote from DarkTimes :Although Scawen has fixed this bug in the latest LFS patch, I'm not going to change it in InSim.NET for the moment, as that would break backwards compatibly with old LFS versions (which still have the bug). For the time being the maximum length of the BTN text field will remain 239 bytes.

Just a Q: When an official/stable version of LFS arrives, what do you plan on doing? I think it would be better to keep it compatible only as far as stable versions are concerned. But, anyway, we have the source, so we can tweak-a-la-freak as much as we want. Which means, that in the end, it doesn't really matter.

@Nasty! : I think you would need to provide the exact string of the problematic nickname, or maybe a replay would work too. Though, I think, the string is preferred.
-
(DarkTimes) DELETED by DarkTimes : I'm gonna delete these cause they're angry and not helpful.
forgot that i find what cause crash

that was this
User {0} blaaablaablaaaaaaablaaaa {1}", user.Playername, user.CurrentCar
well all start go good and many bugs has fixed
then i start get error with compar and i think i change that nothing any idea what cause this....



InSim Error: System.InvalidOperationException: EntityMemberChanged or EntityComp
lexMemberChanged was called without first calling EntityMemberChanging or Entity
ComplexMemberChanging on the same change tracker with the same property name. Fo
r information about properly reporting changes, see the Entity Framework documen
tation.
at System.Data.Objects.EntityEntry.EntityMemberChanged(String entityMemberNam
e, Object complexObject, String complexObjectMemberName)
at System.Data.Objects.EntityEntry.EntityMemberChanged(String entityMemberNam
e)
at System.Data.Objects.ObjectStateEntry.System.Data.Objects.DataClasses.IEnti
tyChangeTracker.EntityMemberChanged(String entityMemberName)
at System.Data.Objects.DataClasses.EntityObject.ReportPropertyChanged(String
property)
at SparkCruise.User.set_Distance(Double value) in C:\Documents and Settings\J
anne\Työpöytä\NCRCruise\NCRCruise\SparkCruise.Designer.cs:line 459
at SparkCruise.CruiseApp.UpdateDistance(CompCar car, User user) in C:\Documen
ts and Settings\Janne\Työpöytä\NCRCruise\NCRCruise\CruiseApp.cs:line 870
at SparkCruise.CruiseApp.CarUpdate(InSim insim, IS_MCI mci) in C:\Documents a
nd Settings\Janne\Työpöytä\NCRCruise\NCRCruise\CruiseApp.cs:line 833
at InSimDotNet.PacketBinding`1.ExecuteCallback(InSim insim, IPacket packet) i
n C:\Documents and Settings\Janne\Työpöytä\insimdotnet-8981182341c2\insimdotnet_
8981182341c2\InSimDotNet\PacketBinding~.cs:line 14
at InSimDotNet.BindingManager.ExecuteCallbacks(InSim insim, IPacket packet) i
n C:\Documents and Settings\Janne\Työpöytä\insimdotnet-8981182341c2\insimdotnet_
8981182341c2\InSimDotNet\BindingManager.cs:line 85
at InSimDotNet.InSim.RaisePacketEvent(IPacket packet) in C:\Documents and Set
tings\Janne\Työpöytä\insimdotnet-8981182341c2\insimdotnet_8981182341c2\InSimDotN
et\InSim.cs:line 432
This exception is being thrown by the Entity Framework, it's not got anything to do with InSim.NET. The reason InSim.NET reports the exception is because it's being thrown on the packet receive thread.

You need to look for this exception in reference to the Entity Framework, unfortunately I can't really help you fix it.

http://www.google.co.uk/search ... invalidoperationexception
yeah thanks again darktimes i figure that out my self
new istall c# whole program fix that somehow that come some database system error idk what happend but after reinstall c# not get anymore that :P

btw AGAIN big thanks to make "idiot proof"library so stupid like me can code insim stuff that :P
I said ages ago that I'd release a quick example to show using InSim.NET in a Windows Forms application, but I never got round to it. So anyway, here is a small app that prints the contents of each MSO packet received to a text box.

You can find the VS2010 project and a screenshot below.
Attached images
InSimUI.png
Attached files
InSimUI.zip - 146.4 KB - 933 views
any fast and good idea to block player took over feature in sparkcruise , that make weird km run without move bug ?

all tips are welcome
thanks
Quote from broken :Just a Q: When an official/stable version of LFS arrives, what do you plan on doing? I think it would be better to keep it compatible only as far as stable versions are concerned. But, anyway, we have the source, so we can tweak-a-la-freak as much as we want. Which means, that in the end, it doesn't really matter.

Sorry, I didn't see this question before.

I will update InSim.NET to match the most stable release of LFS where I can. There is nothing in the current version of InSim.NET that stops you from using it with InSim 4 or 5, although there are a couple of small issues. For instance in the new patch Scawen has fixed the old BTN text bug. I could fix this in InSim.NET, but there are two reasons not to. Firstly, the old version of LFS still has the bug and fixing it would mean braking support for Z28. Secondly, it's actually easier for me to not fix it, as it would mean changing the way in which InSim.NET handles strings. This isn't laziness however, it's caution.

I normally would have no problem messing with this sort of stuff, but I've finally got to the point where the LFS string encoding is working reliably, and I'd prefer to leave it stable for a while rather than messing around with it and possibly breaking lots of new things. It will need attention at some point, as there are several issues that have built up that I would like resolve, but they all require the same bit of code to be refactored.
  • InSim.Send(byte, string, params object[]) became (possibly) much less efficient in a recent bug fix
  • InSim.NET still works around the text bug in IS_BTN (as mentioned above)
  • The EncodingHelper static class needs to be rewritten as an actual System.Text.Encoding derived object.
All of these issues are connected and require modification to the same piece of code, so I'm going to put it off for a while until I really feel like doing it. It's also the piece of code which has caused about 8 of the last 10 bugs in InSim.NET, so I don't really want to change it unless I have to (I'm also thinking about taking an entirely different approach to coding it).

To sum up, I will keep InSim.NET up-to-date with the most stable release of LFS, unless I have a reason not to, and that reason might not be immediately apparent. I won't break InSim.NET however.
Quote from DarkTimes :Sorry, I didn't see this question before.

Well no problem at all, I was just curious.

Thanks for all the explanations too, that sounds awesome. ^^
This library actually makes me want to program in a way, it's weird. If it was still named Spark, I'd probably say something stupid like "It gives me the Spark", or some lame flat joke like that.
Thanks!

You should probably be asking how I've managed to write a class I'm afraid to touch incase I break it again.
Well, this is (or at least used to be, we will see) my regular routine, so I don't find it strange at all. xD

But what I do find weird... this library's progress goes mindblowingly fast, and in the meantime, you just decide and update another library.. pssht, just a regular thing, right?
Quote from broken :Well, this is (or at least used to be, we will see) my regular routine, so I don't find it strange at all. xD

But what I do find weird... this library's progress goes mindblowingly fast, and in the meantime, you just decide and update another library.. pssht, just a regular thing, right?

I had thought about updating it for a while, but I couldn't be bothered. Then I realised that the free license for Reflector runs out at the end of May, so if I was going to do it I would have to do it now. The main point was to post the source for LFS_External, as once that is up anyone can change it, and I wouldn't have to worry about the license for Reflector being changed.. The changes I made took literally 30 minutes and could have been done by anyone in the last two years.
weird problem i cant get key press function work , any sample how example insim click number 7 via insim. Thanks for help.
Quote from Nasty! :weird problem i cant get key press function work , any sample how example insim click number 7 via insim. Thanks for help.

Heya,

Sorry, I didn't see this before. To send a keypress you just send a IS_SCH packet, although you can also send a IS_MST with a /press command.

Anyway, here is an example of sending a IS_SCH to LFS.

using (InSim insim = new InSim()) {
insim.Initialize(new InSimSettings {
Host = "127.0.0.1",
Port = 29999,
Admin = String.Empty,
});

// Send IS_SCH packet.
insim.Send(new IS_SCH {
CharB = '7',
});

Console.ReadKey(true);
}

It should be noted that this doesn't do much, although if you open the chat box ('t') you can see the number being typed in game.

On a general note I'm waiting for Scawen to release the next patch with the planned InSim updates before I make a new version of this.
well, thanks i try test that. again good job with this lib this is rly awesome
I'll try and release an updated InSim.NET tomorrow. I've added all the updates but I need to test them.
Uploaded version 2.0.9 beta, what has stuff for 0.6A1 in it. It's a beta, I've tested it, but it will likely have some oddities.

FGED GREDG RDFGDR GSFDG