PDA

View Full Version : acceleration.lpr - can it be condensed in arrays?


sinanju
18th January 2010, 00:02
Hi

I use a little marshall on my servers that shows various messages.

Some of these give you (tongue in cheek) messages regarding about how well you can accelerate your car (whatever type).

All quite simple button/label stuff - if in this car and accelerate so fast then this message. Lots of IF - ENDIF statements.

You can see them in action at Sin'rs and Sin'rs too (S2)

Quite a simple little thing, but about a thousand lines of code!

I'm quite sure if any coder had done it they would have just used arrays and condensed the code way down.

However, apart from a very simple array, I've no idea how arrays work.

Anyone willing to put in a lot of effort and turn my code into proper array code? :schwitz:

Because I know how my code works, and what it does, I've more chance of 'reverse-engineering' someone else's code.

Cheeky of me I know :razz:

Thanks.


PS - I've put it in .lpr format to make it easier to include as add-on for testing

Krayy
18th January 2010, 05:11
Try this as a starting point. You may want to move the definitions into a global var, and maybe consolidate the time bands into one array, and the car names into another to streamline it a bit more.

Nice addon though...you okay for me to use it?

sinanju
18th January 2010, 14:19
I'm seriously impressed!

Both by the compactness and especially the speed.

Many thanks for the quick reply - much appreciated.

No problem with anyone using the marshall - that's why I made it public - you may want to remove the (c) Sin'rs first though. Change the clogo and manlogo buttons.

I use the marshall and board for other messages too - mainly warning messages - like swearing, entering/leaving pits, etc.

Forgot to add following in the Language file

main_yellowflag1 = "^3|";

This is what gives the yellow hi-vis jacket effect.
-------------------------------------------------------------------

PS

Saw your reply to other post regarding someone wanting to have repeat messages every couple of minutes or so - maybe I could change my marshall to a man carrying advertising hoardings! Think of how much money I'd be owed!

Krayy
18th January 2010, 20:10
I'll do some modifications to my version later on as I wouldn't want it to do a DISMAL if someone is leaving the pits and it takes them ~20 secs to get up to speed, so I'll just drop the first test (longest time), then maybe cut the number of speed bands to 3 for AMAZING, GREAT and PEDESTRIAN.

sinanju
4th February 2010, 13:51
I'll do some modifications to my version later on as I wouldn't want it to do a DISMAL if someone is leaving the pits and it takes them ~20 secs to get up to speed, so I'll just drop the first test (longest time), then maybe cut the number of speed bands to 3 for AMAZING, GREAT and PEDESTRIAN.
Saw it on the NZ server (just being nosy!), but the "bib" was actually the id missing message scrunched up.

You need to have

main_yellowflag1 = "^3|";

in your Language file