Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //start_unprocessed_text
- /*/|*
- repopulate_AZetc()
- {
- integer i;
- for (i=0 ; i<llGetListLength(inventory)/3 ; i++)
- {
- integer sprite_no = llList2Integer(inventory, (i*3)+2);
- string amount = llList2String(inventory, (i*3)+1);
- integer menu_index = i+1;; /|/order in menu prims not list]
- llSay(0, (string)sprite_no);
- llSay(0, (string)amount);
- llSay(0, (string)menu_index);
- /|/make all below a function.
- integer last_digit = sprite_no - (llFloor(sprite_no/grid_y)*10);
- float h = -0.45 + (
- (1/grid_x)*(last_digit-1) );
- float v = 0.45 - ( (1/grid_y) *llFloor(sprite_no/(grid_y+1) ) ) ; /|/as 1-9 is no change
- llSay(0, "v" + (string)v);
- integer face;
- integer link;
- integer fur_num;
- if(menu_index%2 == 0)/|/even number
- {
- link = llList2Integer(inventory_links, (((menu_index)/2) -1) );
- face = 4;
- fur_num = ((menu_index)/2) ;
- }
- else
- {
- face = 0;
- link = llList2Integer(inventory_links, (((menu_index+1)/2) -1) );
- fur_num = ((menu_index+1)/2) ;
- }
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE, face,
- "00282dee-a2e7-f7f1-4377-d118387d5af2", <(1/grid_x),(1/grid_y),0>, <h,v,0>, 0.0]);
- /|/update FURWARE AMOUNT update
- llMessageLinked(LINK_SET, 0, (string)amount, "fw_data :Box"+ (string)menu_index );
- }/|/end for loop
- }
- repopulate_menudisplay(list InventoryList)
- {
- /|/-----------------Updating current list /|/
- if ( llListFindList(InventoryList, [item]) != -1)/|/find item
- {
- integer list_index = llListFindList(InventoryList, [item]); /|/ index in list
- integer menu_index = (list_index/3)+1; /|/order in menu prims not list]
- integer sprite_no = llList2Integer(InventoryList, list_index+2);
- InventoryList = llListReplaceList(InventoryList,amount, list_index+1,list_index+1); /|/updating item numer
- /|/ llSay(0, (string) list_order_index);
- /|/llSay(0, (string)menu_index);
- /|/llSay(0, (string)sprite_no);
- /|/32 /|/(sprite_no)
- integer last_digit = sprite_no - (llFloor(sprite_no/grid_y)*10);
- /|/llSay(0, (string)last_digit);
- float h = -0.45 + (
- (1/grid_x)*(last_digit-1) );
- /|/llSay(0, "h"+ (string)h);
- /|/calcuation row height 1,2 - 0, 3,4 1
- float v = 0.45 - ( (1/grid_y) *llFloor(sprite_no/(grid_y+1) ) ) ; /|/as 1-9 is no change
- /|/llSay(0, "v" + (string)v);
- /|/llSay(0, (string)(menu_index%2) );
- /|/integer link = llList2Integer(inventory_links, )
- /|/llSay(0, (string) ( llFloor( (float)menu_index/2) -1 ) ) ;
- integer face;
- integer link;
- integer fur_num;
- if(menu_index%2 == 0)/|/even number
- {
- link = llList2Integer(inventory_links, (((menu_index)/2) -1) );
- face = 4;
- fur_num = ((menu_index)/2) ;
- }
- else
- {
- face = 0;
- link = llList2Integer(inventory_links, (((menu_index+1)/2) -1) );
- fur_num = ((menu_index+1)/2) ;
- }
- /|/llSay(0, (string)( ((menu_index+1)/2) -1) );
- /|/llSay(0, (string)link );
- /|/ llSay(0,"start is:" + (string)inv_start);
- /|/ llSay(0, "sprite index" + (string)sprite_no);
- /|/ llSay(0,"link is:" + (string)link);
- /|/ llSay(0,"face is:" + (string)face);
- /|/ llSay(0,(string) llFloor(sprite_no/(grid_y+1) ) );
- /|/llSay (0, llDumpList2String(List, ",") );
- if ( llListFindList(inventory, [item]) != -1)/|/i.e. if faulty message
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE, face,
- "00282dee-a2e7-f7f1-4377-d118387d5af2", <(1/grid_x),(1/grid_y),0>, <h,v,0>, 0.0]);
- /|/update FURWARE AMOUNT update
- if ( llListFindList(inventory, [item]) != -1) /|/if bad message don't send
- llMessageLinked(LINK_SET, 0, (string)amount, "fw_data :Box"+ (string)menu_index );
- }
- /|/-----------------Updating current list END /|/
- }
- *|/
- /|/key partner_id= "7ed8d94c-83eb-4734-8c1f-9b8dbe1d0741";/|/temp Reishi
- /|/string partner_name = "Silent Alchemi";
- key partner_id= "8b3b54aa-4de6-4b49-8c42-146555d26863";/|/temp Labyrinth
- string partner_name = "Labyrinthstarchild";
- key temp_if_id = "8b3b54aa-4de6-4b49-8c42-146555d26863";/|/if so and so make Reishi partner etc.
- /|/string temp_name;
- /|/key partner_id;/|/ = "42e9405d-19f6-4bd5-8b9a-00436a5da1b4";/|/temp silent
- /|/string partner_name; /|/ = "ReishiProphet Resident";
- integer accept_link;
- rotation accept_rot_visible = <-0.000000, -0.000000, -0.766031, 0.642804>;
- rotation accept_rot_hidden = <-0.000000, -0.000000, 0.000022, 1.000000>;
- /|*
- rotation accept_rot_visible = <0.00000, 0.00000, 0.00000, 1.00000>;
- rotation accept_rot_hidden = <0.00000, 0.00000, -0.70711, 0.70711>;
- *|/
- list Index_Inventory_PrimLinks( string prim_desc )
- {
- /|*Indexes various sets of prims for inventory menu.
- Puts in order via sequential name in description/name, adds prim link after.
- Orders list via link name stride.
- New list including only prim links (which will be in order).
- *|/
- integer i;
- integer y=1;
- list Grab_prims_list;
- string link_name;
- string order_number;
- for (i = 0; i < llGetNumberOfPrims()+1; i++)
- {
- order_number = llList2String(llGetLinkPrimitiveParams(i,[PRIM_DESC]),0);
- link_name = llGetLinkName(i);
- if (llGetSubString(order_number,0,3) == prim_desc )
- {
- Grab_prims_list += (integer) llGetSubString(order_number,4,llStringLength(order_number) );
- Grab_prims_list += i;/|/puts in prim number
- }
- else if (link_name == "AcceptAction")
- {
- accept_link = i; /|/ Store link number for AcceptAction prim.
- llSay(0,"action link" + (string)accept_link );
- }
- }
- /|/llSay(0, "start list - " + llDumpList2String(Grab_invprims_list,",") );
- list reordered_list = llListSort(Grab_prims_list, 2, TRUE ); /|/Rearranges list numerically by prims
- /|/llSay(0, "Mid list - " + llDumpList2String(reordered_list,",") );
- list link_list;
- for (i = 1; i < llGetListLength(reordered_list); i+=2)
- link_list += llList2Integer(reordered_list,i);
- /|*
- for (i = 0; i < llGetListLength(reordered_list); i++)
- {
- if (i%2 != 0)/|/odd, as in grabbing 2nd part, prim
- link_list += llList2Integer(reordered_list,i);
- }
- *|/
- llSay(0, "Final list - " + llDumpList2String(link_list,",") );
- return link_list;
- }
- /|/First name to index calculation
- /|/(itemName_num-1)*3
- list inventory_main_info = ["Chestnut",25,1,"Pancakes",100,2,"Oyster",7,3,"Orange",9,4,"Ghost",9,5,"Egg",10,6,"Onion",11,7,"Oil",20,8,"Octopus",60,9,"Seaweed",34,10,"ExoticMushroom","006",11,"Mushroom",33,12] ;
- /|/this list should never change. Is the master reference.
- list inventory = ["Chestnut",25,1,"Pancakes",100,2,"Oyster",7,3,"Orange",9,4,"Ghost",9,5,"Egg",10,6,"Onion",11,7,"Oil",20,8,"Octopus",60,9,"Seaweed",34,10,"ExoticMushroom","006",11,"Mushroom",33,12] ;
- /|/name, amount in inventory, index on sprite sheet
- list GL_Temporary_Bucket /|*=["Chestnut",10,1,"Pancakes",1,2,"Oyster",2,3,"Orange",3,4]*|/;
- list GL_Sell_Bucket;
- list SelfTrade;
- list Gl_IncomingTrade;
- list Gl_IncomingTrade_Prims;
- list inventory_links;
- list Sell_prims;
- string Gl_Use_click_bank;
- integer Gi_old_link;
- integer Gi_old_face;
- /|*
- index_calculations(integer itemName_num, list List, integer DebugMessaging)
- {
- item_name_list_index = (itemName_num -1)*3;
- item_amount_list_index = item_name_list_index +1;
- item_spriteIndex_list_index = item_name_list_index +2;
- inventory_name = llList2String(List,item_name_list_index);
- inventory_amount = llList2String(List,item_amount_list_index);
- inventory_sprite_index = llList2String(List,item_spriteIndex_list_index);
- if (DebugMessaging==TRUE)
- llSay(0, "Name: " + inventory_name + ", " + "Amount: " + inventory_amount + ", " + "Sprite_index: " + inventory_sprite_index);
- }
- *
- /|* could probably make two functions -
- One perhaps to grab the various indexes.
- Updating/ cross referencing a list.
- Updating prims.
- *|/
- /|/maybes
- integer item_name_list_index;
- integer item_amount_list_index;
- integer item_spriteIndex_list_index;
- string inventory_name_s;
- integer inventory__name_index ;
- integer inventory_amount;
- integer inventory_sprite_num ;
- integer menudisplay_index ;
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/Retreiving and updating Data.
- link_click2_inventory_item_name(integer link, integer face, list inventory_l)
- {
- /|/ Gets inventory name via prim and face clicked. Inventory name is used for all the other indexes.
- string inventoryprim_num = llGetSubString( llList2String(
- llGetLinkPrimitiveParams(link,[PRIM_DESC]),0) ,4,4 );
- integer itemName_num = (integer)inventoryprim_num;
- itemName_num = (itemName_num*2)-1;
- if (face==4) /|/second face is part of menu
- itemName_num +=1;
- inventory_name_s = llList2String (inventory_l, ((itemName_num-1)*3 ) );
- /|/llSay(0, inventory_name_s);
- }
- Index_info_grabber(string item_name, list l_Inventory)
- {
- /|/ Works with function above. Feed in name, spits out various other indexes.
- inventory__name_index = llListFindList (l_Inventory, [item_name]);
- inventory_amount = llList2Integer(l_Inventory,inventory__name_index+1);
- inventory_sprite_num = llList2Integer(l_Inventory,inventory__name_index+2);
- menudisplay_index = (inventory__name_index/3)+1; /|/works out order shown in display
- }
- Data_Message()
- {
- /|/easy to turn on a message that shows data.
- llSay(0, "Item Name: " + (string)inventory_name_s + ", Name Index: " + (string)inventory__name_index +
- ", Amount: " + (string)inventory_amount + ", Sprite: " + (string)inventory_sprite_num +
- ", MenuDisplayNo :" + (string)menudisplay_index );
- }
- Update_Inventory_Display(string changestyle, list Updating_l, list l_Inventory, list l_Inventory_prims,vector colour)
- {
- /|*
- (Doesn't change any list contents)
- Cross references smaller list to bigger (unless same list).
- Updates sprite display and amount.
- Sets colour if part of a mode (ZERO_VECTOR leaves white)
- Makes any prims not being used by bigger list blank, also turns back to white.
- *|/
- integer i;
- integer link;
- integer face;
- integer menudisplay_index;
- integer blank_link_offset;
- if (llGetListLength(Updating_l) > 1)/|/if no list don't do anything.
- {
- for(i=0; i <llGetListLength(Updating_l); i+=3) /|/Running through
- {
- /|/llSay(0, "list length " + (string)llGetListLength(Updating_l));
- /|/llSay(0, "i count " + (string)i);
- /|/llSay(0, "updating list " + llDumpList2String(Updating_l,",") );
- /|/llSay(0, (string)inventory_sprite_num);
- if (changestyle == "ChangerList") /|/ if lists different, running smaller list
- {
- inventory_name_s = llList2String(Updating_l,i);
- inventory_amount = llList2Integer(Updating_l,i+1);
- inventory__name_index = llListFindList (l_Inventory, [inventory_name_s]);
- menudisplay_index = (inventory__name_index/3)+1;
- inventory_sprite_num = llList2Integer(l_Inventory,inventory__name_index+2);
- }
- else if (changestyle == "SameList")
- {
- inventory_name_s = llList2String(l_Inventory,i);
- inventory_amount = llList2Integer(l_Inventory,i+1);
- inventory_sprite_num = llList2Integer(l_Inventory,i+2);
- menudisplay_index = (i/3)+1;
- }
- if(menudisplay_index%2 == 0)
- {
- link = llList2Integer(l_Inventory_prims, (menudisplay_index/2)-1 );
- face = 4;
- }
- else
- {
- face = 0;
- link = llList2Integer(l_Inventory_prims, ((menudisplay_index+1)/2)-1 );
- }
- set_link_texture_grid(link, face, "9a5e49c8-896c-ee94-ff8e-c484c30c2a49", inventory_sprite_num-1, 8, 8); /|/setting sprite texture.
- if (colour != ZERO_VECTOR )
- llSetLinkPrimitiveParamsFast(link, [ PRIM_COLOR, face, colour, 1.0 ]);
- string s_update_amount = (string)inventory_amount;
- integer length = llStringLength(s_update_amount);
- if (length <4) /|/So number's do not bleed on to more faces, i.e. next sprite display
- {
- integer j;
- for (j=0; j<length; j++)/|/update number display
- {
- string digit = llGetSubString(s_update_amount,j,j);
- integer face = face + j+1;
- if (digit =="0")
- digit = "11"; /|/0 shows up as 11 on texture grid
- set_link_texture_grid(link, face, "6b43cc76-1f9c-6d22-045d-064b32f1b368", (integer)digit -1, 3, 4);
- }/|/ end for
- integer i;
- if (3-length>0)
- {
- for (i=0;i<(3-length);i++)
- {
- integer face = face + 3 - i ;
- set_link_texture_grid(link, face,"6b43cc76-1f9c-6d22-045d-064b32f1b368", (integer)12-1, 3, 4);/|/inserts blank
- }
- } /|/ End (3-length>0)
- } /|/ End if if (length <4)
- }/|/ End for(i=0; i<llGetListLength(l_Inventory); i++)
- }/|/ end if (llGetListLength(Updating_l) > 1)/|/if no list don't do anything.
- /|/Make excess prims blank not being used by larger inventory.
- if ( llGetListLength(l_Inventory)/3 < llGetListLength(l_Inventory_prims)*2 /|*2 as two face per prim *|/)
- {
- integer first_blank_face = llGetListLength(l_Inventory)/3+1;
- for (i=first_blank_face ; i < (llGetListLength(l_Inventory_prims)*2)+1 ; i++)
- {
- if(i%2 == 0)
- {
- link = llList2Integer(l_Inventory_prims, (i/2)-1 );
- face = 4;
- }
- else
- {
- face = 0;
- link = llList2Integer(l_Inventory_prims, ((i+1)/2)-1 );
- }
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
- llSetLinkColor(link,<1,1,1>,face); /|/setting back to white
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+1,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+2,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+3,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
- }/|/ End for (i=first_blank_face ; i < (llGetListLength(l_Inventory_prims)*2)+1 ; i++)
- } /|/ End if ( llGetListLength(l_Inventory)/3 < etc
- } /|/ End function
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/2nd version
- Colour_menu_facesFrom_list(list bucket_l, list changing_l, list prims_to_change_l, vector colour)
- {
- /|*Changes prims corrsponding to items already in a mode list to a colour.
- *|/
- integer i;
- integer link;
- integer face;
- for (i=0; i < (llGetListLength(bucket_l)+1) ; i+=3)
- {
- /|/llSay(0, (string)i);
- inventory_name_s = llList2String(bucket_l,i);
- /|/llSay(0, (string)inventory_name_s);
- inventory__name_index = llListFindList (changing_l, [inventory_name_s]);
- /|/llSay(0, (string)inventory__name_index);
- menudisplay_index = (inventory__name_index/3)+1;
- /|/llSay(0, (string)menudisplay_index);
- if(menudisplay_index%2 == 0)
- {
- link = llList2Integer(prims_to_change_l, (menudisplay_index/2)-1 );
- face = 4;
- }
- else
- {
- face = 0;
- link = llList2Integer(prims_to_change_l, ((menudisplay_index+1)/2)-1 );
- }
- llSetLinkPrimitiveParamsFast(link,
- [ PRIM_COLOR,face, colour, 1.0 ]); /|/set to re
- }
- }
- /|/get rid of _old
- Colour_menu_facesFrom_list_old(list bucket_l, list prims_to_change_l, vector colour)
- {
- integer i;
- integer link;
- integer face;
- for (i=1; i < (llGetListLength(bucket_l)/3)+1 ; i++)
- {
- if(i%2 == 0)
- {
- link = llList2Integer(prims_to_change_l, (i/2)-1 );
- face = 4;
- }
- else
- {
- face = 0;
- link = llList2Integer(prims_to_change_l, ((i+1)/2)-1 );
- }
- llSetLinkPrimitiveParamsFast(link,
- [ PRIM_COLOR,face, colour, 1.0 ]); /|/set to re
- }
- }
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/Modifying lists etc
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/CURRENTLY HERE 1
- /|/UPGRADING FUNCTION
- /|/ RIGHT HERE
- list List2List_Update(list Updating_L, list l_Inventory)
- {
- /|/maybe add ad and subtract variant?
- integer i;
- string item_word;
- integer new_amount;
- integer link;
- integer face;
- integer inventory__name_index;
- for(i=0; i<llGetListLength(Updating_L); i+=3) /|/updating new amounts to main list.Only two as don't need sprite.
- {
- item_word = llList2String(Updating_L,i);
- new_amount = llList2Integer(Updating_L,i+1);
- if( llListFindList(l_Inventory, [item_word])!=-1)
- {
- inventory__name_index = llListFindList (l_Inventory, [item_word]);
- l_Inventory = llListReplaceList(l_Inventory,[new_amount],inventory__name_index+1,inventory__name_index+1);
- }
- }
- /|/smaller list update bigger
- return l_Inventory;
- }
- integer Gi_contains_zero;
- string ModifyLists2( integer amount_change, string change_style, list modifying_l, list taking_l, list l_giving)
- {
- /|/ COULD PROBABLY CHANGE AMOUNT CHANGE TO A LIST IF NEED ALTERNATIVE NUMBERS, perhaps one style where just is amount.
- /|/Style - "ListChange" "SingleAmountChange"
- Gi_contains_zero = FALSE;/|/default no 0s till discovered
- list take_list_mod_snip ;
- list give_list_mod_snip ;
- integer new_amount;
- string item_word;
- integer sprite_index;
- string combined_lists;
- /|/llSay(0, llDumpList2String (modifying_l,","));
- /|/llSay(0, llDumpList2String (taking_l,","));
- /|/llSay(0, llDumpList2String (l_giving,","));
- /|/llSay(0, (string)llGetListLength(modifying_l) );
- integer i;
- for(i=0; i<llGetListLength(modifying_l); i+=3) /|/changing updating_l new amounts
- {
- /|/llSay(0, (string)i);
- /|/ llSay(0, (string)(amount_change*(-1) ));
- /|/llSay(0, llDumpList2String (taking_l,","));
- item_word = llList2String(modifying_l,i);
- llSay(0, item_word );
- if (change_style == "ListChangeGive")
- amount_change = llList2Integer(modifying_l,i+1)*-1;
- else if(change_style == "ListChangeTake")
- amount_change = llList2Integer(modifying_l,i+1);
- integer t_name_index = llListFindList (taking_l, [item_word]);
- integer t_amount = llList2Integer(taking_l,t_name_index +1);
- sprite_index = llListFindList (inventory_main_info, [item_word]);
- integer sprite_number = llList2Integer (inventory_main_info, sprite_index +2);
- integer giving_index = llListFindList (l_giving, [item_word]);
- integer give_amount = llList2Integer(l_giving,giving_index+1);
- integer new_amount = amount_change;
- /|/llSay(0,"amount change - " + (string)amount_change );
- if (change_style == "SingleAmount")
- {
- /|/llSay(0, "here 1");
- if (amount_change > 0)/|/taking from t_list
- {
- /|/llSay(0, "here 2");
- if (t_amount < amount_change)
- new_amount = t_amount;
- }
- else if (amount_change < 0) /|/taking from give list
- {
- /|/llSay(0, "here 3");
- if (give_amount < amount_change*(-1) )
- new_amount = give_amount*(-1);
- }
- }
- /|/llSay(0, (string)new_amount );
- if (t_name_index !=-1 && t_amount - new_amount <1 ) /|/if finds the name but amount set to 0
- {/|/delete from list
- /|/ llSay(0, llDumpList2String (taking_l,","));
- /|/ llSay(0, item_word);
- /|/llSay(0, (string)i);
- taking_l = llDeleteSubList (taking_l, t_name_index,t_name_index+2);
- Gi_contains_zero = TRUE; /|/contains 0
- }
- /|/Update_Inventory_Display(inventory, inventory,inventory_links,ZERO_VECTOR );
- else if (give_amount != -1)
- taking_l = llListReplaceList(taking_l,[ t_amount - new_amount ],t_name_index+1,t_name_index+1);
- else /|/if can't find it just put it in
- taking_l += [item_word,t_amount - new_amount, sprite_number];
- take_list_mod_snip += [item_word,t_amount - new_amount, sprite_number];
- /|/llSay(0, llDumpList2String (take_list_mod_snip,","));
- /|/llSay(0, (string)amount_change);
- /|/llSay(0, llDumpList2String (take_list_mod_snip,","));
- if (give_amount!=-1 && give_amount - (new_amount*(-1)) < 1) /|/taking last amount delete from list
- {
- llSay(0, "Giving less than 1");
- /|/Gi_contains_zero = TRUE; /|/contains 0
- l_giving = llDeleteSubList (l_giving, giving_index,giving_index+2);
- }
- else if (giving_index!=-1) /|/ if in list replace
- {
- llSay(0, "1");
- l_giving = llListReplaceList(l_giving,[give_amount + new_amount],giving_index+1,giving_index+1);
- }
- else /|/if new just add
- {
- llSay(0, "2");
- l_giving += [item_word,(give_amount + new_amount), sprite_number];/|/take sprite as references inventory
- }
- give_list_mod_snip += [item_word,(give_amount + new_amount), sprite_number];
- }/|/end for loop
- combined_lists = "taking_l," + llDumpList2String (taking_l,",") + "|" + "take_snip," + llDumpList2String (take_list_mod_snip,",")
- + "|" + "l_giving," + llDumpList2String (l_giving,",") + "|" + "give_snip," + llDumpList2String (give_list_mod_snip,",") ;
- /|/llSay(0, "combined " +combined_lists );
- return combined_lists;
- /|* Calculations for other end
- string packed;
- packed = ModifyLists2(-1000, "ListChangeGive", GL_Sell_Bucket, inventory, []);
- list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in, has tags before each entry taken out
- inventory = llList2List( llCSV2List ( llList2String(bundle,0) ),
- 1, llGetListLength( llCSV2List ( llList2String(bundle,0) )));
- *|/
- }
- /|* working 17th Jan
- string ModifyLists2( integer amount_change, string change_style, list modifying_l, list taking_l, list l_giving)
- {
- /|/ COULD PROBABLY CHANGE AMOUNT CHANGE TO A LIST IF NEED ALTERNATIVE NUMBERS, perhaps one style where just is amount.
- /|/Style - "ListChange" "SingleAmountChange"
- Gi_contains_zero = FALSE;/|/default no 0s till discovered
- list take_list_mod_snip ;
- list give_list_mod_snip ;
- integer new_amount;
- string item_word;
- integer sprite_index;
- string combined_lists;
- /|/llSay(0, llDumpList2String (modifying_l,","));
- /|/llSay(0, llDumpList2String (taking_l,","));
- /|/llSay(0, llDumpList2String (l_giving,","));
- /|/llSay(0, (string)llGetListLength(modifying_l) );
- integer i;
- for(i=0; i<llGetListLength(modifying_l); i+=3) /|/changing updating_l new amounts
- {
- /|/llSay(0, (string)i);
- /|/ llSay(0, (string)(amount_change*(-1) ));
- /|/llSay(0, llDumpList2String (taking_l,","));
- item_word = llList2String(modifying_l,i);
- llSay(0, item_word );
- if (change_style == "ListChangeGive")
- amount_change = llList2Integer(modifying_l,i+1)*-1;
- else if(change_style == "ListChangeTake")
- amount_change = llList2Integer(modifying_l,i+1);
- integer t_name_index = llListFindList (taking_l, [item_word]);
- integer t_amount = llList2Integer(taking_l,t_name_index +1);
- sprite_index = llListFindList (inventory_main_info, [item_word]);
- integer sprite_number = llList2Integer (inventory_main_info, sprite_index +2);
- integer giving_index = llListFindList (l_giving, [item_word]);
- integer give_amount = llList2Integer(l_giving,giving_index+1);
- integer new_amount = amount_change;
- if (change_style == "SingleAmount")
- {
- if (amount_change > 0)
- {
- if (t_amount < amount_change)
- new_amount = t_amount;
- }
- else if (amount_change < 0)
- {
- if (give_amount < amount_change*(-1) )
- new_amount = give_amount*(-1);
- }
- }
- /|/llSay(0, (string)t_amount);
- /|/llSay(0, (string)new_amount);
- /|/llSay(0, (string)(t_amount - new_amount) );
- if(taking_l != ["Empty"])
- {
- /|/integer take_sprite = llList2Integer(taking_l,t_name_index+2);
- if (t_name_index!=-1 && t_amount - new_amount <1 )
- {
- /|/ llSay(0, llDumpList2String (taking_l,","));
- /|/ llSay(0, item_word);
- /|/llSay(0, (string)i);
- taking_l = llDeleteSubList (taking_l, t_name_index,t_name_index+2);
- Gi_contains_zero = TRUE; /|/contains 0
- /|/llSay(0, llDumpList2String (taking_l,","));
- /|/llSay(0, "Taking less than 1");
- }
- /|/Update_Inventory_Display(inventory, inventory,inventory_links,ZERO_VECTOR );
- else if (give_amount != -1)
- taking_l = llListReplaceList(taking_l,[ t_amount - new_amount ],t_name_index+1,t_name_index+1);
- else
- taking_l += [item_word,t_amount - new_amount, sprite_number];
- take_list_mod_snip += [item_word,t_amount - new_amount, sprite_number];
- }
- /|/llSay(0, llDumpList2String (taking_l,","));
- /|/llSay(0, llDumpList2String (take_list_mod_snip,","));
- /|/llSay(0, (string)amount_change);
- /|/llSay(0, llDumpList2String (take_list_mod_snip,","));
- if(l_giving != ["Empty"])
- {
- if (give_amount!=-1 && give_amount - (new_amount*(-1)) < 1) /|/taking last amount delete from list
- {
- llSay(0, "Giving less than 1");
- /|/Gi_contains_zero = TRUE; /|/contains 0
- l_giving = llDeleteSubList (l_giving, giving_index,giving_index+2);
- }
- else if (giving_index!=-1) /|/ if in list replace
- {
- llSay(0, "1");
- l_giving = llListReplaceList(l_giving,[give_amount + new_amount],giving_index+1,giving_index+1);
- }
- else /|/if new just add
- {
- llSay(0, "2");
- l_giving += [item_word,(give_amount + new_amount), sprite_number];/|/take sprite as references inventory
- }
- give_list_mod_snip += [item_word,(give_amount + new_amount), sprite_number];
- }
- /|/(0, llDumpList2String (l_giving,","));
- llSay(0, "big giving lsit" + llDumpList2String (l_giving,","));
- llSay(0,"snippet list" + llDumpList2String (give_list_mod_snip,","));
- /|/llSay(0, llDumpList2String (taking_l,","));
- /|/llSay(0, llDumpList2String (l_giving,","));
- }/|/end for loop
- combined_lists = "taking_l," + llDumpList2String (taking_l,",") + "|" + "take_snip," + llDumpList2String (take_list_mod_snip,",")
- + "|" + "l_giving," + llDumpList2String (l_giving,",") + "|" + "give_snip," + llDumpList2String (give_list_mod_snip,",") ;
- /|/llSay(0, "combined " +combined_lists );
- return combined_lists;
- /|* Calculations for other end
- string packed;
- packed = ModifyLists2(-1000, "ListChangeGive", GL_Sell_Bucket, inventory, []);
- list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in, has tags before each entry taken out
- inventory = llList2List( llCSV2List ( llList2String(bundle,0) ),
- 1, llGetListLength( llCSV2List ( llList2String(bundle,0) )));
- *|/
- /|/}
- /|*
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- list Add_or_Subtract_Amounts_list2list_Update(list updating_l, list l_2update, integer amount_change)
- {
- Creates a new list, slice looks for amount in bigger list, adds amount changed, and makes it's own
- smaller list.
- Shouldn't I scrap this and have it replace it in
- updating_l = llListReplaceList(updating_l,[new_amount],i+1,i+1);
- below.
- Then runs List2List_Update(updating_l, l_2update);
- To update the larger list with it's new entries.
- integer i;
- for(i=0; i<llGetListLength(updating_l)+1; i+=3) /|/changing updating_l new amounts
- {
- string item_word = llList2String(updating_l,i);
- llSay(0,(string)amount_change);
- /|/ llSay(0, (string)(amount_change*(-1) ));
- inventory__name_index = llListFindList (l_2update, [item_word]);
- integer current_amount = llList2Integer(l_2update,inventory__name_index+1);
- /|/ check actual inventory
- /|/ if amount > 0 (adding)
- /|/check inv to see if possible
- /|/if amount <0 putting back in inventory, needs to check the bucket
- Perhaps add the list to check actual values of
- Probably update the list in one go.
- integer invname_index = llListFindList (inventory, [item_word]);
- integer inv_amount = llList2Integer(inventory,invname_index+1);
- integer new_amount;
- if (inv_amount<amount_change)
- {
- new_amount = inv_amount;
- llOwnerSay("Not Enough " + item_word + ", all " + (string)current_amount + " were put in" );
- }
- else
- new_amount = current_amount + amount_change;
- integer new_amount = current_amount + amount_change;
- /|/ llSay(0,(string)inventory__name_index);
- if (new_amount<0)
- new_amount = 0;
- updating_l = llListReplaceList(updating_l,[new_amount],i+1,i+1);
- }
- /|/llSay(0, "temp End - " + llDumpList2String(updating_l,",") );
- /|/llSay(0, llDumpList2String(GL_Sell_Bucket,",") );
- l_2update = List2List_Update(updating_l, l_2update); /|/feed new list in to old one to change amounts.
- /|/llSay(0, "Updated Bucket - " + llDumpList2String(l_2update,",") );
- return l_2update;
- }
- *|/
- /|/llSay(0, llDumpList2String(GL_Temporary_Bucket,",") );
- string inventory_state;
- integer DebugMessaging = TRUE;
- list tradeInventory;
- float grid_x = 10.0; /|/grid size of inventory
- float grid_y = 10.0; /|/grid size of inventory
- integer inv_start;
- integer inv_end;
- string item;
- list amount;
- string command;
- set_link_texture_grid(integer link,integer face, string texture, integer num, integer x, integer y)
- {
- float step_x = 1.0 / (float)x;
- float step_y = 1.0 / (float)y;
- integer part_x = num % x;
- integer part_y = num / x;
- float pos_y = -0.5+step_y/2.0 + step_y*(float)(y-part_y-1);
- float pos_x = -0.5+step_x/2.0 + step_x*(float)part_x;
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face,texture,<step_x,step_y,0>,<pos_x,pos_y,0>,0.0]);
- }
- integer link_clicked;
- string link_name;
- string link_description;
- integer face_clicked;
- list List_AlterItems_Colour(vector colour, list ListChange, integer list_limit, string inventory_name, integer new_num)
- {
- if ( llList2Vector( llGetLinkPrimitiveParams(link_clicked,[ PRIM_COLOR,face_clicked]),0) == colour) /|/ check if colour
- {
- llSetLinkPrimitiveParamsFast(link_clicked,[ PRIM_COLOR,face_clicked, <1,1,1>, 1.0 ]); /|/turn white
- if ( llListFindList(ListChange,[inventory_name]) != -1 )
- {
- integer index = llListFindList(ListChange,[inventory_name]);
- ListChange = llDeleteSubList(ListChange,index,index+2);/|/Take item out of list
- }
- }/|/ end If Red
- else if (llGetListLength(ListChange) > list_limit*3-1) /|/so when hits limit, hence -1 otherwise it's equal.
- llOwnerSay("Only " + (string)list_limit + " items allowed in Trade Bucket, please remove items");
- else if ( llGetListLength(ListChange) < list_limit*3+1)
- {
- llSetLinkPrimitiveParamsFast(link_clicked,
- [ PRIM_COLOR,face_clicked, colour, 1.0 ]); /|/set to colour
- if( llListFindList(ListChange,[inventory_name])==-1 ) /|/if not already in add it
- ListChange += [inventory_name] + [new_num] + [inventory_sprite_num];
- /|/llSay(0,(string)llGetListLength(ListChange));
- } /|/ End ( llGetListLength(GL_Sell_Bucket) < 12 )
- ListChange = AZ_09Lists2(ListChange,"AZ"); /|/puts in alphabetical order
- return ListChange;
- }
- list AZ_09Lists2(list Inventory_list, string command)
- {
- /|/llSay (0, "Startinst list: " + llDumpList2String(Inventory_list, ",") );
- if(command == "AZ")
- {
- list reordered_list_az = llListSort(Inventory_list, 3, TRUE ); /|/Rearranges list alphabetically.
- /|/llSay (0, "End list: " + llDumpList2String(reordered_list_az, ",") );
- return reordered_list_az;
- }
- if(command == "0-9") /|/ new amount ordered list 001-999
- {
- integer i;
- list numerical;
- /|/while (i<llGetListLength(Inventory_list) )
- for (i=0; i<llGetListLength(Inventory_list); i+=3)
- {
- numerical += llList2Integer(Inventory_list,i+1);/|/ put in amount
- numerical += llList2String(Inventory_list,i);/|/ then put in name
- numerical += llList2Integer(Inventory_list,i+2); /|/then put in sprie no.
- }
- numerical = llListSort(numerical, 3, TRUE ); /|/sorts via number
- /|/llSay (0, "End list: " + llDumpList2String(numerical, ",") );
- return numerical;
- } /|/ end Numerical message
- return [];
- }
- string saving;
- integer clicked_times;
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|*
- TRADING FUNCTIONS
- *|/
- integer comm_chan = -5421422;/|/ Communication between HUDs.
- integer action_chan = 42; /|/ Action word channel
- integer menu_chan; /|/ Menu channel.
- integer menu_handle; /|/ Menu listen handle.
- set_listens()
- {
- /|/ Listen for messages from HUDs.
- llListen(comm_chan, "", NULL_KEY, "");
- /|/ Listen for messages from owner on action_chan.
- llListen(action_chan, "", owner_id, "");
- /|/ Listen for menu messages from owner.
- llListenRemove(menu_handle);
- menu_chan = ((integer)("0x"+llGetSubString((string)llGetKey(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF;
- menu_handle = llListen(menu_chan, "", NULL_KEY, ""); /|/ Listen for menu messages.
- } /|/ End set_listens.
- list av_names; /|/ List of nearby avatar names to select a partner.
- list av_buttons; /|/ List of numbers for buttons for avatar partner selection.
- key owner_id;
- string owner_name;
- key player_id;
- string player_name;
- string player_call;
- string cur_action;
- string secondary_action;
- key requesting_avatar_id;
- string trade_emote;
- string Gs_Trade_State;
- list Gl_Trade_agreement;
- trader_menu()
- {
- /|/ Menu text.
- string text = "\nYour currently trading with " + partner_name + ".\n\nChoose who you would like to next trade with.\n\nNearby Avatars:";
- integer i; /|/ Loop counter.
- /|/ Loop through av_names.
- for (i = 0; i < llGetListLength(av_names); i++)
- {
- text += "\n" + (string)(i+1) + ". " + llList2String(av_names, i); /|/ Add next name to text.
- } /|/ End for.
- /|/ Display selection menu of avatar names.
- llDialog(owner_id, text, av_buttons, menu_chan);
- cur_action = "";
- } /|/ End selection_menu.
- new_partner(key new_partner)
- {
- /|/ old partner_time_out = FALSE; /|/ Reset partner_timeout.
- /|/ Send message to previous partner's HUD to unpartner. /|/Mynote - possibly do not need this.
- if (partner_id != NULL_KEY && partner_id != new_partner)
- llRegionSayTo(partner_id, comm_chan, "not partnered");
- partner_id = new_partner; /|/ Update partner_id.
- partner_name = llKey2Name(partner_id); /|/ Update partner_name.
- /|/ Set float text.
- /|/ old displaying their name llSetLinkPrimitiveParamsFast(hover_partner_link, [PRIM_TEXT, partner_name, <1,1,1>, 1.0]);
- /|/ Set partner text prim name.
- /|/ old setting furwarellMessageLinked(LINK_THIS, 0, partner_name, "fw_data:partner");
- /|/ Start bonding timer.
- /|/last_bond_time = llGetUnixTime();
- /|/llSetTimerEvent(bonding_interval);
- /|/ Restore stats from script (b) if previously partnered with this avatar.
- /|/llMessageLinked(LINK_THIS, -100, "", partner_id);
- /|/Could probably do with some global text to go with each relationship style. You are "Partnered", trading, fighting, On a mission for etc.
- llDialog(owner_id, "\nYour actions will now go to " + partner_name + " until you select another avatar to play with.", ["OK"], menu_chan);
- } /|/ End new_partner.
- trade_transaction()
- {
- llRegionSayTo(partner_id, comm_chan, "ConfirmFinish");
- Gs_Trade_State = "";/|/reset trade state
- Gl_Trade_agreement = []; /|/reset trade agreements
- string packed = ModifyLists2(-1000, "ListChangeGive", Gl_IncomingTrade, inventory,[]);/|/just taking
- list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in string.
- inventory = llCSV2List ( llList2String(bundle,0) );
- list inv_update = llCSV2List ( llList2String(bundle,1) );/|/ possibly do this twice
- /|/Update_Inventory_Display(inv_update, inventory,inventory_links,ZERO_VECTOR );
- packed = ModifyLists2(-1000, "ListChangeTake", GL_Sell_Bucket, inventory,[]);
- inventory = llCSV2List ( llList2String(bundle,0) );
- inv_update += llCSV2List ( llList2String(bundle,1) );
- Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,ZERO_VECTOR );
- GL_Sell_Bucket = [];
- Gl_IncomingTrade = [];
- /|/llRegionSayTo(partner_id, comm_chan,
- /|/"TradeGiven|" + llDumpList2String(GL_Sell_Bucket,",") );
- /|/Update_Inventory_Display(inv_update, inventory,inventory_links,ZERO_VECTOR );
- Update_Inventory_Display("ChangerList",[], GL_Sell_Bucket,Sell_prims,ZERO_VECTOR );
- Update_Inventory_Display("ChangerList",[], Gl_IncomingTrade,Gl_IncomingTrade_Prims,ZERO_VECTOR );
- llOwnerSay("Congratulations you have just traded with " + partner_name + " consisting of: " +
- trade_emote );/|/message to self
- }
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
- default
- {
- state_entry()
- {
- llListen(0,"",NULL_KEY,"");
- inventory_links = Index_Inventory_PrimLinks( "Inv:");
- Sell_prims = Index_Inventory_PrimLinks("Sel:");
- Gl_IncomingTrade_Prims = Index_Inventory_PrimLinks("Oth:");
- llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_hidden]);
- /|/llSay(0, llDumpList2String(inventory_links,",") );
- /|/llSay(0, llDumpList2String(Sell_prims,",") );
- /|/llSay(0, llDumpList2String(Gl_IncomingTrade,",") );
- list prim_resetTo_white = inventory_links + Sell_prims + Gl_IncomingTrade;
- integer i;
- for (i=0; i < llGetListLength(prim_resetTo_white)+1 ; i++)
- {
- integer prim = llList2Integer(prim_resetTo_white,i);
- llSetLinkPrimitiveParamsFast(prim,
- [ PRIM_COLOR,ALL_SIDES, <1.0,1.0,1.0>, 1.0 ]);
- }
- /|* Menu speed test, is fast!!
- Update_Inventory_Display(inventory, inventory,inventory_links,<1,1,1>);
- inventory = AZ_09Lists2(inventory,"AZ");
- llSleep(2.0);
- llSay(0,"Start");
- Update_Inventory_Display(inventory, inventory,inventory_links,<1,1,1>);
- llSay(0, llDumpList2String(inventory,",") );
- *|/
- /|/Update_Inventory_Display(inventory, inventory,inventory_links);
- inventory = AZ_09Lists2(inventory,"AZ");
- Update_Inventory_Display("SameList",inventory, inventory,inventory_links,<1,1,1>);
- /|/GL_Temporary_Bucket = GL_Sell_Bucket = llList2List(inventory, 0,3*4-1); /|/gets first four entrie
- Update_Inventory_Display("ChangerList",GL_Temporary_Bucket, GL_Sell_Bucket,Sell_prims,<0,1,0>);
- Update_Inventory_Display("ChangerList",[], Gl_IncomingTrade,Gl_IncomingTrade_Prims,ZERO_VECTOR );
- owner_id = llGetOwner(); /|/ Owner's key.
- owner_name = llKey2Name(owner_id); /|/ Owner's name.
- set_listens(); /|/ Set listens.
- }
- on_rez(integer start_param)
- {
- owner_id = llGetOwner(); /|/ Owner's key.
- owner_name = llKey2Name(owner_id); /|/ Owner's name.
- set_listens(); /|/ Set listens.
- if (owner_id == temp_if_id) /|/if Silent is using make Reisi the partner
- {
- llSay(0, "TempIDFound");
- partner_id= "42e9405d-19f6-4bd5-8b9a-00436a5da1b4";
- partner_name = "Reishi";
- }
- }
- touch_start(integer total_number)
- {
- link_clicked = llDetectedLinkNumber(0);
- link_name = llGetLinkName(link_clicked);
- link_description = llList2String( llGetLinkPrimitiveParams(link_clicked,[PRIM_DESC]),0);
- face_clicked = llDetectedTouchFace(0);
- /|/llSay(0,link_name );
- llSay(0, llList2String (llGetLinkPrimitiveParams(accept_link, [ PRIM_ROT_LOCAL ]) ,0) );
- if (link_name=="TempButton")
- {
- trade_transaction();
- llSay(0, llDumpList2String(inventory, ",") );
- }
- if (link_name=="NormalMode")
- {
- llSay(0,link_name );
- /|/Colour_menu_facesFrom_list([],GL_Sell_Bucket, Sell_prims, <0,0,0>);
- Update_Inventory_Display("ChangerList",[], [], Sell_prims,<1,1,1>); /|/GL_Sell_Bucket
- string packed;
- packed = ModifyLists2(-1000, "ListChangeGive", GL_Sell_Bucket, inventory, []);/|/if a list is blank it will change the order
- list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in string.
- /|/llSay(0, packed);
- inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;/|/takes out first entry identifier/placeholder
- list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
- llSay(0, llDumpList2String(inventory, ",") );
- Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,<1,1,1> );
- llSay(0, "inv_update" + llDumpList2String(inv_update, ",") );
- Colour_menu_facesFrom_list(GL_Temporary_Bucket,inventory, inventory_links, <1,1,1>);
- GL_Temporary_Bucket = [];/|/reset temporary.
- inventory_state = "NormalMode";
- }
- else if (link_name=="BasketState")
- {
- /|/GL_Sell_Bucket = ["Chestnut",20,1,"Pancakes",50,2,"Oyster",3,3,"Orange",5,4]; temp just to test
- llSay(0, "inv_update" + llDumpList2String(GL_Temporary_Bucket, ",") );
- string packed;
- packed = ModifyLists2(-1000, "ListChangeTake", GL_Sell_Bucket, inventory, []);/|/if a list is blank it will change the order
- list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in string.
- inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;/|/takes out first entry identifier/placeholder
- list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
- /|/Colour_menu_facesFrom_list(GL_Sell_Bucket,GL_Sell_Bucket, Sell_prims, <0,1,0>);/|/turn red, do I even need this function??
- Update_Inventory_Display("SameList",GL_Sell_Bucket, GL_Sell_Bucket, Sell_prims,<0,1,0>);
- Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,<1,0,0> );
- /|/Colour_menu_facesFrom_list(GL_Sell_Bucket,inventory, inventory_links, <1,0,0>);
- inventory_state = "BasketState";
- llOwnerSay("Basket State Active");
- }
- else if (llGetSubString(link_description,0,3)=="Inv:" || llGetSubString(link_description,0,3)=="Sel:")
- { /|/update inventory data if inventory prim is clicked
- if (llGetSubString(link_description,0,3)=="Inv:")
- {
- link_click2_inventory_item_name(link_clicked,face_clicked,inventory);
- Index_info_grabber(inventory_name_s,inventory);
- }
- else if (llGetSubString(link_description,0,3)=="Sel:")
- {
- link_click2_inventory_item_name(link_clicked,face_clicked,GL_Sell_Bucket);
- Index_info_grabber(inventory_name_s,GL_Sell_Bucket);
- }
- /|/works out other indexes based on word.
- /|/Data_Message();
- }
- if (inventory_state == "NormalMode")
- {
- if (llGetSubString(link_description,0,3)=="Inv:")
- {
- if (Gl_Use_click_bank!=inventory_name_s)
- {
- llSetLinkPrimitiveParamsFast(Gi_old_link, [ PRIM_COLOR, Gi_old_face,<1,1,1>, 1.0 ]);
- Gi_old_link= link_clicked;
- Gi_old_face= face_clicked;
- llOwnerSay("Are you sure you want to use " + inventory_name_s + ", click item again to confirm");
- Gl_Use_click_bank = inventory_name_s;
- llSetLinkPrimitiveParamsFast(link_clicked, [ PRIM_COLOR, face_clicked,<0.502, 1.000, 1.000>, 1.0 ]);
- }
- else if (Gl_Use_click_bank==inventory_name_s)
- {
- Gl_Use_click_bank;/|/reset
- llSetLinkPrimitiveParamsFast(link_clicked, [ PRIM_COLOR, face_clicked,<1,1,1>, 1.0 ]);
- /|/llSay(0, llDumpList2String(inventory,",") );
- if (inventory_amount-1 <1)
- {
- llOwnerSay("You have used all your " + inventory_name_s +"s");
- inventory = llDeleteSubList (inventory, inventory__name_index,inventory__name_index+2);
- Update_Inventory_Display("SameList",inventory, inventory,inventory_links,ZERO_VECTOR );
- }
- else
- {
- llOwnerSay("You used a " + inventory_name_s);
- GL_Temporary_Bucket = [inventory_name_s,inventory_amount-1,inventory_sprite_num]; inventory = List2List_Update(GL_Temporary_Bucket, inventory);
- /|/inventory = Add_or_Subtract_Amounts_list2list_Update(GL_Temporary_Bucket, inventory,-1);
- Update_Inventory_Display("ChangerList",GL_Temporary_Bucket, inventory,inventory_links,ZERO_VECTOR );
- /|/Update_Inventory_Display(GL_Sell_Bucket, inventory,inventory_links,ZERO_VECTOR );
- }
- llSay(0, llDumpList2String(inventory,",") );
- Gl_Use_click_bank="";
- /|/llSay(0, llDumpList2String(inventory,",") );
- }/|/ if (Gl_Use_click_bank==inventory_name_s)
- }/|/ End if (llGetSubString(link_description,0,3)=="Inv:")
- } /|/ End of if (inventory_state == "NormalMode")
- if (inventory_state == "BasketState") /|/ Need an if for inventory button check
- {
- if (face_clicked ==0 || face_clicked == 4)
- {
- if(llGetSubString(link_description,0,3)=="Inv:")
- { /|/adding one item
- GL_Temporary_Bucket = List_AlterItems_Colour(<1, 0.445, 0>,GL_Temporary_Bucket,8,inventory_name_s,0);
- llSay(0, "GL_Temporary_Bucket List - " + llDumpList2String(GL_Temporary_Bucket,",") );
- }
- /|* scrapped this
- else if(llGetSubString(link_description,0,3)=="Sel:")
- { /|/turn green and add or remove from list
- /|/GL_Temporary_Bucket = List_AlterItems_Colour(<0,1,0>,GL_Temporary_Bucket,8,inventory_name_s,0);
- /|/llSay(0, "GL_Temporary_Bucket List - " + llDumpList2String(GL_Temporary_Bucket,",") );
- }
- *|/
- }/|/ End if (face_clicked ==0 || face_clicked == 4)
- if (llGetSubString(link_name,0,6)=="Bucket:" ) /|/to modify items in bucket
- {
- string num = llGetSubString(link_name,7,llStringLength(link_name));
- if (num=="Reset")
- num = "-1000"; /|/turns everything to 0
- integer amount_change = (integer)num;
- /|/llSay(0, "temp Start - " + llDumpList2String(GL_Sell_Bucket,",") );
- if (llGetListLength(GL_Temporary_Bucket)>2)/|/if something actually in the bucket to add
- /|/create GL_Temporary_Bucket with updated amounts
- {
- /|/ RIGHT HERE 2
- llSay(0,"Sell Bucket before - " + llDumpList2String(GL_Sell_Bucket,",") );
- string packed;
- packed = ModifyLists2(amount_change, "SingleAmount", GL_Temporary_Bucket, inventory, GL_Sell_Bucket);/|/if a list is blank it will change the order
- list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in string.
- inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;/|/takes out first entry identifier/placeholder
- GL_Sell_Bucket = llListReplaceList( llCSV2List ( llList2String(bundle,2) ),[],0,0 ) ;
- /|/list sell_update = llListReplaceList( llCSV2List ( llList2String(bundle,3) ),[],0,0 ) ;
- llSay(0,"inventory - " + llDumpList2String(inventory,",") );
- llSay(0,"GL_Sell_Bucket - " + llDumpList2String(GL_Sell_Bucket,",") );
- llSay(0,"cotains 0 flag - " + (string)Gi_contains_zero);
- if(Gi_contains_zero == TRUE)
- Update_Inventory_Display("SameList",inventory, inventory,inventory_links,ZERO_VECTOR );
- else
- {
- list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
- Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,ZERO_VECTOR );
- /|/llSay(0,"inv update" + llDumpList2String(inv_update,",") );
- }
- Update_Inventory_Display("SameList",GL_Sell_Bucket, GL_Sell_Bucket,Sell_prims,ZERO_VECTOR );
- }
- else if (llGetListLength(GL_Temporary_Bucket)<3)
- llOwnerSay("Active more items in the trade bucket!");
- } /|/ end if (llGetSubString(link_name,0,6)=="Bucket:" )
- } /|/ End if Basket State
- if (link_name == "TradeRadar")
- {
- cur_action = "partner";
- llSay(0, "?");/|/ this working
- llSay(comm_chan, "?");
- /|/inventory_state =="Trading"
- }
- else if (link_name == "ProposeTrade") /|/ && cur_action == "partner"
- {
- string trade_message = "TradeProposed|" + llDumpList2String(GL_Sell_Bucket,",");
- trade_emote;
- integer i;
- for (i=0; i < llGetListLength(GL_Sell_Bucket) ; i+=3)/|/generating emote minus sprites
- {
- /|/llSay(0, (string)i);
- trade_emote += llList2String(GL_Sell_Bucket,i) + "," + llList2String(GL_Sell_Bucket,i+1) + ",";
- }
- llOwnerSay("You have proposed a trade to " + partner_name + " consisting of: " +
- trade_emote );/|/message to self
- /|/llRegionSay( comm_chan, trade_message);
- llRegionSayTo(partner_id, comm_chan, trade_message);/|/plust list of items
- /|/llSay(0, (string)trade_message);
- /|/llRegionSay(0, owner_name + " would like to trade the following items: " + trade_emote);
- llRegionSayTo(partner_id, 0, owner_name + " would like to trade the following items: " + trade_emote);
- /|*
- if ()/|/tradebasket empty)
- llOwnerSay("You have offered to receive no items, if you accept this trade will be a gift to ");
- *|/
- if (Gs_Trade_State == "TradeAgreed_Countdown" || llListFindList(Gl_Trade_agreement,["Other"]) !=-1 )
- llOwnerSay("You cancelled the agreement making a new proposal");
- Gl_Trade_agreement = [];
- Gs_Trade_State = "Proposals";
- llSetTimerEvent(0.0); /|/stops trade window
- /|/you have changed your proposal. You and Reishi will need to confirm again.
- /|/also send to them in reverse.
- /|/llSay(0, Gs_Trade_State);
- }/|/ else if (link_name == "AcceptAction")
- else if (link_name == "TradeAgree" && Gs_Trade_State != "ConfirmFinish" )
- {
- /|/ llRegionSay(comm_chan, "TradeAgree");
- llRegionSayTo(partner_id, comm_chan, "TradeAgree");
- if (llListFindList(Gl_Trade_agreement,["Other"]) !=-1)/|/new incoming proposal stops countdown reests back to proposals stage.
- {
- Gl_Trade_agreement += ["Self"];
- Gs_Trade_State = "TradeAgreed_Countdown";
- llOwnerSay("You and " + partner_name + " have both agreed on a trade. Wait 20 seconds and either one of you can confirm to finish the trade.");
- llSetTimerEvent(0.1); /|/starts trade window
- /|/both of you agree, after twenty seconds either of you can click to finsih the trade.
- }
- else
- {
- Gl_Trade_agreement = ["Self"];
- llOwnerSay("You have agreed the proposal. If " + partner_name + " agrees you will start the trade count down") ; /|/ waiting for other to come in.
- }
- llSay(0, llDumpList2String(Gl_Trade_agreement,",") );
- llSay(0, Gs_Trade_State);
- llSay(0, "Sent - Proposals");
- }/|/ else if (link_name == "AcceptAction")
- else if (link_name == "ConfirmFinish" && Gs_Trade_State == "ConfirmFinish") /|/
- {
- /|/llRegionSay(comm_chan, "ConfirmTrade");
- llSay(0, "Clicker Confirm Sent");
- llRegionSayTo(partner_id, comm_chan, "ConfirmFinish");
- Gs_Trade_State = "SentMessage";
- /|/Say to them "ConfirmTrade" - will wait for response.
- /|/send message, wait for reception.
- /|/run through from their return to confirm.
- llSay(0, Gs_Trade_State);
- }
- else if (link_name == "AcceptAction") /|/
- {
- /|/llSay(0, cur_action);
- if (cur_action == "partner")
- {
- llSay(0,(string)face_clicked);
- if (face_clicked == 1) /|/ Yes.
- {
- /|/llSay(0, "Received2");
- /|/ Send acceptance back to other avatar's HUD.
- llRegionSayTo(requesting_avatar_id, comm_chan, "accepted");/|/comm chat
- llOwnerSay("You accept " + partner_name + "'s " + cur_action + " request.");/|/message to self
- llRegionSayTo(requesting_avatar_id, 0, owner_name + " accepted your request to play."); /|/message they get
- new_partner(requesting_avatar_id);/|/adds them as a new partner etc
- llSay(0, (string)partner_id );
- } /|/ End if.
- else if (face_clicked == 2) /|/ No.
- llRegionSayTo(requesting_avatar_id, 0, owner_name + " turned down your request to play.");
- /|/ Hide accept action link.
- llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_hidden]);
- } /|/ End if.
- } /|/ else if (link_name == "AcceptAction")
- }/|/ end Touch Start
- listen(integer channel, string name, key id, string msg)
- {
- if (channel == comm_chan)/|/|/coming from other users or own NPCs
- {
- llSay(0, "Comm chan message is - " + msg);
- if (msg == "?")/|/ Anybody around with a hud on?
- {
- av_names = []; /|/ Clear av_names list. /|/resets own
- av_buttons = []; /|/ Clear av_buttons list. /|/ resets own
- /|/llSay(0, "!");
- llRegionSayTo(id, comm_chan, "!"); /|/ Send back reply to querying HUD.
- } /|/ End if.
- else if (msg == "!" && llGetOwnerKey(id) != owner_id )/|/ Response message to "hud in area?". Not owner of hud message.
- {
- string av_name = llKey2Name(llGetOwnerKey(id));
- if (llListFindList(av_names, [av_name]) == -1) /|/if av name not already in list
- {
- av_names += av_name; /|/ Add avatar name to list.
- av_buttons += (string)(llGetListLength(av_names));/|/ Add button number to list.
- }
- if (llGetListLength(av_names) == 12) /|/ 12 is max amount in dialog menu
- {
- trader_menu(); /|/ Display selection menu of avatar names.
- }
- else
- {
- llSetTimerEvent(1.0); /|/ Extend timeout by 1 second.
- /|/working llSay(0, "Received4");
- }
- } /|/ End if (msg == "!" && llGetOwnerKey(id) != owner_id )
- else if (msg == "Partner?")
- {
- /|/ Show accept action link.
- cur_action = "partner";
- llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_visible]);
- requesting_avatar_id = llGetOwnerKey(id);
- string av_name = llKey2Name(requesting_avatar_id);
- llOwnerSay(av_name + " has sent a " + cur_action + " request.");/|/message to self
- /|/ Set cur_action.
- cur_action = "partner";
- /|/ Store requester's id in requesting_avatar_id.
- requesting_avatar_id = llGetOwnerKey(id);
- } /|/ End else if.
- else if (msg == "accepted") /|/sends it to self and other when clicked accept button.
- {
- /|/old partner_time_out = FALSE; /|/ Reset partner time out flag.
- /|/ Do new partner stuff.
- new_partner(llGetOwnerKey(id));
- } /|/ End else if.
- else if ( llGetSubString(msg,0,13) == "TradeProposed|" /|*&& llGetOwnerKey(id) == partner_id*|/)
- {
- llSay(0, "Received");
- string incoming_t = llGetSubString(msg,14,llStringLength(msg) );
- Gl_IncomingTrade = llCSV2List(incoming_t);
- Update_Inventory_Display("SameList",Gl_IncomingTrade, Gl_IncomingTrade,Gl_IncomingTrade_Prims,<1, 1,0> );
- /|/llSay(0,llList2String(Gl_IncomingTrade,0) );
- /|/say trader sent new proposal
- /|/ llSay(0,incoming_t);
- if (Gs_Trade_State == "TradeAgreed_Countdown" || llListFindList(Gl_Trade_agreement,["Self"]) !=-1)/|/Reset agreement
- {
- llOwnerSay(partner_name + " has sent a new trade proposal, Agreement has been reset");/|/message to self
- llSetTimerEvent(0.0);
- llSay(0, "A new proposal has been sent by " + partner_name +", Agreement Reset");
- /|/ put forth a new proposal, agreement reset.
- }
- else
- {
- llOwnerSay(partner_name + " has sent a new trade proposal.");
- }
- llSetTimerEvent(0.0);
- Gs_Trade_State = "Proposals";
- Gl_Trade_agreement = [];
- /|/llSay(0,"received list is list is " + llDumpList2String(Gl_Trade_agreement,",") );
- /|/llSay(0, "trade state " + Gs_Trade_State);
- /|/llSay(0, "Received - Proposals");
- }
- else if ( msg == "TradeAgree") /|*&& llGetOwnerKey(id) == partner_id*|/
- {
- if (llListFindList(Gl_Trade_agreement,["Self"]) !=-1)/|/new incoming proposal stops countdown reests back to proposals stage.
- {
- Gl_Trade_agreement += ["Other"];/|/do I even need this bit?
- Gs_Trade_State = "TradeAgreed_Countdown";
- llOwnerSay("You and " + partner_name + " have both agreed on a trade. Wait 20 seconds and either one of you can confirm to finish the trade.");
- llSetTimerEvent(0.1); /|/starts trade window
- /|/both of you agree, after twenty seconds either of you can click to finsih the trade.
- }
- else
- {
- Gl_Trade_agreement = ["Other"]; /|/ waiting for other to come in.
- llOwnerSay(partner_name + " has agreed to the trade. Click agree to confirm or change proposal");
- }
- /|/llSay(0, llDumpList2String(Gl_Trade_agreement,",") );
- /|/llSay(0, Gs_Trade_State);
- /|/llSay(0, "Received - TradeAgree");
- }
- } /|/ End if (channel == comm_chan) /|/coming from other users/NPCs
- if ( msg == "ConfirmFinish" && Gs_Trade_State == "SentMessage" ) /|/for some reason clicker needed another state. Not sure why yet.
- { /|/Sent message is the state the one that first sends the message, i.e. hud user that clicks first sends and goes in to.
- trade_transaction();
- }
- else if ( msg == "ConfirmFinish" && Gs_Trade_State == "ConfirmFinish" )
- {/|/sends return message to trade initiater
- trade_transaction();
- }
- if (channel == menu_chan && id == owner_id)/|/coming from user using dialogue menu
- {
- /|/ Response to avatar partnering name selection menu.
- /|/ Check for a valid number button.
- /|/llSay(0, msg);
- if (llListFindList(av_buttons, [msg]) != -1) /|/Dialogue receiving a number of chosen avatar.
- {
- string av_name = llList2String(av_names, (integer)msg -1); /|/ Avatar selected.
- string av_id = llName2Key(av_name); /|/ UUID of selected avatar.
- if (av_id == NULL_KEY)
- {
- llDialog(id, "\n" + av_name + " is no longer in the region. Please select another avatar.", ["OK"], menu_chan);
- } /|/ End if.
- else
- {
- llSay(0,"sent");
- llSay(0,(string)av_id );
- /|/ Send partner confirm message to chosen avatar's HUD.
- llDialog(owner_id, "Sending request to TRADE to " + av_name, ["OK"], menu_chan);
- llRegionSayTo(av_id, comm_chan, "Partner?");
- } /|/ End else.
- } /|/ End if.
- } /|/ End if.
- /|/update list
- /|/list NewList = llParseString2List(msg, ["|"], [","] );
- /|/llSay(0, llDumpList2String(Gl_IncomingTrade,",") );
- /|/Gl_IncomingTrade = List2List_Update(NewList, Gl_IncomingTrade);
- /|/Gl_IncomingTrade = NewList;
- /|/Update_Inventory_Display(Gl_IncomingTrade, Gl_IncomingTrade,Gl_IncomingTrade,<1.000, 1.000, 0.000>);
- /|/inventory = List2List_Update(NewList, inventory);
- /|/Update_Inventory_Display(NewList, inventory,inventory_links);
- /|/llSay(0, llDumpList2String(Gl_IncomingTrade,",") );
- } /|/end Listen
- timer()
- {
- if(cur_action == "partner")
- {
- if (llGetListLength(av_names) > 0)
- trader_menu(); /|/ Display selection menu of avatar names.
- else
- llDialog(owner_id, "There are no nearby avatars wearing Sex HUDs found.", ["OK"], menu_chan);
- llSetTimerEvent(0.0); /|/turn timer off again
- }
- if (Gs_Trade_State == "TradeAgreed_Countdown")
- {
- llSay(0, "Proposal Countdown Started - " + Gs_Trade_State);
- llSetTimerEvent(5.0);/|/20 second countdown
- /|/perhaps less and announce count
- Gs_Trade_State = "FinishedOpen";
- }
- else if (Gs_Trade_State == "FinishedOpen")
- {
- /|/send message so both in unison. perhaps wait one second after.
- Gs_Trade_State = "ConfirmFinish";
- llSay(0,"State in " + Gs_Trade_State);
- /|/message you can now finish trade etc
- /|/ you or trading partner may now click to finalise the trade.
- llSetTimerEvent(0.0);
- /|/run trading action
- }
- } /|/ End timer()
- }
- */
- //end_unprocessed_text
- //nfo_preprocessor_version 0
- //program_version Firestorm-Releasex64 6.3.2.58052 - ReishiProphet
- //last_compiled 01/18/2020 04:44:21
- //mono
- list lazy_list_set(list L, integer i, list v)
- {
- while (llGetListLength(L) < i)
- L = L + 0;
- return llListReplaceList(L, v, i, i);
- }
- key partner_id= "8b3b54aa-4de6-4b49-8c42-146555d26863";
- string partner_name = "Labyrinthstarchild";
- key temp_if_id = "8b3b54aa-4de6-4b49-8c42-146555d26863";
- integer accept_link;
- rotation accept_rot_visible = <-0.000000, -0.000000, -0.766031, 0.642804>;
- rotation accept_rot_hidden = <-0.000000, -0.000000, 0.000022, 1.000000>;
- list Index_Inventory_PrimLinks( string prim_desc )
- {
- integer i;
- integer y=1;
- list Grab_prims_list;
- string link_name;
- string order_number;
- for (i = 0; i < llGetNumberOfPrims()+1; i++)
- {
- order_number = llList2String(llGetLinkPrimitiveParams(i,[PRIM_DESC]),0);
- link_name = llGetLinkName(i);
- if (llGetSubString(order_number,0,3) == prim_desc )
- {
- Grab_prims_list += (integer) llGetSubString(order_number,4,llStringLength(order_number) );
- Grab_prims_list += i;
- }
- else if (link_name == "AcceptAction")
- {
- accept_link = i;
- llSay(0,"action link" + (string)accept_link );
- }
- }
- list reordered_list = llListSort(Grab_prims_list, 2, TRUE );
- list link_list;
- for (i = 1; i < llGetListLength(reordered_list); i+=2)
- link_list += llList2Integer(reordered_list,i);
- llSay(0, "Final list - " + llDumpList2String(link_list,",") );
- return link_list;
- }
- list inventory_main_info = ["Chestnut",25,1,"Pancakes",100,2,"Oyster",7,3,"Orange",9,4,"Ghost",9,5,"Egg",10,6,"Onion",11,7,"Oil",20,8,"Octopus",60,9,"Seaweed",34,10,"ExoticMushroom","006",11,"Mushroom",33,12] ;
- list inventory = ["Chestnut",25,1,"Pancakes",100,2,"Oyster",7,3,"Orange",9,4,"Ghost",9,5,"Egg",10,6,"Onion",11,7,"Oil",20,8,"Octopus",60,9,"Seaweed",34,10,"ExoticMushroom","006",11,"Mushroom",33,12] ;
- list GL_Temporary_Bucket /*=["Chestnut",10,1,"Pancakes",1,2,"Oyster",2,3,"Orange",3,4]*/;
- list GL_Sell_Bucket;
- list SelfTrade;
- list Gl_IncomingTrade;
- list Gl_IncomingTrade_Prims;
- list inventory_links;
- list Sell_prims;
- string Gl_Use_click_bank;
- integer Gi_old_link;
- integer Gi_old_face;
- integer item_name_list_index;
- integer item_amount_list_index;
- integer item_spriteIndex_list_index;
- string inventory_name_s;
- integer inventory__name_index ;
- integer inventory_amount;
- integer inventory_sprite_num ;
- integer menudisplay_index ;
- link_click2_inventory_item_name(integer link, integer face, list inventory_l)
- {
- string inventoryprim_num = llGetSubString( llList2String(
- llGetLinkPrimitiveParams(link,[PRIM_DESC]),0) ,4,4 );
- integer itemName_num = (integer)inventoryprim_num;
- itemName_num = (itemName_num*2)-1;
- if (face==4)
- itemName_num +=1;
- inventory_name_s = llList2String (inventory_l, ((itemName_num-1)*3 ) );
- }
- Index_info_grabber(string item_name, list l_Inventory)
- {
- inventory__name_index = llListFindList (l_Inventory, [item_name]);
- inventory_amount = llList2Integer(l_Inventory,inventory__name_index+1);
- inventory_sprite_num = llList2Integer(l_Inventory,inventory__name_index+2);
- menudisplay_index = (inventory__name_index/3)+1;
- }
- Data_Message()
- {
- llSay(0, "Item Name: " + (string)inventory_name_s + ", Name Index: " + (string)inventory__name_index +
- ", Amount: " + (string)inventory_amount + ", Sprite: " + (string)inventory_sprite_num +
- ", MenuDisplayNo :" + (string)menudisplay_index );
- }
- Update_Inventory_Display(string changestyle, list Updating_l, list l_Inventory, list l_Inventory_prims,vector colour)
- {
- integer i;
- integer link;
- integer face;
- integer menudisplay_index;
- integer blank_link_offset;
- if (llGetListLength(Updating_l) > 1)
- {
- for(i=0; i <llGetListLength(Updating_l); i+=3)
- {
- if (changestyle == "ChangerList")
- {
- inventory_name_s = llList2String(Updating_l,i);
- inventory_amount = llList2Integer(Updating_l,i+1);
- inventory__name_index = llListFindList (l_Inventory, [inventory_name_s]);
- menudisplay_index = (inventory__name_index/3)+1;
- inventory_sprite_num = llList2Integer(l_Inventory,inventory__name_index+2);
- }
- else if (changestyle == "SameList")
- {
- inventory_name_s = llList2String(l_Inventory,i);
- inventory_amount = llList2Integer(l_Inventory,i+1);
- inventory_sprite_num = llList2Integer(l_Inventory,i+2);
- menudisplay_index = (i/3)+1;
- }
- if(menudisplay_index%2 == 0)
- {
- link = llList2Integer(l_Inventory_prims, (menudisplay_index/2)-1 );
- face = 4;
- }
- else
- {
- face = 0;
- link = llList2Integer(l_Inventory_prims, ((menudisplay_index+1)/2)-1 );
- }
- set_link_texture_grid(link, face, "9a5e49c8-896c-ee94-ff8e-c484c30c2a49", inventory_sprite_num-1, 8, 8);
- if (colour != ZERO_VECTOR )
- llSetLinkPrimitiveParamsFast(link, [ PRIM_COLOR, face, colour, 1.0 ]);
- string s_update_amount = (string)inventory_amount;
- integer length = llStringLength(s_update_amount);
- if (length <4)
- {
- integer j;
- for (j=0; j<length; j++)
- {
- string digit = llGetSubString(s_update_amount,j,j);
- integer face = face + j+1;
- if (digit =="0")
- digit = "11";
- set_link_texture_grid(link, face, "6b43cc76-1f9c-6d22-045d-064b32f1b368", (integer)digit -1, 3, 4);
- }
- integer i;
- if (3-length>0)
- {
- for (i=0;i<(3-length);i++)
- {
- integer face = face + 3 - i ;
- set_link_texture_grid(link, face,"6b43cc76-1f9c-6d22-045d-064b32f1b368", (integer)12-1, 3, 4);
- }
- }
- }
- }
- }
- if ( llGetListLength(l_Inventory)/3 < llGetListLength(l_Inventory_prims)*2 /*2 as two face per prim */)
- {
- integer first_blank_face = llGetListLength(l_Inventory)/3+1;
- for (i=first_blank_face ; i < (llGetListLength(l_Inventory_prims)*2)+1 ; i++)
- {
- if(i%2 == 0)
- {
- link = llList2Integer(l_Inventory_prims, (i/2)-1 );
- face = 4;
- }
- else
- {
- face = 0;
- link = llList2Integer(l_Inventory_prims, ((i+1)/2)-1 );
- }
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
- llSetLinkColor(link,<1,1,1>,face);
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+1,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+2,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+3,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
- }
- }
- }
- Colour_menu_facesFrom_list(list bucket_l, list changing_l, list prims_to_change_l, vector colour)
- {
- integer i;
- integer link;
- integer face;
- for (i=0; i < (llGetListLength(bucket_l)+1) ; i+=3)
- {
- inventory_name_s = llList2String(bucket_l,i);
- inventory__name_index = llListFindList (changing_l, [inventory_name_s]);
- menudisplay_index = (inventory__name_index/3)+1;
- if(menudisplay_index%2 == 0)
- {
- link = llList2Integer(prims_to_change_l, (menudisplay_index/2)-1 );
- face = 4;
- }
- else
- {
- face = 0;
- link = llList2Integer(prims_to_change_l, ((menudisplay_index+1)/2)-1 );
- }
- llSetLinkPrimitiveParamsFast(link,
- [ PRIM_COLOR,face, colour, 1.0 ]);
- }
- }
- Colour_menu_facesFrom_list_old(list bucket_l, list prims_to_change_l, vector colour)
- {
- integer i;
- integer link;
- integer face;
- for (i=1; i < (llGetListLength(bucket_l)/3)+1 ; i++)
- {
- if(i%2 == 0)
- {
- link = llList2Integer(prims_to_change_l, (i/2)-1 );
- face = 4;
- }
- else
- {
- face = 0;
- link = llList2Integer(prims_to_change_l, ((i+1)/2)-1 );
- }
- llSetLinkPrimitiveParamsFast(link,
- [ PRIM_COLOR,face, colour, 1.0 ]);
- }
- }
- list List2List_Update(list Updating_L, list l_Inventory)
- {
- integer i;
- string item_word;
- integer new_amount;
- integer link;
- integer face;
- integer inventory__name_index;
- for(i=0; i<llGetListLength(Updating_L); i+=3)
- {
- item_word = llList2String(Updating_L,i);
- new_amount = llList2Integer(Updating_L,i+1);
- if( llListFindList(l_Inventory, [item_word])!=-1)
- {
- inventory__name_index = llListFindList (l_Inventory, [item_word]);
- l_Inventory = llListReplaceList(l_Inventory,[new_amount],inventory__name_index+1,inventory__name_index+1);
- }
- }
- return l_Inventory;
- }
- integer Gi_contains_zero;
- string ModifyLists2( integer amount_change, string change_style, list modifying_l, list taking_l, list l_giving)
- {
- Gi_contains_zero = FALSE;
- list take_list_mod_snip ;
- list give_list_mod_snip ;
- integer new_amount;
- string item_word;
- integer sprite_index;
- string combined_lists;
- integer i;
- for(i=0; i<llGetListLength(modifying_l); i+=3)
- {
- item_word = llList2String(modifying_l,i);
- llSay(0, item_word );
- if (change_style == "ListChangeGive")
- amount_change = llList2Integer(modifying_l,i+1)*-1;
- else if(change_style == "ListChangeTake")
- amount_change = llList2Integer(modifying_l,i+1);
- integer t_name_index = llListFindList (taking_l, [item_word]);
- integer t_amount = llList2Integer(taking_l,t_name_index +1);
- sprite_index = llListFindList (inventory_main_info, [item_word]);
- integer sprite_number = llList2Integer (inventory_main_info, sprite_index +2);
- integer giving_index = llListFindList (l_giving, [item_word]);
- integer give_amount = llList2Integer(l_giving,giving_index+1);
- integer new_amount = amount_change;
- if (change_style == "SingleAmount")
- {
- if (amount_change > 0)
- {
- if (t_amount < amount_change)
- new_amount = t_amount;
- }
- else if (amount_change < 0)
- {
- if (give_amount < amount_change*(-1) )
- new_amount = give_amount*(-1);
- }
- }
- if (t_name_index !=-1 && t_amount - new_amount <1 )
- {
- taking_l = llDeleteSubList (taking_l, t_name_index,t_name_index+2);
- Gi_contains_zero = TRUE;
- }
- else if (give_amount != -1)
- taking_l = llListReplaceList(taking_l,[ t_amount - new_amount ],t_name_index+1,t_name_index+1);
- else
- taking_l += [item_word,t_amount - new_amount, sprite_number];
- take_list_mod_snip += [item_word,t_amount - new_amount, sprite_number];
- if (give_amount!=-1 && give_amount - (new_amount*(-1)) < 1)
- {
- llSay(0, "Giving less than 1");
- l_giving = llDeleteSubList (l_giving, giving_index,giving_index+2);
- }
- else if (giving_index!=-1)
- {
- llSay(0, "1");
- l_giving = llListReplaceList(l_giving,[give_amount + new_amount],giving_index+1,giving_index+1);
- }
- else
- {
- llSay(0, "2");
- l_giving += [item_word,(give_amount + new_amount), sprite_number];
- }
- give_list_mod_snip += [item_word,(give_amount + new_amount), sprite_number];
- }
- combined_lists = "taking_l," + llDumpList2String (taking_l,",") + "|" + "take_snip," + llDumpList2String (take_list_mod_snip,",")
- + "|" + "l_giving," + llDumpList2String (l_giving,",") + "|" + "give_snip," + llDumpList2String (give_list_mod_snip,",") ;
- return combined_lists;
- }
- string inventory_state;
- integer DebugMessaging = TRUE;
- list tradeInventory;
- float grid_x = 10.0;
- float grid_y = 10.0;
- integer inv_start;
- integer inv_end;
- string item;
- list amount;
- string command;
- set_link_texture_grid(integer link,integer face, string texture, integer num, integer x, integer y)
- {
- float step_x = 1.0 / (float)x;
- float step_y = 1.0 / (float)y;
- integer part_x = num % x;
- integer part_y = num / x;
- float pos_y = -0.5+step_y/2.0 + step_y*(float)(y-part_y-1);
- float pos_x = -0.5+step_x/2.0 + step_x*(float)part_x;
- llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face,texture,<step_x,step_y,0>,<pos_x,pos_y,0>,0.0]);
- }
- integer link_clicked;
- string link_name;
- string link_description;
- integer face_clicked;
- list List_AlterItems_Colour(vector colour, list ListChange, integer list_limit, string inventory_name, integer new_num)
- {
- if ( llList2Vector( llGetLinkPrimitiveParams(link_clicked,[ PRIM_COLOR,face_clicked]),0) == colour)
- {
- llSetLinkPrimitiveParamsFast(link_clicked,[ PRIM_COLOR,face_clicked, <1,1,1>, 1.0 ]);
- if ( llListFindList(ListChange,[inventory_name]) != -1 )
- {
- integer index = llListFindList(ListChange,[inventory_name]);
- ListChange = llDeleteSubList(ListChange,index,index+2);
- }
- }
- else if (llGetListLength(ListChange) > list_limit*3-1)
- llOwnerSay("Only " + (string)list_limit + " items allowed in Trade Bucket, please remove items");
- else if ( llGetListLength(ListChange) < list_limit*3+1)
- {
- llSetLinkPrimitiveParamsFast(link_clicked,
- [ PRIM_COLOR,face_clicked, colour, 1.0 ]);
- if( llListFindList(ListChange,[inventory_name])==-1 )
- ListChange += [inventory_name] + [new_num] + [inventory_sprite_num];
- }
- ListChange = AZ_09Lists2(ListChange,"AZ");
- return ListChange;
- }
- list AZ_09Lists2(list Inventory_list, string command)
- {
- if(command == "AZ")
- {
- list reordered_list_az = llListSort(Inventory_list, 3, TRUE );
- return reordered_list_az;
- }
- if(command == "0-9")
- {
- integer i;
- list numerical;
- for (i=0; i<llGetListLength(Inventory_list); i+=3)
- {
- numerical += llList2Integer(Inventory_list,i+1);
- numerical += llList2String(Inventory_list,i);
- numerical += llList2Integer(Inventory_list,i+2);
- }
- numerical = llListSort(numerical, 3, TRUE );
- return numerical;
- }
- return [];
- }
- string saving;
- integer clicked_times;
- integer comm_chan = -5421422;
- integer action_chan = 42;
- integer menu_chan;
- integer menu_handle;
- set_listens()
- {
- llListen(comm_chan, "", NULL_KEY, "");
- llListen(action_chan, "", owner_id, "");
- llListenRemove(menu_handle);
- menu_chan = ((integer)("0x"+llGetSubString((string)llGetKey(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF;
- menu_handle = llListen(menu_chan, "", NULL_KEY, "");
- }
- list av_names;
- list av_buttons;
- key owner_id;
- string owner_name;
- key player_id;
- string player_name;
- string player_call;
- string cur_action;
- string secondary_action;
- key requesting_avatar_id;
- string trade_emote;
- string Gs_Trade_State;
- list Gl_Trade_agreement;
- trader_menu()
- {
- string text = "\nYour currently trading with " + partner_name + ".\n\nChoose who you would like to next trade with.\n\nNearby Avatars:";
- integer i;
- for (i = 0; i < llGetListLength(av_names); i++)
- {
- text += "\n" + (string)(i+1) + ". " + llList2String(av_names, i);
- }
- llDialog(owner_id, text, av_buttons, menu_chan);
- cur_action = "";
- }
- new_partner(key new_partner)
- {
- if (partner_id != NULL_KEY && partner_id != new_partner)
- llRegionSayTo(partner_id, comm_chan, "not partnered");
- partner_id = new_partner;
- partner_name = llKey2Name(partner_id);
- llDialog(owner_id, "\nYour actions will now go to " + partner_name + " until you select another avatar to play with.", ["OK"], menu_chan);
- }
- trade_transaction()
- {
- llRegionSayTo(partner_id, comm_chan, "ConfirmFinish");
- Gs_Trade_State = "";
- Gl_Trade_agreement = [];
- string packed = ModifyLists2(-1000, "ListChangeGive", Gl_IncomingTrade, inventory,[]);
- list bundle = llParseString2List( packed,["|"],[""]);
- inventory = llCSV2List ( llList2String(bundle,0) );
- list inv_update = llCSV2List ( llList2String(bundle,1) );
- packed = ModifyLists2(-1000, "ListChangeTake", GL_Sell_Bucket, inventory,[]);
- inventory = llCSV2List ( llList2String(bundle,0) );
- inv_update += llCSV2List ( llList2String(bundle,1) );
- Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,ZERO_VECTOR );
- GL_Sell_Bucket = [];
- Gl_IncomingTrade = [];
- Update_Inventory_Display("ChangerList",[], GL_Sell_Bucket,Sell_prims,ZERO_VECTOR );
- Update_Inventory_Display("ChangerList",[], Gl_IncomingTrade,Gl_IncomingTrade_Prims,ZERO_VECTOR );
- llOwnerSay("Congratulations you have just traded with " + partner_name + " consisting of: " +
- trade_emote );
- }
- default
- {
- state_entry()
- {
- llListen(0,"",NULL_KEY,"");
- inventory_links = Index_Inventory_PrimLinks( "Inv:");
- Sell_prims = Index_Inventory_PrimLinks("Sel:");
- Gl_IncomingTrade_Prims = Index_Inventory_PrimLinks("Oth:");
- llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_hidden]);
- list prim_resetTo_white = inventory_links + Sell_prims + Gl_IncomingTrade;
- integer i;
- for (i=0; i < llGetListLength(prim_resetTo_white)+1 ; i++)
- {
- integer prim = llList2Integer(prim_resetTo_white,i);
- llSetLinkPrimitiveParamsFast(prim,
- [ PRIM_COLOR,ALL_SIDES, <1.0,1.0,1.0>, 1.0 ]);
- }
- inventory = AZ_09Lists2(inventory,"AZ");
- Update_Inventory_Display("SameList",inventory, inventory,inventory_links,<1,1,1>);
- Update_Inventory_Display("ChangerList",GL_Temporary_Bucket, GL_Sell_Bucket,Sell_prims,<0,1,0>);
- Update_Inventory_Display("ChangerList",[], Gl_IncomingTrade,Gl_IncomingTrade_Prims,ZERO_VECTOR );
- owner_id = llGetOwner();
- owner_name = llKey2Name(owner_id);
- set_listens();
- }
- on_rez(integer start_param)
- {
- owner_id = llGetOwner();
- owner_name = llKey2Name(owner_id);
- set_listens();
- if (owner_id == temp_if_id)
- {
- llSay(0, "TempIDFound");
- partner_id= "42e9405d-19f6-4bd5-8b9a-00436a5da1b4";
- partner_name = "Reishi";
- }
- }
- touch_start(integer total_number)
- {
- link_clicked = llDetectedLinkNumber(0);
- link_name = llGetLinkName(link_clicked);
- link_description = llList2String( llGetLinkPrimitiveParams(link_clicked,[PRIM_DESC]),0);
- face_clicked = llDetectedTouchFace(0);
- llSay(0, llList2String (llGetLinkPrimitiveParams(accept_link, [ PRIM_ROT_LOCAL ]) ,0) );
- if (link_name=="TempButton")
- {
- trade_transaction();
- llSay(0, llDumpList2String(inventory, ",") );
- }
- if (link_name=="NormalMode")
- {
- llSay(0,link_name );
- Update_Inventory_Display("ChangerList",[], [], Sell_prims,<1,1,1>);
- string packed;
- packed = ModifyLists2(-1000, "ListChangeGive", GL_Sell_Bucket, inventory, []);
- list bundle = llParseString2List( packed,["|"],[""]);
- inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;
- list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
- llSay(0, llDumpList2String(inventory, ",") );
- Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,<1,1,1> );
- llSay(0, "inv_update" + llDumpList2String(inv_update, ",") );
- Colour_menu_facesFrom_list(GL_Temporary_Bucket,inventory, inventory_links, <1,1,1>);
- GL_Temporary_Bucket = [];
- inventory_state = "NormalMode";
- }
- else if (link_name=="BasketState")
- {
- llSay(0, "inv_update" + llDumpList2String(GL_Temporary_Bucket, ",") );
- string packed;
- packed = ModifyLists2(-1000, "ListChangeTake", GL_Sell_Bucket, inventory, []);
- list bundle = llParseString2List( packed,["|"],[""]);
- inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;
- list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
- Update_Inventory_Display("SameList",GL_Sell_Bucket, GL_Sell_Bucket, Sell_prims,<0,1,0>);
- Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,<1,0,0> );
- inventory_state = "BasketState";
- llOwnerSay("Basket State Active");
- }
- else if (llGetSubString(link_description,0,3)=="Inv:" || llGetSubString(link_description,0,3)=="Sel:")
- {
- if (llGetSubString(link_description,0,3)=="Inv:")
- {
- link_click2_inventory_item_name(link_clicked,face_clicked,inventory);
- Index_info_grabber(inventory_name_s,inventory);
- }
- else if (llGetSubString(link_description,0,3)=="Sel:")
- {
- link_click2_inventory_item_name(link_clicked,face_clicked,GL_Sell_Bucket);
- Index_info_grabber(inventory_name_s,GL_Sell_Bucket);
- }
- }
- if (inventory_state == "NormalMode")
- {
- if (llGetSubString(link_description,0,3)=="Inv:")
- {
- if (Gl_Use_click_bank!=inventory_name_s)
- {
- llSetLinkPrimitiveParamsFast(Gi_old_link, [ PRIM_COLOR, Gi_old_face,<1,1,1>, 1.0 ]);
- Gi_old_link= link_clicked;
- Gi_old_face= face_clicked;
- llOwnerSay("Are you sure you want to use " + inventory_name_s + ", click item again to confirm");
- Gl_Use_click_bank = inventory_name_s;
- llSetLinkPrimitiveParamsFast(link_clicked, [ PRIM_COLOR, face_clicked,<0.502, 1.000, 1.000>, 1.0 ]);
- }
- else if (Gl_Use_click_bank==inventory_name_s)
- {
- Gl_Use_click_bank;
- llSetLinkPrimitiveParamsFast(link_clicked, [ PRIM_COLOR, face_clicked,<1,1,1>, 1.0 ]);
- if (inventory_amount-1 <1)
- {
- llOwnerSay("You have used all your " + inventory_name_s +"s");
- inventory = llDeleteSubList (inventory, inventory__name_index,inventory__name_index+2);
- Update_Inventory_Display("SameList",inventory, inventory,inventory_links,ZERO_VECTOR );
- }
- else
- {
- llOwnerSay("You used a " + inventory_name_s);
- GL_Temporary_Bucket = [inventory_name_s,inventory_amount-1,inventory_sprite_num]; inventory = List2List_Update(GL_Temporary_Bucket, inventory);
- Update_Inventory_Display("ChangerList",GL_Temporary_Bucket, inventory,inventory_links,ZERO_VECTOR );
- }
- llSay(0, llDumpList2String(inventory,",") );
- Gl_Use_click_bank="";
- }
- }
- }
- if (inventory_state == "BasketState")
- {
- if (face_clicked ==0 || face_clicked == 4)
- {
- if(llGetSubString(link_description,0,3)=="Inv:")
- {
- GL_Temporary_Bucket = List_AlterItems_Colour(<1, 0.445, 0>,GL_Temporary_Bucket,8,inventory_name_s,0);
- llSay(0, "GL_Temporary_Bucket List - " + llDumpList2String(GL_Temporary_Bucket,",") );
- }
- }
- if (llGetSubString(link_name,0,6)=="Bucket:" )
- {
- string num = llGetSubString(link_name,7,llStringLength(link_name));
- if (num=="Reset")
- num = "-1000";
- integer amount_change = (integer)num;
- if (llGetListLength(GL_Temporary_Bucket)>2)
- {
- llSay(0,"Sell Bucket before - " + llDumpList2String(GL_Sell_Bucket,",") );
- string packed;
- packed = ModifyLists2(amount_change, "SingleAmount", GL_Temporary_Bucket, inventory, GL_Sell_Bucket);
- list bundle = llParseString2List( packed,["|"],[""]);
- inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;
- GL_Sell_Bucket = llListReplaceList( llCSV2List ( llList2String(bundle,2) ),[],0,0 ) ;
- llSay(0,"inventory - " + llDumpList2String(inventory,",") );
- llSay(0,"GL_Sell_Bucket - " + llDumpList2String(GL_Sell_Bucket,",") );
- llSay(0,"Sell Bucket Length - " + (string)llGetListLength(GL_Sell_Bucket) );
- llSay(0,"cotains 0 flag - " + (string)Gi_contains_zero);
- if(Gi_contains_zero == TRUE)
- Update_Inventory_Display("SameList",inventory, inventory,inventory_links,ZERO_VECTOR );
- else
- {
- list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
- Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,ZERO_VECTOR );
- }
- Update_Inventory_Display("SameList",GL_Sell_Bucket, GL_Sell_Bucket,Sell_prims,ZERO_VECTOR );
- }
- else if (llGetListLength(GL_Temporary_Bucket)<3)
- llOwnerSay("Active more items in the trade bucket!");
- }
- }
- if (link_name == "TradeRadar")
- {
- cur_action = "partner";
- llSay(0, "?");
- llSay(comm_chan, "?");
- }
- else if (link_name == "ProposeTrade")
- {
- string trade_message = "TradeProposed|" + llDumpList2String(GL_Sell_Bucket,",");
- trade_emote;
- integer i;
- for (i=0; i < llGetListLength(GL_Sell_Bucket) ; i+=3)
- {
- trade_emote += llList2String(GL_Sell_Bucket,i) + "," + llList2String(GL_Sell_Bucket,i+1) + ",";
- }
- llOwnerSay("You have proposed a trade to " + partner_name + " consisting of: " +
- trade_emote );
- llRegionSayTo(partner_id, comm_chan, trade_message);
- llRegionSayTo(partner_id, 0, owner_name + " would like to trade the following items: " + trade_emote);
- if (Gs_Trade_State == "TradeAgreed_Countdown" || llListFindList(Gl_Trade_agreement,["Other"]) !=-1 )
- llOwnerSay("You cancelled the agreement making a new proposal");
- Gl_Trade_agreement = [];
- Gs_Trade_State = "Proposals";
- llSetTimerEvent(0.0);
- }
- else if (link_name == "TradeAgree" && Gs_Trade_State != "ConfirmFinish" )
- {
- llRegionSayTo(partner_id, comm_chan, "TradeAgree");
- if (llListFindList(Gl_Trade_agreement,["Other"]) !=-1)
- {
- Gl_Trade_agreement += ["Self"];
- Gs_Trade_State = "TradeAgreed_Countdown";
- llOwnerSay("You and " + partner_name + " have both agreed on a trade. Wait 20 seconds and either one of you can confirm to finish the trade.");
- llSetTimerEvent(0.1);
- }
- else
- {
- Gl_Trade_agreement = ["Self"];
- llOwnerSay("You have agreed the proposal. If " + partner_name + " agrees you will start the trade count down") ;
- }
- llSay(0, llDumpList2String(Gl_Trade_agreement,",") );
- llSay(0, Gs_Trade_State);
- llSay(0, "Sent - Proposals");
- }
- else if (link_name == "ConfirmFinish" && Gs_Trade_State == "ConfirmFinish")
- {
- llSay(0, "Clicker Confirm Sent");
- llRegionSayTo(partner_id, comm_chan, "ConfirmFinish");
- Gs_Trade_State = "SentMessage";
- llSay(0, Gs_Trade_State);
- }
- else if (link_name == "AcceptAction")
- {
- if (cur_action == "partner")
- {
- llSay(0,(string)face_clicked);
- if (face_clicked == 1)
- {
- llRegionSayTo(requesting_avatar_id, comm_chan, "accepted");
- llOwnerSay("You accept " + partner_name + "'s " + cur_action + " request.");
- llRegionSayTo(requesting_avatar_id, 0, owner_name + " accepted your request to play.");
- new_partner(requesting_avatar_id);
- llSay(0, (string)partner_id );
- }
- else if (face_clicked == 2)
- llRegionSayTo(requesting_avatar_id, 0, owner_name + " turned down your request to play.");
- llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_hidden]);
- }
- }
- }
- listen(integer channel, string name, key id, string msg)
- {
- if (channel == comm_chan)
- {
- llSay(0, "Comm chan message is - " + msg);
- if (msg == "?")
- {
- av_names = [];
- av_buttons = [];
- llRegionSayTo(id, comm_chan, "!");
- }
- else if (msg == "!" && llGetOwnerKey(id) != owner_id )
- {
- string av_name = llKey2Name(llGetOwnerKey(id));
- if (llListFindList(av_names, [av_name]) == -1)
- {
- av_names += av_name;
- av_buttons += (string)(llGetListLength(av_names));
- }
- if (llGetListLength(av_names) == 12)
- {
- trader_menu();
- }
- else
- {
- llSetTimerEvent(1.0);
- }
- }
- else if (msg == "Partner?")
- {
- cur_action = "partner";
- llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_visible]);
- requesting_avatar_id = llGetOwnerKey(id);
- string av_name = llKey2Name(requesting_avatar_id);
- llOwnerSay(av_name + " has sent a " + cur_action + " request.");
- cur_action = "partner";
- requesting_avatar_id = llGetOwnerKey(id);
- }
- else if (msg == "accepted")
- {
- new_partner(llGetOwnerKey(id));
- }
- else if ( llGetSubString(msg,0,13) == "TradeProposed|" /*&& llGetOwnerKey(id) == partner_id*/)
- {
- llSay(0, "Received");
- string incoming_t = llGetSubString(msg,14,llStringLength(msg) );
- Gl_IncomingTrade = llCSV2List(incoming_t);
- Update_Inventory_Display("SameList",Gl_IncomingTrade, Gl_IncomingTrade,Gl_IncomingTrade_Prims,<1, 1,0> );
- if (Gs_Trade_State == "TradeAgreed_Countdown" || llListFindList(Gl_Trade_agreement,["Self"]) !=-1)
- {
- llOwnerSay(partner_name + " has sent a new trade proposal, Agreement has been reset");
- llSetTimerEvent(0.0);
- llSay(0, "A new proposal has been sent by " + partner_name +", Agreement Reset");
- }
- else
- {
- llOwnerSay(partner_name + " has sent a new trade proposal.");
- }
- llSetTimerEvent(0.0);
- Gs_Trade_State = "Proposals";
- Gl_Trade_agreement = [];
- }
- else if ( msg == "TradeAgree") /*&& llGetOwnerKey(id) == partner_id*/
- {
- if (llListFindList(Gl_Trade_agreement,["Self"]) !=-1)
- {
- Gl_Trade_agreement += ["Other"];
- Gs_Trade_State = "TradeAgreed_Countdown";
- llOwnerSay("You and " + partner_name + " have both agreed on a trade. Wait 20 seconds and either one of you can confirm to finish the trade.");
- llSetTimerEvent(0.1);
- }
- else
- {
- Gl_Trade_agreement = ["Other"];
- llOwnerSay(partner_name + " has agreed to the trade. Click agree to confirm or change proposal");
- }
- }
- }
- if ( msg == "ConfirmFinish" && Gs_Trade_State == "SentMessage" )
- {
- trade_transaction();
- }
- else if ( msg == "ConfirmFinish" && Gs_Trade_State == "ConfirmFinish" )
- {
- trade_transaction();
- }
- if (channel == menu_chan && id == owner_id)
- {
- if (llListFindList(av_buttons, [msg]) != -1)
- {
- string av_name = llList2String(av_names, (integer)msg -1);
- string av_id = llName2Key(av_name);
- if (av_id == NULL_KEY)
- {
- llDialog(id, "\n" + av_name + " is no longer in the region. Please select another avatar.", ["OK"], menu_chan);
- }
- else
- {
- llSay(0,"sent");
- llSay(0,(string)av_id );
- llDialog(owner_id, "Sending request to TRADE to " + av_name, ["OK"], menu_chan);
- llRegionSayTo(av_id, comm_chan, "Partner?");
- }
- }
- }
- }
- timer()
- {
- if(cur_action == "partner")
- {
- if (llGetListLength(av_names) > 0)
- trader_menu();
- else
- llDialog(owner_id, "There are no nearby avatars wearing Sex HUDs found.", ["OK"], menu_chan);
- llSetTimerEvent(0.0);
- }
- if (Gs_Trade_State == "TradeAgreed_Countdown")
- {
- llSay(0, "Proposal Countdown Started - " + Gs_Trade_State);
- llSetTimerEvent(5.0);
- Gs_Trade_State = "FinishedOpen";
- }
- else if (Gs_Trade_State == "FinishedOpen")
- {
- Gs_Trade_State = "ConfirmFinish";
- llSay(0,"State in " + Gs_Trade_State);
- llSetTimerEvent(0.0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement