The online racing simulator
Searching in All forums
(357 results)
t1ger
S3 licensed
Hi horrgakx,

It looks like we may have forgotten about this after all sorry mate.

I think I was waiting for S.Varjonen or Solar to answer a question, but I am not in front of my PC which will have all the emails and conversations on it. I will have a look tonight and see if I can sort it out once and for all tonight.

Once again, sorry for the delay.

Tim
t1ger
S3 licensed
Quote from t1ger :
Like I say, I do not deny that this is not possible, I am just saying that I would have expected to have seen it by now with the amount of testing I have done.

FYI, I have now seen this 3 times in total. However, most of the time it does not happen. I can now confirm that VB6 is not "hiding" me from it and it is possible, just nowhere near often enough for me to successfully write the code to handle it.



Tim
t1ger
S3 licensed
Which bit exactly are you having trouble with?

Are you connected to InSim and successfully sending and receiving other packets?
Do you just need help converting VB6 types to InSim types?
Are you sending them into InSim or receiving them from?

Let me know, and I will see what I can help you with. However, I haven't yet converted floats if that is what you are struggling with!

Tim
t1ger
S3 licensed
What about


Private Type something
a As Long
b As Long
e as Long
f as Long
c() As Byte
d() As Byte
End Type



Tim
t1ger
S3 licensed
Hmmm, how odd. Must be to do with the way VB deals with ReDimmed arrays, ie maybe it doesn't actually increase the size of the original, it just creates a new one and points the old one to the new one or something...I don't know.

How about the following:


Private Type something3 'Length = 24 (no matter what redimmed to)
a As Long
b As Long
c() As Byte
d() As Byte
e As Long
f As Long
End Type

Dim Example1 as something3

This is 24 because we know that the four LONG variables are each 4 bytes and it must use one four byte space to hold the variable to be redimmed, thus 6 x 4 = 24.

Why not use this to find out the size:

arrlength = UBOUND(Example1.c) + UBOUND(Example1.d) + 16

Of course, this will fail if Example1.c and Example1.d have not been redimmed already, but if you ReDim them straight away, even just to 1, then this will overcome that.

EDIT:
Just checked to make sure I am right (I may not be)


Private Type something1
a As Long
End Type

dim Example1 as something1

lenb(example1) = 4 : I would expect this.


Private Type something1
a As Long
b As Long
End Type

dim Example1 as something1

lenb(example1) = 8 : I would expect this too.


Private Type something1
a As Long
b As Long
c(1) as Byte
End Type

dim example1 as something1

lenb(example1) = 12 : again, what I expected.

But:


Private Type something1
a As Long
b As Long
c(1) as Byte
d(1) as Byte
End Type

dim example1 as something1

lenb(example1) = 12 : this I was expecting to be 16!

Only when you add another variable (ie e(1) as Byte) does it move to 16, and then you can add another one (ie f(1) as byte) and it stays at 16!)

Oh dear, seems not to be as simple as I thought.

Tim
Last edited by t1ger, .
t1ger
S3 licensed
Don't get me wrong, I *want* the Prius to be as green a car as possible, just like I want all cars to be greener than they are. I just think that (like all things that I don't actually fully understand) there will always be arguments.

I am sure there is a document which argues why the responses to the pacinst.org report are wrong and invalid and shouldn't be believed. Unless I know all the facts, and quite frankly I am never going to, I am never going to know which one I should actually believe is right.

oh dear, getting too deep now

/leaves conversation

Tim

ps just noticed that the Washington Post link confirms that I was right in post #198 above! hey hey, first time for everything
Last edited by t1ger, .
t1ger
S3 licensed
t1ger
S3 licensed
Quote from Bob Smith :
...

Public Type Something
A As Long
B As Long
C() As Long
D() As Long
E As Long
F As Long
End Type

The following code does not work:

Dim Example As Something
ReDim Example.C(5)

...

How bizarre, this code works for me (except I had to declare the type as PRIVATE). Other than that I have done the following:


Private Type something
a As Long
b As Long
c() As Byte
d() As Byte
e As Long
f As Long
End Type

...

Dim example As something
ReDim example.c(5)
MsgBox UBound(example.c)
ReDim example.c(7)
MsgBox UBound(example.c)

and get two message boxes, one which says "5" and one which says "7".

Edit: just re-read your post! It works for me, allows me to redim it OK.

Tim
Last edited by t1ger, .
t1ger
S3 licensed
Oops, just found this. (Should have googled first, then posted) nevermind:

Quote from Chris Demorro @ The Recorder Online :

Building a Toyota Prius causes more environmental damage than a Hummer that is on the road for three times longer than a Prius. As already noted, the Prius is partly driven by a battery which contains nickel. The nickel is mined and smelted at a plant in Sudbury, Ontario.

This plant has caused so much environmental damage to the surrounding environment that NASA has used the ‘dead zone’ around the plant to test moon rovers. The area around the plant is devoid of any life for miles.

