The online racing simulator
Speed in Windows Forms TextBox
(15 posts, started )
Speed in Windows Forms TextBox
How can I output the speed of a player in a TextBox?

Thanks

I tried with:

textBoxSpeed.Text = Convert.ToString(MCI.Info[0].Speed);

and nothing appears into the textbox

I have tried too:

textBoxSpeed.Text = MCI.Info[0].Speed;

and it said "No se puede convertir implícitamente el tipo 'ushort' a 'string' (CS0029)"
#2 - herki
Is the .Text property writeable? You might need to call a method like .setText() or something.
Also, did you test if MCI.Info[0].Speed actually has a value assigned?
Quote from herki :Is the .Text property writeable? You might need to call a method like .setText() or something.

Yes, it is property writeable doing that, i have asigned a one of the textbox that i have the value of for example the tyre comound

This thextbox in the MSO packet:

//Vaciar los campos (clear the textbox after write it)
textBoxTyreFL.Text = "";
textBoxTyreFR.Text = "";
textBoxTyreRL.Text = "";
textBoxTyreRR.Text = "";
//Compuestos de las ruedas. (Tyrecompund)
textBoxTyreFL.Text += Players[0].Tyre_FL;
textBoxTyreFR.Text += Players[0].Tyre_FR;
textBoxTyreRL.Text += Players[0].Tyre_RL;
textBoxTyreRR.Text += Players[0].Tyre_RR;

and it works, so the .Text is property writeable.

Quote from herki :
Also, did you test if MCI.Info[0].Speed actually has a value assigned?

I don't know how check that, maybe with the Insim Sniffer i can check it . But i suposed that if only my car is runing, the value 0 can be my car for test if code works.
#4 - Blub
you should try
MCI.Info[0].Speed.ToString()

Quote from Blub :you should try
MCI.Info[0].Speed.ToString()


Thanks, it works, but the insim crashes sometime .

When it works, it only shows the number "19" an it doesn't move. If I'm at 200 km/h and then open the insim, it shows the number "19" too.

I have cheked with Insim Sniffer that if only my car is in the track, it always got the value 1 in MCI.PLID

The code now:

textBoxSpeed.Text = MCI.Info[1].Speed.ToString();

In the insim flags i have the MCI flags activated

InSimSettings Settings = new InSimSettings("127.0.0.1", 29999, 0, Flags.InSimFlags.ISF_MSO_COLS | Flags.InSimFlags.ISF_MCI | Flags.InSimFlags.ISF_NLP, '!', 2, "****", "^3LFS External", 5);

Some info:
LFS EXTERNAL
C#
LFS 0.5Z28
I'm still trying to know how i can get propertythe MCI packets, because I set it,
I declare a variable :
String vel = "";
String nodo = "";

and I reqest it in "private void MCI_CarInformation" trying 2 diferent ways of convert it from 'ushort' to 'string'

try
{
vel = MCI.Info[1].Speed.ToString();
nodo = Convert.ToString(MCI.Info[1].Node);
}
catch (Exception EX)
{
MessageBox.Show("MCI - " + EX.Message);
}

Then I ask for it in "private void MSO_MessageOut"

case "vel":
InSim.Send_MTC_MessageToConnection(vel + " nodo " + nodo, MSO.UCID, 0);
break;

And when i say "vel" in LFS, first the InSim says me "19 nodo 2".
When i say "vel" another time, the InSim says me "0 nodo 14457"

I have been looking in other codes like cruises (cause they use LFS External too) and i have tried to put it with the same structure and it doesn't work
I have solved it "THANKS" :rolleyes:
Jesus,
I hate it when people ask for a solution, get some sort of guidance and ideas, solve their problem and walk away
I`m having all sorts of ideas for building me a real simulator and while browsing the internet, I found too many people leaving all others in dark.
I would like to see that someone really share his knowledge and let us see the finished product. If that someone was getting into project to make some money of it, than I don`t expect him to share the knowledge, just a finished product
There is nothing to learn here. You would be far better off spending two minutes reading a "introduction to programming" tutorial than reading this thread.
Quote from fermevc :
I hate it when people ask for a solution, get some sort of guidance and ideas, solve their problem and walk away

