Bonjour voilà,
je recherche a modifier un de mes scripts qui est un giver d'objets via un liste pour mettre la liste via notecard ( la raison est toute simple, je veux créer un giver pour des amies, et qu'elle puisse modifier la liste sans ouvrir le script et risquer de la casser), ça doit être une fonction simple a faire, mais j'ai bon lire les articles a ce sujet je ne trouve pas le moyen de le faire fonctionner
list laccess = ["theoaphrodite Devin",
"Angy Wirefly",
"Loki Adderstein"];
integer nStart = 0;
integer DIALOG_CHANNEL;
integer nTotalCardGiven;
dialogCard(key id)
{
// how many notecards ?
integer nCardCount = llGetInventoryNumber(INVENTORY_OBJECT);
// prepare a menu with inventory notecard
string cTxt = "";
list lDlg;
if (nStart > 0) { lDlg += "<< Prev.";}
else { lDlg += "-";}
lDlg += "Close";
if (nStart + 9 < nCardCount) {lDlg += "Next >>";}
else { lDlg += "-";}
integer nAdd = 0;
string cItem = "none";
while (cItem != "")
{
cItem = llGetInventoryName(INVENTORY_OBJECT, nStart + nAdd);
if (cItem != "")
{
if (nAdd < 9)
{
// add to the text
nAdd++;
string cP = (string)(nAdd + nStart) + ".";
cTxt += "\n" + cP + " " + cItem;
lDlg += (string)cP;
}
else
{
cItem = "";
}
}
}
llDialog(id, cTxt, lDlg, DIALOG_CHANNEL);
}
txtRefresh()
{
llSetText("Liquides" + "",
<1, 1, 1>, 1);
}
default
{
state_entry()
{
// set text
txtRefresh();
// dialog menu random channel
DIALOG_CHANNEL = llRound(llFrand(999999) + 9999);
llListen(DIALOG_CHANNEL, "", NULL_KEY, "");
}
touch_start(integer total_number)
{
// touch key
key id = llDetectedKey(0);
string nom = llDetectedName(0);
if (llListFindList(laccess,[nom])!=-1)
{
dialogCard(id);
llSay(0, nom + " prend");
}
else
llSay(0,"Desolé, " + nom + ", vous n'êtes pas autorisé à ouvrir la boite");
}
// waiting for an answer
listen(integer channel, string name, key id, string message)
{
if (channel == DIALOG_CHANNEL)
{
// prev/next/close
if (message == "<< Prev.")
{
nStart -= 9;
dialogCard(id);
}
else if (message == "Next >>")
{
nStart += 9;
dialogCard(id);
}
else if (message == "Close")
{
// nothing to d0!
}
else if ((integer)message > 0)
{
// extract the notecard name
string cCardName = llGetInventoryName(INVENTORY_OBJECT, ((integer)message) - 1);
if (cCardName != "")
{
llInstantMessage(id, "Livraison '" + cCardName + "'...");
llGiveInventory(id, cCardName);
nTotalCardGiven++;
txtRefresh();
nStart = 0;
}
else
{
llInstantMessage(id, ".");
}
}
}
}
}
|