EnglishGermanFrenchRussianPolishItalianSpanish
Log inRegister
 
[SCRIPT] Hotkey Manager : V1.11 : 2010/01/03
Post new topic Reply to topic Goto page 1, 2, 3  Next
View previous topic :: View next topic
Author Message
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 15 Nov 2004
Posts: 20457 on topic
Location: London
Thank you for registering your game
modified
PostPosted: Fri, 5. Dec 08, 14:24    Post subject: [SCRIPT] Hotkey Manager : V1.11 : 2010/01/03 Reply with quote Print

=============================================
Script: Hotkey Manager
Created: 03/01/2010
Version: 1.11
Author: Cycrow
Game: X3: Terran Conflict 1.3+
=============================================

Arrow Installation:




    Idea Requires: Plugin Manager Lite

    Install via the Plugin Manager Lite
    Requires Games Version 1.3+ to function


Arrow Introduction:

    This is a library script to make it easier to register and maintain hotkeys.
    The advantage of using this, is that the hotkeys will be saved in memory so can easily be found later
    and they can automatically be removed if the script is no longer available.
    So scripts dont need to create extra uninstall routines for removing the hotkeys


Arrow Scripters Usage:

    Using it is fairly straight forward, you simply need to call the add script withint your setup script

    Code:

    = call script 'plugin.hotkeymanager.add' nameid='myhotkey' Display Text='My Hotkey' Hotkey Script='plugin.myscript.hotkey'


    The first argument, nameid, is a unique string identifier for your hotkey. If your scripts uses multiple hotkeys, they need to have seperate ids
    The next argument, Display Text, is the text that is display in the controls menu.
    The last argument, Hotkey Script, the string name of the script to run when the hotkey is pressed.

    This is all you need to do, theres no need to remove the hotkey, the manager will take care of this.

    However, unlike with normal hotkeys, you have to register this each time the game loads, ie, in your setup script, you dont need any check, just call the script each time.
    Also, it must not be in an Init script


Arrow Advanced Usage:

    The add script will always returns true, this means you can use it to detect if the hotkey manager is installed.
    This will allow you to create a script that can still work without the library, ie

    Code:

    if not [THIS] -> call script 'plugin.hotkeymanager.add'
      $key = register hotkey $text....
    end


    This will then use your own hotkey control if the manager is not installed.


Arrow Technical Information:

    Now, how the manager actually works.

    The manager maintains a list of all registered hotkeys and thier setings in a global varible.
    There is in init script that is run before all the script setups, this script will go through the whole list and mark all the hotkeys to be deleted
    When the setup scripts are run and they add thier hotkeys, if the hotkey exists, they will be marked not to be deleted.
    The manager then has its own setup script that will run another script that waits for a short time. After this time, it will check all the hotkeys that are still marked as deleted and remove them.
    So any hotkey that hasn't been readded in setup scripts, ie because the setup script no longer exists, will then be removed.



_________________
My Scripts | MY X3TC Scripts | X3 Plugin Manager | Custom Gui


Last edited by Cycrow on Tue, 25. Aug 15, 08:55; edited 4 times in total
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
cheata





Joined: 16 Mar 2007



PostPosted: Tue, 16. Dec 08, 14:05    Post subject: create your own keybindings Reply with quote Print

Is it possible to bind keys to scripts?


{Merged to apparently very relevant script thread. jlehtone}

Back to top
View user's profile Send private message
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 15 Nov 2004
Posts: 20457 on topic
Location: London
Thank you for registering your game
PostPosted: Tue, 16. Dec 08, 15:28    Post subject: Reply with quote Print

yes, just create a hotkey and call the script you want.

for an easier way, you can use my hotkey manager


_________________
My Scripts | MY X3TC Scripts | X3 Plugin Manager | Custom Gui
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
cheata





Joined: 16 Mar 2007



PostPosted: Tue, 16. Dec 08, 15:57    Post subject: Reply with quote Print

lol thanks man.. that will save me a few hours reverse enginering the game code.

I was going Completly the wrong direction Very Happy

Back to top
View user's profile Send private message
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 15 Nov 2004
Posts: 20457 on topic
Location: London
Thank you for registering your game
PostPosted: Fri, 10. Jul 09, 19:02    Post subject: Reply with quote Print

Updated to fix a few bugs


_________________
My Scripts | MY X3TC Scripts | X3 Plugin Manager | Custom Gui
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
testmod





Joined: 13 Mar 2009
Posts: 71 on topic

Thank you for registering your game
PostPosted: Sun, 13. Dec 09, 07:41    Post subject: Reply with quote Print

