Extended script support ( hooks / broadcasts )

Features wanted...
Post Reply
Acecool
Posts: 43
Joined: 25 May 2016 11:13

Extended script support ( hooks / broadcasts )

Post by Acecool »

I will be buying this when it is 50% off ( even at $40 it is still quite expensive as Windows 10 is only $20-$30 for a pro oem key ) for life-time but I believe the scripting support should be extended to allow us more control over how it behaves. This will mean that the customers will be able to integrate their own features into XYplorer...

I'm not sure what language code it is that is currently used, but some additional functionality should be added such as function support.. Using something like python or Lua may make the transition easier..

What is a hook / broadcast? A hook is code that executes when certain functionality is executed in the main code with the ability to process its own commands when executed, or alter the behavior of the original code... Altering the behavior is a huge want because it can change the way XYplorer works making it more desirable..

In short, a hook is basically a function with a CallID and a unique name ( so it can be overwritten if the code changes and so multiple can be executed per call id ). The original function assigned to the hook is always executed last BUT when a return is processed of non-nil value then it stops processing hooks under that call id ( which overrides default behavior and other behavior altering hooks; first come first serve in a table and it works very well in Garry's Mod and can work very well here ).


In the post asking for integral support to prevent duplicate tabs, I show some examples of how a hook could be added, what it could look like and what it can do in the instance of preventing duplicate tabs by closing unlocked tabs as you enter a tab already open and opening a new tab from a locked tab if you change directory with focus being applied in each case so the transition between directories is seamless: http://www.xyplorer.com/xyfc/viewtopic. ... 32#p138901

Another example using GLua https://dl.dropboxusercontent.com/u/260 ... n.lua.html -- which is an example for number 3 which modifies behavior based on another hook by either running the code if the hud element should be displayed or not displaying it if the other hook doesn't want it to be shown...
  • Scripts than run with XYplorer ( all the time / stay in memory.. This is so when a hook is added it can execute at the appropriate time rather than execute only when the script is executed )
  • custom function support - right now I see we can call, but I don't see where we can create ( this will help reduce the amount of code needed to perform actions )
  • Callbacks / Hooks / Broadcasts - this is the biggest ask / want and will require more code to be written for Pre / Post hooks... and code probably needs to be moved around so default behavior is assigned to a function and if a return of non-nil is returned from the hook system then that original function isn't processed...
I know this is a huge task, but the benefits of being able to call other built in functions or completely change their behavior through hooks would provide a level of customization almost unparalleled by any other explorer replacement ( there are some that allow plugins which need to be coded in C++ or C# if I recall correctly via dll and that can create security concerns where-as using a VM / scripting engine you can ensure more security by requiring the code be seen by users )..

I could create the no duplicate integration with ease, among other things without needing to ask for it to be added here in Wishes and I could post the code in Script Exchange for others to use or you could create a plugin manager ( similar to Notepad++ so users can add / remove features which others have coded [ link it to the forum or a script-exchange feature on the website requiring code to be open and legible with a full description of what it does ] ).

Not everyone knows how to code so not everyone will be able to read or know what the code shared does which is where you would need to control the system ( via user moderation so it doesn't take up your time ) to authorize it to be displayed in the plugin / feature manager ( but non authorized should be displayed to those that do know the language by having a dev feature and marking features that haven't been authorized with a [DEV] or [Pending] tag prepended to the title or a separate column...

Scripting is great, but right now we're severely limited in what we can actually do and we can't overwrite behavior to better personalize the explorer to make it serve us in the ways we want it to and we're required to execute the script each time we want to run it which can be quite annoying...
Last edited by bdeshi on 07 Jun 2016 14:07, edited 1 time in total.
Reason: list formatting

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Extended script support ( hooks / broadcasts )

Post by highend »

Functions:

Code: Select all

::rtfm "idh_scripting.htm#idh_scripting_udf";
One of my scripts helped you out? Please donate via Paypal

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Extended script support ( hooks / broadcasts )

Post by bdeshi »

Hooks is a nice idea. Maybe this can be implemented as a part of the mythical Custom Event Actions.

Also, look into tl;dr -- you run the risk of having responders crash into a wall of text.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply