PDA

View Full Version : [CODE] Common Interface Framework (CIF) & Modules


Krayy
12th January 2011, 01:10
Holy heck, it's finally here!!

This is my new and improved common look & feel interface for LFSLapper and supersedes the previously released GUI. I was going to wait unitl I had a few more modules done, but I figure that you guys can help me out with the testing and debugging.

NOTE: This addon requires Lapper 6.011 or greater and the latest community utils.lpr that is in the utils.lpr thread : http://www.lfsforum.net/showthread.php?t=71245

Just download the zip file, extract it into your includes folder (it will create the ./cif directory) and add these lines near the top of your addonsused.lpr file:

#####################################
# CIF includes
# You can reorder these lines to change the tab order on the sub-menus
#####################################
include ("./cif/cif.lpr"); # This MUST be first to define all of the CIF globals

# CIF Admin Modules #################
include ("./cif/admin_membership.lpr"); # Membership administration

# CIF User Modules #################
include ("./cif/info_who.lpr"); # Who, replaces the who,lpr module and !who command
include ("./cif/info_handicaps.lpr"); # Player Handicap Info
include ("./cif/info_tops.lpr"); # Top output with interactive buttons, replaces tops.lpr, !top, !near, !qual, !nearqual

# CIF Help Modules #################
include ("./cif/help_general.lpr"); # General Help and !help command
include ("./cif/help_admin.lpr"); # Admin Help
include ("./cif/help_stats.lpr"); # Stats Help
include ("./cif/help_custom.lpr"); # Custom server Help
#include ("./cif/help_cruise.lpr"); # Only needed if you're running T3Charmys Cruise system


You will need to comment out the following modules from the addonsused.lpr file too:


tops.lpr
who.lpr
gui*.lpr (anything that starts with gui)
handicaps.lpr
member_admin.lpr
admin_* (older admin guis stuff)

Have a look at the code for now, and I'll put some actual docs on how to create new ones later on.

Updates:
24 Jan 2011
- Big rewrite of cif.lpr module to redraw screen more efficiently
- Rewrite of info_tops.lpr to improve car selections and layout
- utils.lpr updated (see community edition thread link above)
- Handicap module rolled into 1 for Admins and Users alike - stupid having it split into the 2 different ones

02 Feb 2011
- Even bigger rewrite of how the tabs are drawn and redrawn to speed it up
- Modified display so all modules on Tab Bar now

Krayy
12th January 2011, 01:49
...now with added screenies!!!

I also want to add a <<back arrow so that you can go to the main cif groupos (Info, Admin, Help, Etc) from any other acreen.

Dygear
12th January 2011, 03:11
Color me impressed, that's a great bit of programming, the GUI looks great, well done!

Fire_optikz001
12th January 2011, 04:23
didn't you have alot of this already made?(i see now you updated it)... either way nice! :P ... i don't really use LFSLapper anymore but meh :P

emit-nl
12th January 2011, 05:33
Oehh! I love the tops module! ^^
Hope I have some time to check it out soon..

Very good work :D
Tim

sinanju
25th January 2011, 18:01
Superb piece of work Krayy! :thumb:

Been onto my Server provider (500Servers) asking if they'll update the lapper from V5.926 to newest V6 so I can start using this.

Tried it in local mode on my pc and it's great.

I especially like the !top part and how you can find out times by clicking with mouse rather than keying commands.

That's mainly how I've got my lapper; much easier seeing and pressing a button rather than trying to have to remember a specialized command, which can be different for the end user, especially if they jump between servers that may use different versions of homemade lapper scripts or even Aario.

Now for the constructive criticism!

When you invoke the !top command, the screen has the car choice buttons at bottom of the list. They're bit too far down - could do with being brought up a couple of pixels - there's plenty of space under the 18th row of the table.

Also, could do with the standard car group choices (FWD, RWD, GTR, TBO, etc). Would muck up your button display a bit unless you maybe fit on 2 rows?

Now a request.

Could something similar to tops be done for !drf command?

I don't do my list by car, but by position; e.g. 19 to 36, 37 to 55, etc, but anyway would do. :)

Krayy
26th January 2011, 00:21
I just posted an update for th emain cif.lpr and the tops module...see post 1 along with attachments.

As to drift stats, I would think it can be. I'd need to see your .lpr file that displays the current drift scores.

I'm looking at putting in a Grid Reordering module which will require an updated Lapper.exe file which I will post here when I get it tested.

sinanju
26th January 2011, 14:57
....As to drift stats, I would think it can be. I'd need to see your .lpr file that displays the current drift scores....
See attached.

Nothing special - just opening/closing lots of buttons the long winded way.

Not sure if i've included everything, although most of it should be, and anything missing should be obvious.

