|
Bonjour, j'ai trouver ici un script avec défilement des textures, j'ai, dans sl, un script de vendeur ... j'aimerais fusionner les deux .. mais là je bloque ^^ quelqu'un de charitable ? *fait un immmmence sourire*
Script texture
list items ;
integer index;
integer max ;
integer oper ;
string courant;
Init(){
items = [];
index = 0 ;
integer i;
max = llGetInventoryNumber(INVENTORY_TEXTURE);
if (max>0){
for ( i = 0; i < max ; i++) {
string item = llGetInventoryName(INVENTORY_TEXTURE, i);
items += [item];
}
AffTexture();
oper = TRUE;
}
else {
oper = FALSE ;
llSetText("OFF LINE",<1,1,1>,1);
}
}
AffTexture(){
integer suiv;
integer prec;
integer suiv2;
integer prec2;
courant = llList2String(items,index);
llSetTexture(courant,4); // face avant
llSetText("ITEM "+(string)(index+1)+"/"+(string)max+"\n"+courant,<1,1,1>,1);
if (max>1){
suiv = index+1;
if (suiv == max) suiv = 0;
llSetTexture(llList2String(items,suiv),0);
prec = index-1;
if (prec < 0) prec = max-1;
llSetTexture(llList2String(items,prec),1);
}
if (max>2){
suiv2 = suiv+1;
if (suiv2 == max) suiv2 = 0;
llSetTexture(llList2String(items,suiv2),3);
prec2 = prec-1;
if (prec2 < 0) prec2 = max-1;
llSetTexture(llList2String(items,prec2),5);
}
}
default{
state_entry(){
Init();
if (oper) state operation;
}
changed(integer change){
if (change & CHANGED_INVENTORY) Init();
if (oper) state operation;
}
}
state operation{
changed(integer change){
if (change & CHANGED_INVENTORY) Init();
if(oper) state default ;
}
link_message(integer sender_num, integer num, string str, key id){
if (num==1) index -- ;
if (num==2) index ++ ;
if (index == max) index = 0;
if (index < 0) index = max-1;
AffTexture();
}
}
Scripte vendor
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/_/_/_/_/_/_/_/_/_/_/_/ The script begins _/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
list info_list = [ // the data of the items textures and their prices
"398bd068-2969-72d2-41fd-a592eea590d6",10, // 1st item, using right click to buy texture, L$10
"398bd068-2969-72d2-41fd-a592eea590d6",20, // 2nd item, using right click to buy texture, L$20
"398bd068-2969-72d2-41fd-a592eea590d6",30, // 3rd item, using right click to buy texture, L$30
"398bd068-2969-72d2-41fd-a592eea590d6",40, // 4th item, using right click to buy texture, L$40
"398bd068-2969-72d2-41fd-a592eea590d6",50, // 5th item, using right click to buy texture, L$50
"398bd068-2969-72d2-41fd-a592eea590d6",60, // 6th item, using right click to buy texture, L$60
"398bd068-2969-72d2-41fd-a592eea590d6",70, // 7th item, using right click to buy texture, L$70
"398bd068-2969-72d2-41fd-a592eea590d6",80, // 8th item, using right click to buy texture, L$80
"398bd068-2969-72d2-41fd-a592eea590d6",90, // 9th item, using right click to buy texture, L$90
"398bd068-2969-72d2-41fd-a592eea590d6",100 // *** IMPORTANT *** there is no , (comma) at the end of the last item
];
integer with_text = TRUE; // TRUE - with floating text; FALSE - otherwise
vector text_color = <1.0,1.0,1.0>; // the floating text color, only apply when with_text = TRUE
integer notify = TRUE; // TRUE - IM notify to you after purchased; FALSE - otherwise
integer texture_face = 1; // the face on the prim to display the texture
//=================================================
key owner = NULL_KEY;
integer total_object = 0;
integer current_price = 1;
string current_texture = "";
string current_object = "";
integer current_slot = 0;
//=================================================
string get_slurl()
{
vector pos = llGetPos();
string region_string = llEscapeURL(llGetRegionName());
string result = "(http://slurl.com/secondlife/"+region_string+"/"+(string)((integer)pos.x)+"/"+(string)((integer)pos.y)+"/"+(string)((integer)pos.z)+")";
return result;
}
//=================================================
change_slot(integer slot)
{
current_texture = llList2String(info_list,slot * 2);
current_price = llList2Integer(info_list,slot * 2 + 1);
current_object = llGetInventoryName(INVENTORY_OBJECT,slot);
llSetTexture(current_texture,texture_face);
llSetPayPrice(PAY_HIDE, [current_price,PAY_HIDE,PAY_HIDE,PAY_HIDE]);
llSetText("Now Selling L$"+(string)current_price+"\n[ "+current_object+" ]\n \nRight click > Pay to buy",text_color,(float)with_text);
}
//=================================================
inventory_change()
{
total_object = llGetInventoryNumber(INVENTORY_OBJECT);
if (total_object == 0)
{
llSetPayPrice(PAY_HIDE, [PAY_HIDE,PAY_HIDE,PAY_HIDE,PAY_HIDE]);
llSetText("VENDOR OFFLINE",<1.0,1.0,0.0>,1.0);
}
else
{
change_slot(0);
}
}
//=================================================
default
{
state_entry()
{
llOwnerSay(" script memory = "+(string)llGetFreeMemory()+". Safety range more than 3000.");
llSetText("VENDOR OFFLINE",<1.0,1.0,0.0>,1.0);
owner = llGetOwner();
llRequestPermissions(owner, PERMISSION_DEBIT);
}
on_rez(integer int)
{
llSetPos(llGetPos() + <0.0,0.0,1.0>);
llResetScript();
}
run_time_permissions(integer perm)
{
if(perm & PERMISSION_DEBIT)
{
state ready;
}
else
{
llOwnerSay(" please 'Grant' the permission to continue...");
llResetScript();
}
}
}
state ready
{
state_entry()
{
inventory_change();
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
inventory_change();
}
touch_start(integer total_number)
{
if (total_object != 0)
{
string touched_prim = llGetLinkName(llDetectedLinkNumber(0));
if ( touched_prim == "next" )
{
current_slot += 1;
if (current_slot > total_object - 1)
current_slot = 0;
change_slot(current_slot);
}
else if ( touched_prim == "prev" )
{
current_slot -= 1;
if (current_slot < 0)
current_slot = total_object - 1;
change_slot(current_slot);
}
else
{
llSay(0," right click > Pay to buy [ "+current_object+" ] L$"+(string)current_price+".");
}
}
}
money(key customer, integer amt)
{
if (amt == current_price)
{
string customer_name = llKey2Name(customer);
llSay(0," thank you for your purchase "+customer_name+". Delivering [ "+current_object+" ]...");
llGiveInventory(customer,current_object);
if (notify)
llInstantMessage(owner," "+customer_name+" purchased [ "+current_object+" ] L$"+(string)amt+". "+get_slurl());
}
else
{
llSay(0," sorry, payment incorrect. L$"+(string)amt+" refunded.");
llGiveMoney(customer,amt);
}
}
}
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/_/_/_/_/_/_/_/_/_/_/_/ The script ends _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
|