Giter Site home page Giter Site logo

vs_library's People

Contributors

samisalreadytaken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vs_library's Issues

VS::CreateEntity is incompatible with prop entities

Entities.CreateByClassname() does not work properly when trying to spawn prop entities. In these cases CreateProp() should be used instead. Since VS.CreateEntity() always calls the former, it is not usable when trying to spawn a prop.

I suggest creating a method (VS.CreateProp()?) for this matter, and possible throwing an exception when VS.CreateEntity() is called with a prop classname.

On the other hand, the same function could handle both cases. However, it must be noted that CreateProp()'s signature forces a model and an animation to be passed.

Cannot fetch player name: "the index 'GetScriptScope' does not exist"

Trying to run the following code:

IncludeScript("vs_library");

VS.ListenToGameEvent( "bullet_impact", function( event )
{
    local player = VS.GetPlayerByUserid( event );
    printl(player)
    local scope = player.GetScriptScope();

    printl( scope.userid );
    printl( scope.networkid );
    printl( scope.name );
}, "test" );

But I get the following error in the console:

(null : 0x00000000)

AN ERROR HAS OCCURED [the index 'GetScriptScope' does not exist]

CALLSTACK
*FUNCTION [unknown()] myscript.nut line [8]

LOCALS
[player] NULL
[event] TABLE
[this] TABLE

I assume the Null response from printl(player) is part of the problem, but I cant figure out where I've gone wrong.

Can't get events

Did everything according to the guide and video, created a logic_eventlistener and point_template, well, it gives errors to the console

AN ERROR HAS OCCURED [the index 'ROOT' does not exist]

CALLSTACK
*FUNCTION [main()] vs_events.nut line [27]
*FUNCTION [DoIncludeScript()] NATIVE line [-1]
*FUNCTION [IncludeScript()] unnamed line [83]
*FUNCTION [main()] vs_eventlistener.nut line [1]

LOCALS
[Events] TABLE
[this] TABLE
[scope] TABLE
[name] "vs_events"
[this] TABLE
[this] TABLE
Error running script named vs_events

AN ERROR HAS OCCURED [Failed to include script "vs_events"]

CALLSTACK
*FUNCTION [IncludeScript()] unnamed line [83]
*FUNCTION [main()] vs_eventlistener.nut line [1]

LOCALS
[scope] TABLE
[name] "vs_events"
[this] TABLE
[this] TABLE
Error running script named vs_eventlistener.nut

AN ERROR HAS OCCURED [the index 'userid' does not exist]

CALLSTACK
*FUNCTION [main()] myscript.nut line [3]

LOCALS
[this] TABLE
Error running script named myscript.nut

Event player_connect can only get BOT Networkid

I try to use the eventlistener catch players info but
It seems only BOT player can correctly get the NetworkId and name,while mine is both null.
Is that because I'm running map on local server ?
Here's my consle screenshot
-37ff27a497d99ed1

How to compile src folder in vs_library.nut

I want to change this library a bit under portal 2 so that save/load doesn't update all existing objects, but I can't figure out how I can compile (compress) the src folder into a vs_library.nut file. How can this be done?

Is it effective that use the following vscript code to set up an logic_eventlistener and point_template entity, so that the vs_events.nut can work?

if ( !("eventlistener" in getroottable()) || !( getroottable()["eventlistener"].IsValid()) )
{
::eventlistener <- Entities.CreateByClassname("logic_eventlistener");
::eventlistener.__KeyValueFromString("targetname","vs.eventlistener");
}

if ( !("pointtemplate" in getroottable()) || !( getroottable()["pointtemplate"].IsValid()) )
{
::pointtemplate <- Entities.CreateByClassname("point_template");
::pointtemplate.__KeyValueFromString("vscripts","vs_events.nut");
::pointtemplate.__KeyValueFromString("Template01","vs.eventlistener");
}

IncludeScript("vs_events");

Calling an added event results causes the index of 0 to not be found.

This seems to be caused when any one of the following consecutivley added events are called:

// Three attacks and one to return to idle
VS.EventQueue.AddEvent( Phase2Attack, 0.0, [this, 3] );
VS.EventQueue.AddEvent( Phase2Attack, 3.1, [this, 3] );
VS.EventQueue.AddEvent( Phase2Attack, 6.2, [this, 3] );
VS.EventQueue.AddEvent(ChangeStateToIdle, 9.3);

Occasionally, the entire event system will fail with the error that the index of 0 does not exist at line 6 of vs_library.nut

This seems to happen when the event is called, not when it is added, and it does not seem to happen consistently on any hardware.

StopTimer like SourceMod

Hello, there is a problem what I'm wondering.

It is hard to describe, so that I will use example to describe it.

For example, in an instance, counting:
When the counter reaches a limit, then stops counting, and release the counter handle, from the memory.

I've found the whole library, but didn't found how to do it...

In other languages, for example, sourcepawn, can be done like this, what is shown below:

int counter = 0;
Handle hTimer = null;
public void OnPluginStart()
{
    delete hTimer;
    hTimer = CreateTimer(1.0, Func, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}

public Action Func(Handle myself)
{
    counter++
    if (counter >= 5)
    {
        counter = 0;
        hTimer = null;
        return Plugin_Stop; // Here to stop the timer
    }
    return Plugin_Continue;
}

Is there any method/tutorial to reach this problem in VScript? thx

HPlayerEye.GetAngles() always returns vector : (0.000000, 0.000000, 0.000000)

I wasn't sure if this was a library bug or a coding mistake so I am posting it here.
The problem is when I execute StartTimer function. Console just prints vector : (0.000000, 0.000000, 0.000000)

IncludeScript("vs_library")

function StartTimer() {
	
	VS.Timer(false, 0.5 , Think)
	
	
    
}
function Think()
{
	HPlayer <- VS.GetLocalPlayer()
	HPlayerEye <- VS.CreateMeasure(HPlayer.GetName())
	printl(HPlayerEye.GetAngles())



	
}

Here are some screenshots of the event listeners:
event_listener-1
event_listener-2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.