Question 1:
How do I assign Pitch to the value of "100" only once, perhaps upon the creation of the chip?
The way the code stands right now, pitch is always 100 because when the chip executes it always writes Pitch=100. So when any button is pressed it'll rewrite Pitch to 100.Code:@name PortalSong @inputs PitchUp PitchDown On Off @outputs Pitch @persist Pitch=100 if(On){soundPlay(1,0,"music/portal_still_alive.mp3")} if(Off){soundStop(1)} if(PitchUp){Pitch++,soundPitch(1,Pitch)} if(PitchDown){Pitch--,soundPitch(1,Pitch)}
Question 2:
How do I assign fire only once values?
Scenario: Chair&Adv Pod Controller. I want print("fire only once") to fire when Activate == 1 (when someone sits in the chair)
Faulty Example:
This code will fire "Welcome to the chair!" when you enter the vehicle and also whenever you press Mouse1 (because the chip fires when either input occurs).Code:@name ChairThing @inputs Mouse1 Active @outputs @persist if(Active){print("Welcome to the chair!")} if(Mouse1){print("You hit Mouse1")}


LinkBack URL
About LinkBacks




Reply With Quote



Bookmarks