Raised This Month: $51 Target: $400
 12% 

Vscript compiling problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KneeGrow
Junior Member
Join Date: Mar 2014
Old 05-03-2015 , 18:11   Vscript compiling problems
Reply With Quote #1

I'm trying to set a trigger to enable when a car goes fast enough (a trigger_hurt in the front of the car so people dont die from it when its parked)

But I keep getting compiler issues when I load the map

Compiler log (from console)
Code:
AN ERROR HAS OCCURED [Script terminated by SQQuerySuspend]

CALLSTACK
*FUNCTION [EntFire()] unnamed line [20]
*FUNCTION [startRound()] cs_vehicletest.nut line [38]
*FUNCTION [main()] InputRunScript line [1]

LOCALS
[caller] NULL
[activator] NULL
[delay] 0
[value] ""
[action] "Disable"
[target] "killcar"
[this] TABLE
[e2mean] 0
[e1mean] 0
[e2] INSTANCE
[e1] INSTANCE
[ent2] INSTANCE
[entity] INSTANCE
[this] TABLE
[this] TABLE
My actual code

it finds trigger
compares it's mean velocity (x,y,z) with the value 2000
enables when > 2000
disables otherwise
Code:
function startRound() {
	printl("A new round has started");
	local entity = null;

	entity = Entities.FindByClassname(entity,"trigger_hurt"); // find the trigger

	if(entity!=-1){
	printl("Trigger found");
	} else {
	printl("error trigger"); 
	}

	local e1 = null;
	e1 = entity.GetVelocity(); //get its velocity

	local e1mean = null;
	e1mean = (e1.x + e1.y + e1.z)/3; //separate its dimensional components and sums them up

	printl("The mean is");
	printl("mean1: "+e1mean); //checking the code to see if it compiles this far

	while (entity!=-1) //will constantly be monitored as long as it's "alive"
	{
		if(e1mean > 2000) // condition
		{
			EntFire(entity.GetName(), "Enable", 0,);
		}
		else
		{
			EntFire(entity.GetName(), "Disable", 0,);
		}
	}
}
It doesn't say anything is particularly wrong with the syntax or parameters (it is fine with the "enable" part)

although the documentation says
function EntFire(target, action, value, delay, activator)
i've seen an example for l4d2 written like:
(from https://developer.valvesoftware.com/...cript_Examples)
Code:
ent <- null;
while((ent = Entities.FindByClassname(ent,"prop_physics")) != null)
{
   EntFire(ent.GetName(),"DisableShadow",0);
}
Does anyone else see the problem?

Last edited by KneeGrow; 05-03-2015 at 18:16.
KneeGrow is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 05-05-2015 , 08:43   Re: Vscript compiling problems
Reply With Quote #2

What game are you talking about?
__________________
Kia is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-30-2022 , 17:54   Re: Vscript compiling problems
Reply With Quote #3

Quote:
Originally Posted by KneeGrow View Post
I'm trying to set a trigger to enable when a car goes fast enough (a trigger_hurt in the front of the car so people dont die from it when its parked)

But I keep getting compiler issues when I load the map

Compiler log (from console)
Code:
AN ERROR HAS OCCURED [Script terminated by SQQuerySuspend]

CALLSTACK
*FUNCTION [EntFire()] unnamed line [20]
*FUNCTION [startRound()] cs_vehicletest.nut line [38]
*FUNCTION [main()] InputRunScript line [1]

LOCALS
[caller] NULL
[activator] NULL
[delay] 0
[value] ""
[action] "Disable"
[target] "killcar"
[this] TABLE
[e2mean] 0
[e1mean] 0
[e2] INSTANCE
[e1] INSTANCE
[ent2] INSTANCE
[entity] INSTANCE
[this] TABLE
[this] TABLE
My actual code

it finds trigger
compares it's mean velocity (x,y,z) with the value 2000
enables when > 2000
disables otherwise
Code:
function startRound() {
	printl("A new round has started");
	local entity = null;

	entity = Entities.FindByClassname(entity,"trigger_hurt"); // find the trigger

	if(entity!=-1){
	printl("Trigger found");
	} else {
	printl("error trigger"); 
	}

	local e1 = null;
	e1 = entity.GetVelocity(); //get its velocity

	local e1mean = null;
	e1mean = (e1.x + e1.y + e1.z)/3; //separate its dimensional components and sums them up

	printl("The mean is");
	printl("mean1: "+e1mean); //checking the code to see if it compiles this far

	while (entity!=-1) //will constantly be monitored as long as it's "alive"
	{
		if(e1mean > 2000) // condition
		{
			EntFire(entity.GetName(), "Enable", 0,);
		}
		else
		{
			EntFire(entity.GetName(), "Disable", 0,);
		}
	}
}
It doesn't say anything is particularly wrong with the syntax or parameters (it is fine with the "enable" part)

although the documentation says
function EntFire(target, action, value, delay, activator)
i've seen an example for l4d2 written like:
(from https://developer.valvesoftware.com/...cript_Examples)
Code:
ent <- null;
while((ent = Entities.FindByClassname(ent,"prop_physics")) != null)
{
   EntFire(ent.GetName(),"DisableShadow",0);
}
Does anyone else see the problem?
Because google Duck Duck Go leads to this post when looking up the error name, I will answer that I'm convinced this error is the result of an infinite loop.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
elise11
Zero Posts
Join Date: Apr 2022
Old 04-06-2022 , 10:36   Re: Vscript compiling problems
Reply With Quote #4

Its so dificult.
elise11 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:28.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode