The online racing simulator
#1 - Krayy
[CODE] Common look & feel GUI with modules
NEWS!!! This lapper addon has now been superseded by the Common Interface Framework (CIF): http://www.lfsforum.net/showthread.php?t=72589

Hi guys,

This is a big update in the fact that it could make life a bit easier for us and newcomers to Lapper. Thius initial release is mainly for the framework, but I have additional modules that will be released over the next few weeks to allow a lot of Lapper admin tasks to become easier and the user experience to be a lot friendlier.

*** NOTE: This addon will ONLY work for Lapper v6.0.1.0 ***

Q. What do the main competitors for Lappers "InsIm of Choice" crown offer?
A. A common look & feel across their interface taht makes the user experience that much more underwhelming and friendly.

Q. How do we combat this?
A. See below.

This addon provides wrapper functions for the tabbed GUI system.

This can be used by scripters to create a multi-page interface that has a common look and feel so that Lapper becomes easier to use and promotes a clean style of coding to make scripts easier to edit and maintain.

New modules should follow the following naming guidelines and .lpr heirarchy to keep in sync with other available modules:

gui.lpr (this is the main module that must always exists)
|-> gui_<module_name>.lpr
|-> gui_<module_name>_<sub_module_name>lpr

Luckily, I have provided some GUI templates for you to use. So if we were creating a new module called "foo" with an item tab called bar", we would do the following:

1. Copy the base template (gui_template.lpr) to gui_admin_foo.lpr and then update any variable definitions to new names
2. Copy the mdule template ( gui_template_module1.lpr) to a new file called gui_foo_bar.lpr and update vars etc.
3. Add those filenames to the includes in addonsused.lpr, ensuring that they are listed in heirarchical order (gui_foo.lpr first, then gui_foo_bar.lpr) below the gui.lpr include
4. test it using whatever command you set (default is "!module1")

To kick things off, I have included a version of the multi-page help that uses this system, so have a look at the screenshot and the code. To install save the files to your include directory, rename them from *.lpr.txt to just *.lpr and then add the following lines to your "addonsused.lpr file" somewhere near the top, but below the utils.lpr:


<?php 
# GUI Framework main include - this MUST be first
include ("./gui.lpr");
# Help GUI
include ("./gui_help.lpr"); # Multi-tabbed help (all in one)
include ("./gui_help_cruise.lpr"); # Cruise help file (remove if not reqd)
?>

Have a look at the addons below for further examples.

*** Recent changes ***
7/7/2010 - Updated Help.lpr to include Cruise help and to be more readable and allow easy additions
7/7/2010 - Updated gui.lpr to support grouping of buttons in the tab using a leading colon on group name (see gui_help.lpr for examples)
Attached images
gui_help_with_groups.jpg
Attached files
gui_template.lpr.txt - 1.2 KB - 219 views
gui_template_module1.lpr.txt - 1.5 KB - 205 views
gui_help.lpr.txt - 5.8 KB - 235 views
gui_help_cruise.lpr.txt - 1.9 KB - 216 views
gui.lpr.txt - 4.5 KB - 227 views
#2 - Krayy
Administration GUI base & initial modules
These modules are add-ons for the gui.lpr common look & feel system and replace the Handicap and Membership administration modules.

To install, save the files to your lapper include directory, rename the files from *.lpr.txt to just *.lpr and add the following to your "addonsused.lpr" file below the include for gui.lpr:


<?php 
# Admin GUI
include ("./gui_admin.lpr");    # Admin GUI root include 
include ("./gui_admin_membership.lpr");   # Admin GUI Membership administration
include ("./gui_admin_handicaps.lpr"); # Admin GUI Handicap allocations
?>

Attached images
gui_admin_1.jpg
gui_admin_2.jpg
Attached files
gui_admin.lpr.txt - 1.4 KB - 239 views
gui_admin_handicaps.lpr.txt - 7.2 KB - 241 views
gui_admin_membership.lpr.txt - 8.5 KB - 267 views
I must say Nice Work!
#4 - Krayy
Quote from Fire_optikz001 :I must say Nice Work!

Thanks. And if you like them there are a number of user config and admin modules coming in the next week that will make you put a simley face on the end of that.
is it a bad thing that when i updated to your new member script that user is admin worked?
#6 - Krayy
Quote from Fire_optikz001 :is it a bad thing that when i updated to your new member script that user is admin worked?

The gui_admin_member.lpr scrip defines a UserIsAdmin function that overrides any existing function of that name, so not really (at least from my perspective )
Quote from Krayy :The gui_admin_member.lpr scrip defines a UserIsAdmin function that overrides any existing function of that name, so not really (at least from my perspective )

kk ... reason i was asking is your other !ma thing had user is admin also ... but it didn't work ... i'll be including these scripts in my cruise releases
Hey Krayy ... i found a way to include my help in your !help command... no more confusing people

Added to my cruise script:


<?php 
    GlobalVar $HLP_CRUISE
;   $HLP_CRUISE "Cruise";
    
$GUI_HELP_ITEMS $GUI_HELP_ITEMS.",Cruise"
?>

and


<?php 
      gui_help_contents_Cruise 
"^2General Player commands"
    
"%nl%^3!cruiseh ^8- Shows this help"
    
"%nl%^3!km  ^8- Show current amount of km you have"
    
"%nl%^3!cash  ^8- Show current amount of cash you have"
    
"%nl%^3!cars  ^8- Show the current cars you own"
    
"%nl%^3!show  ^8- Shows Everyone Your Stats"
    
"%nl%^3!buy [car]  ^8- Buy the listed car"
    
"%nl%^3!sell [car]  ^8- Sell the listed car"
    
"%nl%^3!pitlane  ^8- Sends you to pitlane"
    
"%nl%^3!price [car]  ^8- Display price of the listed car"
    
"%nl%^3!send [amount] [user]  ^8- sends the listed amount of cash to the listed user"
    
"%nl%^3!pitsafe  ^8- Displays whether your safe to pit"
    
"%nl%^3!officer  ^8- Go on/off duty"
    
"%nl%"
    
"%nl%^2Police Commands"
    
"%nl%^7!chase [user]"
    
"%nl%^6!unchase"
    
"%nl%^7!Fine [amount]"
    
"%nl%^6!clock [user]";
?>

it works ... this is really great function
#9 - Krayy
I've updated the help.lpr with the cruise help, and also rewritten part of it so that it makes it easier to add new help items. Also, if you want to change the oreder that the tabs show up in, just copy & paste the Globalvar lines for the help items until you get them the way you want e.g

Go from this:


<?php 
    
# Just reorder these lines to change order of help item tabs
    
GlobalVar $HLP_GENERAL$HLP_GENERAL $HLP_MAX$HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "General,";
    
GlobalVar $HLP_STATS;   $HLP_STATS $HLP_MAX;   $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Stats,";
    
GlobalVar $HLP_ADMIN;   $HLP_ADMIN $HLP_MAX;   $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Admin,";
    
GlobalVar $HLP_CRUISE;  $HLP_CRUISE $HLP_MAX;  $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Cruise,";
?>

To This:

<?php 
    
# Just reorder these lines to change order of help item tabs
    
GlobalVar $HLP_CRUISE;  $HLP_CRUISE $HLP_MAX;  $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Cruise,";
     
GlobalVar $HLP_STATS;   $HLP_STATS $HLP_MAX;   $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Stats,";
    
GlobalVar $HLP_ADMIN;   $HLP_ADMIN $HLP_MAX;   $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Admin,";
    
GlobalVar $HLP_GENERAL$HLP_GENERAL $HLP_MAX$HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "General,";
 
?>

to put cruise help at the top and General at the bottom
Quote from Krayy :I've updated the help.lpr with the cruise help, and also rewritten part of it so that it makes it easier to add new help items. Also, if you want to change the oreder that the tabs show up in, just copy & paste the Globalvar lines for the help items until you get them the way you want e.g

Go from this:


<?php 
    
# Just reorder these lines to change order of help item tabs
    
GlobalVar $HLP_GENERAL$HLP_GENERAL $HLP_MAX$HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "General,";
    
GlobalVar $HLP_STATS;   $HLP_STATS $HLP_MAX;   $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Stats,";
    
GlobalVar $HLP_ADMIN;   $HLP_ADMIN $HLP_MAX;   $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Admin,";
    
GlobalVar $HLP_CRUISE;  $HLP_CRUISE $HLP_MAX;  $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Cruise,";
?>

To This:

<?php 
    
# Just reorder these lines to change order of help item tabs
    
