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
Multiple Issues Help Setting up the elevator machine
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#21
RE: Setting up the elevator machine

How about a combination of both?

Like you were saying, you can check the state (the alState parameter) that the lever without having to lock it in place by doing something similar to this:

PHP Code: (Select All)
void LeverFunction(parameters etcetc//This is the function that is called when you pull the lever
{

   if(
alState == 1//Experiment with "1" & "-1". I think 1 is up, and -1 is down.
   
{
      
//Code to do here if the lever is pulled to the aforementioned state
   
}



However, you don't want the machine to start if the repairs aren't complete! To solve this, we'll need some code in the lever function will check if everything is complete.

Do you remember how we set those local integers? "Coal" and "Cogs?" We can use them to see if the machine's repairs are finished:

PHP Code: (Select All)
void leverfunction blahblah //Lever callback, sorry for my shorthand =p
{
   if(
alState == 1//This checks if the lever is pulled
   
{
     
      
//If it is pulled, checks if repairs are complete
      
if(GetLocalVarInt("Coal") == &&  GetLocalVarInt("Cogs") == 3)
      {
         
//This block is executed if everything is complete
         //Run your machine startup routine here
      
}

      else
      {
        
//This block executes if something isn't finished
       
}
   }


I hope it gives you a general idea. Adjust it to your liking!
05-09-2013, 02:57 PM
Find


Messages In This Thread
Setting up the elevator machine - by serbusfish - 05-07-2013, 01:30 AM
RE: Setting up the elevator machine - by Rapture - 05-07-2013, 03:09 AM
RE: Setting up the elevator machine - by Tomato Cat - 05-09-2013, 02:57 PM



Users browsing this thread: 1 Guest(s)