• Hey you! Yes, you! Add images to your downloads, it's free! Use the orange "Manage Download Image" button in the top right.

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:​

Put lizardlib.code-snippets file into .vscode folder of your project.

Key features​

  1. 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.

    See listeners.nut.

  2. 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.

    See timers.nut.

  3. 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.

    See timers.nut.

  4. This library folds Constants and NetProps, so that you could write GetPropInt(...) instead of NetProps.GetPropInt(...) or TF_CLASS_HEAVYWEAPONS instead of Constants.ETFClass.TF_CLASS_HEAVYWEAPONS.

  5. Various utility functions.

  6. 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 (see api_config.nut):
rcmF3y7.png


Instructions​

Your project structure is likely something like this
Code:
tf/custom/myproject/
                    models/
                    materials/
                    scripts/vscripts/
                                     myprojectname/
if so, drag the __lizardlib folder into 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: LizardOfOz
Additional Credits: Ficool2, Mr.Burguers
License
Credit is required. Permission to modify optional.
Author
LizardOfOz
Downloads
64
Views
452
First release
Last update
Category
VScript

More downloads from LizardOfOz

Latest updates

  1. beta 2

    Fixed some bugs and added some extra features. Once the Summer Rush is done, I'll make proper documentation.
  2. beta 1c

    Fixed the includescript order that caused the script to not work
  3. beta 1b

    Fixed a function-breaking typo in CTFPlayer.Yeet(Vector) in players.nut. Added ::IsRoundSetup() to util.nut. Careful: always returns TRUE on gamemodes without setup. Added ::ShuffleArray and ::RandomElement to util.nut. Added...