sinanju
26th January 2011, 15:33
I just posted an update for the main cif.lpr and the tops module...see post 1 along with attachments....
Just downloaded and tried out your updates.

Couple of things.

On the Tops tab, you've removed the handy car type choice from bottom of background button.

Or it's not showing on my pc.

Also. For some reason, and even though I only have your new tops.lpr file and none of the previous tops.lpr files, if you type !top, then lapper will load the normal top listing, then delete it and overlay with your tops listing. See slo-mo movie in attached zipped file.

Krayy
26th January 2011, 19:38
Just downloaded and tried out your updates.

Couple of things.

On the Tops tab, you've removed the handy car type choice from bottom of background button.

Or it's not showing on my pc.

Also. For some reason, and even though I only have your new tops.lpr file and none of the previous tops.lpr files, if you type !top, then lapper will load the normal top listing, then delete it and overlay with your tops listing. See slo-mo movie in attached zipped file.

For the car lists, make sure you have the latest utils.lpr from the community edition thread as the car array was changed (also check your Lapper error log in the logs directory).

As for the overlay, comment out the old tops.lpr from the addonsused.lpr file.

sinanju
28th January 2011, 19:37
For the car lists, make sure you have the latest utils.lpr from the community edition thread as the car array was changed.

Whoops, silly me. :tilt: Put your utils.lpr in wrong version of lapper.

Put it in my test v5.926 (which I use on online server).

Car List now working.

sinanju
28th January 2011, 19:53
As for the overlay, comment out the old tops.lpr from the addonsused.lpr file.

Don't have either the old tops.lpr file or it listed in the addonsused.lpr file.

Only happens when I type !top.

Krayy
28th January 2011, 20:40
Don't have either the old tops.lpr file or it listed in the addonsused.lpr file.

Only happens when I type !top.
You'll need to search your lpr files for anything that says something like "!top" (in quotes) to see what lapper script is already tied to the !top command.

BTW, what is in your addonsused.lpr file?

sinanju
28th January 2011, 21:09
Found !top in the lfslapper.lpr file

CASE "!top":
top( $argv );
BREAK;

Removed the lines and the CIF top is working now.

Thanks.

My addonused.lpr file has

#####################################
# CIF includes
# You can reorder these lines to change the tab order on the sub-menus
#####################################
include ("./cif/cif.lpr"); # This MUST be first to define all of the CIF globals

# CIF Admin Modules #################
include ("./cif/admin_membership.lpr"); # Membership administration
include ("./cif/admin_handicaps.lpr"); # Racer Handicap Administration

# CIF User Modules #################
include ("./cif/info_who.lpr"); # Who, replaces the who,lpr module and !who command
include ("./cif/info_handicaps.lpr"); # Player Handicap Info
include ("./cif/info_tops.lpr"); # Top output with interactive buttons, replaces tops.lpr, !top, !near, !qual, !nearqual

# CIF Help Modules #################
include ("./cif/help_general.lpr"); # General Help and !help command
include ("./cif/help_admin.lpr"); # Admin Help
include ("./cif/help_stats.lpr"); # Stats Help
include ("./cif/help_custom.lpr"); # Custom server Help
include ("./cif/help_cruise.lpr"); # Cruise Help

include( "./utils.lpr");
include( "./myInc.lpr");

#### Include for splitting infos ####
include( "./pitboard.lpr");
include( "./pitwindow_gui.lpr");
# OR
#include( "./defPitInfo.lpr");
#####################################

#### Include for drifting infos ####
#include( "./driftdef.lpr");
# OR
include( "./driftmeter.lpr");
#####################################

include ("./debug.lpr");

include( "./safetycar.lpr");
include( "./ctrack.lpr");
include( "./listevent.lpr");
include( "./winnerflags.lpr");

sinanju
1st February 2011, 19:13
Rather than having individual on screen modules, would it be possible to have them amalgamated into one?

sinanju
1st February 2011, 21:15
Took ages to find reason why, but your admin_membership.lpr file is overwriting my normal 'welcome' message.

Your code:

Event OnConnect( $userName ) # Player event
$NickName = GetCurrentPlayerVar("NickName");
$Posabs = GetCurrentPlayerVar("PosAbs");
$Groupqual = GetCurrentPlayerVar("GroupQual");