The plant is the source of all the nickel found in a Prius’ battery and Toyota purchases 1,000 tons annually. Dubbed the Superstack, the plague-factory has spread sulfur dioxide across northern Ontario, becoming every environmentalist’s nightmare.

“The acid rain around Sudbury was so bad it destroyed all the plants and the soil slid down off the hillside,” said Canadian Greenpeace energy-coordinator David Martin during an interview with Mail, a British-based newspaper.

All of this would be bad enough in and of itself; however, the journey to make a hybrid doesn’t end there. The nickel produced by this disastrous plant is shipped via massive container ship to the largest nickel refinery in Europe. From there, the nickel hops over to China to produce ‘nickel foam.’ From there, it goes to Japan. Finally, the completed batteries are shipped to the United States, finalizing the around-the-world trip required to produce a single Prius battery. Are these not sounding less and less like environmentally sound cars and more like a farce?

Wait, I haven’t even got to the best part yet.

When you pool together all the combined energy it takes to drive and build a Toyota Prius, the flagship car of energy fanatics, it takes almost 50 percent more energy than a Hummer - the Prius’s arch nemesis.

Through a study by CNW Marketing called “Dust to Dust,” the total combined energy is taken from all the electrical, fuel, transportation, materials (metal, plastic, etc) and hundreds of other factors over the expected lifetime of a vehicle. The Prius costs an average of $3.25 per mile driven over a lifetime of 100,000 miles - the expected lifespan of the Hybrid.

The Hummer, on the other hand, costs a more fiscal $1.95 per mile to put on the road over an expected lifetime of 300,000 miles. That means the Hummer will last three times longer than a Prius and use less combined energy doing it.

So, if you are really an environmentalist - ditch the Prius. Instead, buy one of the most economical cars available - a Toyota Scion xB. The Scion only costs a paltry $0.48 per mile to put on the road. If you are still obsessed over gas mileage - buy a Chevy Aveo and fix that lead foot.

One last fun fact for you: it takes five years to offset the premium price of a Prius. Meaning, you have to wait 60 months to save any money over a non-hybrid car because of lower gas expenses.

Source here.

Who knows?!

Tim
t1ger
S3 licensed
Unless the engineering process and destruction process for the Prius is majorly different to that of a "normal" car, then the fact the the Prius gives out a fraction of the emmisions of the "normal" car, then it must gain something. Even though in the bigger picture this is not as much as if you just take the emissions of the car running into account.

