The online racing simulator
[Solved] Wanted: Penalty Matrix
I've been working on a GUI type Race Control Manager, but I'm missing a Penalty Matrix.

By that, I mean a GUI way of clicking a button that automatically gives the player clicked the penalty chosen.

The penalties available should be;
30 seconds
45 seconds
drive through
stop and go
spec
clear (clear last penalty given)
kick
ban 12 hrs
ban 1 day
ban 30 days
ban 999 days
clear ban

All these are available via LFS commands.

See atttached image for what it should look like.

I've included the coding I've managed so far, which basically only gives the shape of the matrix with headers. Add to your includes folder, etc., and activate ingame via !matrix command.

I know what I want this 'matrix' to do, but just don't have necessary coding skills to do it.

My coding allows for up to 24 drivers, but don't know if it should be up to 32.

Also. It's probably far too big to be done in one big display; not sure LFS allows so many buttons at once, so probably has to be done in at least 2 displays. In which case maybe broken down in sub-routinea as follows;

(Sub) Racing/Spec Penalties
.......... ...........(Sub).Kick/Ban Penalties
-----------------------------------------------------------------------------
30 seconds..............................................kick
45 seconds..............................................ban 12 hrs
drive through...........................................ban 1 day
stop and go.............................................ban 30 days
spec.......................................................ban 999 days
clear (clear last penalty given) ..................clear ban

Or maybe 3 displays, each with it's own sub-routine;

Racing/Spec Penalties.. ..Kick/Ban Penalties.. ..Clear
-------------------------
- ------------------------ -------
30 seconds
................ ...kick...................... .clear last penalty
45 seconds............... ....ban 12 hrs............ . clear ban
drive through........... .....ban 1 day
stop and go
.............. ....ban 30 days
spec
........................ ....ban 999 days

Assuming this is feasible, anyone willing to take this on? Shrug

Sorry. Nothing to offer but my thanks!

EDIT
===


Added code and image for breaking up into 2 tables rather than the 1.
.
Just in case this request is impossible, I've come up with an alternate (but rather more long winded) way of doing the penalties, although I'd still much rather have the GUI matrix.

Maybe the long way is the right way to go?

More likely that penalty would be given to correct driver because much easier to click on wrong button.
Attached images
Lapper RCM Penalties.jpg
#3 - Krayy
The way I'd look at doing it is to divide the screen into a top 2/3 and a bottom 1/3. Top 2/3 lists players in a 4x8 matrix to fit 32 in. Bottom 1/3 would show all your penalties in another matrix with default text grey. When a penalty is applied it shows in Yellow, so you can clear as well as set a penalty.

Have a couple of buttons at the bottom like Clear, Apply, Cancel and you're done.

I'm too busy to work out at the moment, but I'll do it in a CIF add on then you can modify it to your RCM

PS. For gods sake man, look at my code examples for how to do loops and common functions. You dont want to create 32 separate functions to do the same thing. Give me a day or so and I'll show you what I mean.
:o

Your solution is a lot more 'elegant' than mine - once I got the original visual idea in my head, couldn't see the simpler solution.

I've had a look at some of your CIF modules where you use the WHILE loops, but really struggled to make sense of them. I sort of see how things work at this bit


<?php 
 
   $LoP 
GetListOfPlayers("N"); # get list of players
   
$aCount arrayCount$LoP); # get qty of players
   
$i=0# needed to start counting
 
WHILE ($i $aCount# if qty of players is less than whats in the list
   
$name $LoP[$i];
  ...do 
something...like open buttons with $name on them... 
   
$i=$i+1# go round loop again until qty in list is balanced out/equal
 
ENDWHILE # stop there and go to next instruction
?>

but after this bit I quickly become confused.

Anyway, at my age, I'm not sure I'm really wanting to learn how to do complicated computer code. Never got the hang of it even in Sinclair BASIC days, when he brought out his ZX81 - and I was in my early 20's then! Quite happy just opening and closing buttons!

But I don't mind marvelling at how it's done properly. I would be interested in looking at your code - to see if I can understand it enough to use it for a twin drift system.

If I ever get that done, it's likely to be the last thing I code for a while - I don't really need anything else (i.e. my minds blank), and with all the updates flying about just now, I'd like to get back on track more (the fact that I'm a mobile chicane is immaterial).

P.S. Looking at number of times our code scripts have been downloaded (and I've downloaded a number of yours a few times each just to make sure I have brand new clean lapper install for experimenting with when I'm trying to make new stuff), I'm not sure many people are even interested in using lapper that much. Which I consider a shame, as lapper is fairly easy to use and change, and unlike the popular competion, we are able to change it. And it's free!

PPS. Sorry, forgot to say that I'm just finishing off the bans part of the Penalties section of my Race Control Manager I'm doing just now, and it should be ready tomorrow latest. Not quite sure how I'm going to test it though; especially the BAN 999 Days part!
#5 - Krayy
I know what you mean about getting old...I had a ZX80, ZX81 and a Spectrum! Almost had enough cash for the Sinclair QL, but it didn't take off like the Spectrum.

Anyhoo, I'll do up a module in CIF that you can easily modify for RCM and I'll comment it properly so you can see what it's doing. Most of the techniques I use are to get rid of multiple functions that do that same thing, as if you need to change something, doing it in 1 place instead of 32 is easier.
This thread is closed

FGED GREDG RDFGDR GSFDG