/////////////////////////////////////////////////////////////////////////// // Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // // rights of fair usage, the disclaimer and warranty conditions. // /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // /////////////////////////////////////////////////////////////////////////// string wasProgress(integer percent, integer length, list symbols) { percent /= (integer)((float)100.0/(length)); string p = llList2String(symbols,0); integer itra = 0; do { if(itra>percent-1) p += llList2String(symbols,2); else p += llList2String(symbols,1); } while(++itra * DEG_TO_RAD)); state arm; } } state arm { state_entry() { llSetText("☛ Power ☚\n" + wasProgress((integer)(spin*100.0/45.0), 20, ["[", "█", "░", "]"]), <1,1,1>, 1); } touch(integer num) { if(spin > 44) return; ++spin; llSetText("☛ Power ☚\n" + wasProgress((integer)(spin*100.0/45.0), 20, ["[", "█", "░", "]"]), <1,1,1>, 1); } touch_end(integer num) { state release; } } state release { state_entry() { llSetTimerEvent(1.175494351E-38); } timer() { if(spin< 1) { llSetTimerEvent(0); spin = 0; state arm; } llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL, llGetLocalRot() * llEuler2Rot(<0., 0., spin> * DEG_TO_RAD)]); llSetText("☛ Power ☚\n" + wasProgress((integer)(spin*100.0/45.0), 20, ["[", "█", "░", "]"]), <1,1,1>, 1); --spin; } }