The online racing simulator
I feel stupid.
I actually ended up using the add_distance for my !location. I set the car.X, car.Y, and car.Z as variables and then just sent a message with the variables. Man that was stupid. I could've sworn I tried that already...
Came up with a simple suggestion for the cruise insim. I've made life easier by modifying the def init:

def init(insim):
insim.sendm('/canreset no')
insim.sendm('/cruise yes')
insim.sendm('/laps 0')
print '%s is running!' % PROG_NAME
print '%s is the current directory!' % CURRENT_DIR

That way, the server is always configured properly for a cruise server

Also, could you make a simple !save command for me? I've tried making one based off of the "def closed(insim)" you've included in the script, but I can't seem to get it to work properly. I haven't tested recently, but IIRC, I was getting errors with loading variables, so I'm thinking the files didnt save properly.
This is untested, but something like this should work. Obviously you need to add it to the CMD_LOOKUP dict.

def cmd_save(insim, ncn, args):
if ncn.Admin:
[save_user_vars(n.UName, n) for n in connections.values() if n.UCID]
insim.sendm('^3| ^7The users have been saved!', ncn.UCID)
else:
insim.sendm('^3| ^7You are not an admin', ncn.UCID)

Or if you only want yourself to be able to do it and not just any admin replace the first line.

if ncn.UName == 'learjet45':
pass

Can i ask something?

Which is better python, C#, C++?
Quote from mariuba2 :Can i ask something?

Which is better python, C#, C++?

My answer is probably not gonna satisfy you, but generally there is no such thing like a "better" or "worse" programming language. There is also much more languages than these three, for example there is Ada, plain C, classic VB, VB.Net, Pascal/Delphi etc etc... each language has it's pros and cons.

Python and C# are easier to learn because they are much easier to debug, they have automatic memory management and nice exceptions. Python is also perfectly multiplatform.
On the other hand C/C++ gives the programmer much better control over the program. Also, programs written in C/C++ usually don't require a boatload of libraries and stuff to run, whereas Python and C# do. A skilled programmer can write more efficient and faster code in C/C++, but the language is more difficult to master.
Quote from mariuba2 :Can i ask something?

Which is better python, C#, C++?

Which is better: a hammer, a saw or a screwdriver?
C# is like a hooker: Learning is a small price compared to the results you get. The downside is the procurer*.

C++ is like a fleshlight: Designed to work in a non-sophisticated environment.

Python is like an ex highschool prom queen: It's amazing fun to play with. Sure it's daft as hell, you can't actually do anything smart with it and it's memory use, oh dear...

*This joke probably doesn't work.
Quote from hyntty :Sure it's daft as hell, you can't actually do anything smart with it

Except, you know, YouTube, BitTorrent and Eve Online...
Bugger.
Ok well thanks for answer, cause alo of people use python more than C#[not sure, just saying my opinion] and alot say python is easier which I think not, because I use C# with LFS_Extenal and it's great I understand how it works but for others I don't know how it work, it look easy but I don't know how it work.

And also another question.
Can someone update LFS_External? Cause They say Trox gave up coding or somthing?
Quote from mariuba2 :
Can someone update LFS_External? Cause They say Trox gave up coding or somthing?

T-RonX never released the source code for LFS_External so it's not possible for anyone to update it.
Quote from DarkTimes :T-RonX never released the source code for LFS_External so it's not possible for anyone to update it.

Ummm ok =[ I wish someone could.

Thx for replying so fast
Quote from DarkTimes :T-RonX never released the source code for LFS_External so it's not possible for anyone to update it.

Really? Wow. I find that to be pretty unacceptable.
I can't seem to get any !save commands to work. I end up getting errors with variables after using it and restarting insim. This has happened with every !save I've tried.
You'll need to specify exactly what errors you're getting as it works fine for me.

I've updated the cruise example to add a !save command and also a few other small tweaks. You can specify a list of admin usernames with the ADMIN_USERNAMES variable.

Remember as well that you need to have a folder called 'users' in the same directory as the script is being run from.
Here is what happens:
I type !save
I get the "The users have been saved" message
Can keep driving, insim works fine.
But:
If I restart insim (whether closing Python shell and starting insim again, or just hitting F5 to restart insim), I get an error, always relating to user vars:

Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 530, in __bootstrap_inner
self.run()
File "C:\Python27\lib\threading.py", line 734, in run
self.function(*self.args, **self.kwargs)
File "C:\Users\Jonathan\Desktop\Pyinsim New\examples\cruise.py", line 157, in heartbeat
draw_osd(insim, ncn)
File "C:\Users\Jonathan\Desktop\Pyinsim New\examples\cruise.py", line 110, in draw_osd
Text='^2Cash: $%d ^7| Total Distance: %.2f Km' % (ncn.vars.cash, ncn.vars.dist))
AttributeError: 'IS_NCN' object has no attribute 'cash'

Tried a second time, ended up being similar, but instead of being with the OSD, it was with adding money. Still, it always comes down to the user vars.
Note: This does not happen if I then disconnect before restarting insim. This issue will not happen in that case, but I'm trying to make it so people don't have to reconnect to have their stats saved while I'm working with the script.

My user file after using !save and restarting insim:
http://mr.learjet45.us/uploads/learjet45
User file after someone disconnects and has vars saved that way rather than with !save
http://mr.learjet45.us/uploads/fatcatpaddy
OK change this:
[save_user_vars(n.UName, n) for n in connections.values() if n.UCID]

to
[save_user_vars(n.UName, n.vars) for n in connections.values() if n.UCID]

You're amazing. <3 Thank you very much!
I'm going to try if this works on android using SL4A. SL4A doesn't support any graphics yet, but it would be somehow cool if it worked!

//well I guess pyinsim has to be "compiled" (.pyc format) to work with SL4A
I released a quick revision of this to CodePlex, only a couple of small tweaks.

Been thinking about forking the codebase and finally creating a Python 3.0 port.
Quote from DarkTimes :PyDev 2.0 out, for anyone interested.

http://pydev.org/

Thank you for directing me to this. A lot better than Python IDLE. It quickly pointed to a bug that I had been trying to locate (darn local variable I thought was global ).

Any words of advice for testing from inside pydev/Eclipse while connected to LFS insim or can it be done?

I am still using your old pysim library for my project because I was almost finished with it when 2.0 came out. I guess I should bite the bullet and look into how much I would have to do to update to the new library.

Thank you for you efforts.
Yes, it's easy to run pyinsim scripts inside Eclipse (that's how I test it). You open the script you want to run in the editor and click the Run button (or CTRL+F11). If it asks you to choose how to run it select 'Python Run'. Then you should see any output in the Console window. To stop the script click the Terminate button on the Console panel (the red stop button).

The only thing to watch out for is if you start another script before stopping the first, as then you end up with multiple scripts running at the one time, which gets confusing. Well, it confuses me.
OK - last update for now, pushed changeset with InSim 5 support onto CodePlex. Again no proper release yet. Might have bugs etc..

FGED GREDG RDFGDR GSFDG