Resizer

Ein Resizer-Skript ab der Serverversion 1.38. Nun wird nur noch ein Skript benötigt, um alle Prims in der Grösse zu ändern.

// script copyright by Rebekka Revnik

integer CHANNEL = -6666660;

integer ALL_PRIMS = TRUE;
integer TIME = 30;

float ScaleOrigin = 1;
float ScaleRez;
integer Listener;
integer SetBack;

integer Menu;
integer MenuOn;
integer Prim;
	
menu1()
{
	Menu = 1;
	MenuOn = TRUE;
	llListenRemove(Listener);
	Listener = llListen(CHANNEL, "", llGetOwner(), "");
	llSetTimerEvent(TIME);
	llDialog(llGetOwner(), "Was soll geändert werden?", ["Dieses Prim", "Alle Prims", "Ende"], CHANNEL);
}

menu2()
{
	Menu = 2;
	MenuOn = TRUE;
	llListenRemove(Listener);
	Listener = llListen(CHANNEL, "", llGetOwner(), "");
	llSetTimerEvent(TIME);
	llDialog(llGetOwner(), "Wähle eine Option:", ["Rücksetzen","Zurück","Löschen"," "," "," ","-1%","-5%","-10%","+1%","+5%","+10%"], CHANNEL);
}

menu3()
{
	Menu = 3;
	MenuOn = TRUE;
	llListenRemove(Listener);
	Listener = llListen(CHANNEL, "", llGetOwner(), "");
	llSetTimerEvent(TIME);
	llDialog(llGetOwner(), "Rücksetzen zu ..", ["Original", "Letztem Rezzen", "Zurück"], CHANNEL);
}

default
{
	state_entry()
	{
		ScaleRez = 1;
		MenuOn = FALSE;
	}
	on_rez(integer start_param)
	{
		ScaleRez = 1;
		MenuOn = FALSE;
	}
	touch_start(integer total_number)
	{
		if(llDetectedKey(0) != llGetOwner()) return;
		Prim = llDetectedLinkNumber(0);
		if(!MenuOn) menu1();
	}
	listen(integer channel, string name, key id, string message)
	{
		llSetTimerEvent(0);
		MenuOn = FALSE;
		if((id != llGetOwner()) && (llGetOwnerKey(id) != llGetOwner())) return;
		string msg = llToLower(message);
		float m = 0;
		vector p;
		vector v;
		list l;
		integer i;
		SetBack = FALSE;
		if(msg == "dieses prim")
		{
			ALL_PRIMS = FALSE;
			menu2();
		} else if(msg == "alle prims")
		{
			ALL_PRIMS = TRUE;
			menu2();
		} else if(msg == "ende")
		{
			llListenRemove(Listener);
			llSetTimerEvent(0);
		} else if(msg == " ") menu2();
		else if(msg == "-1%") m = 0.99;
		else if(msg == "-5%") m = 0.95;
		else if(msg == "-10%") m = 0.9;
		else if(msg == "+1%") m = 1.01;
		else if(msg == "+5%") m = 1.05;
		else if(msg == "+10%") m = 1.1;
		else if(msg == "rücksetzen") menu3();
		else if(msg == "original")
		{
			m = 1 / ScaleOrigin;
			ScaleRez *= m;
			ScaleOrigin = 1;
			SetBack = TRUE;
		}
		else if(msg == "letztem rezzen")
		{
			m = 1 / ScaleRez;
			ScaleOrigin *= m;
			ScaleRez = 1;
			SetBack = TRUE;
		} else if(msg = "zurück")
		{
			if(Menu == 2) menu1(); else menu2();
		} else if(msg == "löschen")
		{
			llRemoveInventory(llGetScriptName());
		}
		if(m != 0)
		{
			if(!SetBack)
			{
				ScaleOrigin *= m;
				ScaleRez *= m;
			}
			if(!ALL_PRIMS)
			{
				l = llGetLinkPrimitiveParams(Prim, [PRIM_SIZE]);
				v = llList2Vector(l, 0) * m;
				llSetLinkPrimitiveParamsFast(Prim, [PRIM_SIZE, v]);
			} else
			{
				if(Prim == 0)
				{
					l = llGetLinkPrimitiveParams(Prim, [PRIM_SIZE]);
					v = llList2Vector(l, 0) * m;
					llSetLinkPrimitiveParamsFast(Prim, [PRIM_SIZE, v]);
				} else
				{
					for(i = 1; i <= llGetNumberOfPrims(); i++)
					{
						l = llGetLinkPrimitiveParams(i, [PRIM_POSITION, PRIM_SIZE]);
						p = llList2Vector(l, 0);
						p = (p - llGetRootPosition()) / llGetRootRotation() * m;
						v = llList2Vector(l, 1) * m;
						if(i > 1) llSetLinkPrimitiveParamsFast(i, [PRIM_POSITION, p, PRIM_SIZE, v]);
						else llSetLinkPrimitiveParamsFast(i, [PRIM_SIZE, v]);
					}
				}
			}
			menu2();
		}
	}
	timer()
	{
		MenuOn = FALSE;
		llSetTimerEvent(0);
		llListenRemove(Listener);
		llOwnerSay("Die Zeit für das Menü ist vorbei. Bitte nochmals anklicken.");
	}
}