Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Boolean??!! Syntax help?
Nuclearbones Offline
Junior Member

Posts: 45
Threads: 19
Joined: May 2012
Reputation: 0
#1
Boolean??!! Syntax help?

I'm in a major predicament because I can't load this map. I'm not sure what's wrong with the script and I don't see anything wrong with it. I'm not sure what it is, maybe it's a syntax error or something, but all the way down to the red text...

////////////////////////////
// Run first time starting map
void OnStart()
{
//Valves
SetEntityConnectionStateChangeCallback("valve_iron_1", "Unlock1");
SetEntityConnectionStateChangeCallback("valve_iron_2", "Unlock2");
SetEntityConnectionStateChangeCallback("valve_iron_3", "Unlock3");

//Levers
SetEntityConnectionStateChangeCallback("lever_simple01_22", "OpenSecurityGate");
ConnectEntities("", "castle_portcullis_1", "lever_simple01_23", false, 1, "CloseGate");

}

void Unlock1(string &in asEntity, int alstate)
{
if (alstate == 1)
{
PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0.0f, false);
SetWheelStuckState(asEntity, 1, true);
AddLocalVarInt("var_1", 1);
GET();
}


}

void Unlock2(string &in asEntity, int alstate)
{
if (alstate == -1)
{
PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0.0f, false);
SetWheelStuckState(asEntity, 1, true);
AddLocalVarInt("var_1", 1);
GET();
}
}

void Unlock3(string &in asEntity, int alstate)
{
if (alstate == -1)
{
PlaySoundAtEntity("", "15_body_impact.snt", "Player", 0.0f, false);
SetWheelStuckState(asEntity, 1, true);
AddLocalVarInt("var_1", 1);
GET();
}
}

void GET()
{
if (GetLocalVarInt("var_1")==3)
{
////OPENING THE GATE
PlaySoundAtEntity("", "24_bang.snt", "Player", 0.0f, false);
SetMoveObjectState("castle_portcullis_1", 1.0f);
}
}

////CLOSE THE GATE
void CloseGate(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
if (alstate == 1)
<--- "alstate not declared" and "Expression must be of Boolean type".
{
PlaySoundAtEntity("", "24_bang.snt", "Player", 0.0f, false);
SetMoveObjectState("castle_portcullis_1)", 0.00f);
}
}

////OPEN SECURITY GATE
void OpenSecurityGate(string &in asEntity, int level_state)
{
if (level_state == 1)
{
SetMoveObjectState("safety_normal_vert_1", 1.0f);
}
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

The alstate message is what threw me off the most. But the Boolean message??!! I'm dealing with levers, I need integers not Boolean values!

I would appreciate it if somebody helped look through the script and see if there is anything that would trigger these messages to appear. Thanks.
(This post was last modified: 11-11-2012, 04:31 AM by Nuclearbones.)
11-11-2012, 03:34 AM
Find
Obsidiaguy Offline
Junior Member

Posts: 42
Threads: 2
Joined: Jul 2012
Reputation: 4
#2
RE: Boolean??!!

Does letter case matter? Capital, lowercase?

"void CloseGate(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
if (alstate == 1)"

Voice actor always looking for work!
Check out my Portfolio
(This post was last modified: 11-11-2012, 04:35 AM by Obsidiaguy.)
11-11-2012, 04:34 AM
Find
Nuclearbones Offline
Junior Member

Posts: 45
Threads: 19
Joined: May 2012
Reputation: 0
#3
RE: Boolean??!! Syntax help?

Yes actually. Scripts are case sensitive. And I fixed that and it stopped giving me the messages but the function wont work. So then I fooled around with script areas. After that wouldn't work, I just decided I would leave the door open. :/
11-11-2012, 04:43 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#4
RE: Boolean??!! Syntax help?

Use some debug messages in your script. It will help you understand what is going on in your script and when. Using debug messages can help you pinpoint a lot of semantics errors. (script compiles but doesn't do what you intended)

For example, before you go into the if-else construct in your function CloseGate, add a debug message 'AddDebugMessage("Gate is at state: " + alState, false);' -- Do the same for a lot of your functions and see where the hiccup is.

Edit: misunderstood some of your script, editing out some of the misunderstandingsnessness Big Grin

(This post was last modified: 11-11-2012, 09:33 PM by palistov.)
11-11-2012, 09:32 PM
Find




Users browsing this thread: 1 Guest(s)