View Single Post
Author Message
thresh0ld
Senior Member
Join Date: Sep 2009
Location: Hell
Old 02-27-2014 , 04:33   [L4D2] VScript Help
Reply With Quote #1

Been trying to make this work but there seems to be an issue on the VScript file.

Basically what I am trying to do is load a vscript from sourcemod to create a simple hud but it keeps throwing an error from the console.

Sourcemod Code:

Code:
public Action:RunVscript(client,args)
{
	new entity = CreateEntityByName("logic_script");
	if( entity != -1 )
	{
		DispatchKeyValue(entity, "vscripts", "vscript_test");
		DispatchSpawn(entity);
		SetVariantString("OnUser1 !self:RunScriptCode::0:-1");
		AcceptEntityInput(entity, "AddOutput");
		SetVariantString("OnUser1 !self:Kill::1:-1");
		AcceptEntityInput(entity, "AddOutput");
		AcceptEntityInput(entity, "FireUser1");
	}
	return Plugin_Handled;
}
Test VScript (vscript_test.nut):

Code:
Msg("Hello 'Console' World.\n");

const HUD_TICKER = 6;
const HUD_FLAG_BLINK = 8;

IncludeScript("scriptedmode")
IncludeScript("sm_utilities")
IncludeScript("sm_spawn")
IncludeScript("sm_resources")

function TestHud( startStr = "" )
{
   TickerHUD <- {}                                  
   Ticker_AddToHud( TickerHUD, startStr )           
   HUDSetLayout( TickerHUD )                        
   Ticker_SetBlink(HUD_FLAG_BLINK)
   Ticker_SetTimeout(15)
   HUDPlace( HUD_TICKER, 0.25, 0.04, 0.5, 0.08 )    
}

TestHud("Hello!");

Error Message from Console:

Code:
Hello 'Console' World.

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

CALLSTACK
*FUNCTION [main()] /home/steam/servers/hlds/left4dead2/left4dead2/scripts/vscripts/scriptedmode.nuc line [30]
*FUNCTION [DoIncludeScript()] NATIVE line [-1]
*FUNCTION [IncludeScript()] unnamed line [75]
*FUNCTION [main()] /home/steam/servers/hlds/left4dead2/left4dead2/scripts/vscripts/vscript_test.nut line [7]

LOCALS
[vargv] ARRAY
[this] TABLE
[scope] TABLE
[name] "scriptedmode"
[this] TABLE
[vargv] ARRAY
[this] TABLE
Error running script named scriptedmode

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

CALLSTACK
*FUNCTION [IncludeScript()] unnamed line [75]
*FUNCTION [main()] /home/steam/servers/hlds/left4dead2/left4dead2/scripts/vscripts/vscript_test.nut line [7]

LOCALS
[scope] TABLE
[name] "scriptedmode"
[this] TABLE
[vargv] ARRAY
[this] TABLE
Error running script named vscript_test
(4614.18) input <NULL>: logic_script.AddOutput(OnUser1 !self:RunScriptCode::0:-1)
(4614.18) input <NULL>: logic_script.AddOutput(OnUser1 !self:Kill::1:-1)
(4614.18) input <NULL>: logic_script.FireUser1()
(4614.18) output: (logic_script,) -> (!self,Kill,1.0)()
(4614.18) output: (logic_script,) -> (!self,RunScriptCode)()
(4614.21) input : logic_script.RunScriptCode()
 Entity logic_script encountered an error in RunScript()
unhandled input: (OnPlayerJoin) -> (game_player_manager), from (player,); target entity not found
unhandled input: (OnPlayerSpawn) -> (game_player_manager), from (player,); target entity not found
(4615.18) input : logic_script.Kill()
thresh0ld is offline