Inscript - "Little scripts, and quickly please."

http://inscriptmod.googlecode.com/files/inscript_cut.png

“Little scripts, and quickly please.”

Hey !
Have you ever encountered a situation where **you want to run a little


clientside

script, but then you need to hook** many things, lua_openscript_cl some stuff, but then you figure out that you want to disable* it, and then you need to add parameters and also put a button and* … … … …

So what is Inscript ? It is a little framework that allows you to craft little scripts quickly. It is actually similar to DepthHUD Inline and GarryWare Two modularities (because it is actually a combination of its features : the modules, menus and automatic hooks).

Put a file in a folder, press the button (or use its console command), and everything is set up.


If you are just a player (that don't give a shit about Lua code),

basically, consider this addon like Firefox Extensions Module in which you can mount and unmount gadgets at any time. A list of shipped gadgets is provided below.

How does it look like ?

http://inscriptmod.googlecode.com/files/simpler_inscript.png

http://inscriptmod.googlecode.com/files/menu_metro.png

A menu is generated with a list of your plugins : Mount them or unmount them, and check the little boxes that you want to enable automatically when joining a server.

For each Inscript, there is a menu. Here is the Metronome menu (It is an example plugin to demonstrate how it works).
Menus are generated using the plugin parameters that inscripters can set up.
Each plugin is given a set of automatically generated console commands to mount or unmount the plugin (under the form of an autocomplete command), plus its own menu console command.

[release]List of available plugins for end-users :

[ul]
[li]SharpeYe::Focus : SharpeYe extension code that allows you to use twitch aim on any weapon. http://www.facepunch.com/showthread.php?p=24135806[/li][li]Target Information : Displays information about your targeted prop in a minimalistic fashion. Keeps in memory the last information about the prop you pointed at.[/li][li]Shane’s MicroHUD : A port of Shane’s MicroHUD ( http://www.facepunch.com/showthread.php?t=898890 ).[/li][li]Helper : Shows (Front,Right,Up) direction and their associated angles, and the world +X and +Y onto the targeted prop. Keeps track on the last prop you pointed at.[/li][li]Physgun Sounds : Adds Physgun sound effects.[/li][li]Keyboard : Adds keystroke sound effects whenever you are typing on the chat.[/li][li]Super DoF for Source Recorder : Allows you to enable Super DoF for Source Recording purposes.[/li][li]*Achievements * : Displays achievement progress.[/li][li]Twitter : Makes use of Twitter API so that you can enter several names, and then read up their new tweets in-game as they are posting them.[/li][/ul]
[/release]

http://inscriptmod.googlecode.com/files/163_isgif.gif

[img_thumb]http://inscriptmod.googlecode.com/files/targetinformation.jpg[/img_thumb][img_thumb]http://inscriptmod.googlecode.com/files/microhud.jpg[/img_thumb][img_thumb]http://inscriptmod.googlecode.com/files/helper.jpg[/img_thumb]
[media]http://www.youtube.com/watch?v=C7p3RvI_QKM

[release]Download :

Name your folder “Inscript”.
You can use the SVN to get updates.

SVN (most updated) :
http://inscriptmod.googlecode.com/svn/trunk/

Stable release :
http://www.garrysmod.org/img/?t=dll&id=95929

Commands :
inscript_menu : Open the Inscript menu. If there are new updates something will be written in the menu.

Sub-commands for advanced users ::
inscript_call_reloadpluginlist : Useful for development. Reloads the plugin list, reinitializes everything, and mounts everything that is checked if auto-mount is on.

inscript_call_mountplugin <autocomplete::plugin_name> : Mounts the plugin.
inscript_call_unmountplugin <autocomplete::plugin_name> : Unmounts the plugin.
inscript_call_toggleplugin <autocomplete::plugin_name> : Mounts or unmounts the plugin.
inscript_call_revertplugin <autocomplete::plugin_name> : Reset the plugins’ parameters back to their default values.

[/release]

Here’s an example of plugin :

[lua]PLUGIN.Name = “Keyboard”
PLUGIN.DefaultOn = false
PLUGIN.Description = “Plays keystroke sounds while typing on the chat.”

function PLUGIN:Load()
self.Length = 0
self.LastUsed = 1
self.LastTime = 0
end

– This is not automatically hooked.
function PLUGIN:_DiceNoRepeat( myMax, lastUsed )
local dice = math.random(1, myMax - 1)
if (dice >= lastUsed) then
dice = dice + 1
end

return dice

end

– This function is automatically hooked on Mount, and unhooked on Unmount.
function PLUGIN.HOOK:ChatTextChanged( sText )
if RealTime() < (self.LastTime + 0.12) then return end
self.LastTime = RealTime()

local sound = "ambient/machines/keyboard"

local length = string.len(sText)
if length &lt; self.Length then
	sound = sound .. "7_clicks_enter.wav"
	
else
	local dice = self:_DiceNoRepeat(6, self.LastUsed)
	self.LastUsed = dice
	sound = sound .. dice .."_clicks.wav"
	
end
self.Length = length

LocalPlayer():EmitSound( sound )

end

– This function is automatically hooked on Mount, and unhooked on Unmount.
function PLUGIN.HOOK:FinishChat()
self.Length = 0

local sound = "ambient/machines/keyboard7_clicks_enter.wav"
LocalPlayer():EmitSound( sound )

end

function PLUGIN:Unload()
end
[/lua]

Note that this addon is specifically designed for occasional script users. If you have an addon that has only one purpose, you could use this as a quick hub !

I’m not exactly sure whether this has already been done before : But I did that addon for my personal use, and I wanted to share it.

Thanks for reading !

ha3= always making awesome shit that the community as a whole never catches onto

Agreed

Looks good. Though, add some padding and spacing in that DCollapsibleCategory.

Made a question bot with this :smiley:

[img_thumb]http://www.facepunch.com/fp/rating/wrench.png[/img_thumb]

Might be useful, if I knew how to use it (lol).

No changes in Inscript internal code, but as of now, Inscript now includes a lightweight-customizable version of MicroHUD as an Inscript :

http://www.facepunch.com/showthread.php?t=898890

Okay so here’s a new list of gadgets end-users can use !

http://inscriptmod.googlecode.com/files/targetinformation.jpg

Target Information : Displays information about your targeted prop in a minimalistic fashion. Keeps in memory the last information about the prop you pointed at.

http://inscriptmod.googlecode.com/files/microhud.jpg

Shane’s MicroHUD : A port of Shane’s MicroHUD ( http://www.facepunch.com/showthread.php?t=898890 ).

http://inscriptmod.googlecode.com/files/163_isgif.gif

http://inscriptmod.googlecode.com/files/helper.jpg

Helper : Shows (Front,Right,Up) direction and their associated angles, and the world +X and +Y onto the targeted prop. Keeps track on the last prop you pointed at.

Physgun Sounds : Adds Physgun sound effects.

Keyboard : Adds keystroke sound effects whenever you are typing on the chat.

Quick demo :

Realtime DoF added :eng101:

That’s pretty damn awesome, try to do it like mw2 ( only shows when looking down the sights or whatnot )

Woah.

Now includes an entity tracker for the dof!

I love you.

Okay let me do a bit of addon status here :

So the addon is pretty much already completed in terms of internal mechanism, plugins excluded. Updates will be more oriented on adding more plugins.

I don’t want to complexify the addon, though I can guess there is a little risk that the list of plugins gets longer, in which there may be a Favorite plugins little checkbox (in form of a star-shaped button) to rearrange the plugin list into two categories. Just to keep it very simple.

And I might add a special parameter called “Concommand” to interface with GUI Buttons and allow plugins to have their own concommands, but that’s not sure. You can pretty much improvise your own concommands with PLUGIN.Load and PLUGIN.Unload that would allow more complexity and operability from the end programmer, so.

A about the SDoF Plugins : Those plugins are especially designed for Machinima makers, so that they can Source Record a whole scene with the SDoF feature. They can enable Inscript while doing a demo playback I guess.

Let people arrange plugins into groups kind of like iTunes playlists.

Or do pre-made categories: “Builders” “Moviemakers” etc

Nice this will come in handy.

I suggest hooks be added to the parameter gui elements, I have done this to my copy already but it’d be a nice feature for others. Set the hook the same way the button sets the doclick.

Do you mean in this fashion ? :
http://luabin.foszor.com/code/addons/derma/lua/derma/init.lua#35

Not quite, I actually meant overriding hooks, as done in this link… http://www.pastey.net/135383-ktzl
Note: I modified the CtrlColor class to have hooks on modifications.