[SCRIPT] Community Configuration Menu : V1.51 : 03/01/2012

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply

Will scripters find this useful ?

Yes
550
87%
No
8
1%
Dont Care
76
12%
 
Total votes: 634

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20541
Joined: Mon, 15. Nov 04, 00:26

[SCRIPT] Community Configuration Menu : V1.51 : 03/01/2012

Post by Cycrow » Mon, 20. Oct 08, 22:18

================================================================
Script: Community Plugin Configuration
Created: 03/01/2012
Author: Cycrow
Version: 1.51
Game: X3: Terran Conflict V2.5+
================================================================

:arrow: Installation:
  • Image

    :idea: Required: Plugin Manager Lite

    Make sure the Plugin Manager Lite is installed and setup. Then Download and install using the Manager

    NOTE: This script is mainly for use for other scripts and can be included with them

    Image (RAR)
:arrow: Introduction:
  • This script is designed to allow the community of a central location for thier configuration menus.
    This creates a menu that lists all the scripts that have configuration, selecting them will open up the scripts own configuration menu.

    Image
:arrow: Users:
  • This script will only work if other scripts have been added to its list. To use it, simply set the hotkey and press it to open the menu.

    if no menu opens, then most likly there is no configurable scripts available.
:arrow: Scripters:
  • To make use of the configuration menu, simply call the script, plugin.config.addscript, from your setup script.
    It takes 3 arguments, the script name and script author (ie you) and the config script.

    The menu will split the scripts into sections for each author and display the name, which you set as the first argument.

    The 3rd argument, config script, is the string name of the script to run. Ie, you create your own script and type in the name of it here.
    When your script is selected from the menu, it will run this script so you can have your own menu open up to do what ever config is required

    The 4th is a boolen (true/false) if you want the author to be displayed

    The 5th is the section you wish it to appear in, leaving this null will put it in the first section in the menu. Anything else will add a new section below to seperate your script from the rest

    WARNING: When calling the config scripts, you must call them normalling, and not use START to create a new process, otherwise it could lock up someones game if they dont have this installed
:arrow: Additional Options:
  • As well as adding your own package menu, you can also add single options.

    There are currently 3 types of options you can add. The options will display the option in the menu, as well as thier current value. Selecting the value allows you to change the option.

    All options have the same basic 4 arguments, these are:
    Unique ID: This is a string id to identify your option from someone elses, can be anything you like
    Option Text: This is the text of your option, and is what will be displayed on the menu
    Setting Script: This is an optional script that can be run when your option is selected, althou until the packages, this is not needed. Scripts need 2 arguments, the first is the Unique ID, the second is the value its been set to
    Section: Like with the package list, this allows you to add your option to a certain section in the menu

    As said, when the user selects your option, the value will change depending on the type of option, you can use the script to do anything else you might need to

    Boolean Option
    This is a simple On/Off switch, selecting it turns the option, on, or off.

    To use this, you need to call the script, plugin.config.addboolean, which has the first 4 arguments above, plus the default value.
    This is the value that it will start at, ie TRUE, or FALSE.

    Selecting this option in the menu simply cycles between on and off.

    Cycle Option:
    This is an extension to the Boolean, but it allows you to cycle between more entries that you define.

    To use this, you need to call the script, plugin.config.addcycle, The 5th argument is an array of your options. The default will be set to the first entry

    When selecting this option, it will cycle between your available options from the array

    Select Option:
    This is simplar to the Cycle Option, its created in the same way, using the script, plugin.config.addselect. And uses the option array.

    The difference with this options, is how the user selects it. Instead of cycling between the available options, it'll open a seperate menu with all the options for the user to pick.

    If your scripts need to check the status of your values, there is a script you can call, plugin.config.getvalue, you send it your Unique ID, and it returns the currently set value
:arrow: Additional Menus:
  • You can also create your own menus, and have the menus open up from other menus. All scripts used to add options also now has a Menu Argument, this specifies the menu you want the option to be added to
    Leaving this option blank, or null will add the options to the main menu (ie the same as normal)
    Otherwise, you can set this to the unique menu id, and the option will then only display when viewing that specific menu.

    To create a new menu to add your options in, you use the plugin.config.addmenu script, setting the unique menu id that you use to add menus too.
    The menu will display the same as the scripts, with the name, and other display, but when selecting it, instead of running your script, it opens the menu and displays all items with the same menuid

    If you want to open your created menu from your own scripts/menus, etc. Then you can call the 'plugin.config.displaymenu' script, with the menuid of your menu and your menu will then be displayed
Last edited by Cycrow on Tue, 25. Aug 15, 08:54, edited 14 times in total.

User avatar
Litcube
Posts: 4240
Joined: Fri, 20. Oct 06, 19:02

Post by Litcube » Mon, 20. Oct 08, 22:46

