Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Menu Texture Changer for Charity Calendars

Sayla Jewell
Registered User
Join date: 20 May 2007
Posts: 9
10-11-2008 23:11
Hi Everyone,

I'm more of a graphic designer than a scripter , but I do know basic scripting.
What I am trying to do is make some calendars for charities using a texture changing menu, I know how to write a simple script with one texture change using touch from the pie menu, but what I would like to do is have a menu with Jan -Dec and have the corresponding texture show up on a prim being ( Image and the Calendar month on the same texture) Can someone give me some idea on how to go about this?
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
This'll do it.
10-12-2008 00:52
This little script should do what you're looking for.

If anyone touches the calendar the menu, with 12 month buttons, comes up to pick from.

Just give the textures the same names as the buttons in the dialog.

CODE

// www.lsleditor.org by Alphons van der Heijden (SL: Alphons Jano)

list buttons = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
integer channel;
integer handle;

default
{
state_entry()
{
// put buttons in normal reading order
// left to right and top to bottom .
integer i;
for (i=0;i<llGetListLength(buttons);i+=3) {
buttons = llListInsertList(llDeleteSubList(buttons, -3, -1), llList2List(buttons, -3, -1), i);
}
}
touch_start(integer total_number)
{
channel = (integer)(llFrand(1000.0)*-1)-1;
handle = llListen(channel,"",llDetectedKey(0),"");
llSetTimerEvent(30.0); // timer to stop listen i.e.o. no response
llDialog(llDetectedKey(0),"Pick a month.",buttons,channel);
}
listen(integer channel, string name, key id, string message)
{
integer index = llListFindList(buttons,[message]);
if (index != -1) {
llSetTimerEvent(0.0);
llListenRemove(handle);
llSetTexture(message,ALL_SIDES);
}
}
timer()
{
llSetTimerEvent(0.0);
llListenRemove(handle);
llSay(0,"Menu timed out.\nTouch calendar to start again.");
}
}
Kaluura Boa
Polygon Project
Join date: 27 Mar 2007
Posts: 194
10-12-2008 01:13
EDIT: Ron posted his answer while I was typing but I won't delete mine. It's almost the same thing, minus a few things, plus a few bells and whistles...
--------------------------

Having a menu won't remove the need to touch the calendar to trigger the dialog at least...
Any way, here is a skeleton with a little flesh on the bones:

--------------------------
list Buttons = ["Oct", "Nov", "Dec", "Jul", "Aug", "Sep", "Apr", "May", "Jun",
"Jan", "Feb", "Mar"];

list Textures = ["10", "11", "12", "7", "8", "9", "4", "5", "6", "1", "2", "3"];
// Replace the number of the month by the name of the corresponding texture.

integer Busy;
integer Handle;
key Avatar;

default {

state_entry()
{
Busy = FALSE;
}

touch_start(integer total)
{
if (Busy)
{
llInstantMessage(llDetectedKey(0), "Already in use. Please wait a minute...";);
return;
}
else
{
Busy = TRUE;
}
Avatar = llDetectedKey(0);
Handle = llListen(-99999, "", Avatar, "";);
llSetTimerEvent(60.0); // 1 minute time out
llDialog(Avatar, "Select the month:", Buttons, -99999);
}

timer()
{
llSetTimerEvent(0.0);
llListenRemove(Handle);
Busy = FALSE;
llInstantMessage(Avatar, "Time out! Dialog is now disabled.";);
}

listen(integer channel, string name, key id, string msg)
{
llSetTimerEvent(0.0);
llListenRemove(Handle);
Busy = FALSE;
integer month = llListFindList(Buttons, [msg]);
if (month != -1) // It should never fail
{
llSetTexture(llList2String(Textures, month), 0);
}
}

}
---------------------------------------------
Not tested in world but I'm very confident... Except for the tyops typso typos... :P
Sayla Jewell
Registered User
Join date: 20 May 2007
Posts: 9
Thankyou So Much
10-12-2008 02:21
Thankyou so much Kaluura & Ron .. that is so awesome of you both.. I am trying them as we speak
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
10-12-2008 12:15
If you wanted a texture for the whole page, you'd have to come up with 28 textures (four possible number of days in the month: 28, 29, 30, 31; 7 possible days for the month to start on). Of course, you might want a separate texture for each month name, so that's 12 extra and you'll want to figure out how to combine the textures (warping a prim, using a second one, etc. With careful use of scale and taper, you could probably have a picture on a "top" face, the month name on a small "middle" one, and the days of the week texture on the "bottom" face.