The online racing simulator
Searching in All forums
(921 results)
DarkTimes
S2 licensed
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.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Quote from MadCatX :Can't you just read the source of the MaKaKaZo's app? It's C++ so it's not exactly easy to read, but the basic idea is there.

You don't have to create any button, you just read the X, Y and Z coords from the MCI packet. MCI packet contains CompCar sturcture which holds the coordinates.
If you use extra libs like InSim.NET, you don't even have to know anything about network communication, I suppose tha X-Y-Z positioning can be done very easily with InSim.NET.

I did write a little example of this for InSim.NET a while back. It does write the coords onto a button, but could be easily changed.

using System;
using System.Collections.Generic;
using InSimDotNet;
using InSimDotNet.Packets;

class Program {
Dictionary<byte, IS_NCN> _conns = new Dictionary<byte, IS_NCN>();
Dictionary<byte, IS_NPL> _plys = new Dictionary<byte, IS_NPL>();

void Run() {
using (InSim insim = new InSim()) {
insim.Bind<IS_NCN>((s, p) => _conns[p.UCID] = p);
insim.Bind<IS_CNL>((s, p) => _conns.Remove(p.UCID));
insim.Bind<IS_NPL>((s, p) => _plys[p.PLID] = p);
insim.Bind<IS_PLL>((s, p) => _plys.Remove(p.PLID));
insim.Bind<IS_ISM>(InSimMulti);
insim.Bind<IS_MCI>(MultiCarInfo);

insim.Initialize(new InSimSettings {
Host = "127.0.0.1",
Port = 29999,
Admin = String.Empty,
IName = "Coords",
Interval = 1000,
Flags = InSimFlags.ISF_MCI,
});

insim.Send(new IS_TINY { ReqI = 1, SubT = TinyType.TINY_ISM });

Console.WriteLine("Coords running!");
Console.WriteLine("Press any key to exit...");
Console.ReadKey(true);
}
}

void InSimMulti(InSim insim, IS_ISM ism) {
insim.Send(new IS_TINY { ReqI = 1, SubT = TinyType.TINY_NCN });
insim.Send(new IS_TINY { ReqI = 1, SubT = TinyType.TINY_NPL });
}

void MultiCarInfo(InSim insim, IS_MCI mci) {
foreach (CompCar info in mci.Info) {
IS_NPL ply;
if (_plys.TryGetValue(info.PLID, out ply)) {
IS_NCN conn = _conns[ply.UCID];

string text = String.Format(
"X: {0:F2} Y: {1:F2} Z: {2:F2}",
info.X / 65536.0,
info.Y / 65536.0,
info.Z / 65536.0);

insim.Send(new IS_BTN {
BStyle = ButtonStyles.ISB_DARK,
ClickID = 1,
H = 8,
W = 30,
L = 80,
T = 4,
ReqI = 1,
Text = text,
UCID = conn.UCID,
});
}
}
}

static void Main() {
new Program().Run();
}
}

Last edited by DarkTimes, .
DarkTimes
S2 licensed
Quote from J@tko :Did Eddie Jordan actually just go into the Sauber garage and interview a random person?

That was the CEO of Sauber, Monisha Kaltenborn.
DarkTimes
S2 licensed
Quote from Juzaa :I don't know where it says Perez got a time since every sports site I go to clearly says that Perez does not have a lap time in Q3. In here for example is the grid before Hamilton's penalty:

http://www.itv.com/formula1/ra ... -prix-session-times-0843/

Ah, OK. I might be wrong then. I was looking at the BBC web site which shows him with a time of 1:15.482, although there is no indication of how that time was determined.
DarkTimes
S2 licensed
Quote from Juzaa :Care to explain why Hamilton should be 10th? Hamilton was faster than Perez in Q2 which makes Hamilton 9th and Perez 10th in the grid. Therefore 10th place will be empty not 9th.

I'm pretty sure 9th will be empty, as Hamilton got his only time deleted for jumping the chicane. Perez did manage to get a time in before his crash, which puts him ahead of Hamilton.
DarkTimes
S2 licensed
OK, you might need to wait for a PHP programmer to turn up, but sounds like you would need to pass the array by reference, which I believe you would do like this.

public function DoFunction([b]&[/b]$data) {

}

Check out this page from the docs.

http://php.net/manual/en/language.references.pass.php
DarkTimes
S2 licensed
Can't you just pass the $data variable to the function as a parameter?


<?php 
public function DoFunction($data) {

}

DoFunction($this->data);
?>

DarkTimes
S2 licensed
Who said delete anything? I said to re-add the LFS_External assembly to your project. The 'obj' folder is not designed to be touched by humans, that's why I think it's a configuration issue. Right-click on the project, select Add Reference and then select the LFS_External.dll file. Once that's done, recompile it.

