View Full Version : .NET - LFS External (InSim/OutSim/OutGauge SDK Library)
T-RonX
22nd August 2007, 20:59
Hello,
LFS External is an InSim/Outsim/OutGauge SDK library for the .NET Framework. This software allows you to build your own external Live for Speed applications.
You can use LFS External with any .NET language that supports dll files. It fully supports InSim V4, OutGouge and OutSim, C# and VB.NET example code is included.
Requirements:
- Microsoft Visual C# Express Edition 2005/2008 (http://www.microsoft.com/express/vcsharp/Default.aspx) (free!) (or another C# IDE) or
- Microsoft Visual Basic Express Edition 2005/2008 (http://www.microsoft.com/express/vb/Default.aspx) (free!) (or another VB.NET IDE)
- Knowledge of C# or VB.NET
Download
InSim Example
- LFS External 1.1 with InSim example for C# (http://www.lfsmods.net/lfs_external/lfs_external_insim_csf11.zip)
- LFS External 1.1 with InSim example for VB.NET (http://www.lfsmods.net/lfs_external/lfs_external_insim_vbf11.zip)
OutSim and Outgauge Example
- LFS External 1.1 with OutSim and OutGauge example for C# (http://www.lfsmods.net/lfs_external/lfs_external_outsim_outgauge_csf11.zip)
- LFS External 1.1 with OutSim and OutGauge example for VB.NET (http://www.lfsmods.net/lfs_external/lfs_external_outsim_outgauge_vbf11.zip)
Library only
- LFS External 1.1 library only (For advanced users) (http://www.lfsmods.net/lfs_external/lfs_external_lib11.zip)
Obsolete
- LFS External 1.04 (NOT recommended, old version) (http://www.lfsmods.net/lfs_external/LFS_External_Client 1.04.zip)
Update 1.1.1.4
- Updated TCP code
- Small performance improvement
Update 1.1.1.3
- Resolved string issue
Update 1.1.1.2
- Added missing TINY and SMALL send methods
Update 1.1.1.0
- Added support for OutSim and OutGauge
Update 1.1.0.0
- Faster and more reliable connection to host
- Auto reconnect on connection failure
- Better error handling
- Example code for C# and VB.Net
- Used more descriptive method names
- Now supports multiple instances of InSimInterface
- Lot of small things
Update 1.04
- Added IntakeRestriction property to Players class
- Removed unused property in Players class
- Player rename bug now really fixed
- Included license file
Update 1.03
- Fixed Player rename bug
- Added missing BFN (shift+i ingame) receive event
Update 1.02
- Fixed crash on crowded server
Update 1.01
- Compiled to dll
- Works much better but by far not perfect
- Fixed lot of bugs
- Added full UDP support
- Flags now work how they should
Updates since previous VB .NET version (http://www.lfsforum.net/showthread.php?t=17673):
- Upgraded to C#
- V4 support
- Supports MCI/NLP
- Automatically maintenances Connections and Players list
- A lot more..
Hollywood
22nd August 2007, 21:26
Uh, you know that LFSLib, which is a .NET LFS library, has been around for quite some time? :) Hate to see duplicated work (unless of course for learning purposes).
Hello,
I made an InSim base for C#. It can handle any InSim V4 packet in both directions. It's build to be mainly used with TCP, but it supports NPL/MCI over UDP too. You should start looking at frmMain(code), I explained the most important stuff there.
Updates since previous VB .NET version (http://www.lfsforum.net/showthread.php?t=17673):
- Upgraded to C#
- Supports MCI/NLP
- Automatically maintenances Connections and Players list
- A lot more..
This is my first big C# thing, so if there might be some bad code, don't start flaming. Instead, help me. :)
Happy coding. :smileypul
T-RonX
22nd August 2007, 21:28
Yes I know. It has been a kinda learning project :) And I think this one is much easier to use for beginners.
Xior
23rd August 2007, 11:09
I can't open the programm it says: "Rapport verzenden/Niet verzenden" when i open vshost.exe.
And when i open InSim_v4.exe it says: "Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd", what must i do now?
T-RonX
23rd August 2007, 11:13
Is this a realistic script like the [TC]City Drving server?
How can i use this script in my server?
It's not a script, its a base. You have to code all the stuff you want for your server yourself. This software handles the communication between LFS and you app.
Xior
23rd August 2007, 11:14
It's not a script, its a base. You have to code all the stuff you want for your server yourself. This software handles the communication between LFS and you app.
Oww oke, thanks for fast reply =}
//edit
I thought a insim server is a realistic server with cops etc..?
T-RonX
23rd August 2007, 11:26
//edit
I thought a insim server is a realistic server with cops etc..?
I don't know what you mean by that.
About the error:
Obviously you have to specify what server it connects to. Read the readme part at the top of the frmMain file
AndroidXP
23rd August 2007, 11:28
@Xior: No, InSim is the interface that allows communication between LFS and external applications. For example TC, CTRA and similar are such external applications that use InSim to interact with LFS.
Xior
23rd August 2007, 16:20
@Xior: No, InSim is the interface that allows communication between LFS and external applications. For example TC, CTRA and similar are such external applications that use InSim to interact with LFS.
So it's another mod they use to be a cop in that servers?
wheel4hummer
24th August 2007, 02:57
So it's another mod they use to be a cop in that servers?
InSim is a protocol for communicating with LFS through the use of TCP or UDP network packets.
CJ Ice
30th August 2007, 13:59
HI!
I was used ur insim base for vb, it was great like the new one is too. But i have a question about it. what packet can i use instead of the old MSS packet?
thanks for the answer and the good work u have done and shared with us.
T-RonX
30th August 2007, 16:07
HI!
I was used ur insim base for vb, it was great like the new one is too. But i have a question about it. what packet can i use instead of the old MSS packet?
thanks for the answer and the good work u have done and shared with us.
MSO, there is a TextStart variable in it.
---
I update the base. I compiled it to a dll so you don't have all the code in your project. Its far from perfect yet, but it works better then the previous version and a lot of bugs are fixed now. And it fully supports udp now. It's not throwing any exceptions yet if something goes wrong, but i'm working on that. It hasn't been tested very well yet...
T-RonX
7th September 2007, 23:20
Updated to 1.02
- Fix a bug that could crash InSim on crowded servers.
Don't forget to add the dll to your project! It's in the zip. Or if you were already using the previous version, you can just replace the dll file.
T-RonX
22nd September 2007, 18:31
Updated to 1.03
- Fixed Player rename bug
- Added missing BFN (shift+i ingame) receive event
CrazyICE
2nd October 2007, 20:49
can this also handle OutGauge?
Hollywood
2nd October 2007, 20:52
Don't think so... see the LFSLib; it handles InSim, OutSim and OutGuage along with the relay server.
can this also handle OutGauge?
CrazyICE
2nd October 2007, 20:57
ok, thx...
windstyle
18th October 2007, 15:44
Can someone give me a sample code of how to create a text field button? And is it possible to use multiple style flags (how?)
Hollywood
18th October 2007, 16:07
This is a text field...
System.Windows.Forms.TextBox tb = new System.Windows.Forms.TextBox(); // creates a new textbox
tb.Text = "whatever"; // sets the text of the textbox.
this.Add(tb); // adds the textbox to the form, represented by this.
This is a button...
System.Windows.Forms.Button btn = new System.Windows.Forms.Button(); // creates a new button
btn.Text = "whatever"; // sets the text of the button.
this.Add(btn); // adds the buttonto the form, represented by this.
Or better yet, just drag-n-drop it onto the form itself in the VS editor; this is pretty basic stuff though.... there are tons of tutorials on doing WindowsForm programming in .NET on the web.
Can someone give me a sample code of how to create a text field button? And is it possible to use multiple style flags (how?)
T-RonX
18th October 2007, 16:46
Can someone give me a sample code of how to create a text field button? And is it possible to use multiple style flags (how?)
InSim.Send_BTN_CreateButton("Button Text", "Title", Flags.ButtonStyles.ISB_DARK | Flags.ButtonStyles.ISB_CLICK, 5, 30, 100, 10, 96, 1, UCID, 40, false);
replace UCID by your UCID.
http://home.deds.nl/~t-ronx/stuff/TextBoxButton.png
As you can see it's an overloader. It's the same function but it requires different parameters.
And yes you can use multiple flags, but not combinations work, just try out.
Good luck.
@Hollywood: He ment an InSim button. :)
vane
3rd December 2007, 23:38
i was gonna have a go at coding something in here, can someone give me an example of a swear filter that says something when you swear. can you also show some examples of where like you write what packet it looks for and what it does when it finds it. thanks, vane
p.s maybe for next release you could have a button code but have // infront to demonstrate the layout of the code.
mcgas001
3rd December 2007, 23:44
i was gonna have a go at coding something in here, can someone give me an example of a swear filter that says something when you swear. can you also show some examples of where like you write what packet it looks for and what it does when it finds it. thanks, vane
why not just say "Will you teach me how to program in C#" thats basically what your asking.. but anyway
if(MSO.Msg.Contains("vane"))
{
InSim.Send_MST_Message("/msg " + Connections[GetConnIdx(MSO.UCID)].PlayerName + " said vane");
}
very basic and bad way but thats a possible way....
vane
4th December 2007, 00:10
well i asked you earlier and you said no :) are all the packet names in the commands.txt file?
vane
4th December 2007, 11:26
i have added that but it just underlines it in a red squiggly line in visual c# it says it cant find MSO in current context
dougie-lampkin
4th December 2007, 11:54
i have added that but it just underlines it in a red squiggly line in visual c# it says it cant find MSO in current context
Have you uncommented MSO in the "default" region?
Have you:
privatevoid MSO(Packets.IS_MSO MSO)
{
before your command?
These are the basics that I found out the hard way :tilt:
vane
4th December 2007, 12:49
thanks, its so confusing!!! best to learn the hard way, lapper makes it look so easy
whats a ucid? is there anything else i need to add to put that button code in with? thanks
i cant get the swear function to work i say vane but it doesn't say anything
thinking into the future is there any way i can connect this to download a pb.txt from an ftp site?
mcgas001
4th December 2007, 16:05
thanks, its so confusing!!! best to learn the hard way, lapper makes it look so easy
What you see is the easy bit, all that you see is a config, go look at the source code you wont be saying that again.
whats a ucid?
A UCID is a unique identifier, its kinda like going down a club, signing up and getting a member ship number.
vane
4th December 2007, 17:40
how do i find out the ucid to put in the button code?
T-RonX
4th December 2007, 17:45
how do i find out the ucid to put in the button code?
Most packets you receive contain a UCID. Something like MSO.UCID should work. If it's a PLID you get with the packet you have to use the connections list. If you want to send the button on any other moment, you have to use the connections list too.
vane
4th December 2007, 17:48
huh? so what do i type in instead of UCID
"ags.ButtonStyles.ISB_CLICK, 5, 30, 100, 10, 96, 1, UCID, 40, false);"
mcgas001
4th December 2007, 18:20
huh? so what do i type in instead of UCID
"ags.ButtonStyles.ISB_CLICK, 5, 30, 100, 10, 96, 1, UCID, 40, false);"
OK, you need to get the UCID from the packet(s) that come in, say you want to send that button when some 1 joins you look for the private void NCN, then inside of that event you add the button code you want but replace UCID with NCN.UCID and then it the insim program will send that button to a new connection!
vane
5th December 2007, 01:28
ah now i understand you, i looked earlier and thought oh god what the hell is he chatting about, thanks
p.s i assume if you only want one person to see the button, you add their ucid instead of ncn.ucid
mcgas001
5th December 2007, 05:23
No, the majority of packets are for each person in the server for example NCN stands for New Connection. Now theres always a packet fired on NCN with the new players details. So when someone connects to the server you have all the info you need. NCN.UCID is for only 1 connection but i have a plan that will help you understand, Try sending this inside of private void NCN.
InSim.Send_MST_Message("New User " + NCN.UName);
Then go and join the server and you will see what i mean about NCN being a packet for each person :)
vane
5th December 2007, 12:22
now the button works, but when i click it, it brings up a text box, how do i set what i want the button to do? which of the numbers changes the buttons location?
mcgas001
5th December 2007, 12:41
now the button works, but when i click it, it brings up a text box, how do i set what i want the button to do? which of the numbers changes the buttons location?
i get the feeling you have been looking at that pic in the other post by T-RonX *sigh*, basically button methods are overloaded so they can be a text box or just a average button. Delete the button text and try again. (If your using Visual C# IDE click the box that shows up and it will show you the different ways you can do that method)
vane
5th December 2007, 15:55
i dont not understand what you are saying :S what do i have to delete then what do i have to do after?
what do you do if the packet you want to detect for has ISP_ at the beginning (i want to know when someone votes to end race/votes to restart)
this is what i have so far
private void VTN(Packets.IS_VTN VTN)
{
InSim.Send_Small_VTA;
InSim.Send_MST_MESSAGE("/msg " + VTN.UCID + ", Do not try and vote");
}
vane
5th December 2007, 16:57
are you eventually going to make this work for outsim?
T-RonX
5th December 2007, 17:00
are you eventually going to make this work for outsim?
Yes
vane
5th December 2007, 17:16
good because id like to be able to use outsim and be able to have it open using a window, also could you release the source of your lfs mail so i could build it into my insim? cause i cant run two insims at the same time
mcgas001
5th December 2007, 18:04
i dont not understand what you are saying :S what do i have to delete then what do i have to do after?
what do you do if the packet you want to detect for has ISP_ at the beginning (i want to know when someone votes to end race/votes to restart)
this is what i have so far
private void VTN(Packets.IS_VTN VTN)
{
InSim.Send_Small_VTA;
InSim.Send_MST_MESSAGE("/msg " + VTN.UCID + ", Do not try and vote");
}
OK, first your sending a small? why?, if you wanna cancel a vote you send a
InSim.Send_TINY(Enums.Tiny.TINY_VTC, 0);
InSim.Send_MST_Message("/msg " + Connections[GetConnIdx(VTN.UCID)].PlayerName + " ^7do not try and vote");
You need to read inside of insim.txt and it will explain what packets carry and what they are used for...
vane
5th December 2007, 18:19
what packet is used to cancel the vote? i was thinking of having, if they vote to restart they get told not to but if they vote to end they get kicked
mcgas001
5th December 2007, 19:51
what packet is used to cancel the vote? i was thinking of having, if they vote to restart they get told not to but if they vote to end they get kicked
Do you not listen?????? i said clearly up there send a tiny VTC(Vote To Cancel)
vane
5th December 2007, 20:52
ah i miss interpreted you i thought that paacket you said was reading that someone had voted not to cancel it ill try it out thanks your keeping your temper with me :)
it won't do anything, do i need to do an "if"?
vane
6th December 2007, 23:02
i finally got that thing to compile but it doesnt say what location im at, is there any way i can make this location show up on a button(not a clickable one)
T-RonX
7th December 2007, 17:18
I suggest you take some C# lessons before trying to achieve all kinds of stuff.
vane
9th December 2007, 14:52
i think i understand the basic layout, unfortunately there isn't anywhere for me to actually take coding lessons but ill find some online coding lessons.
vane
11th December 2007, 23:56
what kind of code would i need to add to get a button that doesn't bring up a text window? thanks
T-RonX
12th December 2007, 17:20
Use other parameters on the same button method. It's an overloaded method. (Hit arrow down/up key when the yellow box appears)
See:
http://www.lfsforum.net/showthread.php?p=577998#post577998
vane
13th December 2007, 23:13
is there anyway i can get the insim to list all the connections to the host when i click a button(similar to the connections list) and a kick and ban button next to each name? thanks
dougie-lampkin
13th December 2007, 23:34
is there anyway i can get the insim to list all the connections to the host when i click a button(similar to the connections list) and a kick and ban button next to each name? thanks
Doesn't it do that by default? Why make one when it's there...
But to the question, yes it is. Each player has a PLID, which AFAIK are numbered 1-32 (or how ever many connections you have). Usernames and Playernames can be gotten from the PLID's in the button class I think, so then it's just a matter of making em! I personaly haven't used the button class yet, so this is all I can help you with I'm afraid...
EDIT: While I'm here, I have a question - does resolution affect insim button placement? I run at 1024 X 768 windowed, but if I make buttons to suit my resolution, what happens if someone with higher/lower resolution comes along? Are buttons made bigger, or do they look out of place?
JasonJ
14th December 2007, 05:49
Doesn't it do that by default? Why make one when it's there...Maybe he wants to grant acces to BAN without giving out the server password. :shrug:
&
Yes, buttons are scaled:
The recommended area for most buttons is defined by :
#define IS_X_MIN 0
#define IS_X_MAX 110
#define IS_Y_MIN 30
#define IS_Y_MAX 170
So a button using up 1/4 of the avaliable area (which is ~110x140) will use up 1/4 of the avaliable area no matter what resolution the client has. It's really handy to make it this way for all clients to be able to use the same buttons without anyone missing out.:tilt:
dougie-lampkin
14th December 2007, 21:06
Ah i see, thanks :thumb:
vane
16th December 2007, 21:47
exactly jason, and it will get annoying always typing in the admin pass :)
dougie-lampkin
17th December 2007, 20:41
Umm, I've just tried to do a button, but I can't get it to work...
I've used the above example in IS_BTN, but I can't see anything in-game. I've used 255 for UCID, InSim.txt says this shows it to all connections (I've also tried using the NCN.UCID, but that won't work either). I couldn't find the line for uncommenting the Default Methods region, do I need to make one for IS_BTN?
Thanks for reading :D
T-RonX
17th December 2007, 22:09
Umm, I've just tried to do a button, but I can't get it to work...
I've used the above example in IS_BTN, but I can't see anything in-game. I've used 255 for UCID, InSim.txt says this shows it to all connections (I've also tried using the NCN.UCID, but that won't work either). I couldn't find the line for uncommenting the Default Methods region, do I need to make one for IS_BTN?
Thanks for reading :D
NCN.UCID should work, make sure you set the right flags on the button, with some flags the button is still invisible. Just play around a bit.
Example:
InSim.Send_BTN_CreateButton("blabla", Flags.ButtonStyles.ISB_LEFT | Flags.ButtonStyles.ISB_DARK | Flags.ButtonStyles.ISB_CLICK, 5, 40, 52, 31, 100, NCN.UCID, 40, false);
You don't need to uncomment anything to create a button. But if you want to receive button clicks you have to enable the BTC event and create the method required. If you want to receive text from textbox buttons you have to enable the BTT event.
dougie-lampkin
17th December 2007, 22:35
NCN.UCID should work, make sure you set the right flags on the button, with some flags the button is still invisible. Just play around a bit.
Example:
InSim.Send_BTN_CreateButton("blabla", Flags.ButtonStyles.ISB_LEFT | Flags.ButtonStyles.ISB_DARK | Flags.ButtonStyles.ISB_CLICK, 5, 40, 52, 31, 100, NCN.UCID, 40, false);
You don't need to uncomment anything to create a button. But if you want to receive button clicks you have to enable the BTC event and create the method required. If you want to receive text from textbox buttons you have to enable the BTT event.
I presume that it needs to be sent from within void BTN(Packets.BTN BTN) ?
mcgas001
17th December 2007, 22:40
I presume that it needs to be sent from within void BTN(Packets.BTN BTN) ?
No you can send it where ever you need to send it..like the MST :)
dougie-lampkin
17th December 2007, 22:42
No you can send it where ever you need to send it..like the MST :)
Well that explains why it probably didn't work...lol
So, am I correct in saying that you need to make a new method (IS_MCI, IS_MSO, etc.) for RECEIVING packets only?
EDIT: Works now! TY guys!
mcgas001
17th December 2007, 22:43
Well that explains why it probably didn't work...lol
So, am I correct in saying that you need to make a new method (IS_MCI, IS_MSO, etc.) for RECEIVING packets only?
Yup :)
dougie-lampkin
17th December 2007, 22:51
Ah, that explains! TY :nod::thumbsup:
Evilvan911
18th December 2007, 04:27
where can we got a doccument for editing the form1.cs cause i try to set password for this and its keep saying "InSim : password does not match your multiplayer admin password"
thanks in advance.
dougie-lampkin
18th December 2007, 12:42
where can we got a doccument for editing the form1.cs cause i try to set password for this and its keep saying "InSim : password does not match your multiplayer admin password"
thanks in advance.
You need to open the LFS_External_Client.sln with Microsoft Visual C# (Or maybe other C# environments work, IDK...), and then the form1.cs
The password option should be set to "password" by default, if you search the source in form1.cs you'll find it :tilt:
Hope this helps...
T-RonX
22nd December 2007, 13:02
Updated to version 1.04. Now includes MIT license, bug fixes and some minor changes.
vane
22nd December 2007, 19:49
what is the difference between putting stuff in the form1.cs and program.cs? and also what does MIT license do? om guessing it checks for an lfs license :)
T-RonX
22nd December 2007, 20:06
what is the difference between putting stuff in the form1.cs and program.cs? and also what does MIT license do? om guessing it checks for an lfs license :)
Read the license.txt file included in the zip file for the license information.
vane
22nd December 2007, 21:13
would you put something like "void spectate" in the form1.cs?
dougie-lampkin
23rd December 2007, 01:38
Form1.cs is where you should put ALL of your InSim program. At least, I do, and it works perfectly...
DarkTimes
23rd December 2007, 02:39
what is the difference between putting stuff in the form1.cs and program.cs?
I would recommend that you spend some time learning about the C# programming language, specifically the part about classes and objects. You will find many introductory tutorials which answer your question by searching on Google.
vane
23rd December 2007, 14:51
i have a text box on the form of my insim, how do i make it so what ever you type in that box is the admin password?
T-RonX
23rd December 2007, 14:53
Take some C# lessons. Don't spam this thread with basic C# questions... Google is your friend!
mcgas001
23rd December 2007, 15:18
Take some C# lessons. Don't spam this thread with basic C# questions... Google is your friend!
+ 1
haelje
27th December 2007, 19:15
i followed the development of this lib with one eye since starting it, but the question i asked myself: why having a second LFSLib-like library, especially LFSLib includes still all aspects ?
mcgas001
27th December 2007, 19:29
i followed the development of this lib with one eye since starting it, but the question i asked myself: why having a second LFSLib-like library, especially LFSLib includes still all aspects ?
As T-RonX said at the start
it was a learning purpose of his!
its easier to use for a beginner
:)
the_angry_angel
27th December 2007, 19:30
LFSLib is also GPL'ed, which some people may not find suitable.
haelje
27th December 2007, 22:56
its easier to use for a beginner:) is it ? what is the "hard to use"-aspect of LFSLib ? i found it very easy to understand, very clear class structure and clear concepts ;) (but only my 2 cents)
mhh, that a GPL licenced lib for a community scares some people to use it, is also not understandable for me, but this is more a philosophy thing ;) i don't wanna do money with insim-progs or something similar so i dont care to give away my codes, but it's defenitely better for the community if there are more sources of all aspects of lfs coding, so all can take a look and find a lot nice solutions. ;)
PWILLARD
31st December 2007, 14:37
Really...
Why would GPL be an issue?
Let's see... A New LFS Patch comes out... the original solo developer now plays World Of Warcraft and never leaves to drive LFS again and can't be bothered to update code...
How many times have you been burned by closed binary only releases and the developer (some guy on his own) just gives up and fades away never to be seen again.
More people might get involved and help keep it running strong if the source is available . Big Deal... keep sharing the code and keep the community string.
Long Live LFS.
the_angry_angel
31st December 2007, 15:47
Really...
Why would GPL be an issue?Do you really want to turn this into an argument, because this is eventually how it's going to go, as opinions are involved? The problem with it being GPL'ed it spelt out very, very clearly by my previous posts, but lets go for it again.
The problem with the GPL is that any code that does not work "at an arms length" must be of the same or compatible licence. This practically means that any application developed using LFSlib must be GPL compatible, as a wrapper is not "at an arms length". This means that any program using LFSlib must be open source itself.
This doesn't affect how LFSlib itself is developed, it affects how programs developed with it are developed. This is my problem.
I'm personally pro open source, I'm not pro copyleft.
It's up to the developer of LFSlib naturally, and as I don't use it I couldn't give two hoots. I'm just trying to make clear the general issue people take with the GPL.
Hollywood
31st December 2007, 16:24
This means that any program using LFSlib must be open source itself.
Forcing InSim apps to be open-source I think its a grand idea. It means that if the original developer goes bye-bye, then someone else can pick up the tab so to speak. I like open source (of course, I work on all closed source on the job, so kinda straddle fence) but dislike the draconian FSF. Open source libs are great and I do feel they should be usable by all, but that changes/modifications/etc. to the lib should be forced to be open source.
It should be noted that the copyright holder of any piece of code could release that code under any number of licenses. It can and does happen.
dougie-lampkin
31st December 2007, 18:50
I haven't really looked into licenses that much, but if I release a program under the GPL, does that mean that it must be open-source? And if it is, can't every one just copy all my program and pass it as their own?
mcgas001
31st December 2007, 18:58
i "think" the licence means if you relase something using the LFSLib you must relase it with the same licence and relase the source code too :shrug:
dougie-lampkin
31st December 2007, 19:04
Doesn't seem fair to me...if I released a good program, everyone could just copy all my code and re-release it and take credit for it...
Maybe I'm interpreting the GPL wrong?
DarkTimes
31st December 2007, 19:14
Yes, if you distribute a program under the GPL then you must release the source.
I think the main point here is not if GPL is evil, it's just that addon programmers should really think about and understand the licenses that they use. Also, just because you want to make a project open-source, doesn't mean you need to do so under the GPL, there are many other less prohibitive licenses around. Plus at the end of the day there is nothing wrong with just ignoring them all and making up your own.
Heck, I'd suggest we write a special LFS Addon License, if I didn't think it would collapse into arguments. :p
http://en.wikipedia.org/wiki/Software_license
DarkTimes
31st December 2007, 19:24
Doesn't seem fair to me...if I released a good program, everyone could just copy all my code and re-release it and take credit for it...
Maybe I'm interpreting the GPL wrong?
If you're worried about that then don't make your program open-source to begin with. Just be careful what libraries you use, as the license they use may force you to.
dougie-lampkin
31st December 2007, 19:35
But even if I release my program free-of-charge as an add-on, do I have to include the source with it, or just supply it on demand?
BTW, what license is LFS External under? I didn't get a license.txt in mine.
DarkTimes
31st December 2007, 19:41
It depends entirely on which license you use, as each stipulate different conditions. The only thing is to read the license in question and see what it says.
dougie-lampkin
31st December 2007, 19:58
OK, thanks. Oh, I didn't get a license file in LFS External, but a post further up mentioned MIT...Is LFS External MIT?
T-RonX
31st December 2007, 23:45
Yes it is, I included the license file in the latest release.
PWILLARD
1st January 2008, 03:29
But even if I release my program free-of-charge as an add-on, do I have to include the source with it, or just supply it on demand?
I hope I don't sound like I'm ranting... I'm not. (Oh, and I'm new at posting here and missed the actual recent thread on Licencing... you have my permission to smack the noob.)
Dougie, You have to supply source... "somehow". Usually it means along side the release as a separate download but is commonly found in the same package.
Honest, I'm not trying to argue and I do know how GPL gets under some peoples skin. I'm also not looking for anyone to say "Hey, I agree with you!". I can be a lone wolf with my opinion and not mind it a bit.
The LINUX world has this GPL argument all the time. If the product is to be part of a "for sale" proprietary package... it gets downright uncomfortable to use GPL sources. The rule there is... "don't use it". It might mean you need to re-invent something, but that was the consequence. The real sticky part comes if you have a new idea "added" to the original GPL code that you are not completely willing to share and would prefer to just provide compiled code for your "novel" approach. It's a "no can do" with GPL, but OK with MIT or somthing more relaxed.
I prefer to think that the original goal of GPL is to counteract proprietary solutions and... amazingly enough... discourage code stealing because you always have to supply the code... If the revisions get reviewed and code is readily available... there is little possibility someone can steal code and call it their own. ;-)
Of course, if the GPL is not followed and code is assembled into binary and the souces are never supplied... well... it would take more than a few minutes to figure out it was originally GPL'd code. Time for lawyers in that case.
Anyway, for the add-on market proprietary usually means "for sale" and with items like LFS or any other PC based SIM or "toy", I'm certainly in favor of the developers that provide source code for the very reasons being discussed. I'm not saying people should not try selling sofware add-ons... just that I personally will always look at those items LAST. I'm not saying that because I'm pinching pennies.
Having been burned by orphaned software products one too many times in the past, I am now less likely to see payware as a preferred path for add-ons.
windstyle
2nd January 2008, 15:38
any idea when the source gets released?
T-RonX
2nd January 2008, 17:49
any idea when the source gets released?
As you can read in the first post, I will release it along with 1.05.
the_angry_angel
24th January 2008, 20:26
Hi guys. Not to be a shit, but would you mind producing some text or html orientated documentation so that those of us without Visual Studio can tell what the arguments for each method are. This would help those of us who don't use LFS_External, don't have visual studio (and have no intention of touching it with a barge pole) and are helping people out who are using it.
T-RonX
24th January 2008, 22:02
You are absolutely right. It currently lacks documentation. But thats because the current code structure is not final yet. The next version, which will be released soon has the final code structure, or at least final enough to make documentation for it. I'm not gonna make any documentation for this version.
I agree it needs some basic instructions to get you going though. I didn't expect it to be used by so many newcomers to programming.
Patience, next version.
Thank you,
Ron
the_angry_angel
24th January 2008, 22:37
No no, thank you Ron :up:
royk1991
26th January 2008, 02:09
i have a cruise sever buy i want money and stuff but i dont no how to do it help plz
mcgas001
26th January 2008, 02:18
i have a cruise sever buy i want money and stuff but i dont no how to do it help plz
Please scan over the other few posts regarding this topic. They may help you.
Ian.H
26th January 2008, 08:40
i have a cruise sever buy i want money and stuff but i dont no how to do it help plz
LOLOLOLOLOLOLOLLLLlzzzzz
(sorry, I couldn't think of anything constructive to say to this fool).
Ok, ok... constructive comment... hmm.... oh, how about you RTFM like everyone else!? :really:
Regards,
Ian
DarkTimes
26th January 2008, 17:59
i have a cruise sever buy i want money and stuff but i dont no how to do it help plz
Hello,
The answer to your question is in the forum FAQ (http://www.lfsforum.net/showthread.php?t=106). :)
Dygear
27th January 2008, 08:24
(sorry, I couldn't think of anything constructive to say to this fool).
Then, don't say anything at all?
Ok, ok... constructive comment... hmm.... oh, how about you RTFM like everyone else!? :really:
Not constructive at all.
Franke
27th January 2008, 10:31
Hi,
A bit of documentation would be in order, on that we can agree, but right now i need to know which of theese 3 letter code things to enable, to see when someone crosses the start/finish line, can anyone help, please?
Regards
Franke... Click
mcgas001
27th January 2008, 10:43
IS_LAP is the 1 you need iirc :)
Franke
27th January 2008, 11:21
Thanks a million, can you please tell me the one for split as well? :)
Forgot i need that one too :(
Regards
Franke... Click
T-RonX
27th January 2008, 11:22
SPX does the job.
Franke
27th January 2008, 11:55
SPX does the job.
Do you by chance have a variable containing the number of splits on track? Like a SPX.LastSplit indicator?
Regards
Franke... Click
mcgas001
27th January 2008, 11:57
Do you by chance have a variable containing the number of splits on track? Like a SPX.LastSplit indicator?
Regards
Franke... Click
You could make this you know? Simply save there last split and then use what info you need when the SPX comes in. After you have done with it, set the last split equal to the one that just came in.
Franke
27th January 2008, 12:02
Problem is i am making a rolling start simulator, and need to show text "LINE UP AND ENGANGE PIT LIMITER" message when 1st car passes last split :) And being 1st lap i don't know by then which split is the last...
I suppose i will need to make a file containing tracks and no. of splits on that track then...
Regards
Franke... Click
the_angry_angel
28th January 2008, 11:54
right now i need to know which of theese 3 letter code things to enableThe best way to figure that out is to check InSim.txt, and read the description for each packet. You'll find that the name of the packet should correspond with the function you need to write/enable/subscribe to when using LFS_External :)
Franke
28th January 2008, 17:53
Thanks TAA,
I actually found that file yesterday, when i was do some extensive searching for, but thanks anyways.
If anyone wants to se the result of the rolling start procedure i made, it's used on server: lfs-event.com
Just start a race, and it will activate automatically... Hopefully :)
Regards
Franke... Click
T-RonX
28th January 2008, 18:46
The next version will be much much better than the current one. Events will be more descriptive too.
Because there will be so many changes the current version will NOT be compatible with the new one. So you can't just replace the .dll to upgrade. Though you can easily copy the code and maybe adjust just a few lines to make it work again.
If you planned to make a project with this version I suggest you wait a few more days for the new one to come out.
dougie-lampkin
28th January 2008, 19:22
Is it worth upgrading to the new one? I have half-finished projects from the current version, would it be easier to keep them or convert?
mcgas001
28th January 2008, 19:24
Yes, the new version contains a lot of better code and other stuff...i have inside info ;)
T-RonX
28th January 2008, 19:28
Is it worth upgrading to the new one? I have half-finished projects from the current version, would it be easier to keep them or convert?
Converting will be quite easy because it will still work with receive events and I'll try to keep the sending commands the same.
dougie-lampkin
28th January 2008, 23:18
Sounds pretty cool then!
dougie-lampkin
5th February 2008, 14:48
Does anyone else have an error that everyone on track must be in spec when starting the app or it crashes? I get that on every app I've made with this SDK...I think it's that C# can't handle all of the NCN packets IDK...
T-RonX
5th February 2008, 15:12
Never noticed that error myself, but probably fixed in the next version.
I'm currently having some trouble getting it all together though. The next version uses a background worker for data arrival so nobody has to worry about threading. But you can't throw exception on a backgroundworker event. That completely messes up my code because I was implementing a auto-reconnect feature. :shrug: I think I'll leave the bgw out, it causes more trouble than I expected.
:Kick_Can_
mcgas001
5th February 2008, 16:36
Dougie in the Main method. Change
// Request all players and connections
InSim.Send_TINY(Enums.Tiny.TINY_NPL, 255);
InSim.Send_TINY(Enums.Tiny.TINY_NCN, 255);
To this....
// Request all players and connections
InSim.Send_TINY(Enums.Tiny.TINY_NCN, 255);
InSim.Send_TINY(Enums.Tiny.TINY_NPL, 255);
The current error is that its requesting player before connections! but that code fix's it
dougie-lampkin
5th February 2008, 17:14
Ah thanks Nova, fixed it :tilt:
dougie-lampkin
11th February 2008, 14:15
I recently found out that Insim uses 2 ports - the port as I knew it, and a port on which the server replies (which is usually +1). What listen port does LFS External use, as it isn't specified anywhere...
mcgas001
11th February 2008, 14:21
I recently found out that Insim uses 2 ports - the port as I knew it, and a port on which the server replies (which is usually +1). What listen port does LFS External use, as it isn't specified anywhere...
You just answered your own question there..
dougie-lampkin
11th February 2008, 14:27
So it's set to Insim port + 1?
T-RonX
11th February 2008, 16:30
You can specify what ports to use in the Settings struct. If you set TCP only and UDP to 0, TCP will be used only. If you set the UDP port too, MCI/NLP packets will be send over UDP on that port.
dougie-lampkin
11th February 2008, 19:15
But by default whats the listen port? (The client-side listen port...)
T-RonX
11th February 2008, 21:44
The UDP port is set to 0 by default, which means it uses port 29999 TCP, which is the default InSim port.
dougie-lampkin
11th February 2008, 23:00
OK cheers! Oh, one thing. To have 2 insim programs running off one server, they need the same TCP port right? What about UDP?
DarkTimes
12th February 2008, 01:27
No, they all need different ports.
dougie-lampkin
12th February 2008, 01:41
Say I have 2 programs. 1 runs on port 29999, the other 30000. When starting the first one, I use /insim=29999. But when I want to start the second one, if I use /insim=30000, will the first one not be lost?
NotAnIllusion
12th February 2008, 03:02
On the lfs insim server you use one port only. It handles all connections. Each client connection (per source ip) to the server needs to have its own port.
i.e, you start a dedi client and type '/insim 29999' in it.
Then you start one client that connects to that server's port 29999 from its port 30000.
Then another connection from 30003 to 29999 etc.
dougie-lampkin
12th February 2008, 12:15
OK, thanks for the info guys, much clearer now :thumb:
bukhem
15th February 2008, 15:59
Hey Ron.
First impression of your lib is ... uhm ... :tilt: ... a good start.
Really looking forward to that new version you promised :nod:
I just have one quick question concerning my "project", is your lib able to run with the Compact Framework (2.0)? Or at least can be compiled for it?
Will you lib be open-source anyway? :really:
Keep it up,
Michael
T-RonX
15th February 2008, 17:41
I haven't tried compiling it for Compact Framework. But ill opensource it when next version is release. You could have a try then. :)
bukhem
16th February 2008, 19:52
I haven't tried compiling it for Compact Framework. But ill opensource it when next version is release. You could have a try then. :)
I will definetly do that - when can I/we expect it? :D
dougie-lampkin
16th February 2008, 20:47
This may not be the correct place to ask, but is there any way of adding the framework to the solution as a resource, so those who use it don't need the framework installed?
mcgas001
16th February 2008, 20:54
This may not be the correct place to ask, but is there any way of adding the framework to the solution as a resource, so those who use it don't need the framework installed?
No, LOL. The .Net is over 200mb.
dougie-lampkin
16th February 2008, 20:56
Ah...then how come some programs made in Visual C# that you can download don't require the framework?
mcgas001
16th February 2008, 20:58
Ah...then how come some programs made in Visual C# that you can download don't require the framework?
iirc they do, Only some old one's are made using .Net 1 which is part of Windows XP install anyway. Therefor it does use the .Net just you dont realise :)
DarkTimes
16th February 2008, 21:21
Correct me if I'm wrong, but I believe anyone with XP SP2+ (which is most people, hopefully) will have at least .NET 2.0, as it came bundled with it. I don't believe .NET 1.0 is a part of the original 2001 XP, as I have that release version of XP and I don't remember it having .NET. I think .NET may have come with XP SP1 actually...
mcgas001
16th February 2008, 21:27
Yer i think it could be .Net 2 acutally, all i was trying to point out is that just because he hasnt installed it doesnt mean its not there :)
T-RonX
16th February 2008, 22:04
This may not be the correct place to ask, but is there any way of adding the framework to the solution as a resource, so those who use it don't need the framework installed?
You could include the .NET Framework webinstaller maybe. It's only a few kB big.
dougie-lampkin
16th February 2008, 23:50
hmm...thanks for the replies people :tilt:
mcgas001
17th February 2008, 09:16
Can i just ask, Why do you want to include the .Net in your project? are you making it in .Net 3.x?
T-RonX
17th February 2008, 11:37
I think you shouldn't worry too much about including it. IIRC the framework is available on the windows auto update service which you should have enabled on a client machine. If you have Vista you already have 3.0 by default. I think XP SP2 has 1.1 by default. If you run the app on 1.1 it comes up with a message you need a newer version of .Net and it provides a download link. So the people who need it can get it that way, rather than including it in your project wasting diskspace/bandwidth for the people who already have it. If you don't have any version of .Net installed you probably have an outdated OS or an outdated version of XP.
bukhem
24th February 2008, 19:15
Hey Ron.
Hows the progress going on with your lib?
I'm really kind of waiting for that next/new version to start my project with it as the LFSlib isn't working with the Compact-Framework of .NET. So, please share some status. :thumb:
Thanks :nod:
mcgas001
24th February 2008, 19:24
Ive been talking to T-RonX a lot and im basically posting on his behalf. The new lib is going ok, ive got a beta version of it, doing some test's etc etc.. The libs connection is much more stable now. Also making great use of the auto reconnect. I have to say this version i have is acutally quite amazing. I was shocked to see how much it can realy do. The lib also now supports more then one insim connection. meaning big programs can be used on more then one server if needed. There only a few bits left untill he release's it, some of which being packets being tweaked. But the main thing is, its not long now :)
bukhem
24th February 2008, 21:47
*wouldliketobebetatestertoo* :x
Mmmmh, could you do me a favour and try to compile the lib against the Compact-Framework? Its essential for me that the lib runs with the CF as my app should/will run a PDA.
Thanks. ;)
T-RonX
24th February 2008, 21:59
I'll do my best. I don't know much about CF, so I have no idea what things need to be changed. But I'll find out. :) Would be a nice addition if it could run on CF too.
Trekkerfahrer
25th February 2008, 09:22
will there be a small tutorial in the future? i found nothing useable and as a full noob in programming i have nearly no rescources, so its quiet hard to learn on your lib.
G. Dierckx
25th February 2008, 13:48
will there be a small tutorial in the future? i found nothing useable and as a full noob in programming i have nearly no rescources, so its quiet hard to learn on your lib.
In the current lib there was a demo in the zip file... + it had all packages in comment lines.. It's perfect to start learing InSim applications...
Trekkerfahrer
25th February 2008, 14:17
but there is no reference how to do and what can i do with it.... and the insim.txt tells me only what this means ;)
T-RonX
25th February 2008, 17:21
Yes I will add some documentation.
Trekkerfahrer
25th February 2008, 19:48
that would be really nice...
maybe with some code samples, that would make the business much easier :D
bukhem
25th February 2008, 22:05
Coding isn't always Cut & Paste :really:
Trekkerfahrer
26th February 2008, 00:22
but its learning by doing and smoetimes check some samples and see how it works ^^
vane
15th March 2008, 17:23
a bit of a noob question but it has completely slipped my mind. the "PIT" packet which is a byte, could someone give me an example of an if for it, if someone has got a drive through penalty (number 1)
mcgas001
15th March 2008, 17:33
IS_PIT does contain a penalty, although its not live. IS_PEN does and sends it as the penaltys happens. It gets fired when someone gets a penalty. If you want to see if its Drive through penalty.
if (PEN.NewPen == Enums.Penalty.PENALTY_DT)
{
// Do something
}
That should work fine. :)
DarkTimes
15th March 2008, 17:58
I dunno anything about LFS_External, but the IS_PIT packet does contain a penalty value...
struct IS_PIT // PIT stop (stop at pit garage)
{
byte Size; // 24
byte Type; // ISP_PIT
byte ReqI; // 0
byte PLID; // player's unique id
word LapsDone; // laps completed
word Flags; // player flags
byte Sp0;
byte Penalty; // current penalty value (see below)
byte NumStops; // number of pit stops
byte Sp3;
byte Tyres[4]; // tyres changed
unsigned Work; // pit work
unsigned Spare;
};
Maybe LFS_E treats it differently though.
mcgas001
15th March 2008, 18:09
Oh Crap, I was thinking of IS_PLP...Sorry!!!
With that said, In order to catch a penalty as it happends, you will need to use IS_PEN.
vane
15th March 2008, 19:12
thanks :) i've just figured out my self about int(integers), strings and decimals :)
vane
15th March 2008, 19:51
ok i got that if in you posted mcgas and it works but i want to be able to make it so it says a message that says {username} was kicked for speeding in the pits but it just says the host's name, could you help me? thanks
mcgas001
15th March 2008, 20:27
Seen as the IS_PEN only contains the PLID you have to go into the players list for the playername or, into the players list then the connections list, something like...
Connections[GetConnIdx(Players[GetPlyIdx(PEN.PLID)].UniqueID)].Username
vane
15th March 2008, 21:09
thanks mcgas, works like a charm :)
vane
16th March 2008, 17:12
i wanted to make an if that finds out if the node is between 136 and 188
heres what i know
if (MCI.Info[0].Node >= 136 (cant remember what goes here) <= 188)
could you help me?
dougie-lampkin
16th March 2008, 17:25
C# uses operators && (and) || (or)
So to check if they're between 136 and 188, use:
if ((MCI.Info[0].Node >= 136) && (MCI.Info[0].Node <= 188))
Hope that helps...
vane
16th March 2008, 17:59
thanks :)
vane
17th March 2008, 22:29
i have got some buttons saying the location of yourself coming up but they only come up on the first person out of the pits, unless they spectate then join again, how could i get around this? thianks
mcgas001
17th March 2008, 22:32
i have got some buttons saying the location of yourself coming up but they only come up on the first person out of the pits, unless they spectate then join again, how could i get around this? thianks
Explain in more detail please, im a little confused..
dougie-lampkin
17th March 2008, 22:55
If I understand correctly, the problem is that only MCI packet 1 is used. What you need to do is make a for loop, like so:
for (int i; i < Players.Count; i++)
{
// do whatever code here, replace 0 with i
}
:shrug:
T-RonX
18th March 2008, 12:47
If I understand correctly, the problem is that only MCI packet 1 is used. What you need to do is make a for loop, like so:
for (int i; i < Players.Count; i++)
{
// do whatever code here, replace 0 with i
}:shrug:
You must not use Players.Count because 1 MCI packet contains up to 8 players only. Lets say if there are 18 players, there will be sent 3 MCI packets in a row. The first packet holds player 1 to 8, the second packet holds player 9 to 16 and the 3rd packet holds the last 2 players. So you have to make some sort of counter to loop trough all the players.
the_angry_angel
18th March 2008, 13:43
So you have to make some sort of counter to loop trough all the players.The NumC element of the IS_MCI contains the number of Compcar structs in a given MCI packet.
Keeping your own tracking is irrelevant and unreliable if you're using it to determine how many Compcar entries exist.
mcgas001
18th March 2008, 13:46
I think you need something like this: (Taken from LFSLapper[Thanks])
for (int i = 0; i < System.Math.Min(8, Players.Count); i++)
{
}
T-RonX
18th March 2008, 14:07
The NumC element of the IS_MCI contains the number of Compcar structs in a given MCI packet.
Keeping your own tracking is irrelevant and unreliable if you're using it to determine how many Compcar entries exist.
Yes you are right, I forgot about NumC. Thanks.
vane
18th March 2008, 18:26
with the original code if two people left the pits the second person has the first persons MCI information like co-ordinates, could someone help me?
G. Dierckx
23rd March 2008, 15:26
Still alot of work until the next release? (can't wait to try it out :nod:)
shaun463
26th March 2008, 16:14
Thanks for this :)
I'm onto my first public project I think :)
mcgas001
26th March 2008, 16:18
2 years younger then sun and you can work better then him. That shows what putting some work into learning does. Well done Shaun :)
shaun463
26th March 2008, 17:48
Thanks Sean :)
dougie-lampkin
27th March 2008, 01:32
Correct me if I'm wrong, but is there no packet handler thingy for IS_REPLY? I've enabled it's event by uncommenting it, but I can't for the life of me work out how to set up the method :shrug:
mcgas001
27th March 2008, 01:37
Correct me if I'm wrong, but is there no packet handler thingy for IS_REPLY? I've enabled it's event by uncommenting it, but I can't for the life of me work out how to set up the method :shrug:
IIRC, you need to receive IS_TINY, then you can check its subtype. I beleive its "SubT", but anyway, Im sure that works.:scratchch
dougie-lampkin
27th March 2008, 01:51
Then what's the point in having an event handler for IS_REPLY, if it comes in with IS_TINY?
It does come in with IS_TINY though, thanks :)
mcgas001
27th March 2008, 01:55
I dont know, Ask the creator (http://www.lfsforum.net/member.php?u=8887).
T-RonX
28th March 2008, 20:12
Updated LFS External to version 1.1
Updates:
- Faster and more reliable connection to host
- Auto reconnect on connection failure
- Better error handling
- Example code for C# and VB.Net
- Used more descriptive method names
- Now supports multiple instances of InSimInterface
- Added documentation
- Lot of small things
This version is NOT compatible with any previous version of LFS External. This means you cannot upgrade by just replacing the dll file. You have to copy/paste the code from the old version to the new one.
You should really consider updating especially because the connection is much more stable and it has much better error handling.
the_angry_angel
29th March 2008, 00:46
Just wanted to spam a little and thank you for your work on LFS External T-RonX :up: You're one of many doing some very good work for the community!
dougie-lampkin
29th March 2008, 02:54
Just converted some of my projects into the new version, I have to say it's incredibly tidy, everything is already set up, all I had to do was Copy + Paste :D
Gratz on the good job, it's very much appreciated by me, I use it for all my LFS projects :thumb:
T-RonX
29th March 2008, 20:59
Updated LFS External to version 1.1.1
Updates
- Added support for OutSim and OutGauge
This update us fully compatible with version 1.1.0, you can replace the dll. I just added 2 new namespaces. LFS_External.OutSim and LFS_External.OutGauge.
I added a examples for C# and VB.NET too.
Hope you like it,
Ron
revolucio
30th March 2008, 14:39
Good job T-RonX. :)
I have a problem, the problem is how to make a configuration file (Setup.txt for example) and the program read it, for the connection options.
Thanks ;)
T-RonX
30th March 2008, 14:46
Obviously that is not a part of LFS External. You should google something like this (http://72.14.221.104/search?hl=nl&q=C%23+file+io&lr=&btnG=Google+zoeken).
revolucio
30th March 2008, 16:33
Obviously that is not a part of LFS External. You should google something like this (http://72.14.221.104/search?hl=nl&q=C%23+file+io&lr=&btnG=Google+zoeken).
Ok, Thank you T-RonX. I have succeeded ;)
vane
3rd April 2008, 21:24
why not put the configuration settings on the form1? like admin pass, ip address and port number?
DarkTimes
3rd April 2008, 22:07
why not put the configuration settings on the form1? like admin pass, ip address and port number?
Because then if someone wants to edit a simple configuration setting, they will need to download and recompile the source. That's probably OK if you're a programmer who has the IDE and knows the language, but if you are giving you program away to, you know, normal people, then that would be insane. Would so many people use LFSLapper if they needed to recompile the source every time they wanted to change the admin password? No, they wouldn't. In my opinion it's a very good idea to put configuration settings in a separate file that's easy to edit. Or even better if your program is graphically based, write a special options dialogbox.
dougie-lampkin
3rd April 2008, 22:58
Or even better if your program is graphically based, write a special options dialogbox.
I think that's what he meant :x
I prefer using the separate config file though, as the user doesn't have to re-adjust it every time :)
DarkTimes
3rd April 2008, 23:11
I think that's what he meant :x
OK - I apologise, I misunderstood. I though he meant to hardcore them into the main form. Sorry.
dougie-lampkin
6th April 2008, 19:24
Is there a bug with the SPX PLID? When I use:
Connections[GetConnIdx(Players[GetPlyIdx(SPX.PLID)].UniqueID)].Username
I get an IndexOutOfRange Exception...
Has anybody else come across this?
G. Dierckx
7th April 2008, 05:37
Is there a bug with the SPX PLID? When I use:
Connections[GetConnIdx(Players[GetPlyIdx(SPX.PLID)].UniqueID)].UsernameI get an IndexOutOfRange Exception...
Has anybody else come across this?
Alot of times... I had the problem every time i started my insim on a full server, some NCN packages got dropped.. so these players where in the Players list but not in the Connections list.. Fixed it with some threads on the NCN handler (to reduce the execution time)
Greetz Glenn
mcgas001
7th April 2008, 08:53
Glenn, Have you tried doing as i said here (http://www.lfsforum.net/showthread.php?p=699184#post699184), Im sure its fixed in 1.1.0> but if your still using 1.0.4 then it isnt.
E: Making a new thread just to handle NCN isnt a good idea really, Use the backgroundWorker or the threadpool. Thats if you MUST use a thread, which IMO isnt needed.
dougie-lampkin
7th April 2008, 21:29
This is using 1.1.0, and the SPX packet is the first time I've come across this. It happens no matter how many people are in the server...
vane
8th April 2008, 15:59
when i opened the source for 1.1 up i got very confused :) it looks so different from the old one :)
vane
11th April 2008, 20:56
how do you open the example outgauge thing? i am having trouble :s it says incorrect bind handle
T-RonX
11th April 2008, 21:28
Have you tried a different port yet?
vane
12th April 2008, 13:10
oh it was just that i was trying to debug it but you cant :) is there any way you can speed up the packet transfer? so there is less lag between the stuff showing on the form and lfs?
T-RonX
12th April 2008, 16:03
change 'OutGauge Delay' to 1 in the lfs config.
vane
12th April 2008, 17:48
i have tried that but it does not seem to make it any different, do you have to modify anything in the app?
T-RonX
12th April 2008, 17:53
Nope. But make sure you closed lfs before editing the config, else lfs will overwrite it with the old settings.
vane
12th April 2008, 22:18
lol :)
AndroidXP
14th April 2008, 17:59
Just a question to see if I'm a numpty or if it is a genuine problem; is LFS External supposed to work with an InSim configured/initialised OutSim port?
What I try to do is:
1) Connect via InSim
2) Send a SMALL SSP packet to init OutSim
3) Read OutSim and use its data for various calculations
4) Send commands via InSim based on the calculated data
The problem is as far as I can tell, that the InSim class automatically creates an UDP listener as soon as you specify an UDP reply port in the IS_ISI packet (actually class constructor). However, in the case for the SMALL SSP packet, this setting is used for configuring OutSim. Now of course I cannot listen to the OutSim port, because the InSim class already has the listener bound to it. Adding to that it throws an exception as soon as LFS starts sending, as it can't handle the OutSim packets (they don't have the packet size/etc. header information, and after all it's expecting InSim packets to arrive).
I got it working right now, but it's very very hacky, and I'd rather use it the proper way. At the moment I'm using a custom written OutSim handler (the OutSim class somehow errors with a NullReferenceException if I try to use it in conjunction with the other hack), and hacked the LFSExternal.dll to not create the UDP listener for the InSim class.
I'm fearing it's something embarrassingly simple and I'm solving problems with a sledgehammer here, but I tried and tried and can't seem to get it working the proper way. :shy:
AndroidXP
15th April 2008, 18:11
Got it working now - it's still a workaround but at least much less of a hack then previously. I wrote a primitive InSim handler to connect to LFS, initialise OutSim and disconnect again, then re-connect via LFS External to have proper InSim handling.
I'm much happier with this approach, so I guess I'll continue using it that way, unless someone can point out a glaringly obvious mistake I made :thumb:
G. Dierckx
27th April 2008, 10:23
Hey T-Ronx,
Normally when you connect to the lfs server with a insim program and the lfs server shuts down it should keep on trying reconnecting right? I just tried it and I got this exception:
System.IO.IOException was unhandled
Message="Kan geen gegevens lezen uit de transportverbinding: De externe host heeft een verbinding verbroken."
Source="System"
StackTrace:
bij System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
bij LFS_External.InSim.InSimInterface.listen_tcp()
bij System.Threading.ThreadHelper.ThreadStart_Context( Object state)
bij System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
bij System.Threading.ThreadHelper.ThreadStart()
And it doesn't point to any line so could it be a "bug" in the class itself?
AndroidXP
27th April 2008, 10:42
That's the same I was getting... do you by any chance have a secondary connection open to LFS in some way? Anyway, the exception is thrown in LFS External's TCP listener thread, so there's no way for you to catch it - it would have to be handled by LFS External itself.
G. Dierckx
27th April 2008, 11:41
nope only 1 connection
T-RonX
27th April 2008, 11:42
Ok it could be a bug. I just reinstalled my OS so I can't have a look right now. I'll investigate when I have time.
Stigpt
8th May 2008, 21:54
Im trying to do something in my PDA. I wonder if this .dll would work on a WM6 pda... (basically I need to communicate with LFS running on my pc, and the easiest way I can figure out to do it is via networking - outgauge to the PDA).
dougie-lampkin
8th May 2008, 22:20
If it's actually networked, whether wireless or wired, it will have an IP to the PC. In LFS' cfg.txt file, change the IP to that of your PDA. Then run LFS_External on the PDA, and it will receive info from the PC :shrug:
Stigpt
8th May 2008, 22:24
awesome, big thanxs.
BTW, other than networking, any other way to commumicate with the PDA (assuming its connected with the USB cable and has activesync on)?
I really have NO idea, and I tried and tried and could find anything remotly usefull on teh web.
dougie-lampkin
8th May 2008, 22:26
I'm not sure about USB...my idea would only work with Ethernet/Wi-Fi...AFAIK USB doesn't have IP addresses, and would be a hell of a lot more complicated, unless you can find a pre-made lib for your specific PDA...
the_angry_angel
9th May 2008, 00:25
You used to beable to get a TCP/IP connection between a PDA and a Windows Mobile device, over ActiveSync - however the last time I had a WM device to play with was over a year ago, so things may have changed.
I believe in ActiveSync if you go to File > Connection Settings there is an option in there to communicate using TCP. However, I think that only recent versions of WM (WM5, I think) actually present a usable network interface, which is part of the problem of getting WM to talk directly to applications on the host PC.
First thing I'd check is what version of WM you're trying to use, what version of ActiveSync, and whether or not you get an extra network interface when you enable TCP over ActiveSync...
Stigpt
10th May 2008, 23:46
I found something pretty cool, though TAA - when I connect the PDA, a new (my 4th) network connection appears - this is the network connection via USB to my pda. I think I can set the TCP/IP protocol to always give it the same IP.
But Im having a lot of trouble of having the bloody program run in the PDA.
I can make a "hello world" style thing, that takes a textbox and outputs the string again, but the program using LFS External wont work (tells me it cant run System - or somethin like this)
More details when I get the time to pick this up again :D
dougie-lampkin
10th May 2008, 23:54
Does the PDA have .NET 3.5 installed on it? If .NET can even be installed on a PDA, idk...It seems like a framework error anyways :shrug:
DarkTimes
10th May 2008, 23:58
Most likely it will be running the .NET Compact Framework (http://msdn.microsoft.com/en-us/netframework/aa497273.aspx).
dougie-lampkin
11th May 2008, 00:01
Ah yes, in which case you'd need to compile the program specifically for the Compact Framework, right? Haven't dealt with PDAs before, I'm too poor to own one :(
DarkTimes
11th May 2008, 00:13
Well I'd be very surprised if LFS_External would run on the CF at all without an awful lot of work. Also seeing that LFS_E still closed source, it's not likely anyone would be able to do anything like that soon. I do know that a CF compliant version of LFSLib is in the works, but I don't know what the current state of that project is. Still, if you wanted to write a CF InSim program, nothing is to stop you writing your own InSim code, it's really not that complicated.
mcgas001
11th May 2008, 09:15
You dont acutally need to own a PDA iirc. Visual studio has something built in called a "Device emulator". You can emulate a PDA, although Im not sure how to run programs on it.
Stigpt
11th May 2008, 10:53
I had .net compact fmwrk 2.0. I installed the .net CF 3.5 and the program STARTED to run, then crashed with the message.
Me thinks the program begins, then as it loads LFS external, boom. which isnt surprising, and is why I asked what I asked a couple posts above.
Guess Ill have to code the tcp/ip stuff myself... oh well... more stuff to learn, I guess :D
T-RonX
11th May 2008, 11:35
I'm currently having a look at making it CF compatible, but I can't promise anything yet.
T-RonX
11th May 2008, 20:19
Just a progress update. It seems to work so far. I might release a test version tomorrow so we can hunt for bugs.
Stigpt
13th May 2008, 16:45
I want to have your babies.
KlausAdam
14th May 2008, 09:29
I need a little help in using the InSim.Send_BTN_CreateButton Method.
I' using LfS_External_vbf11 and event NCN_ClientJoinsHost.
Here is what works fine:
InSim.Send_BTN_CreateButton("Team:", "Team:", Flags.ButtonStyles.ISB_DARK + Flags.ButtonStyles.ISB_LEFT, 5, 20, 65, 20, 0, 101, NCN.UCID, 101, True)
InSim.Send_BTN_CreateButton("OK", Flags.ButtonStyles.ISB_CLICK + Flags.ButtonStyles.ISB_DARK, 5, 40, 70, 40, 103, NCN.UCID, 103, False)But I need to have an input-box for text also. I tried many conbinations and the one out of the documentation as well:
InSim.Send_BTN_CreateButton("Click me", "I'm a textbox", Flags.ButtonStyles.ISB_CLICK + Flags.ButtonStyles.ISB_DARK, 10, 20, 50, 100, 10, 24, NCN.UCID, 98, True)
InSim.Send_BTN_CreateButton("Type Name here", "Type Name here", Flags.ButtonStyles.ISB_LIGHT, 5, 40, 65, 40, 20, 102, NCN.UCID, 102, True)but no luck. The Buttons won't appear. What's wrong? I know it shout be working, T-RonX is using it for his Mail-System, but how the hell?
ReVoX
14th May 2008, 13:36
For the using the fuction when you click button:
if (BTC.ClickID.Equals(HERETHEID))
{
//here your code for when you clicked, for example, when you click send /msg.
InSim.Send_MST_Message("/msg ");
}
For type in the button I don't know how to, some people can post a example?
PD: You are sure your code are true? I believe is wrong.
for example ISB_DARK+ISB_CLICK, the operator for "or" is " | "
KlausAdam
14th May 2008, 13:42
I'm using Visual Basic not C, so the operator should be correct.
The simple Click-Button ist working fine, only the dialog-ones won't work.
dougie-lampkin
14th May 2008, 13:46
For the buttons, where you have '+', the operator is indeed '|'. Normally it is '+' (plus), '||' (or) or '&&' (and). I'm not too sure how you receive the text entered into a textbox, but it should be in "LFS/docs/insim.txt" anyway...
AndroidXP
14th May 2008, 13:52
The + will work, since it has (in that case) the same result as a bitwise OR. The correct way would be using ISB_DARK Or ISB_CLICK, though.
ReVoX
14th May 2008, 13:55
My code run fine, but I use C#, you only need put the ID and the action what you want.
KlausAdam
14th May 2008, 14:16
Ok, I try to explain more precisely:
A Click-Button works fine:
InSim.Send_BTN_CreateButton("OK",Flags.ButtonStyles.ISB_CLICK + Flags.ButtonStyles.ISB_DARK, 5, 40, 70, 40, 103, NCN.UCID, 103, False)
even with Or instead of + this is still working
InSim.Send_BTN_CreateButton("OK",Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 40, 70, 40, 103, NCN.UCID, 103, False)
even the other way (more parameters) is fully functional
InSim.Send_BTN_CreateButton("OK","Here should be the Dialog-Text",Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 40, 70, 40, 0, 103, NCN.UCID, 103, False)
The way to tell a Click-Button to be a Dialog-Button is to give it a value greater then zero for TypeIn. You may have a look into the LFS External Documentation (InSimInterface.Send_BTN_CreateButton Method).
So I did provide a value like 20, 30, 95, 127, 255 with only one result: The Button isn't visible anymore.
I'm not sure but it could be that Dialog-Buttons won't work on server-based InSim-Applications, only in client-based ones.
*** Ahhh, I had a look to the Dedi-Server and saw a message: Dialog-Button cannot always be visible. I changed the last parameter (AlwaysVisible) from true to false, and now it works as expected!
Thanks for your help anyway!
ReVoX
14th May 2008, 18:19
I am testing in Debian, LFS crashed and I don't know what is the problem, I am using Debian, Mono 1.9 for .net and Wine.
Have some crash, 1º problems with System (Mayority of System.IO, I use for define the patch @"users" for create a folder in the same route where I execute the aplication.) and LFS external, the screenshots are in different time, when I fixed one problem apeear other.
http://i255.photobucket.com/albums/hh158/SpainDragTeam/linux.jpg
bapaf
16th May 2008, 08:20
Hi all.
I will send an TINY(InSim.Send_TINY(Enums.Tiny.TINY_VTC,0) ), but when i write InSim.Send_TINY, i dont find the method??
Im using LFS_External 1.1.1.0;
Can someone help me to send an TINY Packet
thx
dougie-lampkin
16th May 2008, 10:50
When sending out packets through InSim, you don't need to send them from a particular method. To send a TINY_VTC, it would be something like this:
InSim.Send_TINY(Enums.Tiny.TINY_VTC, 255);
When a vote is cancelled successfully, LFS sends back a TINY_VTC packet.
// When a vote is cancelled, LFS sends this IS_TINY
// ReqI : 0
// SubT : TINY_VTC (VoTe Cancelled)
Hope that helps :)
bapaf
16th May 2008, 18:21
Yes, that is what i would do and thats wright what y writing, but i have the problem that the Send_TINY is not in my package, grazy ?????
Here is a Screenshot of my InSimInterface Sendmethods. No Send_TINY
dougie-lampkin
17th May 2008, 10:46
Yes, that is what i would do and thats wright what y writing, but i have the problem that the Send_TINY is not in my package, grazy ?????
Here is a Screenshot of my InSimInterface Sendmethods. No Send_TINY
Ah, I see what you mean now :shy: It isn't there in v1.1.0.0 for some reason...unless I just can't see it...my example was from the previous version though...
bapaf
17th May 2008, 16:36
I hope T-Ronx fix the problem.
Great work
T-RonX
18th May 2008, 21:01
Here is an experimental Compact Framework compatible build. There is a slight issue, since Win CE is fully unicoded and does not support Ansi marshaling the only way to put single byte char strings in the packets is with a byte array. So you have to convert the strings manually. In upcoming versions I will make a layer between the packet and receive event so I can solve this issue nicely.
Oh and don't worry about the new namespace, thats for the upcoming release. :scratchch
Would be nice if anyone could have a test. :)
Thanks,
Ron
elmohellno
26th May 2008, 21:14
If you hold Ctrl+T for a minute it disconnects the insim from the server. Can you fix this?
Dyllaann
3rd June 2008, 16:57
im getting a build error and i havent changed any code .... "
Handles clause requires a WithEvents variable defined in the containing type or one of its base types"
I havent even touched the coding, whats wrong? I am noob at Visual Basic , So please bear with me....
dougie-lampkin
3rd June 2008, 18:34
It's Visual C# :)
T-RonX
3rd June 2008, 19:16
It's Visual C# :)
It's available in VB for quite some time now. :nod:
dougie-lampkin
3rd June 2008, 21:07
So it is :eek:
Never even noticed that, nice work :thumb:
elmohellno
4th June 2008, 07:10
What download is the source included in?
T-RonX
4th June 2008, 10:08
What download is the source included in?
None yet. There are some things I need to take care of first. If thats done, I'll make the source available for download.
Stigpt
8th June 2008, 10:29
t-ronx, when I try using your lib for outgauge on compact Framework(didnt use it for insim yet), it gives run-time error of "cannot load System with this version of....."
You didnt update outgauge for CF, did ya? :D
Im trying to code a gauge for windows mobile 5 - should be a big hit.
Another way, of course, is simply code my own listener, but my m4d sk1lzzz dont quite strech that far yet. (maybe after exams Ill go dig up my Computer Networks notes, and go and code a TCP listener myself).
T-RonX
8th June 2008, 11:06
Yes, I only updated InSim so far. OutGauge and OutSim will be updated in the final version too.
Stigpt
9th June 2008, 10:13
kk, thxsw for the fast reply. Now to find out some interesting app to do using insim and a PDA... :D
Maybe lapper-ish thing together with my pitboard... :D
thingsToDo.add(new Project(LFS_External, PDA, new Project()));
wifeHappiness --;
:D
Silox
30th June 2008, 12:08
Hey T-RonX,
I'm coding like 2 days now in VB with your LFS External and I get it bit by bit...
My knowledge of VB is good, but not excellent ^^ Forgive me for the crappy code =$
I'm trying to make a visual admin panel but I have this error:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
In this piece of code:
Me.Invoke(New dlgMSO(AddressOf MSO_MessageOut), p)
The total code is listed here:
Private Sub MSO_MessageOut(ByVal MSO As Packets.IS_MSO)
'Invoke method due to threading. Add this line to any receive event before updating the GUI. Just like in this example, you only have to add a new delegate with the right packet parameter and adjust this line in the new method.
If DoInvoke() Then
Dim p As Object = MSO
Me.Invoke(New dlgMSO(AddressOf MSO_MessageOut), p)
Return
End If
'tekst.Replace(Connections(GetConnIdx(MSO.UCID)).P layerName, "").Replace("^0", "").Replace("^1", "").Replace("^2", "").Replace("^3", "").Replace("^4", "").Replace("^5", "").Replace("^6", "").Replace("^7", "").Replace("^8", "")
Dim tekst As String = MSO.Msg.Substring(MSO.TextStart, (MSO.Msg.Length - MSO.TextStart))
Dim msg() As String = tekst.Split()
Select Case msg(0)
Case "!online"
InSim.Send_BTN_CreateButton("Players: " & CStr(Players.Count), Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 30, 10, 20, 99, MSO.UCID, 99, True)
Case "!connections"
InSim.Send_BTN_CreateButton("Connecties: " & CStr(Connections.Count), Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 30, 15, 20, 98, MSO.UCID, 98, True)
Case "!userlist"
Dim i As Integer = 1
Dim k As Integer = 0
'InSim.Send_BTN_CreateButton("Exit", Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 10, 20, 30, 10, 97, MSO.UCID, 97, True)
For i = 1 To Connections.Count
k = 0
InSim.Send_BTN_CreateButton(Connections(i).PlayerN ame, Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 20, i * 5 + 20 + 5, 20, i, MSO.UCID, i, True)
k = CInt(CStr(i) + "1")
InSim.Send_BTN_CreateButton("Kick", Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 20, i * 5 + 25, 40, k, MSO.UCID, k, True)
k = CInt(CStr(i) + "2")
InSim.Send_BTN_CreateButton("Ban 1 day", Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 20, i * 5 + 25, 60, k, MSO.UCID, k, True)
k = CInt(CStr(i) + "3")
InSim.Send_BTN_CreateButton("Ban 7 days", Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 20, i * 5 + 25, 80, k, MSO.UCID, k, True)
k = CInt(CStr(i) + "4")
InSim.Send_BTN_CreateButton("Ban forever", Flags.ButtonStyles.ISB_CLICK Or Flags.ButtonStyles.ISB_DARK, 5, 20, i * 5 + 25, 100, k, MSO.UCID, k, True)
Next i
End Select
TextBox1.Text += tekst & Constants.vbCrLf
End Sub
When I put my For i = connection.count... loop in comment, I don't get an error...
UPDATE:
Tested a bit further and I get the error when I try this: Connections(i).PlayerName
This command in the loop should get all the PlayerNames of al the people who are connected with the server... Do I do this wrong or is there another way?
T-RonX
30th June 2008, 17:19
Try this:
For i = 1 To (Connections.Count - 1)
...
Next i
Silox
30th June 2008, 18:14
Yup, that works :)
Thanks!
Silox
1st July 2008, 11:57
Sorry for asking but I have 2 questions / requests:
1. When making an admin panel with 9 buttons like Restart, end, close, ... and for each player it's name and 9 options like kick, ban 1 day, ban 7 days, ... and all the penalties, I ran out of RequestID's because my number of ID's is bigger than 255 which is the maximum size of a byte. Is it possible to change the Request ID and the Click ID to a short?
2. Is it possible to clear all the buttons on the screen with one command?
Thanks in regards,
Silox.
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.