You're not using the CASE command properly. Its basically there as a command to do something (usually simple), such as output a button or start a sub-routine WHEN you type in the trigger word - in this case !twin.
Think of the !top command - once you type in !top, you get a list of the top best times.
It happens once. It
normally does not update. If someone does a new faster time while you're looking at the top table, you have to type in !top again, for table to refresh.
Yours should have been something like
CASE "!twin":
openPrivButton( "twin_message",([i]dimensions here[/i]),"Twin Drift System now enabled" );
DoTwinSub();
BREAK;
so when you type !twin, lapper knows to then start the sub called DoTwinSub
as in
Sub DoTwinSub(blah, blah)
$me = GetCurrentPlayerVar("NickName");
$behind = GetPlayerVar( GetCurrentPlayerVar( "UNameBehind" ),"NickName" );
$front = GetPlayerVar( GetCurrentPlayerVar( "UNameBefore" ),"NickName" );
your code in here.....
EndSub
Why do you think you need the $me/$behind/$front variables?
Also. I don't understand the IF statements....
IF (9 > 7)
IF (7 > 6)
9 is always going to be more than 7 and 7 is always going to be more than 6.
What do the numbers indicate?
Now, if you meant
IF ($behind > $me) - or - IF ($behind < $me)
that would make more sense, although may not work, as lapper has already worked out the UNameBehind and UNameBefore users.
If I was making a twin drift system, then there would be 1 question; do i want to give users/admin option to switch twin system off/on, or would it be on all the time?
If an option to turn off/on, then you would have to start playing about with GlobalVars and a simple CASE command to get started - complicated subject. if you want to see it in action, look at Yisc[NL]'s pitboard lapper script for a GlobalVar that has "off" or "on" set.
In either case, all the code should be within the Event OnDriftScore( $userName ) section.
You can either use the section within the lfslapper.lpr file, or make your own add-on, in which case you would need to Catch the Event, as in CatchEvent OnDriftScore( $userName ).
If you went down the GlobalVars route, then you would need another IF-ENDIF section, which could be done various ways, as in,
IF enabled,
THEN...
- or -
IF not enabled
THEN use usual code,
ELSE use this code
....etc
====================
There are probably only a handful of people who use lapper that could make a twin drift system, and I'm
not one of them. Not only that, all but 2 of these people don't actually give advice or put their code on the forum, and even if I could make a twin drift system, I wouldn't make it public.
This is a fairly good feature to have to 'sell' your server, and have people use your server rather than someone else's, so why give it away?