Comme je suis allergique aux notecards qui ne simplifient en rien le bouzin dans la grande majorité des cas, et que les scripteurs ne se bousculent pas.....voilà une version sans NC mais tout aussi simple.....
list ListePhrases = [
///////////////////////////////////////////////////////////////////
//////RAJOUTEZ AUTANT DE PHRASES QUE PERMET LA MEMOIRE LIBRE////////
////////////METTRE ENTRE GUILLEMETS ET UNE VIRGULE A LA FIN/////////
//////////////////////SAUF A LA DERNIERE PHRASE/////////////////////
///////////////////////////////////////////////////////////////////
"mettre une nouvelle phrase ici",
"et puis hop",
"yfuklyfyukfu",
"blablabla",
"gloyuglyug",
"DFGFFFFFFF",
"truc bite chatte",
"pipi caca vomit",
"cépafo",
"uklygfulfgufl",
"ipoipoj",
"hfgfhfgfhfghfgfh",
"kkkkkkk",
"kuyyuft7687687687",
"7687468475435",
"bbbbbbbbbbbbbbbbbbb"
//////////////////////////////////////////////////////////////
];
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) +
llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
DialogPlus(key avatar, string message, list buttons, integer channel, integer CurMenu)
{
if (12 < llGetListLength(buttons))
{
list lbut = buttons;
list Nbuttons = [];
if(CurMenu == -1)
{
CurMenu = 0;
menuindex = 0;
}
if((Nbuttons = (llList2List(buttons, (CurMenu * 10), ((CurMenu * 10) + 9)) + ["<<<", ">>>"])) == ["<<<", ">>>"])
DialogPlus(avatar, message, lbut, channel, menuindex = 0);
else
llDialog(avatar, message, order_buttons(Nbuttons), channel);
}
else
llDialog(avatar, message, order_buttons(buttons), channel);
}
integer menuindex;
integer channel;
integer listen_handle;
list ListeBoutons;
default
{
state_entry()
{
channel = (integer)("0xA" + llGetSubString((string)llGetKey(), 0,6 ));
llOwnerSay((string)llGetFreeMemory() + " bytes de memoire libre.\n"
+(string)llGetListLength(ListePhrases)+ " phrases listées ");
}
touch_start(integer total_number)
{
key owner = llGetOwner();
if(owner==llDetectedKey(0))
{
ListeBoutons = [];
integer i;
integer a = llGetListLength(ListePhrases);
do
{
ListeBoutons += llGetSubString(llList2String(ListePhrases, i),0,12);
}
while (++i < a);
listen_handle = llListen(channel, "", owner,"");
llSetTimerEvent(30.0);
DialogPlus(owner, "Choise une phrase", ListeBoutons, channel, menuindex = 0);
}
}
listen(integer chan, string name, key id, string msg)
{
key owner = llGetOwner();
if(msg == ">>>")
{
DialogPlus(owner, "Choise une phrase", ListeBoutons, channel, ++menuindex);
}
else if(msg == "<<<")
{
DialogPlus(owner, "Choise une phrase", ListeBoutons, channel, --menuindex);
}
else
{
llListenRemove(listen_handle);
llSetTimerEvent(0.0);
integer index = llListFindList(ListeBoutons, [msg]);
string text = llList2String(ListePhrases, index);
llSay(0,text);
}
}
timer()
{
llOwnerSay("Temps ecoulé.");
llListenRemove(listen_handle);
llSetTimerEvent(0.0);
}
changed(integer change)
{
if (change & (CHANGED_OWNER | CHANGED_INVENTORY))
{
llOwnerSay("L'inventaire a changé ");
llResetScript();
}
}
on_rez(integer start_param)
{
llResetScript();
}
}
|