wow. first search didnt turn this up... if I found this earlier it would have saved me so much trouble. Will use ASAP!

thanks!! Very Happy

Back to top
View user's profile Send private message
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 15 Nov 2004
Posts: 20457 on topic
Location: London
Thank you for registering your game
PostPosted: Mon, 4. Jan 10, 01:10    Post subject: Reply with quote Print

Updated to 1.11

Repacked for Plugin Manager Lite

Theres been problems with some older versions not being completly up to date

Installing this should make sure its running the correct version and prevent multiple hotkeys appearing


_________________
My Scripts | MY X3TC Scripts | X3 Plugin Manager | Custom Gui
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
russbo





Joined: 12 Nov 2005
Posts: 847 on topic
Location: Las Vegas
Thank you for registering your game
PostPosted: Mon, 4. Jan 10, 07:39    Post subject: Reply with quote Print

Can this be installed with the older version of the plug in manager?


_________________
www.russbo.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 15 Nov 2004
Posts: 20457 on topic
Location: London
Thank you for registering your game
PostPosted: Mon, 4. Jan 10, 13:27    Post subject: Reply with quote Print

No it will only work with the new one

Its classed as a dependacy library which doesn't exist in the old version


_________________
My Scripts | MY X3TC Scripts | X3 Plugin Manager | Custom Gui
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mark_a_condren





Joined: 03 Aug 2005
Posts: 1385 on topic
Location: Newcastle - Australia
Thank you for registering your game
PostPosted: Sun, 24. Jan 10, 15:18    Post subject: Reply with quote Print

When i was adding this to a script recently i thought it would be good if it could use hotkeys from scripts that were installed before Hotkey manager was installed.

for example, add the already installed hotkey to the script call,

Code:
= call script 'plugin.hotkeymanager.add' nameid='myhotkey' Display Text='My Hotkey' Hotkey Script='plugin.myscript.hotkey' Existing Hotkey= 'myexistinghotkey'


And from then on Hotkey manager could take over the management of it.

Just a thought, ment to post about it when i thought of it.

MarCon

Back to top
View user's profile Send private message Send e-mail
MegaBurn





Joined: 30 Jan 2006
Posts: 224 on topic
Location: Lost in the woods!
Thank you for registering your game
PostPosted: Mon, 3. May 10, 07:24    Post subject: Reply with quote Print

I know this is beyond the intended scope of the Hotkey Manager, but... I'm working on a massive script build and as this drags on I increasingly feel I should contribute my work back to the community, but being a bit of a perfectionist adds a requirement for reasonable ease of use. Unfortunately I'm finding there is an unmanageable proliferation of new hotkeys, over a 100 when I stopped counting. After thinking about it for a while it seems like the best solution is converting hotkeys into "virtual command slots" which can be accessed through a variety of player defined interface widgets.

I think the best way to make this work is expand the Hotkey Manager, essentially bolt on a set of front-end menus and functions to dynamically change which script is triggered by a bound hotkey. From what i understand, I'm assuming this can be done transparently to both players and third-party scripts, players would only have to upgrade to take advantage of the new functionality, the back-end library aspect would remain the same.

From there the focus would turn towards converting wayward scripts. Is it possible for a script to trigger (or copy) a hotkey defined by another script without binding it to a physical key? If so, third-party scripts could be integrated transparently into the front-end, regardless of if they use the library back-end aspect.

Ideas for the virtual command slot interface widgets:
-- Single large dynamic menu of everything available via the hotkey manager. By default it should serve as a sort of quick reference, like a color-coded multi-column layout to easy see whats assigned where. Could have an alternate view to scroll and trigger any virtual command slot available.

-- "Quick Menus", simple ten item dynamic menu with a common set of global hotkeys to trigger quick menu items one through ten. Would require a config menu to review, create, edit, and remove quick menus. Each quick menu would have a virtual command slot, so it could be assigned to a hotkey or another nested quick menu.

-- "Multi Tap", triggers different virtual command slots depending on a hotkey single, double, or triple tab. Each virtual command slot trigger should include an option for subtitle feedback, that way less used commands or those with no immediately apparent effect can give confirmation.

-- Combo Keys, similar to multi tap but uses two or more different keys within a given time period (not to be confused with keys pressed simultaneously). Should include options for subtitle and auto feedback as confirmation. Could include an option to copy combos from a quick menu, allowing the player to avoid displaying the menus they have memorized.

-- Contextual Key, add basic conditional checks for different types/classes of player ship and player target, and target race/IFF. Can't make it too complicated if players have to define it via a config menu.

