View Full Version : x z y, positions program
Ziroh
2nd June 2011, 20:05
Hello,
Can anyone give me a link for a program that shows you your location?
I've tried this one: http://www.lfsforum.net/showthread.php?t=47675
but i get error when it's initialising or something...
Thanks
MariusMM
2nd June 2011, 20:15
You could just make yourself a simple local insim app, gathering that info from the MCI packet, and display it somehow to yourself, like a button that updates itself every second or something like that...
IIRC there should be something like that in the open source cruise insim application that Daugie-Lampkin (or similar name) made... Have a look in that source if you are unsure how to do it.
Ziroh
2nd June 2011, 20:39
Hm, to be honest i don't see any way to do that ^^ lol
MadCatX
2nd June 2011, 20:40
You have to have the pthread2GC.dll in the same dir as EXE for this app to run. Writing a simple X-Y-Z app yourself is a good way to learn InSim basics though...
Ziroh
2nd June 2011, 20:52
Ye, but.. can anyone give me some tips for making it?
I know that i should make a button, that gives the MCI packet, but how? :schwitz:
MadCatX
2nd June 2011, 21:18
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.
Mikjen
2nd June 2011, 22:22
Doesnt lapper give you this function
DarkTimes
3rd June 2011, 08:57
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();
}
}
nikka
4th June 2011, 22:49
http://www.lfsforum.net/showthread.php?p=766264#post766264
Ziroh
5th June 2011, 15:35
http://www.lfsforum.net/showthread.php?p=766264#post766264
Thank you :thumb:
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.