IF ( GetUserStoredNum("MemberType") >= $MEMBERTYPE_AFFILIATE )
THEN
LoginMember($userName);
ELSE
openPrivButton( "welc",25,50,150,15,12,-1,ISB_NONE, langEngine ("%{main_welc1}%", $NickName ) );
openPrivButton( "pos",25,80,150,10,8,-1,ISB_NONE, langEngine ("%{main_welc2}%",$Posabs,$Posqual,$Groupqual ) );
openPrivButton( "clos",78,120,20,10,10,-1,ISB_DARK, langEngine ("%{main_accept}%"),OnConnectClose );
openPrivButton( "ref",103,120,20,10,10,-1,ISB_DARK, langEngine ("%{main_deny}%"),OnConnectCloseKick );
ENDIF
EndEventI no longer have the main_deny event button in my message (but I'd kept the lang entry for some reason).

Think above isn't what you meant anyway, as your LANG "EN" has

Lang "EN"
sponsor_1 = "^7Welcome {0} ^7to this ^1LFSLapper ^7powered server.%nl%^2Type ^7!help ^2after leaving garage for supported commands.";
sponsor_2 = "^7If you are not yet a member of LFSNZ, you will need to abide by our rules.%nl%Respect other players, no crashing, and obey race flags%nl%Please follow these rules or you may be banned%nl%To join LFSNZ, go to http://www.lfsnz.com and sign up.";
sponsor_accept = "Accept";
sponsor_deny = "Deny";
EndLangI suspect where you have the 'main_ ' text you should have had 'sponsor_ '.

If anyone else using this lapper add-on, they may want to change the 'sponsor_2' message to something more suitable for their own server.

Krayy
1st February 2011, 21:39
Rather than having individual on screen modules, would it be possible to have them amalgamated into one?
I looked at doing that but with the number of modules in the works it might overrun the display. I suppose I could do it until I get enough modules up then we can move the help files off. Good idea, will repost shortly.

Krayy
1st February 2011, 21:41
Took ages to find reason why, but your admin_membership.lpr file is overwriting my normal 'welcome' message.

That was actually by design believe it or not, as i wanted to leave the stock Lapper.lpr file and use the membership_admin.lpr as the welcome msg.

It's easy to change by just changing the Event OnConnect to CatchEvent OnConnect

Krayy
2nd February 2011, 06:11
I looked at doing that but with the number of modules in the works it might overrun the display. I suppose I could do it until I get enough modules up then we can move the help files off. Good idea, will repost shortly.
Here's the rewrite. Have sped up the redraws too so that it's a lot smoother when going from module to module.

Just overwrite your existing cif folder, or see top post for new installs.

sinanju
3rd February 2011, 11:35
Your new simplified single on screen module much better now Krayy :thumb:

Especially as although I run a server, I'm a one man band; don't have a team, so don't worry about other people having different levels of admin authorisation (this gets rid of Membership tab), and I don't do Cruise, so don't need these tabs, and I don't change handicaps, so don't need that tab either.

You might want to update your version number though?

500Servers (my hosting company) have now just given option to update lapper to v6, so I need to play around with my existing v5.926 lapper stuff and this CIF module to make sure no more issues (!top, welcome message, etc), then I'll start using it online.

Many thanks for the effort and making your CIF public.

sinanju
6th February 2011, 11:54
You've included a "grid" module in your download, but it's not enabled to show as a tab.

I included it in the addonused.lpr config file, but when you run lapper it comes up with OnREO (I assume meaning on reorder) errors.

Should this module be included?

If so, is there a bit of code needed to be included in the lfslapper.lpr config file?

Or does it rely on having the Handicap module enabled? Mine's disabled. Along with the Membership and Cruise modules.

sinanju
6th February 2011, 21:05
Playing around, and using/plagiarising almost all of one of Krayy's existing modules, made this MyStats module, which gives various stats about you, the driver, e.g. position in overall server track ranking, drift points, pb on server, spb, etc.

You need to add the line
include ("./cif/help_mystats.lpr"); # MyStats Helpinto your addonused.lpr file.

You can either drop the "Brought to you by....." or change it to read your own server name.


EDIT
===

After a bit of thought, decided this wasn't a really a "help" module, but was in fact an "info" module, so changed module name and coding slightly.

You need to add the line
include ("./cif/info_mystats.lpr"); # MyStats Informationinto your addonused.lpr file (and remove "./cif/help_mystats.lpr" if you've already got that).

Krayy
7th February 2011, 03:21
Playing around, and using/plagiarising almost all of one of Krayy's existing modules, made this MyStats module, which gives various stats about you, the driver, e.g. position in overall server track ranking, drift points, pb on server, spb, etc.

You need to add the line
include ("./cif/help_mystats.lpr"); # MyStats Helpinto your addonused.lpr file.

You can either drop the "Brought to you by....." or change it to read your own server name.
Nice...I'll take that thankyou *snatch*

As to the OnREO that the grip.lpr module requires, it also needs a modified LFSLapper.exe won't work, so don't use it until I either:

a) Post it
b) Pass on the code to Gai to include in an update