And I hate when I ask a problem and nobody says useful things... and when another player ask a stupid (or not stupid) question, everybody answer whit useful comentaries.

I have helped via MSN to other insim programmers from this forum, and when I need help, I asked here and nobody helps me (my friend Dalmako have the same problem, he ask a simple question and nobody help).
Quote from KassadGLA :my friend Dalmako have the same problem, he ask a simple question and nobody help

I've just done a search posts made by Dalmako under LFS Programmer Forum and child forums.

2 threads, both with responses. Saying he got no reply isn't entirely valid. I won't dispute that it may not be the answer he was asking for though.You're right that not every request for help gets an answer, but don't forget that:
  1. The people who reply aren't being paid to help
  2. The people who reply are generally not LFS developers (you may occasionally get help from the devs, but it's relatively rare outside of PRISM and the the LFSWorld API)
My point is that the people who are answering are almost always doing it own time, for free. Many of which don't visit the forums every day. Some only visit every few days.

The other reason you may not have been given an answer is because you've only provided partial snippets of code. It's all well and good if your code is doing the right thing, provided your variables are all in the right scope, etc. which you can't tell from very small snippets without the surrounding code.

I'm not being nasty. All I'm trying to say is that the expectations of help are a bit unreasonable sometimes.

More to the point, if everyone posted their solution there would be a lot fewer of the same questions over and over and over and over and over and over..
Quote from the_angry_angel :(you may occasionally get help from the devs, but it's relatively rare outside of PRISM and the the LFSWorld API)

/me find it quite funny that I have something to do with both of these items.
/me feels a warm tingly feeling inside.
Quote from the_angry_angel :The other reason you may not have been given an answer is because you've only provided partial snippets of code. It's all well and good if your code is doing the right thing, provided your variables are all in the right scope, etc. which you can't tell from very small snippets without the surrounding code.

Yes for me the question was too specific. I tend to answer questions that are broad, such as "how do you write a swear filter", and shy away from questions like "help me fix this specific problem using this specific API". The reason for this is that I don't really understand how the other APIs work. My advice is to make your question vague and not to require the answerer to have knowledge of any specific API or library. That way you will be more likely to have your question answered.
Quote from the_angry_angel :I've just done a search posts made by Dalmako under LFS Programmer Forum and child forums.

2 threads, both with responses. Saying he got no reply isn't entirely valid. I won't dispute that it may not be the answer he was asking for though.You're right that not every request for help gets an answer, but don't forget that:
  1. The people who reply aren't being paid to help
  2. The people who reply are generally not LFS developers (you may occasionally get help from the devs, but it's relatively rare outside of PRISM and the the LFSWorld API)
My point is that the people who are answering are almost always doing it own time, for free. Many of which don't visit the forums every day. Some only visit every few days.

The other reason you may not have been given an answer is because you've only provided partial snippets of code. It's all well and good if your code is doing the right thing, provided your variables are all in the right scope, etc. which you can't tell from very small snippets without the surrounding code.

I'm not being nasty. All I'm trying to say is that the expectations of help are a bit unreasonable sometimes.

More to the point, if everyone posted their solution there would be a lot fewer of the same questions over and over and over and over and over and over..

My point is that a lot of more people desn't got answer, and the InSim programers gives answers who they whant to give answers.. no who need realy help because someone get stuck in a point of the InSim programing.

Unfourtonately, after this things I got respect to you, now I havn't nothing, I can see what kind of person are some InSim programers from here.

Speed in Windows Forms TextBox
(15 posts, started )
FGED GREDG RDFGDR GSFDG