"The index does not exist."
Quote from FelixGriffin on July 8, 2012, 4:10 pmOne of my maps includes a logic_script with a single function defined in it. A RunScriptCode calling the function brings up the error "The index [FUNCTION NAME] does not exist." Does anyone know what might cause this?
One of my maps includes a logic_script with a single function defined in it. A RunScriptCode calling the function brings up the error "The index [FUNCTION NAME] does not exist." Does anyone know what might cause this?

Quote from ChickenMobile on July 8, 2012, 9:11 pm1. Your script is not in the Entity Scripts field in your logic_script
2. You are calling a function or value which is not stated inside the code
3. You have a syntax error inside your script. There may be an extra bracket, a random letter inserted somewhere that would break it etc.Paste your code in a [code] tag and tell me what input you are giving it and I can give you an answer to why it isn't working.
1. Your script is not in the Entity Scripts field in your logic_script
2. You are calling a function or value which is not stated inside the code
3. You have a syntax error inside your script. There may be an extra bracket, a random letter inserted somewhere that would break it etc.
Paste your code in a [code] tag and tell me what input you are giving it and I can give you an answer to why it isn't working.
Quote from FelixGriffin on July 9, 2012, 11:47 am
- Code: Select all
function invertParent(){
// local ent = Entities.FindByTarget(null,"@counter_energyball_marker");
local ent = EntityGroup[0];
if(ent == null){
printl("ERROR: Countering Energy Ball:");
printl(" No Marker Found!");
return;
}
local theparent = ent.GetMoveParent();
if(theparent == null){
printl("ERROR: Countering Energy Ball:");
printl(" No Parent Found!");
return;
}
local angles = theparent.GetAngles();
angles *= -1;
angles = GetPlayer().GetAngles();
theparent.SetAngles(angles.x, angles.y, angles.z);
printl("COUNTER");
return;
}printl("SCRIPTFILE RUN");
printl(randomVar);To redirect a combine ball.
- Code: Select all
function invertParent(){
// local ent = Entities.FindByTarget(null,"@counter_energyball_marker");
local ent = EntityGroup[0];
if(ent == null){
printl("ERROR: Countering Energy Ball:");
printl(" No Marker Found!");
return;
}
local theparent = ent.GetMoveParent();
if(theparent == null){
printl("ERROR: Countering Energy Ball:");
printl(" No Parent Found!");
return;
}
local angles = theparent.GetAngles();
angles *= -1;
angles = GetPlayer().GetAngles();
theparent.SetAngles(angles.x, angles.y, angles.z);
printl("COUNTER");
return;
}printl("SCRIPTFILE RUN");
printl(randomVar);
To redirect a combine ball.

Quote from ChickenMobile on July 9, 2012, 12:27 pmchickenmobile wrote:...tell me what input you are giving it...Would be great if you gave me whole error that comes up in console. Not just a generalised one. The code looks syntax error free to me.
EDIT: the player can also be referenced to as player.
e.g. local ang = player.GetAngles()
Would be great if you gave me whole error that comes up in console. Not just a generalised one. The code looks syntax error free to me.
EDIT: the player can also be referenced to as player.
e.g. local ang = player.GetAngles()
Quote from FelixGriffin on July 9, 2012, 12:35 pmSorry.
"Entity [logic_script entity] encountered an error in RunScriptCode: line 1: the index invertParent() does not exist."
Then an empty call stack and empty list of variables, since none had been defined. Input is RunScriptCode invertParent(); (which works fine if I delete the script from the logic_script and use a logic_auto to RunScriptFile).
Sorry.
"Entity [logic_script entity] encountered an error in RunScriptCode: line 1: the index invertParent() does not exist."
Then an empty call stack and empty list of variables, since none had been defined. Input is RunScriptCode invertParent(); (which works fine if I delete the script from the logic_script and use a logic_auto to RunScriptFile).

Quote from ChickenMobile on July 9, 2012, 12:45 pmGet rid of the semicolon. I doubt this is the problem but it could be.
Also try running the script in game using the ent_fire -> logic_script -> RunScriptCode "invertParent()" command. If it still comes up with the error, try reducing your code to just the function name and a printl("Test") inside of it in order to see if it is the actual script that is not being liked / syntax error.
- Code: Select all
function invertParent() {
printl("test")
}
Get rid of the semicolon. I doubt this is the problem but it could be.
Also try running the script in game using the ent_fire -> logic_script -> RunScriptCode "invertParent()" command. If it still comes up with the error, try reducing your code to just the function name and a printl("Test") inside of it in order to see if it is the actual script that is not being liked / syntax error.
- Code: Select all
function invertParent() {
printl("test")
}
Quote from FelixGriffin on July 9, 2012, 12:46 pmBoth of those give the same error message. This seems really weird. The script is in an instance, does that matter?
Both of those give the same error message. This seems really weird. The script is in an instance, does that matter?

Quote from ChickenMobile on July 9, 2012, 12:49 pmFelixGriffin wrote:Both of those give the same error message. This seems really weird. The script is in an instance, does that matter?It shouldn't. Is your script prefixed with an @?
It shouldn't. Is your script prefixed with an @?
Quote from FelixGriffin on July 9, 2012, 12:57 pmYes. And it can be targetted just fine.
Yes. And it can be targetted just fine.

Quote from ChickenMobile on July 9, 2012, 1:01 pmHrmm... Only thing I can think of: Check the Entity Scripts field in your logic_script to see if you are referencing the correct script.
Hrmm... Only thing I can think of: Check the Entity Scripts field in your logic_script to see if you are referencing the correct script.