sinanju
8th February 2011, 18:10
For some reason, the top line when I open the CIF will display host name and the module name of the tab I'm in (e.g. Top), but if I tab around (Handicap, Stats, Membership, etc), the top line doesn't change.

It did in your first version of CIF, but doesn't appear to work this way in later version.

Or is it just me?

Krayy
8th February 2011, 19:31
For some reason, the top line when I open the CIF will display host name and the module name of the tab I'm in (e.g. Top), but if I tab around (Handicap, Stats, Membership, etc), the top line doesn't change.

It did in your first version of CIF, but doesn't appear to work this way in later version.

Or is it just me?
Nope, it's me...I have moved the line that writes the title to just above the line that adds the Close button like this:

# Add the title & Close Command Button
openPrivButton ( "cMain_TabbedGuiTitle", $CifTabOrigL, $CifOrigT - 8, $CifTabWidth + $CifWidth + 7, 8, 1, -1, ISB_LEFT + 2, $HostName . "^0 - " . $cifTitle );
CifCmdButton( 0, "Close", CloseCifAll );

That should fix it.

sinanju
8th February 2011, 21:38
That should fix it.
It does.

Thanks.

I've got 3 versions of lapper 6.011 on my computer, and trialling things on each one, including your CIF modules, and i'm getting myself lost remembering what i'm doing on what, which is why I thought it might have been something i'd changed.

Krayy
9th February 2011, 04:21
It does.

Thanks.

I've got 3 versions of lapper 6.011 on my computer, and trialling things on each one, including your CIF modules, and i'm getting myself lost remembering what i'm doing on what, which is why I thought it might have been something i'd changed.
The next update to CIF will require a new LFSLapper.exe file, so it may be a couple of weeks away while I get the new code to Gai for upload. I'll let you know when it's ready.

sinanju
12th February 2011, 11:04
Again, using/plagiarising almost all of one of Krayy's existing modules, made this Rules module, where you can post your server rules.

You need to add the info_rules.lpr file into your CIF directory.

Then you need to add the line

include ("./cif/info_rules.lpr"); # Server Rules


into your addonused.lpr file.

You will of course need to put in your own rules.

Module can be accessed by typing !rules

sinanju
12th February 2011, 11:07
Again, using/plagiarising almost all of one of Krayy's existing modules, made this News module, where you can post your server news.

You need to add the info_news.lpr file into your CIF directory.

Then you need to add the line

include ("./cif/info_news.lpr"); # Server News


into your addonused.lpr file.

You will of course need to put in your own news.

Module can be accessed by typing !news

Krayy
15th February 2011, 03:48
You know that it's not plagiarism if I've put it in the public domain, right?

But keep going, we'll build it up bit by bit.

sinanju
15th February 2011, 18:47
Again, using one of Krayy's existing modules, made this Newbie module, where you can post some tips for the inexperienced new guys.

You need to add the info_newbie.lpr file into your CIF directory.

Then you need to add the line

include ("./cif/info_newbie.lpr"); # Help specifically for newbies


into your addonused.lpr file.

You can use what text I've got or make up your own to suit.

Module can be accessed by typing !newb or !noob

sinanju
18th February 2011, 21:55
Having problem with the !who module.

Mainly, when you press the 'Info' button, it only displays first couple of lines of info.

It also comes up with a msg, e.g. Id is CIFInfoWho_15_info. Sometimes it's a different number.

The who module is taken from your cif_2011-02-02.zip file.

EDIT

Checked log file, and it shows

2/19/2011 11:46:23 AM -> Syntax error in cfg file "./cif/info_who.lpr" at line #92
Function not defined...GetMemberType
Function 'dowhomemberinfo' script aborted


EDIT 2

The problem seems to be that although I'm in the 'superuser' and 'admin' files, I'm not classed as any type of administrator when it comes to using the Membership module. This is probably because I've changed the Who module as I didn't want to use the welcome text there.

Krayy
20th February 2011, 22:57
Having problem with the !who module.

...
I've rewritten the module to incorporate your user stats...

sinanju
19th May 2011, 11:49
Just realised yesterday evening that the 2 different versions I have of your who.lpr are both called version 1.0.1

Everytime I install new fresh version of lapper on my pc to work on things, I include your CIF modules, and looking thru my old installs, all but 1 are using the older version!

If you do any new modules or updates, can you zip them all together along with current utils.lpr file, so that I know that I'm current?

Ta.

Krayy
19th May 2011, 23:20
Just realised yesterday evening that the 2 different versions I have of your who.lpr are both called version 1.0.1

Everytime I install new fresh version of lapper on my pc to work on things, I include your CIF modules, and looking thru my old installs, all but 1 are using the older version!

If you do any new modules or updates, can you zip them all together along with current utils.lpr file, so that I know that I'm current?

Ta.
I'll reversion and submit new ones soon