User:Decimus Schomer/Scripts/Toggling rotate
Decimus' user page | Decimus' talk page | Decimus' scripts | Decimus' script libraries | Decimus' projects
Main scripts page | Toggling Rotate script | UUID-getter scripts | Texture changer | Channel spier | Chatbot | Jump slab | Emailer | Fractal viewer | Grammar analyser | SPD viewer
The toggling rotate script is an extended version of the normal rotate script. Here is the code:
// Toggling rotate script // Copyright (C) 2007 Decimus Schomer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // (you can find version 2 of the GPL at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) integer spinning = 1; default { touch_start(integer total_number) { if (! spinning) llTargetOmega( < 0, 0, 0 >, 0, 0); else if (spinning == 2) llTargetOmega( < 0, 0, 0 >, 0, 0); else if (spinning == 1) llTargetOmega( < 0, 0, 1 >, PI, 1.0); else llTargetOmega( < 0, 0, 1 >, -PI, 1.0); spinning = spinning + 1; if (spinning == 4) spinning = 0; } }
What this does is makes the object do this, advancing one item each time it is pressed:
- Start turning one direction
- Stop
- Turn the opposite direction to number 1
- Stop
After step 4, the next press starts the loop again.
--Decimus 13:22, 18 March 2007 (GMT)
- Very nice Decimus, thanks for putting this up. I'm off to try it out! --Mark Cabaret 13:16, 25 March 2007 (BST)