Cycrow, you're miles ahead of everyone in terms of scripting for TC. Can you explain what this is?

What's a configuration menu?

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20541
Joined: Mon, 15. Nov 04, 00:26

Post by Cycrow » Mon, 20. Oct 08, 22:50

well, remember in X3 when some scripts have a configuration. Ie, my Xenon migration script.

well, this acts a central place for them all. So instead of having a seperate command or hotkey to config the script, it can be added to this menu.

so if you want to configure ur script, jsut open this menu and it will list all scripts that can be configured

Khaak_Slayer
Posts: 383
Joined: Sun, 18. Apr 04, 17:04

Post by Khaak_Slayer » Mon, 20. Oct 08, 22:59

Very nice. So this is going to become one of those essentials then i presume?
Rawr.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20541
Joined: Mon, 15. Nov 04, 00:26

Post by Cycrow » Mon, 20. Oct 08, 23:04

depends how many ppl use it really.

User avatar
Litcube
Posts: 4240
Joined: Fri, 20. Oct 06, 19:02

Post by Litcube » Mon, 20. Oct 08, 23:08

Ok, cool.

Was kind of hoping TC would implement a script command that would add configuration items to the global options menu. This is the next best thing, though.

Thanks.

User avatar
joelR
Posts: 1984
Joined: Mon, 9. Jul 07, 23:33

Post by joelR » Tue, 21. Oct 08, 00:21

Think we could sticky this like the plugin manager thread? Seems like an incredibly valuable "tool".

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45

Post by s9ilent » Tue, 21. Oct 08, 01:55

Horay for Cycrow!!

I tried to make something like this before.. but it failed miserably (It works.. just that no one uses it, including me) Not to mention it was hard to use. But luckily, if you start early, you can standardize anything (Especially so if your Cycrow).
I'm guessing that one of the key improvements of TC is the "call script with name $Variable" ?


I just wish that TC was released in Australia... I've still got to wait another day :S. I've finished coding the script for my resupply thingy... but I haven't written the UI yet (As I knew there was going to be a new one, nor have I done the buying bit)

Standardization is key!

Coruskane
Posts: 796
Joined: Fri, 13. Jun 08, 13:14

Post by Coruskane » Tue, 21. Oct 08, 02:31

yey!

i really hope the great scripters out there decide to use this as a standard. My final install of X3:R needed about 10 dedicated hotkeys (no easy task on a laptop)

User avatar
Sandalpocalypse
Posts: 4142
Joined: Tue, 2. Dec 03, 23:28

Post by Sandalpocalypse » Tue, 21. Oct 08, 06:41

So this is like an Artificial Life menu of the Future?

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20541
Joined: Mon, 15. Nov 04, 00:26

Post by Cycrow » Tue, 21. Oct 08, 11:49

no abit different to the AL menu, the AL menu is still available ;)

things like Xenon Migration that has a seperate setup menu, ie it had a hotkey that you can set how hard to the xenon attacks were.

this allows it to be added to this menu isntead of using seperate hotkeys and menus for it.


i will be releasing SEWN to that makes use of this

shinyclef
Posts: 32
Joined: Sun, 2. Sep 07, 13:25

Post by shinyclef » Tue, 21. Oct 08, 22:45

I'm not a scripter, but I voted yes cause this would be very useful! One key bind is better than many! I really hope this catches on.

ThisIsHarsh
Posts: 1132
Joined: Sun, 19. Oct 08, 18:46

Post by ThisIsHarsh » Sat, 25. Oct 08, 07:14

Hey, I've used this for a script I'm working on and just have one comment/suggestion:

I don't really see the need to have a separate section for each author. I can imagine a case where people use, say, 30 scripts, with authors only being attributed to 1 or 2 each... lots of clutter.

I would suggest instead simply *sorting* the options by author name, that way they stay grouped, but don't come under a separate title. If the authors want to include their name, then they can do so as part of the 'Plugin Name' parameter.

Just a thought.

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45

Post by s9ilent » Sun, 26. Oct 08, 04:42

Hey

Just an idea,

What if you changed the very of plugin.config.menu.xml end such that:

066 ||= null -> call named script: script=$ret, null, null, null, null, null
067 |end
068 end
069
070 return null

such that the script returns some true/false checker variable. And if it was false, it will be marked as N/A; *and* then if there was an option to hide/delete all N/A marked menu's.



This way its like a "am I installed" checker each time the script is run.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20541
Joined: Mon, 15. Nov 04, 00:26

Post by Cycrow » Sun, 26. Oct 08, 12:57

well if it appears in the list, then it would be installed.

because, the menu uses an init file, it can whip the script list on load and then all the scripts can re add themselves in the setup scripts.

so if they are in the list, then they must have run at that time.

so to check it if its installed, u can just check the script array

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”