-- Macros keys, a player defined interface widget that triggers a series of virtual command slots. Could readily be expanded into a full macro system, with a quick menu to select macros and a multi-tap to record, run, and save macros.


Thoughts?

I lack the X3 scripting experience to do this on my own but I'll try to help if I can...


_________________
"Only the dead have seen the end of war." -Plato
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
AtomicDryad





Joined: 19 Jan 2008



PostPosted: Mon, 3. May 10, 09:12    Post subject: Reply with quote Print

Those are good ideas, some of which I've considered looking into awhile bback. They sound feasable but I'd need to look into hotkey mgr code to verify.
This may warrant a seperate thread, especially if it becomes a collaborative project.
Using SVN for scripts might help, though the weird structure might make unified diffs a pain.

Back to top
View user's profile Send private message
MegaBurn





Joined: 30 Jan 2006
Posts: 224 on topic
Location: Lost in the woods!
Thank you for registering your game
PostPosted: Tue, 4. May 10, 12:37    Post subject: Reply with quote Print

This should not be big enough to warrant SVN but that does make me wonder why the community doesn't have an integrated asset pipeline established. Never cases to amaze me how game modding communities get the complete ass end of the game development "deal" yet they produce an incredible amount of content. Just imagine what this place would look like if engine modules and scripts could be written in Eclipse and the community were hosted on a FusionForge site with all the server side "bells & whistles" (better than SourceForge).

Anyway, hopefully Cycrow can find some time to weigh in on this and coordinate the work. To be effective it must be based around his Hotkey Manager just to get the third-party script "market penetration" - that is unless there is a way to either hijack the hotkey manager or intercept script defined hotkeys (no clue there). I've almost completed my final sweep through my massive script/mod build list, last count is 94 plus 45 "major tweaks", should be a large enough sample for compatibility testing, but I won't be testing anything until after the DDTC1.1 final release (and a fresh X3TC install).

Another thing to consider is saving and loading hotkey condigs including defined widgets from files, theres a JSON library around somewhere that might be useful.


_________________
"Only the dead have seen the end of war." -Plato
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 15 Nov 2004
Posts: 20457 on topic
Location: London
Thank you for registering your game
PostPosted: Tue, 4. May 10, 14:46    Post subject: Reply with quote Print

there are a few problems with the suggestions.

the main would be, that scripted hotkeys only work in open space, so if you press a hotkey to open a menu, you can no longer use hotkeys until that menu closes, so you cant select items from the menu using hotkeys.

best you can get as far as hotkey menus go, would be my community config plugin


_________________
My Scripts | MY X3TC Scripts | X3 Plugin Manager | Custom Gui
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
MegaBurn





Joined: 30 Jan 2006
Posts: 224 on topic
Location: Lost in the woods!
Thank you for registering your game
PostPosted: Tue, 4. May 10, 21:16    Post subject: Reply with quote Print

Well for the quick menus it could use a ten item dummy comm menu, those support the 1-0 row keys to select entries but the t-files would be a real pain... Even without that, the rest should work as intended, except the "quick menus" wouldn't be as quick. People could focus on multi-tap or combo keys instead, might increase the focus on using subtitles as remainders too.

Any idea how the game settings control profile menu is built? If it uses script accessible global variables with the target script, description, and hotkey ID's that might work for hijacking hotkeys defined by other scripts, just load the target script and description ID's into an array for reassignment via the hotkey config menu, and removed the existing hotkey. I can't see any other way to get the target script of a defined hotkey. Could hotkey ID's in profileX.xpf be back traced to some script accessible global variable?

EDIT: I did some searching around and came up with a few more ideas... Looks like an incoming question pop-up will work fine, annoying aspects can be disabled, and only needs a few t-files for menu templates. Didn't find anything to help with hijacking hotkeys from other scripts but I could use my script/mod list to index most of them, and investigate any special handling needed (e.g. breaking up existing multi-tap hotkeys). Some more "yet another thing to consider", add most stock commands/utilities to hotkey config menu for easy assignment, design widgets with consideration for use as a general library, and merge in some of the older hotkey scripts. Any other issues?


_________________
"Only the dead have seen the end of war." -Plato
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic Reply to topic Goto page 1, 2, 3  Next
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Control Panel
Login Data
The time now is Sat, 21. Oct 17, 17:48

All times are GMT + 2 Hours


Board Security

Copyright © EGOSOFT 1989-2017
Powered by phpBB © 2001, 2005 phpBB Group
Template created by Avatar & BurnIt!
Debug: page generation = 0.70491 seconds, sql queries = 29