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
Script Help Why won't this script work?
Dobbydoo Offline
Member

Posts: 50
Threads: 6
Joined: Aug 2011
Reputation: 0
#3
RE: Why won't this script work?

(12-17-2011, 05:18 PM)palistov Wrote: Your syntax is all correct but your semantics is all out of whack. Semantics is basically programming "grammar", while syntax is programming "spelling". Your code is syntactically correct, but if you take a look at your function StoreCheckLeverState, you'll notice that no matter what lever is pulled, the variables are all set to the correct state. Hence, the player can pull any one lever and solve the puzzle. To solve this, use this function instead

PHP Code: (Select All)
void StoreCheckLeverState(string &in entityint state)
{
if(
entity == "lever_1"SetLocalVarInt("lever_1"state);
if(
entity == "lever_2"SetLocalVarInt("lever_2"state); 
if(
entity == "lever_3"SetLocalVarInt("lever_3"state); 
if(
entity == "lever_4"SetLocalVarInt("lever_4"state); 
if(
entity == "lever_5"SetLocalVarInt("lever_5"state); 
if(
entity == "lever_6"SetLocalVarInt("lever_6"state);
CheckLeverStates(); 


Good luck Smile
It would be much easier to have only one variable for all levers. Then every time you pull a lever you add one to the variable and when it reaches 6 the puzzle is completed.

12-17-2011, 05:29 PM
Find


Messages In This Thread
Why won't this script work? - by ferryadams10 - 12-17-2011, 04:29 PM
RE: Why won't this script work? - by palistov - 12-17-2011, 05:18 PM
RE: Why won't this script work? - by Dobbydoo - 12-17-2011, 05:29 PM
RE: Why won't this script work? - by Dobbydoo - 12-17-2011, 07:50 PM
RE: Why won't this script work? - by ferryadams10 - 12-17-2011, 06:52 PM
RE: Why won't this script work? - by palistov - 12-17-2011, 07:10 PM
RE: Why won't this script work? - by ferryadams10 - 12-21-2011, 08:29 PM



Users browsing this thread: 1 Guest(s)