GlobalVar $HLP_CRUISE;  $HLP_CRUISE $HLP_MAX;  $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Cruise,";
     
GlobalVar $HLP_STATS;   $HLP_STATS $HLP_MAX;   $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Stats,";
    
GlobalVar $HLP_ADMIN;   $HLP_ADMIN $HLP_MAX;   $HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "Admin,";
    
GlobalVar $HLP_GENERAL$HLP_GENERAL $HLP_MAX$HLP_MAX $HLP_MAX  1$GUI_HELP_ITEMS $GUI_HELP_ITEMS "General,";
 
?>

to put cruise help at the top and General at the bottom

or i could just do

<?php 
 GlobalVar $HLP_CRUISE
;   $HLP_CRUISE "Cruise"
    
$GUI_HELP_ITEMS "Cruise,"$GUI_HELP_ITEMS;  
?>

oh i see... will include that in next ver.

but i added the stuff i said to my own cruise.lpr so people who don't have cruise wont see it
It's only for the fact that I put all the help into one file. In theory I should practice what I preach and put the help into multiple files, but I wanted to include this as an example of how to do a self contained item list rather than a multi file one. More fool me hey?
Quote from Krayy :It's only for the fact that I put all the help into one file. In theory I should practice what I preach and put the help into multiple files, but I wanted to include this as an example of how to do a self contained item list rather than a multi file one. More fool me hey?

ahh ok understood
how would it look if i added rules to the !help? :P
Quote from Krayy :What do you mean rules?

like
  • Dont Spam
  • say sorry when you crash
ect :P
Quote from Fire_optikz001 :like
  • Dont Spam
  • say sorry when you crash
ect :P

Dude,

Just for you I did a quick rewrite (and updated the attachments to the first post) to add the facility to have button groups in the tab bar. To do this, put an entry into the item list using a leading colon (check the updated gui_help.lpr attached to the first post and the screenshot for an example).

That should make things a bit more organised.
Hi Krayy,

You did a very good job in making this GUI, thank you!

There is only one thing that can be improved, i think.
In the old handicap menu (handicapper.lpr) is a function to save the handicaps in the database and the next time you start lapper, to load the handicaps out of the database.
I think the handicap menu will be complete if you manage to add this function to it!

Very nice job, and if you have any ideas to add, I can help you if you want, 4 hands always type faster then 2 ^^

Kind regards,
Tim

EDIT: I'm now working on the admin GUI to make a page with kick, ban and penalty buttons. How should I call this page?? I have really no idea what is a good name for this page.
Hi,

I wanted to make an addon for the Admin GUI you made, so the administrators of the server can kick users, ban users with reason and give users penalties.

Yay, I got it! I tried different things, but I'm stuck now.
Could anyone help me with the part of the script where an user will be kicked?
I tried some things, but every time nothing happens or I kick myself instead of any other user.

I attached what I have done so far. (remove .txt) If you can help me with the kick section, then I can finish it on my own I think
In addonsused.lpr, I have this for the GUI.
Never mind the red text

<?php 
########### ##GUI Files #############
# GUI Framework main include - this MUST be first 
include ("./gui.lpr"); 
# Help GUI 
include ("./gui_help.lpr"); # Multi-tabbed help (all in one) 
include ("./gui_help_cruise.lpr"); # Cruise help file (remove if not reqd)

# Admin GUI 
include ("./gui_admin.lpr");    # Admin GUI root include  
include ("./gui_admin_usercontrol.lpr"); #Admin GUI UserControl (kick, ban, penalties)
include ("./gui_admin_membership.lpr");   # Admin GUI Membership administration 
include ("./gui_admin_handicaps.lpr"); # Admin GUI Handicap allocations 
#####################################
?>

Sorry for my bad English, I hope you can understand what I mean.

Thanks in advance.

Kind regards,
Tim

EDIT:
I also changed some things in the 'gui_admin_membership.lpr' and the 'gui_admin_handicaps.lpr' file. Now users that aren't admin can see this windows too, but only admins can change settings. I attached the files to this post. (EDITED_gui_admin_*.lpr.txt ;remove the EDITED_ and .txt again)
There are comments with every thing I changed. I added my username to all comments so you can find all changes I made really fast. You can find all changes quick by searching for 'EMIT-NL'.
If you like the simple changes I've made you can release it. You can edit it if you want and just remove my comments.

