LizardLib beta 2
Evil Lizardry
What and Why?
Since the release of TF2 VScript I've accumulated a bunch of useful general-purpose stuff, and I believe it will be useful not just for me, but for anyone making a VScript-powered project.VSCode integration:
Putlizardlib.code-snippets
file into .vscode
folder of your project.Key features
- Normally, you can attach only 1 function per game event via
OnGameEvent_x
. I've made a system to attach as many game event listeners as you want and define their execution order.
The event listeners share their lifetime with the scope they're created in, allowing you to discard listeners by simply discarding the scope.
If an event listener throws an exception, it will be contained inside that listener.
In addition, you can create and pass custom events around the script.
Seelisteners.nut
.
- Normally, you can create only 1
think
function per script, therefore all your repeating activities share the same timer. With this library you can create as many independent timers as you want.
Similar to event listeners, you can set the priority order, timers get deleted with their associated scope, and exceptions don't leak outside of the timer function.
Please note that the timer precision is limited by TF2 ticks (1\66th of a second) and won't execute more than once per tick.
Seetimers.nut
.
- Another system allows you to schedule delayed execution of a function. Similar to the previous systems, a scheduled function will not be executed if its scope gets discarded.
Seetimers.nut
.
- This library folds Constants and NetProps, so that you could write
GetPropInt(...)
instead ofNetProps.GetPropInt(...)
orTF_CLASS_HEAVYWEAPONS
instead ofConstants.ETFClass.TF_CLASS_HEAVYWEAPONS
.
- Various utility functions.
- Normally, the outputs needed to set VScript parameters from within the map I/O aren't intuitive for the mappers. I've created a system that is more straightforward. Create a
info_particle_system
, and use Control Point fields to specify the key and the value of the parameters (seeapi_config.nut
):
Instructions
Your project structure is likely something like this
Code:
tf/custom/myproject/
models/
materials/
scripts/vscripts/
myprojectname/
tf/custom/myproject/scripts/vscripts/myprojectname
.In your main script file, add
Code:
::projectDir <- "myprojectname";
IncludeScript("myprojectname/_lizardlib/_lizardlib.nut");
Is there a manual?
I'm running short on time. So I figured, releasing a library without a proper manual is better than sitting on it unreleased.Also, please let me know of a good system to host a manual, as I couldn't find any. A simple readme.md (which is close to what you're reading right now) doesn't have sufficient formatting capabilities.
Is there a sample project?
Soon(tm)Credits
Made by: LizardOfOzAdditional Credits: Ficool2, Mr.Burguers
- License
- Credit is required. Permission to modify optional.