The online racing simulator
Weird InSim VB Timer problem...
(3 posts, started )
#1 - Silox
Weird InSim VB Timer problem...
Hey guys,
I'm trying to get a better view on InSim through the .NET - LFS External (InSim/OutSim/OutGauge SDK Library) by T-RonX.

First of all I'm trying to make a simple thing:
If the first player crosses the line, it saves his names to an array. This works.
When I enable a timer after the adding-to piece, that has an interval of 2 minutes, and restarts the race then, it doesn't work. This are some things are tried and I came up with this weird thing:

1.
I enabled a timer from the MSO sub. When I type !blaat, a timer gets activated and once it ticks, it says "Blaat". This works.

MSO:
Case "!request"
Timer3.Enabled = True
------
Timer3 Tick:
Insim.Send_MST_Message("/blaat")

2.
I replaced the code which is in timer tick function to the code it should be (underneath an example). The code fails (= it doesn't does anything, no messages, ...) with no error.

MSO:
Case "!request"
Timer3.Enabled = True
------
Timer3 Tick:
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
Dim i As Integer
everyfinish = True
InSim.Send_MST_Message("/msg ^7Race ^1ended! ^7Restart in^1 0.5 minutes!")
For i = 0 To UBound(finished)
InSim.Send_MST_Message("/msg " & i + 1 & ". " & finished(i))
Next i
Timer3.Enabled = False

3.
I placed the code which doesn't works in the timer tick at step 2 to the !request. This works.

MSO:
Case "!request"
Dim i As Integer
everyfinish = True
InSim.Send_MST_Message("/msg ^7Race ^1ended! ^7Restart in^1 0.5 minutes!")
For i = 0 To UBound(finished)
InSim.Send_MST_Message("/msg " & i + 1 & ". " & finished(i))
Next i

I hope the steps gave a better vieuw at the problem and I hope someone can come up with a solution

Ciao & Thanks!
#2 - Silox
I did some further testing and I found what causes this problem.

Script:
MSO:

Case "!Tik"
Timer3.Enabled = True

Timer3 Tick:

Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick

InSim.Send_MST_Message("/msg Tik, Tak!")

End Sub

When I start the race, and type !Tik. The message Tik, Tak! Pops up.
But:
When I start the race, I cross the finishline ( = I finish), and I type !Tik. The message doesn't pops up.

Is there any reason why I can't send MST messages when I crossed the finishline or is there another way I can try to send a message?

Thanks in regards,
Tom Naessens Aka Silox.
i don't know about your bug... and i surely don't know the allready done object Timer of visual basic...

i'm new into the microsoft codding way, and i will say i better prefer, coding a Log system my self as example then using the one that is already made into .net and who i can't take a real look at.(really hope my english don't sound too bad)

Don't know how many time you passed searching why this is not working like you think he will , but writing a timer your self should be pretty simple and probably will be faster solution the key is having a loop with a Miliseconde diff know between each loop, i will say take 3-4 line of code doing this. with .net thread are so easy to maintain, so you can create you loop timer into a new thread.

Im not telling you is the right way... im just telling it one of the way.


by the way i will say take a look at Drive_LFSS project, the whole project is made under update(diff) world, mean where ever you are into the code, you know exactely how many time passed since last time you where there.

I will say take a look at :drive_lfss.cs file under "while (MainRun)", follow the line->SessionList.update(diff); , this function call will be protagate to all sub object with virtual/new function, so the "diff" is everywhere.


really hope i did not gave you too much information! im ofent talking too much and also hope that at least gave you some new idea that will solve you probleme!

Weird InSim VB Timer problem...
(3 posts, started )
FGED GREDG RDFGDR GSFDG