Also, what do you think: Should it be cool if the WHO.lpr script is being implemented in your GUI? Otherwise you have diffirent windows instead of one clear page.

Regards,
Tim
Attached files
EDITED_gui_admin_handicaps.lpr.txt - 7.9 KB - 226 views
EDITED_gui_admin_membership.lpr.txt - 8.9 KB - 291 views
Quote from emit-nl :
I also changed some things in the 'gui_admin_membership.lpr' and the 'gui_admin_handicaps.lpr' file. Now users that aren't admin can see this windows too, but only admins can change settings. I attached the files to this post.
...
Also, what do you think: Should it be cool if the WHO.lpr script is being implemented in your GUI? Otherwise you have diffirent windows instead of one clear page.

I've been a bit busy at work (promotion, yay!) to do any updates, but this functionality is being addressed in the upcoming gui_user modules. I have ported the who, handicaps and some other stuff the the gui, but have as yet to publish it here. The reason for supplying them as seperate modules, even though the functionality is similar, is to allow for finer detail in what to allow access to from a server admins perspective.

Also helps with ordering them in the admin or user gui lists
Quote from Krayy :I've been a bit busy at work (promotion, yay!) to do any updates, but this functionality is being addressed in the upcoming gui_user modules. I have ported the who, handicaps and some other stuff the the gui, but have as yet to publish it here. The reason for supplying them as seperate modules, even though the functionality is similar, is to allow for finer detail in what to allow access to from a server admins perspective.

Also helps with ordering them in the admin or user gui lists

Congratiolations with your promotion!!
I'm looking foward to your new release

Tim
Hi guys,

I'm starting to find time to get back to work on the common look interface but need to seek some quick opinions. I'm redoing a bunch of the modules and the main interface, so I need to separate it from the original version, and to do that I reckon I need to rename the framework. Here are the options I want to go with. Cast your vote for which one you like best:

cif Common Interface Framework
clif Common Look Interface Framework
cmi Common Menu Interface
cui Common User Interface

Remember that the interface can be used to support User modules, Admin modules, Help or any other thing that needs multiple tabs, so I would like the name to be as generic as possible. My current favourite is the Common Interface Framework, as that to me is the most descriptive.

Throw in your .02 cents worth and I'll try to have a spanky new download in the next couple of weeks.
I vote for the CIF, Common Interface Framework designation.
I have personalised the tops.lpr file that comes bundled with v6.011 to fit in with the other menu's but Im having problems modifying it into a seperate points based lpr file. That would be a nice feature.
Loving your work so far.

Regards,

Austin.
Much prefer MILF myself (Module Interface Lapper Framework)

or

Common Lapper Interface Thingy
Menu User Frequent Framework
Common User Menu Experience
Frequent Lapper User Framework
Framework Interface Lapper Menu
General Lapper User Module

Don't like CIF - reminds me of the cleaning brand (http://www.unilever.co.uk/brands/homecarebrands/cif.aspx) that used to be Jif.

Maybe CLUI (Common Lapper User Interface), pronounced CLUE, as in 'don't have a ...', or 'do you have a ....'.
LOL @
Quote from sinanju :Much prefer MILF myself (Module Interface Lapper Framework)

Well,.. I'll vote for CIF

But uhmm, what are you going to change on the framework?
I just finished with implementing the who.lpr functions into your current GUI and I also made penalty and warn/kick/ban functions for admins. xD

Anyway, good that you found some time again, you are making great stuff for LFSLapper

Tim
I was going to ask if someone could make a relevant acronym for CLIT, but alas it's not to be. CIF it is (sorry sinanju).

Here's a list of current working modules within the rewritten framework:

For users:
Handicaps (display only)
Who (with a click through to get server race stats)
Top (along with a UI to set DefaultTopCar for each user or globally if you're an admin)
Help files

For admins:
Handicaps (set user handicaps)
Membership Admin (used to control who is admin, guest, etc)
Race setup (sets laps, track, cars, laps etc)
Server Options (in beta, but can set who can log on, server restrictions like view, can reset,
Penalties (set server penalties for speeding, car reset etc)

If you have modded any of the original modules that you think make it better, send me a PM, or email them to me at [email protected]

I'll look at finalising (well beta-ing) the revised framework in the next week or so, which will make adding new modules a heap easier too.
1

FGED GREDG RDFGDR GSFDG