Of course I might be completely wrong.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
It's impossible to know exactly what the error is, but that message says the issue is with the 'obj' folder, which makes it likely it's a configuration issue. I'd suggest re-adding the reference to LFS_External and then recompiling the project. I'm suspicious that's the issue, you just need to re-add the reference to that library.

I'd also suggest upgrading to Visual Studio 2010. It's free you know...
Last edited by DarkTimes, .
DarkTimes
S2 licensed
I updated the LFS_External example program to better reflect how I believe .NET programs should be written.

I uploaded the project to the library post. It requires VS2010 (express or better) to run it.
DarkTimes
S2 licensed
Because they're binary files designed to be read by programs, not by humans. You would need to write some code that reads the values, or alternatively you can open it in a hex editor.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Sure, no problem.

I updated pyinsim for InSim 5. As always it's on CodePlex.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Bitwise OR operator

BStyle = ISB_DARK | ISB_LEFT

DarkTimes
S2 licensed
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.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Thanks!

You should probably be asking how I've managed to write a class I'm afraid to touch incase I break it again.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
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.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Quote from S14 DRIFT :Actually registrys do get clogged up. Please note I did not advocae any program or even mention the use of programs. Thus Amp88 wouldn't use it as another excuse to try and establish his obvious superiority (being twice my age and all that).

Many programs install paths to the registry but some of these paths are not erased when you uninstall them, or if you move a game folder, new registry paths are recreated, for example if they use them to locate save game or config files.

The biggest clogger upper though are those pesky internet files which don't always save themselves to the folder specified...ah well.

Just cleaned 1Gig of junk off my PC and removed close to 200 eroneous (sp) registry entries. Probably won't speed it up because it's my HD which is getting old, but hey.

The registry does get larger with time, of course, but this has an extremely minimal impact on performance. The reason I mentioned programs that promise to speed up your computer by cleaning the registry, is that those are the chief source of the myth that cleaning the registry improves performance. Orphaned registry keys have practically zero impact on your computer, which is one reason Windows doesn't bother to clean them up itself. I'm not saying Windows performance doesn't degrade with time, it frustratingly does, just that the registry isn't a culprate.


Quote from thisnameistaken :It's precisely activity such as this which has turned Windows into the steaming bag of shit it is today. Do you remember the Windows source code leak several years back? I didn't go looking for it myself (seemed like a bad idea, commercially speaking) but apparently there are kludges like that all over it.

I'm actually saying the opposite, that these are the things that make Windows a good operating system. Every one of those little tweaks and hacks represent thousands of man-hours of testing and development. It's those little hacks that mean I can still run Planescape Torment on Windows 7. My understanding is that the code quality of Windows is actually pretty good, at least no worse than any other codebase of a similar size that's been in development for twenty years, which frankly there aren't many of. Seems to me that Windows works pretty well and they don't have problems adding new features, that's generally a good sign of a codebase's health.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
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.
DarkTimes
S2 licensed
Quote from Ant0niS :First of all, thanks DarkTimes for your time to update the library

I modified a little the vbnet example(outsim&outgauge) from the first post, to test the outgauge, but I found some problems and I can't figure out what it is wrong. I think something is wrong with the new dll...

-Throttle value reporting as brake
-Brake value reporting as clutch
-And none of the ShowLights reporting as on (always 0)

I attached my modified vbnet example for outsim&outgauge: http://www.box.net/shared/ktbcz35ob0

I hope you can check it sometime...
Thanks in advance and sorry for my poor English

Yup, I accidentally made the DashLightFlags a ushort instead of a uint. That caused all the fields that follow it to be shifted up two bytes. I uploaded a fixed version.

http://www.lfsforum.net/showthread.php?p=1589388#post1589388
Last edited by DarkTimes, .
DarkTimes
S2 licensed
DarkTimes
S2 licensed
Quote from MadCatX :and sort of clumsy user management where every third app requries admin rights to run.

Well, I discussed my feelings on UAC earlier on in the year in a very badly received and misunderstood thread regarding LFS+UAC (turns out most Windows users don't understand how Windows works). Fact is any issue people may have with UAC is the result of badly written programs, and not with any flaws in Windows itself. Sadly there are a lot of programs that don't understand how to play nice with Windows security and it's doubly-sadly that LFS is one of them. This is the complete failure of the programmers who write those programs. Anyway there is a very, very good argument to be made that UAC is the single best feature Microsoft have ever introduced to Windows.
Last edited by DarkTimes, .
DarkTimes
S2 licensed
Quote from S14 DRIFT :I think 7 is faster than XP and should stay faster for longer as well as it's not as stupid in terms of clogging up the registry.

Um... you do know that whole clogged up registry thing is a myth. I know a lot of people find this hard to believe, but it's true. Any program that pretends it can speed up your computer by cleaning out the registry is a scam.

But yes, Windows 7 is much more efficient. I've installed 7 on all my machines, and all of them run faster. Even the really sucky ones.
Last edited by DarkTimes, .
FGED GREDG RDFGDR GSFDG