trevorg Posted October 11, 2002 Posted October 11, 2002 I just learned something and thought I'd share. In the past whenever I wanted to use a field as a toggle (on, off) I would write a script that would check if on/true/1 then set it set it to off/false/0 , else set it to the other on/true/1. This can all be replaced with just ONE set field and no [if's] inside. Lets say we had the field called "Toggle" and it's a number field. Since this technique only uses the 0, and 1 (0=off, 1=on), then a number field makes sense to me. If we simply make a set field command like this: Set Field ["Toggle", "Not Toggle"] This automatically flips the 0 to a 1, or a 1 to a 0. The only problem is if the field is empty to start, then it doesn't enter anything. I thought it could be useful and wanted to share.
CobaltSky Posted October 11, 2002 Posted October 11, 2002 To deal with the null field issue, you can use the slightly less "streamlined" version: Set Field ["toggle", "Case(toggle, not toggle, 1)"]
Recommended Posts
This topic is 8083 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now