Plus, how do we know that something else the Prius is doing (emmitting, causing, anything really) is not damaging something else that we have not measured or even know about yet. If we all moved NOW to a Prius, we may find that all those hybrid cars cause something else to break somewhere in the environment. (I don't know what, but you know what I mean).

Tim
t1ger
S3 licensed
Quote from Stigpt :Sorry for being an ass, but.. I don't see the point of the Prius.

It is not all about the MPG, it is about the emmisions; the harmful gasses to the environment and atmosphere. It does have a "normal" mpg, but:

Quote from Toyota :Prius is certified as an Advanced Technology Partial Zero Emission Vehicle (AT-PZEV), [6] a standard created by the California Air Resources Board and adopted by other states. [6] AT-PZEV certification means Prius has near-zero tailpipe emissions, zero evaporative emissions and a special extended warranty on emission control components. [6], [7] It is one step cleaner than the previous generation's Super Ultra Low Emission Vehicle (SULEV) certification.

The source is here (Note: The links above only work from the actual site).

Tim
t1ger
S3 licensed
Also remember, that LFS can send more than 1 LFS packet in an actual packet. For example, you may receive 40 bytes, but byte(0) = 20. This means the rest of the packet is another (or more) seperate LFS packet (or packets), so byte(20) could = 4 and those 4 bytes are and IS_TINY for something else.

There is also the really horrid version where you don't get enough data in the actual packet. I have had this 3 times in all the time I have been playing with InSim v4 and I have yet to write the code to deal with it.

Basically, you would get 13 bytes actual, and byte(0) = 20. This means you have to wait for the next receive event to fire and add the first 7 bytes onto the end of the last set of bytes, and then deal with the next lot.

I haven't worked out yet where I want to save the first lot and I haven't yet worked out how to test it. As I say, it has happened to me 3 times now so I know it is possible, but I program by trial and error and with it only happening every so often, debugging and getting it working would take ages. So I haven't bothered yet. But I will..... soon...

Tim
t1ger
S3 licensed
No, the very first byte is the length of the LFS packet and the second is the LFS packet type.

So if you receive (physically) 20 bytes, and byte(0) = 20, then you know you have the full packet. Then you check byte(1) to see what type of LFS packet it is. In this case it should be 2 as that equals ISP_VER.

Edit: also remember LFS is sending you (and expecting from you) bytes, so an integer is broken down into 4 bytes which you have to convert to a type that VB knows how to deal with. Characters are easy because they are just 1 byte anyway and that corresponds to their ASCII value. ie 97 = a. This is why working with a string is not the best way, but it does work in places.

Tim
Last edited by t1ger, .
t1ger
S3 licensed
Is that in your _DataArrival sub?

If it is, then I don't think you are best working with the bytes in a string like that. This is my DataArrival routine:


Private Sub myWinsock_DataArrival(ByVal bytestotal As Long)
ReDim bytFull(bytestotal) As Byte

myWinsock.GetData bytFull
Call checkdatain(bytFull)
End Sub

The checkdatain routine checks to make sure the right number of bytes has been received and if not splits it up into "LFS packets" or saves it and waits for more to be recieved. That last bit of code I posted is part of a "processpacket" routine which is called by checkdatain when it gets a full and complete LFS packet. The "processpacket" routine is just basically a big CASE statement which checks the second byte to see which LFS packet it is.

Tim
t1ger
S3 licensed
Quote from Krammeh :akgrid2 a public type?

Its just a list control that I use instead of a ListBox, however recently I have been favouring the ListView anyway. Just imagine it is a list.

Quote from Krammeh :hmm. I can encode a packet now, and it sends just loverly.

Its just receiving a packet, I've got NO idea how to decode it.

the data I get is: ôý
and: ôý

OK, start at the beginning then, this is how I decode the response to the InSim ISP_VER:

Firstly, I assume you have the packet recieved and fully checked to ensure you have a full "LFS packet". So you will have an array of bytes with a length of 20 bytes. So byte 0 = 20, byte 1 = 2.

To get LFS version and product use this


Dim txtstring As String

For loopy = 4 To 17
If packetin(loopy) <> 0 Then
txtstring = txtstring + Chr(packetin(loopy))
End If
Next

Tim
t1ger
S3 licensed
I also don't like using the libraries because that means there is a part of the code which I did not write and therefore don't fully understand. To this end, I stripped one library (edit: remembered, it was this one) down and I now manually decode and encode my packets. I know it is not the best programming practice, but I understand the code and, imho, it is easy to understand.

Here is how I encode a simple packet (this is a IS_REO packet that I send to LFS. akgrid is a 3rd party list control):


Dim bytData(0 To 35) As Byte
Dim loopy As Long
For loopy = 0 To 35
bytData(loopy) = 0
Next

bytData(0) = 36
bytData(1) = 36
bytData(2) = 0
bytData(3) = akGrid2.Rows
For loopy = 1 To akGrid2.Rows
bytData(loopy + 3) = Val(akGrid2.TextMatrix(loopy, 4))
Next
myWinsock.SendData (bytData)

The main issue with decoding the packets is in converting the bytes to VB6 types. I don't have them all yet, because I don't use some, but is there anything inparticular you are after. I could post the code I use.

Otherwise, do like I did and get a library and work out how it works so you can do it yourself without the library.

Tim
Last edited by t1ger, .
t1ger
S3 licensed
That makes for very interesting reading.

Tim
t1ger
S3 licensed
Quote from kx_mole :great stuff

Thanks! Just a shame about my connection
t1ger
S3 licensed
Thanks Jonas8431.

We just need more people to practice now!
t1ger
S3 licensed
For a bit of fun while we wait for the season to start again, why not join our OLFSL 1 by 500servers server and then check out http://www.olfsl.game-host.org/.

Have fun, and play fair.

Tim
t1ger
S3 licensed
Anyone else going this year? It's on next weekend (8th - 9th September 2007) - which strikes me as odd as it clashes with the F1 in Italy?! :-/

We are going on the Sunday anyway as it should be a good day out for us.

http://www.worldseriesbyrenault.com/donington/uk/

Tim
t1ger
S3 licensed
Scooter - The question is what is the question.

http://www.youtube.com/watch?v=dUklTESKmis

Sorry, I love it! dum dum de dum, de dum, de dum, dah dah dah dum de dum......
t1ger
S3 licensed
Quote from horrgakx :Hi chaps, is there any more news on this (race 5) -40 point result please?

Hi horrgakx,

Please bear with us, we have not forgotten you and a decision should be made soon. I would hope that this will be made before the next race.

Thanks for your patience.

Tim
t1ger
S3 licensed
Quote from Renku :Cya when You get back .

LOL to that Renku!

'tis true! You won't be able to stay away from racing LFS for long, Ant!

Seriously, though, good luck and I have only the greatest of respect for you and your decision.

Tim
t1ger
S3 licensed
Quote from AtomAnt :Already found him.......sorry ,Tim Kay is the next name to watch.
You could try to bribe him, but he's on staff with OLFSL. The largest LFS league....and one of the oldest.

Thanks ANT!

I would like to help, but I have my work cut out with the Original LFS League and the app I am writing for it.

Sorry,
Tim
FGED GREDG RDFGDR GSFDG