Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 113.31 KB | None | 0 0
  1. //start_unprocessed_text
  2. /*/|*
  3. repopulate_AZetc()
  4. {
  5.  
  6. integer i;
  7. for (i=0 ; i<llGetListLength(inventory)/3 ; i++)
  8. {
  9. integer sprite_no = llList2Integer(inventory, (i*3)+2);
  10. string amount = llList2String(inventory, (i*3)+1);
  11. integer menu_index = i+1;; /|/order in menu prims not list]
  12. llSay(0, (string)sprite_no);
  13. llSay(0, (string)amount);
  14. llSay(0, (string)menu_index);
  15.  
  16.  
  17. /|/make all below a function.
  18. integer last_digit = sprite_no - (llFloor(sprite_no/grid_y)*10);
  19. float h = -0.45 + (
  20. (1/grid_x)*(last_digit-1) );
  21. float v = 0.45 - ( (1/grid_y) *llFloor(sprite_no/(grid_y+1) ) ) ; /|/as 1-9 is no change
  22. llSay(0, "v" + (string)v);
  23.  
  24.  
  25. integer face;
  26. integer link;
  27. integer fur_num;
  28.  
  29. if(menu_index%2 == 0)/|/even number
  30. {
  31. link = llList2Integer(inventory_links, (((menu_index)/2) -1) );
  32. face = 4;
  33. fur_num = ((menu_index)/2) ;
  34. }
  35. else
  36. {
  37. face = 0;
  38. link = llList2Integer(inventory_links, (((menu_index+1)/2) -1) );
  39. fur_num = ((menu_index+1)/2) ;
  40. }
  41.  
  42. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE, face,
  43. "00282dee-a2e7-f7f1-4377-d118387d5af2", <(1/grid_x),(1/grid_y),0>, <h,v,0>, 0.0]);
  44. /|/update FURWARE AMOUNT update
  45. llMessageLinked(LINK_SET, 0, (string)amount, "fw_data :Box"+ (string)menu_index );
  46.  
  47.  
  48. }/|/end for loop
  49.  
  50.  
  51. }
  52.  
  53. repopulate_menudisplay(list InventoryList)
  54. {
  55. /|/-----------------Updating current list /|/
  56.  
  57. if ( llListFindList(InventoryList, [item]) != -1)/|/find item
  58. {
  59.  
  60. integer list_index = llListFindList(InventoryList, [item]); /|/ index in list
  61. integer menu_index = (list_index/3)+1; /|/order in menu prims not list]
  62. integer sprite_no = llList2Integer(InventoryList, list_index+2);
  63. InventoryList = llListReplaceList(InventoryList,amount, list_index+1,list_index+1); /|/updating item numer
  64. /|/ llSay(0, (string) list_order_index);
  65. /|/llSay(0, (string)menu_index);
  66.  
  67. /|/llSay(0, (string)sprite_no);
  68. /|/32 /|/(sprite_no)
  69. integer last_digit = sprite_no - (llFloor(sprite_no/grid_y)*10);
  70. /|/llSay(0, (string)last_digit);
  71. float h = -0.45 + (
  72. (1/grid_x)*(last_digit-1) );
  73. /|/llSay(0, "h"+ (string)h);
  74. /|/calcuation row height 1,2 - 0, 3,4 1
  75. float v = 0.45 - ( (1/grid_y) *llFloor(sprite_no/(grid_y+1) ) ) ; /|/as 1-9 is no change
  76. /|/llSay(0, "v" + (string)v);
  77. /|/llSay(0, (string)(menu_index%2) );
  78. /|/integer link = llList2Integer(inventory_links, )
  79. /|/llSay(0, (string) ( llFloor( (float)menu_index/2) -1 ) ) ;
  80.  
  81. integer face;
  82. integer link;
  83. integer fur_num;
  84.  
  85. if(menu_index%2 == 0)/|/even number
  86. {
  87. link = llList2Integer(inventory_links, (((menu_index)/2) -1) );
  88. face = 4;
  89. fur_num = ((menu_index)/2) ;
  90. }
  91. else
  92. {
  93. face = 0;
  94. link = llList2Integer(inventory_links, (((menu_index+1)/2) -1) );
  95. fur_num = ((menu_index+1)/2) ;
  96. }
  97.  
  98. /|/llSay(0, (string)( ((menu_index+1)/2) -1) );
  99. /|/llSay(0, (string)link );
  100.  
  101.  
  102. /|/ llSay(0,"start is:" + (string)inv_start);
  103. /|/ llSay(0, "sprite index" + (string)sprite_no);
  104. /|/ llSay(0,"link is:" + (string)link);
  105. /|/ llSay(0,"face is:" + (string)face);
  106. /|/ llSay(0,(string) llFloor(sprite_no/(grid_y+1) ) );
  107.  
  108. /|/llSay (0, llDumpList2String(List, ",") );
  109.  
  110. if ( llListFindList(inventory, [item]) != -1)/|/i.e. if faulty message
  111. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE, face,
  112. "00282dee-a2e7-f7f1-4377-d118387d5af2", <(1/grid_x),(1/grid_y),0>, <h,v,0>, 0.0]);
  113. /|/update FURWARE AMOUNT update
  114. if ( llListFindList(inventory, [item]) != -1) /|/if bad message don't send
  115. llMessageLinked(LINK_SET, 0, (string)amount, "fw_data :Box"+ (string)menu_index );
  116. }
  117.  
  118. /|/-----------------Updating current list END /|/
  119.  
  120. }
  121. *|/
  122.  
  123. /|/key partner_id= "7ed8d94c-83eb-4734-8c1f-9b8dbe1d0741";/|/temp Reishi
  124. /|/string partner_name = "Silent Alchemi";
  125.  
  126. key partner_id= "8b3b54aa-4de6-4b49-8c42-146555d26863";/|/temp Labyrinth
  127. string partner_name = "Labyrinthstarchild";
  128.  
  129. key temp_if_id = "8b3b54aa-4de6-4b49-8c42-146555d26863";/|/if so and so make Reishi partner etc.
  130. /|/string temp_name;
  131.  
  132. /|/key partner_id;/|/ = "42e9405d-19f6-4bd5-8b9a-00436a5da1b4";/|/temp silent
  133. /|/string partner_name; /|/ = "ReishiProphet Resident";
  134.  
  135.  
  136.  
  137.  
  138.  
  139. integer accept_link;
  140. rotation accept_rot_visible = <-0.000000, -0.000000, -0.766031, 0.642804>;
  141. rotation accept_rot_hidden = <-0.000000, -0.000000, 0.000022, 1.000000>;
  142. /|*
  143. rotation accept_rot_visible = <0.00000, 0.00000, 0.00000, 1.00000>;
  144. rotation accept_rot_hidden = <0.00000, 0.00000, -0.70711, 0.70711>;
  145. *|/
  146.  
  147. list Index_Inventory_PrimLinks( string prim_desc )
  148. {
  149. /|*Indexes various sets of prims for inventory menu.
  150. Puts in order via sequential name in description/name, adds prim link after.
  151. Orders list via link name stride.
  152. New list including only prim links (which will be in order).
  153. *|/
  154. integer i;
  155. integer y=1;
  156. list Grab_prims_list;
  157. string link_name;
  158. string order_number;
  159.  
  160. for (i = 0; i < llGetNumberOfPrims()+1; i++)
  161. {
  162. order_number = llList2String(llGetLinkPrimitiveParams(i,[PRIM_DESC]),0);
  163. link_name = llGetLinkName(i);
  164.  
  165. if (llGetSubString(order_number,0,3) == prim_desc )
  166. {
  167. Grab_prims_list += (integer) llGetSubString(order_number,4,llStringLength(order_number) );
  168. Grab_prims_list += i;/|/puts in prim number
  169. }
  170.  
  171. else if (link_name == "AcceptAction")
  172. {
  173. accept_link = i; /|/ Store link number for AcceptAction prim.
  174. llSay(0,"action link" + (string)accept_link );
  175. }
  176. }
  177.  
  178. /|/llSay(0, "start list - " + llDumpList2String(Grab_invprims_list,",") );
  179. list reordered_list = llListSort(Grab_prims_list, 2, TRUE ); /|/Rearranges list numerically by prims
  180. /|/llSay(0, "Mid list - " + llDumpList2String(reordered_list,",") );
  181.  
  182. list link_list;
  183.  
  184. for (i = 1; i < llGetListLength(reordered_list); i+=2)
  185. link_list += llList2Integer(reordered_list,i);
  186.  
  187. /|*
  188. for (i = 0; i < llGetListLength(reordered_list); i++)
  189. {
  190. if (i%2 != 0)/|/odd, as in grabbing 2nd part, prim
  191. link_list += llList2Integer(reordered_list,i);
  192. }
  193. *|/
  194.  
  195. llSay(0, "Final list - " + llDumpList2String(link_list,",") );
  196. return link_list;
  197. }
  198.  
  199.  
  200.  
  201.  
  202.  
  203. /|/First name to index calculation
  204. /|/(itemName_num-1)*3
  205.  
  206.  
  207. 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] ;
  208. /|/this list should never change. Is the master reference.
  209. 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] ;
  210.  
  211.  
  212. /|/name, amount in inventory, index on sprite sheet
  213. list GL_Temporary_Bucket /|*=["Chestnut",10,1,"Pancakes",1,2,"Oyster",2,3,"Orange",3,4]*|/;
  214. list GL_Sell_Bucket;
  215. list SelfTrade;
  216. list Gl_IncomingTrade;
  217. list Gl_IncomingTrade_Prims;
  218. list inventory_links;
  219. list Sell_prims;
  220.  
  221.  
  222. string Gl_Use_click_bank;
  223. integer Gi_old_link;
  224. integer Gi_old_face;
  225.  
  226. /|*
  227. index_calculations(integer itemName_num, list List, integer DebugMessaging)
  228. {
  229. item_name_list_index = (itemName_num -1)*3;
  230. item_amount_list_index = item_name_list_index +1;
  231. item_spriteIndex_list_index = item_name_list_index +2;
  232.  
  233.  
  234. inventory_name = llList2String(List,item_name_list_index);
  235. inventory_amount = llList2String(List,item_amount_list_index);
  236. inventory_sprite_index = llList2String(List,item_spriteIndex_list_index);
  237.  
  238. if (DebugMessaging==TRUE)
  239. llSay(0, "Name: " + inventory_name + ", " + "Amount: " + inventory_amount + ", " + "Sprite_index: " + inventory_sprite_index);
  240. }
  241. *
  242.  
  243.  
  244. /|* could probably make two functions -
  245. One perhaps to grab the various indexes.
  246. Updating/ cross referencing a list.
  247. Updating prims.
  248.  
  249. *|/
  250.  
  251. /|/maybes
  252. integer item_name_list_index;
  253. integer item_amount_list_index;
  254. integer item_spriteIndex_list_index;
  255.  
  256. string inventory_name_s;
  257. integer inventory__name_index ;
  258. integer inventory_amount;
  259. integer inventory_sprite_num ;
  260. integer menudisplay_index ;
  261.  
  262.  
  263.  
  264.  
  265.  
  266. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  267. /|/Retreiving and updating Data.
  268.  
  269.  
  270.  
  271.  
  272. link_click2_inventory_item_name(integer link, integer face, list inventory_l)
  273. {
  274. /|/ Gets inventory name via prim and face clicked. Inventory name is used for all the other indexes.
  275.  
  276. string inventoryprim_num = llGetSubString( llList2String(
  277. llGetLinkPrimitiveParams(link,[PRIM_DESC]),0) ,4,4 );
  278.  
  279. integer itemName_num = (integer)inventoryprim_num;
  280. itemName_num = (itemName_num*2)-1;
  281. if (face==4) /|/second face is part of menu
  282. itemName_num +=1;
  283.  
  284. inventory_name_s = llList2String (inventory_l, ((itemName_num-1)*3 ) );
  285. /|/llSay(0, inventory_name_s);
  286. }
  287.  
  288. Index_info_grabber(string item_name, list l_Inventory)
  289. {
  290. /|/ Works with function above. Feed in name, spits out various other indexes.
  291. inventory__name_index = llListFindList (l_Inventory, [item_name]);
  292. inventory_amount = llList2Integer(l_Inventory,inventory__name_index+1);
  293. inventory_sprite_num = llList2Integer(l_Inventory,inventory__name_index+2);
  294. menudisplay_index = (inventory__name_index/3)+1; /|/works out order shown in display
  295. }
  296.  
  297. Data_Message()
  298. {
  299. /|/easy to turn on a message that shows data.
  300. llSay(0, "Item Name: " + (string)inventory_name_s + ", Name Index: " + (string)inventory__name_index +
  301. ", Amount: " + (string)inventory_amount + ", Sprite: " + (string)inventory_sprite_num +
  302. ", MenuDisplayNo :" + (string)menudisplay_index );
  303. }
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310. Update_Inventory_Display(string changestyle, list Updating_l, list l_Inventory, list l_Inventory_prims,vector colour)
  311. {
  312. /|*
  313.  
  314.  
  315. (Doesn't change any list contents)
  316. Cross references smaller list to bigger (unless same list).
  317. Updates sprite display and amount.
  318. Sets colour if part of a mode (ZERO_VECTOR leaves white)
  319. Makes any prims not being used by bigger list blank, also turns back to white.
  320. *|/
  321. integer i;
  322. integer link;
  323. integer face;
  324. integer menudisplay_index;
  325. integer blank_link_offset;
  326.  
  327. if (llGetListLength(Updating_l) > 1)/|/if no list don't do anything.
  328. {
  329.  
  330. for(i=0; i <llGetListLength(Updating_l); i+=3) /|/Running through
  331. {
  332. /|/llSay(0, "list length " + (string)llGetListLength(Updating_l));
  333. /|/llSay(0, "i count " + (string)i);
  334. /|/llSay(0, "updating list " + llDumpList2String(Updating_l,",") );
  335. /|/llSay(0, (string)inventory_sprite_num);
  336.  
  337. if (changestyle == "ChangerList") /|/ if lists different, running smaller list
  338. {
  339. inventory_name_s = llList2String(Updating_l,i);
  340. inventory_amount = llList2Integer(Updating_l,i+1);
  341. inventory__name_index = llListFindList (l_Inventory, [inventory_name_s]);
  342. menudisplay_index = (inventory__name_index/3)+1;
  343. inventory_sprite_num = llList2Integer(l_Inventory,inventory__name_index+2);
  344. }
  345.  
  346. else if (changestyle == "SameList")
  347. {
  348. inventory_name_s = llList2String(l_Inventory,i);
  349. inventory_amount = llList2Integer(l_Inventory,i+1);
  350. inventory_sprite_num = llList2Integer(l_Inventory,i+2);
  351. menudisplay_index = (i/3)+1;
  352. }
  353.  
  354.  
  355. if(menudisplay_index%2 == 0)
  356. {
  357. link = llList2Integer(l_Inventory_prims, (menudisplay_index/2)-1 );
  358. face = 4;
  359. }
  360. else
  361. {
  362. face = 0;
  363. link = llList2Integer(l_Inventory_prims, ((menudisplay_index+1)/2)-1 );
  364. }
  365.  
  366. set_link_texture_grid(link, face, "9a5e49c8-896c-ee94-ff8e-c484c30c2a49", inventory_sprite_num-1, 8, 8); /|/setting sprite texture.
  367. if (colour != ZERO_VECTOR )
  368. llSetLinkPrimitiveParamsFast(link, [ PRIM_COLOR, face, colour, 1.0 ]);
  369.  
  370. string s_update_amount = (string)inventory_amount;
  371. integer length = llStringLength(s_update_amount);
  372.  
  373. if (length <4) /|/So number's do not bleed on to more faces, i.e. next sprite display
  374. {
  375. integer j;
  376. for (j=0; j<length; j++)/|/update number display
  377. {
  378. string digit = llGetSubString(s_update_amount,j,j);
  379. integer face = face + j+1;
  380.  
  381. if (digit =="0")
  382. digit = "11"; /|/0 shows up as 11 on texture grid
  383.  
  384. set_link_texture_grid(link, face, "6b43cc76-1f9c-6d22-045d-064b32f1b368", (integer)digit -1, 3, 4);
  385. }/|/ end for
  386.  
  387. integer i;
  388.  
  389. if (3-length>0)
  390. {
  391. for (i=0;i<(3-length);i++)
  392. {
  393. integer face = face + 3 - i ;
  394. set_link_texture_grid(link, face,"6b43cc76-1f9c-6d22-045d-064b32f1b368", (integer)12-1, 3, 4);/|/inserts blank
  395. }
  396. } /|/ End (3-length>0)
  397.  
  398. } /|/ End if if (length <4)
  399.  
  400. }/|/ End for(i=0; i<llGetListLength(l_Inventory); i++)
  401. }/|/ end if (llGetListLength(Updating_l) > 1)/|/if no list don't do anything.
  402.  
  403. /|/Make excess prims blank not being used by larger inventory.
  404. if ( llGetListLength(l_Inventory)/3 < llGetListLength(l_Inventory_prims)*2 /|*2 as two face per prim *|/)
  405. {
  406. integer first_blank_face = llGetListLength(l_Inventory)/3+1;
  407.  
  408. for (i=first_blank_face ; i < (llGetListLength(l_Inventory_prims)*2)+1 ; i++)
  409. {
  410. if(i%2 == 0)
  411. {
  412. link = llList2Integer(l_Inventory_prims, (i/2)-1 );
  413. face = 4;
  414. }
  415. else
  416. {
  417. face = 0;
  418. link = llList2Integer(l_Inventory_prims, ((i+1)/2)-1 );
  419. }
  420.  
  421. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
  422. llSetLinkColor(link,<1,1,1>,face); /|/setting back to white
  423. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+1,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
  424. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+2,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
  425. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+3,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
  426.  
  427. }/|/ End for (i=first_blank_face ; i < (llGetListLength(l_Inventory_prims)*2)+1 ; i++)
  428.  
  429. } /|/ End if ( llGetListLength(l_Inventory)/3 < etc
  430.  
  431. } /|/ End function
  432.  
  433.  
  434.  
  435. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  436.  
  437. /|/2nd version
  438. Colour_menu_facesFrom_list(list bucket_l, list changing_l, list prims_to_change_l, vector colour)
  439. {
  440. /|*Changes prims corrsponding to items already in a mode list to a colour.
  441. *|/
  442.  
  443. integer i;
  444. integer link;
  445. integer face;
  446.  
  447. for (i=0; i < (llGetListLength(bucket_l)+1) ; i+=3)
  448. {
  449. /|/llSay(0, (string)i);
  450.  
  451. inventory_name_s = llList2String(bucket_l,i);
  452. /|/llSay(0, (string)inventory_name_s);
  453. inventory__name_index = llListFindList (changing_l, [inventory_name_s]);
  454. /|/llSay(0, (string)inventory__name_index);
  455.  
  456. menudisplay_index = (inventory__name_index/3)+1;
  457. /|/llSay(0, (string)menudisplay_index);
  458. if(menudisplay_index%2 == 0)
  459. {
  460. link = llList2Integer(prims_to_change_l, (menudisplay_index/2)-1 );
  461. face = 4;
  462. }
  463. else
  464. {
  465. face = 0;
  466. link = llList2Integer(prims_to_change_l, ((menudisplay_index+1)/2)-1 );
  467. }
  468.  
  469. llSetLinkPrimitiveParamsFast(link,
  470. [ PRIM_COLOR,face, colour, 1.0 ]); /|/set to re
  471. }
  472.  
  473. }
  474.  
  475. /|/get rid of _old
  476. Colour_menu_facesFrom_list_old(list bucket_l, list prims_to_change_l, vector colour)
  477. {
  478. integer i;
  479. integer link;
  480. integer face;
  481.  
  482. for (i=1; i < (llGetListLength(bucket_l)/3)+1 ; i++)
  483. {
  484. if(i%2 == 0)
  485. {
  486. link = llList2Integer(prims_to_change_l, (i/2)-1 );
  487. face = 4;
  488. }
  489. else
  490. {
  491. face = 0;
  492. link = llList2Integer(prims_to_change_l, ((i+1)/2)-1 );
  493. }
  494.  
  495. llSetLinkPrimitiveParamsFast(link,
  496. [ PRIM_COLOR,face, colour, 1.0 ]); /|/set to re
  497. }
  498.  
  499. }
  500.  
  501.  
  502. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  503. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  504. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  505. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  506. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  507. /|/Modifying lists etc
  508.  
  509. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  510. /|/CURRENTLY HERE 1
  511. /|/UPGRADING FUNCTION
  512.  
  513. /|/ RIGHT HERE
  514.  
  515.  
  516. list List2List_Update(list Updating_L, list l_Inventory)
  517. {
  518. /|/maybe add ad and subtract variant?
  519.  
  520. integer i;
  521. string item_word;
  522. integer new_amount;
  523. integer link;
  524. integer face;
  525. integer inventory__name_index;
  526.  
  527. for(i=0; i<llGetListLength(Updating_L); i+=3) /|/updating new amounts to main list.Only two as don't need sprite.
  528. {
  529. item_word = llList2String(Updating_L,i);
  530. new_amount = llList2Integer(Updating_L,i+1);
  531.  
  532. if( llListFindList(l_Inventory, [item_word])!=-1)
  533. {
  534. inventory__name_index = llListFindList (l_Inventory, [item_word]);
  535. l_Inventory = llListReplaceList(l_Inventory,[new_amount],inventory__name_index+1,inventory__name_index+1);
  536. }
  537. }
  538.  
  539. /|/smaller list update bigger
  540. return l_Inventory;
  541.  
  542. }
  543.  
  544. integer Gi_contains_zero;
  545.  
  546.  
  547.  
  548.  
  549.  
  550. string ModifyLists2( integer amount_change, string change_style, list modifying_l, list taking_l, list l_giving)
  551. {
  552.  
  553. /|/ COULD PROBABLY CHANGE AMOUNT CHANGE TO A LIST IF NEED ALTERNATIVE NUMBERS, perhaps one style where just is amount.
  554. /|/Style - "ListChange" "SingleAmountChange"
  555. Gi_contains_zero = FALSE;/|/default no 0s till discovered
  556. list take_list_mod_snip ;
  557. list give_list_mod_snip ;
  558. integer new_amount;
  559. string item_word;
  560. integer sprite_index;
  561.  
  562. string combined_lists;
  563.  
  564. /|/llSay(0, llDumpList2String (modifying_l,","));
  565. /|/llSay(0, llDumpList2String (taking_l,","));
  566. /|/llSay(0, llDumpList2String (l_giving,","));
  567. /|/llSay(0, (string)llGetListLength(modifying_l) );
  568.  
  569. integer i;
  570.  
  571. for(i=0; i<llGetListLength(modifying_l); i+=3) /|/changing updating_l new amounts
  572. {
  573. /|/llSay(0, (string)i);
  574.  
  575. /|/ llSay(0, (string)(amount_change*(-1) ));
  576. /|/llSay(0, llDumpList2String (taking_l,","));
  577.  
  578.  
  579.  
  580. item_word = llList2String(modifying_l,i);
  581. llSay(0, item_word );
  582.  
  583. if (change_style == "ListChangeGive")
  584. amount_change = llList2Integer(modifying_l,i+1)*-1;
  585.  
  586. else if(change_style == "ListChangeTake")
  587. amount_change = llList2Integer(modifying_l,i+1);
  588.  
  589.  
  590. integer t_name_index = llListFindList (taking_l, [item_word]);
  591. integer t_amount = llList2Integer(taking_l,t_name_index +1);
  592.  
  593. sprite_index = llListFindList (inventory_main_info, [item_word]);
  594. integer sprite_number = llList2Integer (inventory_main_info, sprite_index +2);
  595.  
  596. integer giving_index = llListFindList (l_giving, [item_word]);
  597. integer give_amount = llList2Integer(l_giving,giving_index+1);
  598.  
  599. integer new_amount = amount_change;
  600.  
  601. /|/llSay(0,"amount change - " + (string)amount_change );
  602.  
  603. if (change_style == "SingleAmount")
  604. {
  605. /|/llSay(0, "here 1");
  606. if (amount_change > 0)/|/taking from t_list
  607. {
  608. /|/llSay(0, "here 2");
  609. if (t_amount < amount_change)
  610. new_amount = t_amount;
  611. }
  612.  
  613. else if (amount_change < 0) /|/taking from give list
  614. {
  615. /|/llSay(0, "here 3");
  616. if (give_amount < amount_change*(-1) )
  617. new_amount = give_amount*(-1);
  618.  
  619. }
  620. }
  621.  
  622. /|/llSay(0, (string)new_amount );
  623.  
  624. if (t_name_index !=-1 && t_amount - new_amount <1 ) /|/if finds the name but amount set to 0
  625. {/|/delete from list
  626. /|/ llSay(0, llDumpList2String (taking_l,","));
  627. /|/ llSay(0, item_word);
  628. /|/llSay(0, (string)i);
  629. taking_l = llDeleteSubList (taking_l, t_name_index,t_name_index+2);
  630. Gi_contains_zero = TRUE; /|/contains 0
  631. }
  632. /|/Update_Inventory_Display(inventory, inventory,inventory_links,ZERO_VECTOR );
  633. else if (give_amount != -1)
  634. taking_l = llListReplaceList(taking_l,[ t_amount - new_amount ],t_name_index+1,t_name_index+1);
  635.  
  636. else /|/if can't find it just put it in
  637. taking_l += [item_word,t_amount - new_amount, sprite_number];
  638.  
  639. take_list_mod_snip += [item_word,t_amount - new_amount, sprite_number];
  640.  
  641. /|/llSay(0, llDumpList2String (take_list_mod_snip,","));
  642. /|/llSay(0, (string)amount_change);
  643.  
  644. /|/llSay(0, llDumpList2String (take_list_mod_snip,","));
  645.  
  646. if (give_amount!=-1 && give_amount - (new_amount*(-1)) < 1) /|/taking last amount delete from list
  647. {
  648. llSay(0, "Giving less than 1");
  649. /|/Gi_contains_zero = TRUE; /|/contains 0
  650. l_giving = llDeleteSubList (l_giving, giving_index,giving_index+2);
  651. }
  652.  
  653.  
  654.  
  655. else if (giving_index!=-1) /|/ if in list replace
  656. {
  657. llSay(0, "1");
  658. l_giving = llListReplaceList(l_giving,[give_amount + new_amount],giving_index+1,giving_index+1);
  659. }
  660.  
  661. else /|/if new just add
  662. {
  663. llSay(0, "2");
  664. l_giving += [item_word,(give_amount + new_amount), sprite_number];/|/take sprite as references inventory
  665. }
  666.  
  667. give_list_mod_snip += [item_word,(give_amount + new_amount), sprite_number];
  668.  
  669.  
  670.  
  671. }/|/end for loop
  672.  
  673. combined_lists = "taking_l," + llDumpList2String (taking_l,",") + "|" + "take_snip," + llDumpList2String (take_list_mod_snip,",")
  674. + "|" + "l_giving," + llDumpList2String (l_giving,",") + "|" + "give_snip," + llDumpList2String (give_list_mod_snip,",") ;
  675.  
  676. /|/llSay(0, "combined " +combined_lists );
  677. return combined_lists;
  678.  
  679. /|* Calculations for other end
  680. string packed;
  681. packed = ModifyLists2(-1000, "ListChangeGive", GL_Sell_Bucket, inventory, []);
  682. list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in, has tags before each entry taken out
  683. inventory = llList2List( llCSV2List ( llList2String(bundle,0) ),
  684. 1, llGetListLength( llCSV2List ( llList2String(bundle,0) )));
  685.  
  686.  
  687. *|/
  688.  
  689. }
  690.  
  691.  
  692.  
  693.  
  694. /|* working 17th Jan
  695. string ModifyLists2( integer amount_change, string change_style, list modifying_l, list taking_l, list l_giving)
  696. {
  697.  
  698. /|/ COULD PROBABLY CHANGE AMOUNT CHANGE TO A LIST IF NEED ALTERNATIVE NUMBERS, perhaps one style where just is amount.
  699. /|/Style - "ListChange" "SingleAmountChange"
  700. Gi_contains_zero = FALSE;/|/default no 0s till discovered
  701. list take_list_mod_snip ;
  702. list give_list_mod_snip ;
  703. integer new_amount;
  704. string item_word;
  705. integer sprite_index;
  706.  
  707. string combined_lists;
  708.  
  709. /|/llSay(0, llDumpList2String (modifying_l,","));
  710. /|/llSay(0, llDumpList2String (taking_l,","));
  711. /|/llSay(0, llDumpList2String (l_giving,","));
  712. /|/llSay(0, (string)llGetListLength(modifying_l) );
  713.  
  714. integer i;
  715.  
  716. for(i=0; i<llGetListLength(modifying_l); i+=3) /|/changing updating_l new amounts
  717. {
  718. /|/llSay(0, (string)i);
  719.  
  720. /|/ llSay(0, (string)(amount_change*(-1) ));
  721. /|/llSay(0, llDumpList2String (taking_l,","));
  722.  
  723.  
  724.  
  725. item_word = llList2String(modifying_l,i);
  726. llSay(0, item_word );
  727. if (change_style == "ListChangeGive")
  728. amount_change = llList2Integer(modifying_l,i+1)*-1;
  729.  
  730. else if(change_style == "ListChangeTake")
  731. amount_change = llList2Integer(modifying_l,i+1);
  732.  
  733.  
  734. integer t_name_index = llListFindList (taking_l, [item_word]);
  735. integer t_amount = llList2Integer(taking_l,t_name_index +1);
  736.  
  737. sprite_index = llListFindList (inventory_main_info, [item_word]);
  738. integer sprite_number = llList2Integer (inventory_main_info, sprite_index +2);
  739.  
  740. integer giving_index = llListFindList (l_giving, [item_word]);
  741. integer give_amount = llList2Integer(l_giving,giving_index+1);
  742.  
  743. integer new_amount = amount_change;
  744.  
  745.  
  746. if (change_style == "SingleAmount")
  747. {
  748. if (amount_change > 0)
  749. {
  750. if (t_amount < amount_change)
  751. new_amount = t_amount;
  752. }
  753.  
  754. else if (amount_change < 0)
  755. {
  756. if (give_amount < amount_change*(-1) )
  757. new_amount = give_amount*(-1);
  758.  
  759. }
  760. }
  761.  
  762. /|/llSay(0, (string)t_amount);
  763. /|/llSay(0, (string)new_amount);
  764. /|/llSay(0, (string)(t_amount - new_amount) );
  765.  
  766. if(taking_l != ["Empty"])
  767. {
  768. /|/integer take_sprite = llList2Integer(taking_l,t_name_index+2);
  769.  
  770. if (t_name_index!=-1 && t_amount - new_amount <1 )
  771. {
  772. /|/ llSay(0, llDumpList2String (taking_l,","));
  773. /|/ llSay(0, item_word);
  774. /|/llSay(0, (string)i);
  775. taking_l = llDeleteSubList (taking_l, t_name_index,t_name_index+2);
  776. Gi_contains_zero = TRUE; /|/contains 0
  777. /|/llSay(0, llDumpList2String (taking_l,","));
  778. /|/llSay(0, "Taking less than 1");
  779. }
  780. /|/Update_Inventory_Display(inventory, inventory,inventory_links,ZERO_VECTOR );
  781. else if (give_amount != -1)
  782. taking_l = llListReplaceList(taking_l,[ t_amount - new_amount ],t_name_index+1,t_name_index+1);
  783.  
  784. else
  785. taking_l += [item_word,t_amount - new_amount, sprite_number];
  786.  
  787. take_list_mod_snip += [item_word,t_amount - new_amount, sprite_number];
  788. }
  789. /|/llSay(0, llDumpList2String (taking_l,","));
  790. /|/llSay(0, llDumpList2String (take_list_mod_snip,","));
  791. /|/llSay(0, (string)amount_change);
  792.  
  793. /|/llSay(0, llDumpList2String (take_list_mod_snip,","));
  794.  
  795. if(l_giving != ["Empty"])
  796. {
  797. if (give_amount!=-1 && give_amount - (new_amount*(-1)) < 1) /|/taking last amount delete from list
  798. {
  799. llSay(0, "Giving less than 1");
  800. /|/Gi_contains_zero = TRUE; /|/contains 0
  801. l_giving = llDeleteSubList (l_giving, giving_index,giving_index+2);
  802. }
  803.  
  804.  
  805.  
  806. else if (giving_index!=-1) /|/ if in list replace
  807. {
  808. llSay(0, "1");
  809. l_giving = llListReplaceList(l_giving,[give_amount + new_amount],giving_index+1,giving_index+1);
  810. }
  811.  
  812. else /|/if new just add
  813. {
  814. llSay(0, "2");
  815. l_giving += [item_word,(give_amount + new_amount), sprite_number];/|/take sprite as references inventory
  816. }
  817.  
  818. give_list_mod_snip += [item_word,(give_amount + new_amount), sprite_number];
  819. }
  820.  
  821. /|/(0, llDumpList2String (l_giving,","));
  822.  
  823. llSay(0, "big giving lsit" + llDumpList2String (l_giving,","));
  824. llSay(0,"snippet list" + llDumpList2String (give_list_mod_snip,","));
  825. /|/llSay(0, llDumpList2String (taking_l,","));
  826. /|/llSay(0, llDumpList2String (l_giving,","));
  827.  
  828.  
  829. }/|/end for loop
  830.  
  831. combined_lists = "taking_l," + llDumpList2String (taking_l,",") + "|" + "take_snip," + llDumpList2String (take_list_mod_snip,",")
  832. + "|" + "l_giving," + llDumpList2String (l_giving,",") + "|" + "give_snip," + llDumpList2String (give_list_mod_snip,",") ;
  833.  
  834. /|/llSay(0, "combined " +combined_lists );
  835. return combined_lists;
  836.  
  837. /|* Calculations for other end
  838. string packed;
  839. packed = ModifyLists2(-1000, "ListChangeGive", GL_Sell_Bucket, inventory, []);
  840. list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in, has tags before each entry taken out
  841. inventory = llList2List( llCSV2List ( llList2String(bundle,0) ),
  842. 1, llGetListLength( llCSV2List ( llList2String(bundle,0) )));
  843.  
  844.  
  845. *|/
  846.  
  847. /|/}
  848.  
  849.  
  850.  
  851. /|*
  852. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  853.  
  854. list Add_or_Subtract_Amounts_list2list_Update(list updating_l, list l_2update, integer amount_change)
  855. {
  856.  
  857. Creates a new list, slice looks for amount in bigger list, adds amount changed, and makes it's own
  858. smaller list.
  859.  
  860.  
  861. Shouldn't I scrap this and have it replace it in
  862. updating_l = llListReplaceList(updating_l,[new_amount],i+1,i+1);
  863. below.
  864. Then runs List2List_Update(updating_l, l_2update);
  865. To update the larger list with it's new entries.
  866.  
  867.  
  868.  
  869. integer i;
  870. for(i=0; i<llGetListLength(updating_l)+1; i+=3) /|/changing updating_l new amounts
  871. {
  872. string item_word = llList2String(updating_l,i);
  873. llSay(0,(string)amount_change);
  874. /|/ llSay(0, (string)(amount_change*(-1) ));
  875. inventory__name_index = llListFindList (l_2update, [item_word]);
  876. integer current_amount = llList2Integer(l_2update,inventory__name_index+1);
  877.  
  878. /|/ check actual inventory
  879.  
  880. /|/ if amount > 0 (adding)
  881. /|/check inv to see if possible
  882.  
  883. /|/if amount <0 putting back in inventory, needs to check the bucket
  884.  
  885.  
  886. Perhaps add the list to check actual values of
  887. Probably update the list in one go.
  888.  
  889.  
  890.  
  891. integer invname_index = llListFindList (inventory, [item_word]);
  892. integer inv_amount = llList2Integer(inventory,invname_index+1);
  893.  
  894. integer new_amount;
  895. if (inv_amount<amount_change)
  896. {
  897. new_amount = inv_amount;
  898. llOwnerSay("Not Enough " + item_word + ", all " + (string)current_amount + " were put in" );
  899. }
  900. else
  901. new_amount = current_amount + amount_change;
  902.  
  903.  
  904. integer new_amount = current_amount + amount_change;
  905. /|/ llSay(0,(string)inventory__name_index);
  906. if (new_amount<0)
  907. new_amount = 0;
  908.  
  909. updating_l = llListReplaceList(updating_l,[new_amount],i+1,i+1);
  910.  
  911. }
  912.  
  913. /|/llSay(0, "temp End - " + llDumpList2String(updating_l,",") );
  914.  
  915. /|/llSay(0, llDumpList2String(GL_Sell_Bucket,",") );
  916.  
  917. l_2update = List2List_Update(updating_l, l_2update); /|/feed new list in to old one to change amounts.
  918. /|/llSay(0, "Updated Bucket - " + llDumpList2String(l_2update,",") );
  919. return l_2update;
  920. }
  921.  
  922. *|/
  923. /|/llSay(0, llDumpList2String(GL_Temporary_Bucket,",") );
  924.  
  925.  
  926.  
  927. string inventory_state;
  928.  
  929. integer DebugMessaging = TRUE;
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936. list tradeInventory;
  937.  
  938. float grid_x = 10.0; /|/grid size of inventory
  939. float grid_y = 10.0; /|/grid size of inventory
  940.  
  941.  
  942.  
  943. integer inv_start;
  944. integer inv_end;
  945.  
  946.  
  947. string item;
  948. list amount;
  949. string command;
  950.  
  951.  
  952. set_link_texture_grid(integer link,integer face, string texture, integer num, integer x, integer y)
  953. {
  954. float step_x = 1.0 / (float)x;
  955. float step_y = 1.0 / (float)y;
  956. integer part_x = num % x;
  957. integer part_y = num / x;
  958. float pos_y = -0.5+step_y/2.0 + step_y*(float)(y-part_y-1);
  959. float pos_x = -0.5+step_x/2.0 + step_x*(float)part_x;
  960. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face,texture,<step_x,step_y,0>,<pos_x,pos_y,0>,0.0]);
  961. }
  962.  
  963.  
  964.  
  965. integer link_clicked;
  966. string link_name;
  967. string link_description;
  968. integer face_clicked;
  969.  
  970. list List_AlterItems_Colour(vector colour, list ListChange, integer list_limit, string inventory_name, integer new_num)
  971. {
  972.  
  973. if ( llList2Vector( llGetLinkPrimitiveParams(link_clicked,[ PRIM_COLOR,face_clicked]),0) == colour) /|/ check if colour
  974. {
  975. llSetLinkPrimitiveParamsFast(link_clicked,[ PRIM_COLOR,face_clicked, <1,1,1>, 1.0 ]); /|/turn white
  976.  
  977. if ( llListFindList(ListChange,[inventory_name]) != -1 )
  978. {
  979. integer index = llListFindList(ListChange,[inventory_name]);
  980. ListChange = llDeleteSubList(ListChange,index,index+2);/|/Take item out of list
  981. }
  982. }/|/ end If Red
  983.  
  984. else if (llGetListLength(ListChange) > list_limit*3-1) /|/so when hits limit, hence -1 otherwise it's equal.
  985. llOwnerSay("Only " + (string)list_limit + " items allowed in Trade Bucket, please remove items");
  986.  
  987. else if ( llGetListLength(ListChange) < list_limit*3+1)
  988. {
  989. llSetLinkPrimitiveParamsFast(link_clicked,
  990. [ PRIM_COLOR,face_clicked, colour, 1.0 ]); /|/set to colour
  991.  
  992. if( llListFindList(ListChange,[inventory_name])==-1 ) /|/if not already in add it
  993. ListChange += [inventory_name] + [new_num] + [inventory_sprite_num];
  994.  
  995. /|/llSay(0,(string)llGetListLength(ListChange));
  996.  
  997. } /|/ End ( llGetListLength(GL_Sell_Bucket) < 12 )
  998.  
  999. ListChange = AZ_09Lists2(ListChange,"AZ"); /|/puts in alphabetical order
  1000. return ListChange;
  1001. }
  1002.  
  1003.  
  1004.  
  1005. list AZ_09Lists2(list Inventory_list, string command)
  1006. {
  1007. /|/llSay (0, "Startinst list: " + llDumpList2String(Inventory_list, ",") );
  1008.  
  1009. if(command == "AZ")
  1010. {
  1011. list reordered_list_az = llListSort(Inventory_list, 3, TRUE ); /|/Rearranges list alphabetically.
  1012. /|/llSay (0, "End list: " + llDumpList2String(reordered_list_az, ",") );
  1013. return reordered_list_az;
  1014. }
  1015.  
  1016. if(command == "0-9") /|/ new amount ordered list 001-999
  1017. {
  1018. integer i;
  1019. list numerical;
  1020. /|/while (i<llGetListLength(Inventory_list) )
  1021.  
  1022. for (i=0; i<llGetListLength(Inventory_list); i+=3)
  1023. {
  1024. numerical += llList2Integer(Inventory_list,i+1);/|/ put in amount
  1025. numerical += llList2String(Inventory_list,i);/|/ then put in name
  1026. numerical += llList2Integer(Inventory_list,i+2); /|/then put in sprie no.
  1027. }
  1028.  
  1029. numerical = llListSort(numerical, 3, TRUE ); /|/sorts via number
  1030. /|/llSay (0, "End list: " + llDumpList2String(numerical, ",") );
  1031. return numerical;
  1032. } /|/ end Numerical message
  1033.  
  1034.  
  1035. return [];
  1036. }
  1037.  
  1038.  
  1039.  
  1040.  
  1041. string saving;
  1042. integer clicked_times;
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  1063. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  1064. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  1065. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  1066. /|*
  1067. TRADING FUNCTIONS
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076. *|/
  1077. integer comm_chan = -5421422;/|/ Communication between HUDs.
  1078. integer action_chan = 42; /|/ Action word channel
  1079. integer menu_chan; /|/ Menu channel.
  1080. integer menu_handle; /|/ Menu listen handle.
  1081.  
  1082. set_listens()
  1083. {
  1084. /|/ Listen for messages from HUDs.
  1085. llListen(comm_chan, "", NULL_KEY, "");
  1086.  
  1087. /|/ Listen for messages from owner on action_chan.
  1088. llListen(action_chan, "", owner_id, "");
  1089.  
  1090. /|/ Listen for menu messages from owner.
  1091. llListenRemove(menu_handle);
  1092. menu_chan = ((integer)("0x"+llGetSubString((string)llGetKey(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF;
  1093. menu_handle = llListen(menu_chan, "", NULL_KEY, ""); /|/ Listen for menu messages.
  1094. } /|/ End set_listens.
  1095.  
  1096.  
  1097.  
  1098. list av_names; /|/ List of nearby avatar names to select a partner.
  1099. list av_buttons; /|/ List of numbers for buttons for avatar partner selection.
  1100. key owner_id;
  1101. string owner_name;
  1102. key player_id;
  1103. string player_name;
  1104.  
  1105. string player_call;
  1106. string cur_action;
  1107. string secondary_action;
  1108.  
  1109. key requesting_avatar_id;
  1110.  
  1111. string trade_emote;
  1112. string Gs_Trade_State;
  1113. list Gl_Trade_agreement;
  1114.  
  1115. trader_menu()
  1116. {
  1117. /|/ Menu text.
  1118. string text = "\nYour currently trading with " + partner_name + ".\n\nChoose who you would like to next trade with.\n\nNearby Avatars:";
  1119.  
  1120. integer i; /|/ Loop counter.
  1121.  
  1122. /|/ Loop through av_names.
  1123. for (i = 0; i < llGetListLength(av_names); i++)
  1124. {
  1125. text += "\n" + (string)(i+1) + ". " + llList2String(av_names, i); /|/ Add next name to text.
  1126. } /|/ End for.
  1127.  
  1128. /|/ Display selection menu of avatar names.
  1129. llDialog(owner_id, text, av_buttons, menu_chan);
  1130. cur_action = "";
  1131. } /|/ End selection_menu.
  1132.  
  1133. new_partner(key new_partner)
  1134. {
  1135. /|/ old partner_time_out = FALSE; /|/ Reset partner_timeout.
  1136.  
  1137. /|/ Send message to previous partner's HUD to unpartner. /|/Mynote - possibly do not need this.
  1138. if (partner_id != NULL_KEY && partner_id != new_partner)
  1139. llRegionSayTo(partner_id, comm_chan, "not partnered");
  1140.  
  1141. partner_id = new_partner; /|/ Update partner_id.
  1142. partner_name = llKey2Name(partner_id); /|/ Update partner_name.
  1143.  
  1144. /|/ Set float text.
  1145. /|/ old displaying their name llSetLinkPrimitiveParamsFast(hover_partner_link, [PRIM_TEXT, partner_name, <1,1,1>, 1.0]);
  1146.  
  1147. /|/ Set partner text prim name.
  1148. /|/ old setting furwarellMessageLinked(LINK_THIS, 0, partner_name, "fw_data:partner");
  1149.  
  1150. /|/ Start bonding timer.
  1151. /|/last_bond_time = llGetUnixTime();
  1152. /|/llSetTimerEvent(bonding_interval);
  1153.  
  1154. /|/ Restore stats from script (b) if previously partnered with this avatar.
  1155. /|/llMessageLinked(LINK_THIS, -100, "", partner_id);
  1156.  
  1157. /|/Could probably do with some global text to go with each relationship style. You are "Partnered", trading, fighting, On a mission for etc.
  1158.  
  1159. llDialog(owner_id, "\nYour actions will now go to " + partner_name + " until you select another avatar to play with.", ["OK"], menu_chan);
  1160. } /|/ End new_partner.
  1161.  
  1162. trade_transaction()
  1163. {
  1164.  
  1165. llRegionSayTo(partner_id, comm_chan, "ConfirmFinish");
  1166. Gs_Trade_State = "";/|/reset trade state
  1167. Gl_Trade_agreement = []; /|/reset trade agreements
  1168.  
  1169.  
  1170. string packed = ModifyLists2(-1000, "ListChangeGive", Gl_IncomingTrade, inventory,[]);/|/just taking
  1171. list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in string.
  1172. inventory = llCSV2List ( llList2String(bundle,0) );
  1173. list inv_update = llCSV2List ( llList2String(bundle,1) );/|/ possibly do this twice
  1174. /|/Update_Inventory_Display(inv_update, inventory,inventory_links,ZERO_VECTOR );
  1175.  
  1176. packed = ModifyLists2(-1000, "ListChangeTake", GL_Sell_Bucket, inventory,[]);
  1177. inventory = llCSV2List ( llList2String(bundle,0) );
  1178. inv_update += llCSV2List ( llList2String(bundle,1) );
  1179. Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,ZERO_VECTOR );
  1180.  
  1181.  
  1182. GL_Sell_Bucket = [];
  1183. Gl_IncomingTrade = [];
  1184.  
  1185. /|/llRegionSayTo(partner_id, comm_chan,
  1186. /|/"TradeGiven|" + llDumpList2String(GL_Sell_Bucket,",") );
  1187.  
  1188. /|/Update_Inventory_Display(inv_update, inventory,inventory_links,ZERO_VECTOR );
  1189. Update_Inventory_Display("ChangerList",[], GL_Sell_Bucket,Sell_prims,ZERO_VECTOR );
  1190. Update_Inventory_Display("ChangerList",[], Gl_IncomingTrade,Gl_IncomingTrade_Prims,ZERO_VECTOR );
  1191.  
  1192. llOwnerSay("Congratulations you have just traded with " + partner_name + " consisting of: " +
  1193. trade_emote );/|/message to self
  1194. }
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266. /|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/|/
  1267.  
  1268. default
  1269. {
  1270. state_entry()
  1271. {
  1272.  
  1273.  
  1274.  
  1275. llListen(0,"",NULL_KEY,"");
  1276. inventory_links = Index_Inventory_PrimLinks( "Inv:");
  1277. Sell_prims = Index_Inventory_PrimLinks("Sel:");
  1278. Gl_IncomingTrade_Prims = Index_Inventory_PrimLinks("Oth:");
  1279. llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_hidden]);
  1280. /|/llSay(0, llDumpList2String(inventory_links,",") );
  1281. /|/llSay(0, llDumpList2String(Sell_prims,",") );
  1282. /|/llSay(0, llDumpList2String(Gl_IncomingTrade,",") );
  1283.  
  1284. list prim_resetTo_white = inventory_links + Sell_prims + Gl_IncomingTrade;
  1285. integer i;
  1286. for (i=0; i < llGetListLength(prim_resetTo_white)+1 ; i++)
  1287. {
  1288. integer prim = llList2Integer(prim_resetTo_white,i);
  1289. llSetLinkPrimitiveParamsFast(prim,
  1290. [ PRIM_COLOR,ALL_SIDES, <1.0,1.0,1.0>, 1.0 ]);
  1291. }
  1292.  
  1293. /|* Menu speed test, is fast!!
  1294. Update_Inventory_Display(inventory, inventory,inventory_links,<1,1,1>);
  1295. inventory = AZ_09Lists2(inventory,"AZ");
  1296. llSleep(2.0);
  1297. llSay(0,"Start");
  1298. Update_Inventory_Display(inventory, inventory,inventory_links,<1,1,1>);
  1299. llSay(0, llDumpList2String(inventory,",") );
  1300. *|/
  1301. /|/Update_Inventory_Display(inventory, inventory,inventory_links);
  1302.  
  1303. inventory = AZ_09Lists2(inventory,"AZ");
  1304. Update_Inventory_Display("SameList",inventory, inventory,inventory_links,<1,1,1>);
  1305.  
  1306. /|/GL_Temporary_Bucket = GL_Sell_Bucket = llList2List(inventory, 0,3*4-1); /|/gets first four entrie
  1307. Update_Inventory_Display("ChangerList",GL_Temporary_Bucket, GL_Sell_Bucket,Sell_prims,<0,1,0>);
  1308. Update_Inventory_Display("ChangerList",[], Gl_IncomingTrade,Gl_IncomingTrade_Prims,ZERO_VECTOR );
  1309.  
  1310. owner_id = llGetOwner(); /|/ Owner's key.
  1311. owner_name = llKey2Name(owner_id); /|/ Owner's name.
  1312. set_listens(); /|/ Set listens.
  1313.  
  1314.  
  1315.  
  1316. }
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330. on_rez(integer start_param)
  1331. {
  1332. owner_id = llGetOwner(); /|/ Owner's key.
  1333. owner_name = llKey2Name(owner_id); /|/ Owner's name.
  1334. set_listens(); /|/ Set listens.
  1335.  
  1336.  
  1337. if (owner_id == temp_if_id) /|/if Silent is using make Reisi the partner
  1338. {
  1339. llSay(0, "TempIDFound");
  1340. partner_id= "42e9405d-19f6-4bd5-8b9a-00436a5da1b4";
  1341. partner_name = "Reishi";
  1342. }
  1343. }
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360. touch_start(integer total_number)
  1361. {
  1362. link_clicked = llDetectedLinkNumber(0);
  1363. link_name = llGetLinkName(link_clicked);
  1364. link_description = llList2String( llGetLinkPrimitiveParams(link_clicked,[PRIM_DESC]),0);
  1365. face_clicked = llDetectedTouchFace(0);
  1366.  
  1367. /|/llSay(0,link_name );
  1368.  
  1369. llSay(0, llList2String (llGetLinkPrimitiveParams(accept_link, [ PRIM_ROT_LOCAL ]) ,0) );
  1370. if (link_name=="TempButton")
  1371. {
  1372. trade_transaction();
  1373. llSay(0, llDumpList2String(inventory, ",") );
  1374. }
  1375.  
  1376. if (link_name=="NormalMode")
  1377. {
  1378.  
  1379. llSay(0,link_name );
  1380.  
  1381. /|/Colour_menu_facesFrom_list([],GL_Sell_Bucket, Sell_prims, <0,0,0>);
  1382. Update_Inventory_Display("ChangerList",[], [], Sell_prims,<1,1,1>); /|/GL_Sell_Bucket
  1383.  
  1384.  
  1385. string packed;
  1386. packed = ModifyLists2(-1000, "ListChangeGive", GL_Sell_Bucket, inventory, []);/|/if a list is blank it will change the order
  1387. list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in string.
  1388. /|/llSay(0, packed);
  1389. inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;/|/takes out first entry identifier/placeholder
  1390. list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
  1391.  
  1392. llSay(0, llDumpList2String(inventory, ",") );
  1393. Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,<1,1,1> );
  1394. llSay(0, "inv_update" + llDumpList2String(inv_update, ",") );
  1395. Colour_menu_facesFrom_list(GL_Temporary_Bucket,inventory, inventory_links, <1,1,1>);
  1396. GL_Temporary_Bucket = [];/|/reset temporary.
  1397. inventory_state = "NormalMode";
  1398. }
  1399.  
  1400. else if (link_name=="BasketState")
  1401. {
  1402. /|/GL_Sell_Bucket = ["Chestnut",20,1,"Pancakes",50,2,"Oyster",3,3,"Orange",5,4]; temp just to test
  1403. llSay(0, "inv_update" + llDumpList2String(GL_Temporary_Bucket, ",") );
  1404. string packed;
  1405. packed = ModifyLists2(-1000, "ListChangeTake", GL_Sell_Bucket, inventory, []);/|/if a list is blank it will change the order
  1406. list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in string.
  1407. inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;/|/takes out first entry identifier/placeholder
  1408. list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
  1409.  
  1410. /|/Colour_menu_facesFrom_list(GL_Sell_Bucket,GL_Sell_Bucket, Sell_prims, <0,1,0>);/|/turn red, do I even need this function??
  1411. Update_Inventory_Display("SameList",GL_Sell_Bucket, GL_Sell_Bucket, Sell_prims,<0,1,0>);
  1412. Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,<1,0,0> );
  1413. /|/Colour_menu_facesFrom_list(GL_Sell_Bucket,inventory, inventory_links, <1,0,0>);
  1414.  
  1415. inventory_state = "BasketState";
  1416. llOwnerSay("Basket State Active");
  1417. }
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425. else if (llGetSubString(link_description,0,3)=="Inv:" || llGetSubString(link_description,0,3)=="Sel:")
  1426. { /|/update inventory data if inventory prim is clicked
  1427. if (llGetSubString(link_description,0,3)=="Inv:")
  1428. {
  1429. link_click2_inventory_item_name(link_clicked,face_clicked,inventory);
  1430. Index_info_grabber(inventory_name_s,inventory);
  1431. }
  1432. else if (llGetSubString(link_description,0,3)=="Sel:")
  1433. {
  1434. link_click2_inventory_item_name(link_clicked,face_clicked,GL_Sell_Bucket);
  1435. Index_info_grabber(inventory_name_s,GL_Sell_Bucket);
  1436. }
  1437. /|/works out other indexes based on word.
  1438. /|/Data_Message();
  1439. }
  1440.  
  1441. if (inventory_state == "NormalMode")
  1442. {
  1443. if (llGetSubString(link_description,0,3)=="Inv:")
  1444. {
  1445.  
  1446. if (Gl_Use_click_bank!=inventory_name_s)
  1447. {
  1448. llSetLinkPrimitiveParamsFast(Gi_old_link, [ PRIM_COLOR, Gi_old_face,<1,1,1>, 1.0 ]);
  1449. Gi_old_link= link_clicked;
  1450. Gi_old_face= face_clicked;
  1451.  
  1452. llOwnerSay("Are you sure you want to use " + inventory_name_s + ", click item again to confirm");
  1453. Gl_Use_click_bank = inventory_name_s;
  1454. llSetLinkPrimitiveParamsFast(link_clicked, [ PRIM_COLOR, face_clicked,<0.502, 1.000, 1.000>, 1.0 ]);
  1455.  
  1456. }
  1457.  
  1458. else if (Gl_Use_click_bank==inventory_name_s)
  1459. {
  1460. Gl_Use_click_bank;/|/reset
  1461. llSetLinkPrimitiveParamsFast(link_clicked, [ PRIM_COLOR, face_clicked,<1,1,1>, 1.0 ]);
  1462.  
  1463. /|/llSay(0, llDumpList2String(inventory,",") );
  1464.  
  1465. if (inventory_amount-1 <1)
  1466. {
  1467. llOwnerSay("You have used all your " + inventory_name_s +"s");
  1468. inventory = llDeleteSubList (inventory, inventory__name_index,inventory__name_index+2);
  1469. Update_Inventory_Display("SameList",inventory, inventory,inventory_links,ZERO_VECTOR );
  1470. }
  1471.  
  1472. else
  1473. {
  1474. llOwnerSay("You used a " + inventory_name_s);
  1475. GL_Temporary_Bucket = [inventory_name_s,inventory_amount-1,inventory_sprite_num]; inventory = List2List_Update(GL_Temporary_Bucket, inventory);
  1476. /|/inventory = Add_or_Subtract_Amounts_list2list_Update(GL_Temporary_Bucket, inventory,-1);
  1477. Update_Inventory_Display("ChangerList",GL_Temporary_Bucket, inventory,inventory_links,ZERO_VECTOR );
  1478. /|/Update_Inventory_Display(GL_Sell_Bucket, inventory,inventory_links,ZERO_VECTOR );
  1479. }
  1480.  
  1481. llSay(0, llDumpList2String(inventory,",") );
  1482. Gl_Use_click_bank="";
  1483.  
  1484. /|/llSay(0, llDumpList2String(inventory,",") );
  1485.  
  1486. }/|/ if (Gl_Use_click_bank==inventory_name_s)
  1487. }/|/ End if (llGetSubString(link_description,0,3)=="Inv:")
  1488.  
  1489. } /|/ End of if (inventory_state == "NormalMode")
  1490.  
  1491. if (inventory_state == "BasketState") /|/ Need an if for inventory button check
  1492. {
  1493. if (face_clicked ==0 || face_clicked == 4)
  1494. {
  1495. if(llGetSubString(link_description,0,3)=="Inv:")
  1496. { /|/adding one item
  1497. GL_Temporary_Bucket = List_AlterItems_Colour(<1, 0.445, 0>,GL_Temporary_Bucket,8,inventory_name_s,0);
  1498. llSay(0, "GL_Temporary_Bucket List - " + llDumpList2String(GL_Temporary_Bucket,",") );
  1499. }
  1500.  
  1501.  
  1502.  
  1503.  
  1504. /|* scrapped this
  1505. else if(llGetSubString(link_description,0,3)=="Sel:")
  1506. { /|/turn green and add or remove from list
  1507. /|/GL_Temporary_Bucket = List_AlterItems_Colour(<0,1,0>,GL_Temporary_Bucket,8,inventory_name_s,0);
  1508. /|/llSay(0, "GL_Temporary_Bucket List - " + llDumpList2String(GL_Temporary_Bucket,",") );
  1509. }
  1510. *|/
  1511. }/|/ End if (face_clicked ==0 || face_clicked == 4)
  1512.  
  1513. if (llGetSubString(link_name,0,6)=="Bucket:" ) /|/to modify items in bucket
  1514. {
  1515. string num = llGetSubString(link_name,7,llStringLength(link_name));
  1516.  
  1517. if (num=="Reset")
  1518. num = "-1000"; /|/turns everything to 0
  1519.  
  1520. integer amount_change = (integer)num;
  1521.  
  1522. /|/llSay(0, "temp Start - " + llDumpList2String(GL_Sell_Bucket,",") );
  1523.  
  1524. if (llGetListLength(GL_Temporary_Bucket)>2)/|/if something actually in the bucket to add
  1525. /|/create GL_Temporary_Bucket with updated amounts
  1526. {
  1527.  
  1528. /|/ RIGHT HERE 2
  1529. llSay(0,"Sell Bucket before - " + llDumpList2String(GL_Sell_Bucket,",") );
  1530. string packed;
  1531. packed = ModifyLists2(amount_change, "SingleAmount", GL_Temporary_Bucket, inventory, GL_Sell_Bucket);/|/if a list is blank it will change the order
  1532. list bundle = llParseString2List( packed,["|"],[""]); /|/parses 4 lists buried in string.
  1533. inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;/|/takes out first entry identifier/placeholder
  1534. GL_Sell_Bucket = llListReplaceList( llCSV2List ( llList2String(bundle,2) ),[],0,0 ) ;
  1535. /|/list sell_update = llListReplaceList( llCSV2List ( llList2String(bundle,3) ),[],0,0 ) ;
  1536.  
  1537. llSay(0,"inventory - " + llDumpList2String(inventory,",") );
  1538. llSay(0,"GL_Sell_Bucket - " + llDumpList2String(GL_Sell_Bucket,",") );
  1539.  
  1540.  
  1541.  
  1542. llSay(0,"cotains 0 flag - " + (string)Gi_contains_zero);
  1543.  
  1544. if(Gi_contains_zero == TRUE)
  1545. Update_Inventory_Display("SameList",inventory, inventory,inventory_links,ZERO_VECTOR );
  1546.  
  1547. else
  1548. {
  1549. list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
  1550. Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,ZERO_VECTOR );
  1551. /|/llSay(0,"inv update" + llDumpList2String(inv_update,",") );
  1552. }
  1553.  
  1554. Update_Inventory_Display("SameList",GL_Sell_Bucket, GL_Sell_Bucket,Sell_prims,ZERO_VECTOR );
  1555. }
  1556.  
  1557.  
  1558. else if (llGetListLength(GL_Temporary_Bucket)<3)
  1559. llOwnerSay("Active more items in the trade bucket!");
  1560.  
  1561. } /|/ end if (llGetSubString(link_name,0,6)=="Bucket:" )
  1562.  
  1563.  
  1564. } /|/ End if Basket State
  1565.  
  1566. if (link_name == "TradeRadar")
  1567. {
  1568. cur_action = "partner";
  1569. llSay(0, "?");/|/ this working
  1570. llSay(comm_chan, "?");
  1571. /|/inventory_state =="Trading"
  1572. }
  1573.  
  1574.  
  1575. else if (link_name == "ProposeTrade") /|/ && cur_action == "partner"
  1576. {
  1577. string trade_message = "TradeProposed|" + llDumpList2String(GL_Sell_Bucket,",");
  1578. trade_emote;
  1579. integer i;
  1580.  
  1581. for (i=0; i < llGetListLength(GL_Sell_Bucket) ; i+=3)/|/generating emote minus sprites
  1582. {
  1583. /|/llSay(0, (string)i);
  1584. trade_emote += llList2String(GL_Sell_Bucket,i) + "," + llList2String(GL_Sell_Bucket,i+1) + ",";
  1585. }
  1586.  
  1587. llOwnerSay("You have proposed a trade to " + partner_name + " consisting of: " +
  1588. trade_emote );/|/message to self
  1589. /|/llRegionSay( comm_chan, trade_message);
  1590. llRegionSayTo(partner_id, comm_chan, trade_message);/|/plust list of items
  1591. /|/llSay(0, (string)trade_message);
  1592. /|/llRegionSay(0, owner_name + " would like to trade the following items: " + trade_emote);
  1593. llRegionSayTo(partner_id, 0, owner_name + " would like to trade the following items: " + trade_emote);
  1594.  
  1595.  
  1596. /|*
  1597. if ()/|/tradebasket empty)
  1598. llOwnerSay("You have offered to receive no items, if you accept this trade will be a gift to ");
  1599. *|/
  1600.  
  1601. if (Gs_Trade_State == "TradeAgreed_Countdown" || llListFindList(Gl_Trade_agreement,["Other"]) !=-1 )
  1602. llOwnerSay("You cancelled the agreement making a new proposal");
  1603.  
  1604. Gl_Trade_agreement = [];
  1605. Gs_Trade_State = "Proposals";
  1606. llSetTimerEvent(0.0); /|/stops trade window
  1607.  
  1608. /|/you have changed your proposal. You and Reishi will need to confirm again.
  1609. /|/also send to them in reverse.
  1610.  
  1611.  
  1612. /|/llSay(0, Gs_Trade_State);
  1613.  
  1614. }/|/ else if (link_name == "AcceptAction")
  1615.  
  1616. else if (link_name == "TradeAgree" && Gs_Trade_State != "ConfirmFinish" )
  1617. {
  1618.  
  1619. /|/ llRegionSay(comm_chan, "TradeAgree");
  1620. llRegionSayTo(partner_id, comm_chan, "TradeAgree");
  1621.  
  1622.  
  1623.  
  1624. if (llListFindList(Gl_Trade_agreement,["Other"]) !=-1)/|/new incoming proposal stops countdown reests back to proposals stage.
  1625. {
  1626. Gl_Trade_agreement += ["Self"];
  1627. Gs_Trade_State = "TradeAgreed_Countdown";
  1628. 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.");
  1629. llSetTimerEvent(0.1); /|/starts trade window
  1630. /|/both of you agree, after twenty seconds either of you can click to finsih the trade.
  1631. }
  1632.  
  1633. else
  1634. {
  1635. Gl_Trade_agreement = ["Self"];
  1636. llOwnerSay("You have agreed the proposal. If " + partner_name + " agrees you will start the trade count down") ; /|/ waiting for other to come in.
  1637. }
  1638.  
  1639. llSay(0, llDumpList2String(Gl_Trade_agreement,",") );
  1640.  
  1641. llSay(0, Gs_Trade_State);
  1642. llSay(0, "Sent - Proposals");
  1643.  
  1644. }/|/ else if (link_name == "AcceptAction")
  1645.  
  1646. else if (link_name == "ConfirmFinish" && Gs_Trade_State == "ConfirmFinish") /|/
  1647. {
  1648. /|/llRegionSay(comm_chan, "ConfirmTrade");
  1649. llSay(0, "Clicker Confirm Sent");
  1650. llRegionSayTo(partner_id, comm_chan, "ConfirmFinish");
  1651. Gs_Trade_State = "SentMessage";
  1652. /|/Say to them "ConfirmTrade" - will wait for response.
  1653. /|/send message, wait for reception.
  1654. /|/run through from their return to confirm.
  1655. llSay(0, Gs_Trade_State);
  1656.  
  1657. }
  1658.  
  1659.  
  1660. else if (link_name == "AcceptAction") /|/
  1661. {
  1662. /|/llSay(0, cur_action);
  1663. if (cur_action == "partner")
  1664. {
  1665. llSay(0,(string)face_clicked);
  1666. if (face_clicked == 1) /|/ Yes.
  1667. {
  1668. /|/llSay(0, "Received2");
  1669. /|/ Send acceptance back to other avatar's HUD.
  1670. llRegionSayTo(requesting_avatar_id, comm_chan, "accepted");/|/comm chat
  1671. llOwnerSay("You accept " + partner_name + "'s " + cur_action + " request.");/|/message to self
  1672.  
  1673. llRegionSayTo(requesting_avatar_id, 0, owner_name + " accepted your request to play."); /|/message they get
  1674. new_partner(requesting_avatar_id);/|/adds them as a new partner etc
  1675.  
  1676. llSay(0, (string)partner_id );
  1677. } /|/ End if.
  1678.  
  1679. else if (face_clicked == 2) /|/ No.
  1680. llRegionSayTo(requesting_avatar_id, 0, owner_name + " turned down your request to play.");
  1681.  
  1682. /|/ Hide accept action link.
  1683. llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_hidden]);
  1684. } /|/ End if.
  1685. } /|/ else if (link_name == "AcceptAction")
  1686.  
  1687.  
  1688. }/|/ end Touch Start
  1689.  
  1690.  
  1691. listen(integer channel, string name, key id, string msg)
  1692. {
  1693. if (channel == comm_chan)/|/|/coming from other users or own NPCs
  1694. {
  1695. llSay(0, "Comm chan message is - " + msg);
  1696.  
  1697. if (msg == "?")/|/ Anybody around with a hud on?
  1698. {
  1699. av_names = []; /|/ Clear av_names list. /|/resets own
  1700. av_buttons = []; /|/ Clear av_buttons list. /|/ resets own
  1701. /|/llSay(0, "!");
  1702. llRegionSayTo(id, comm_chan, "!"); /|/ Send back reply to querying HUD.
  1703. } /|/ End if.
  1704.  
  1705. else if (msg == "!" && llGetOwnerKey(id) != owner_id )/|/ Response message to "hud in area?". Not owner of hud message.
  1706. {
  1707. string av_name = llKey2Name(llGetOwnerKey(id));
  1708.  
  1709. if (llListFindList(av_names, [av_name]) == -1) /|/if av name not already in list
  1710. {
  1711. av_names += av_name; /|/ Add avatar name to list.
  1712. av_buttons += (string)(llGetListLength(av_names));/|/ Add button number to list.
  1713. }
  1714.  
  1715. if (llGetListLength(av_names) == 12) /|/ 12 is max amount in dialog menu
  1716. {
  1717. trader_menu(); /|/ Display selection menu of avatar names.
  1718. }
  1719. else
  1720. {
  1721. llSetTimerEvent(1.0); /|/ Extend timeout by 1 second.
  1722. /|/working llSay(0, "Received4");
  1723. }
  1724.  
  1725. } /|/ End if (msg == "!" && llGetOwnerKey(id) != owner_id )
  1726.  
  1727. else if (msg == "Partner?")
  1728. {
  1729. /|/ Show accept action link.
  1730. cur_action = "partner";
  1731. llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_visible]);
  1732.  
  1733. requesting_avatar_id = llGetOwnerKey(id);
  1734. string av_name = llKey2Name(requesting_avatar_id);
  1735.  
  1736. llOwnerSay(av_name + " has sent a " + cur_action + " request.");/|/message to self
  1737. /|/ Set cur_action.
  1738. cur_action = "partner";
  1739.  
  1740. /|/ Store requester's id in requesting_avatar_id.
  1741. requesting_avatar_id = llGetOwnerKey(id);
  1742. } /|/ End else if.
  1743.  
  1744. else if (msg == "accepted") /|/sends it to self and other when clicked accept button.
  1745. {
  1746. /|/old partner_time_out = FALSE; /|/ Reset partner time out flag.
  1747.  
  1748. /|/ Do new partner stuff.
  1749. new_partner(llGetOwnerKey(id));
  1750. } /|/ End else if.
  1751.  
  1752.  
  1753. else if ( llGetSubString(msg,0,13) == "TradeProposed|" /|*&& llGetOwnerKey(id) == partner_id*|/)
  1754. {
  1755. llSay(0, "Received");
  1756.  
  1757. string incoming_t = llGetSubString(msg,14,llStringLength(msg) );
  1758. Gl_IncomingTrade = llCSV2List(incoming_t);
  1759. Update_Inventory_Display("SameList",Gl_IncomingTrade, Gl_IncomingTrade,Gl_IncomingTrade_Prims,<1, 1,0> );
  1760. /|/llSay(0,llList2String(Gl_IncomingTrade,0) );
  1761. /|/say trader sent new proposal
  1762. /|/ llSay(0,incoming_t);
  1763.  
  1764. if (Gs_Trade_State == "TradeAgreed_Countdown" || llListFindList(Gl_Trade_agreement,["Self"]) !=-1)/|/Reset agreement
  1765. {
  1766. llOwnerSay(partner_name + " has sent a new trade proposal, Agreement has been reset");/|/message to self
  1767. llSetTimerEvent(0.0);
  1768. llSay(0, "A new proposal has been sent by " + partner_name +", Agreement Reset");
  1769. /|/ put forth a new proposal, agreement reset.
  1770. }
  1771.  
  1772. else
  1773. {
  1774. llOwnerSay(partner_name + " has sent a new trade proposal.");
  1775. }
  1776. llSetTimerEvent(0.0);
  1777.  
  1778. Gs_Trade_State = "Proposals";
  1779. Gl_Trade_agreement = [];
  1780.  
  1781. /|/llSay(0,"received list is list is " + llDumpList2String(Gl_Trade_agreement,",") );
  1782. /|/llSay(0, "trade state " + Gs_Trade_State);
  1783. /|/llSay(0, "Received - Proposals");
  1784.  
  1785. }
  1786.  
  1787. else if ( msg == "TradeAgree") /|*&& llGetOwnerKey(id) == partner_id*|/
  1788. {
  1789.  
  1790. if (llListFindList(Gl_Trade_agreement,["Self"]) !=-1)/|/new incoming proposal stops countdown reests back to proposals stage.
  1791. {
  1792. Gl_Trade_agreement += ["Other"];/|/do I even need this bit?
  1793. Gs_Trade_State = "TradeAgreed_Countdown";
  1794. 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.");
  1795. llSetTimerEvent(0.1); /|/starts trade window
  1796. /|/both of you agree, after twenty seconds either of you can click to finsih the trade.
  1797. }
  1798.  
  1799. else
  1800. {
  1801. Gl_Trade_agreement = ["Other"]; /|/ waiting for other to come in.
  1802. llOwnerSay(partner_name + " has agreed to the trade. Click agree to confirm or change proposal");
  1803. }
  1804.  
  1805. /|/llSay(0, llDumpList2String(Gl_Trade_agreement,",") );
  1806. /|/llSay(0, Gs_Trade_State);
  1807. /|/llSay(0, "Received - TradeAgree");
  1808.  
  1809. }
  1810.  
  1811. } /|/ End if (channel == comm_chan) /|/coming from other users/NPCs
  1812.  
  1813.  
  1814. if ( msg == "ConfirmFinish" && Gs_Trade_State == "SentMessage" ) /|/for some reason clicker needed another state. Not sure why yet.
  1815. { /|/Sent message is the state the one that first sends the message, i.e. hud user that clicks first sends and goes in to.
  1816. trade_transaction();
  1817. }
  1818.  
  1819. else if ( msg == "ConfirmFinish" && Gs_Trade_State == "ConfirmFinish" )
  1820. {/|/sends return message to trade initiater
  1821. trade_transaction();
  1822. }
  1823.  
  1824.  
  1825. if (channel == menu_chan && id == owner_id)/|/coming from user using dialogue menu
  1826. {
  1827. /|/ Response to avatar partnering name selection menu.
  1828. /|/ Check for a valid number button.
  1829. /|/llSay(0, msg);
  1830.  
  1831. if (llListFindList(av_buttons, [msg]) != -1) /|/Dialogue receiving a number of chosen avatar.
  1832. {
  1833. string av_name = llList2String(av_names, (integer)msg -1); /|/ Avatar selected.
  1834. string av_id = llName2Key(av_name); /|/ UUID of selected avatar.
  1835.  
  1836. if (av_id == NULL_KEY)
  1837. {
  1838. llDialog(id, "\n" + av_name + " is no longer in the region. Please select another avatar.", ["OK"], menu_chan);
  1839. } /|/ End if.
  1840. else
  1841. {
  1842. llSay(0,"sent");
  1843. llSay(0,(string)av_id );
  1844. /|/ Send partner confirm message to chosen avatar's HUD.
  1845. llDialog(owner_id, "Sending request to TRADE to " + av_name, ["OK"], menu_chan);
  1846. llRegionSayTo(av_id, comm_chan, "Partner?");
  1847. } /|/ End else.
  1848. } /|/ End if.
  1849. } /|/ End if.
  1850.  
  1851. /|/update list
  1852.  
  1853. /|/list NewList = llParseString2List(msg, ["|"], [","] );
  1854. /|/llSay(0, llDumpList2String(Gl_IncomingTrade,",") );
  1855.  
  1856. /|/Gl_IncomingTrade = List2List_Update(NewList, Gl_IncomingTrade);
  1857. /|/Gl_IncomingTrade = NewList;
  1858. /|/Update_Inventory_Display(Gl_IncomingTrade, Gl_IncomingTrade,Gl_IncomingTrade,<1.000, 1.000, 0.000>);
  1859.  
  1860. /|/inventory = List2List_Update(NewList, inventory);
  1861. /|/Update_Inventory_Display(NewList, inventory,inventory_links);
  1862. /|/llSay(0, llDumpList2String(Gl_IncomingTrade,",") );
  1863.  
  1864.  
  1865.  
  1866.  
  1867. } /|/end Listen
  1868.  
  1869. timer()
  1870. {
  1871. if(cur_action == "partner")
  1872. {
  1873. if (llGetListLength(av_names) > 0)
  1874. trader_menu(); /|/ Display selection menu of avatar names.
  1875. else
  1876. llDialog(owner_id, "There are no nearby avatars wearing Sex HUDs found.", ["OK"], menu_chan);
  1877. llSetTimerEvent(0.0); /|/turn timer off again
  1878. }
  1879.  
  1880. if (Gs_Trade_State == "TradeAgreed_Countdown")
  1881. {
  1882. llSay(0, "Proposal Countdown Started - " + Gs_Trade_State);
  1883. llSetTimerEvent(5.0);/|/20 second countdown
  1884. /|/perhaps less and announce count
  1885. Gs_Trade_State = "FinishedOpen";
  1886. }
  1887.  
  1888. else if (Gs_Trade_State == "FinishedOpen")
  1889. {
  1890. /|/send message so both in unison. perhaps wait one second after.
  1891. Gs_Trade_State = "ConfirmFinish";
  1892. llSay(0,"State in " + Gs_Trade_State);
  1893. /|/message you can now finish trade etc
  1894. /|/ you or trading partner may now click to finalise the trade.
  1895. llSetTimerEvent(0.0);
  1896. /|/run trading action
  1897. }
  1898.  
  1899. } /|/ End timer()
  1900.  
  1901. }
  1902.  
  1903. */
  1904. //end_unprocessed_text
  1905. //nfo_preprocessor_version 0
  1906. //program_version Firestorm-Releasex64 6.3.2.58052 - ReishiProphet
  1907. //last_compiled 01/18/2020 04:44:21
  1908. //mono
  1909.  
  1910.  
  1911. list lazy_list_set(list L, integer i, list v)
  1912. {
  1913. while (llGetListLength(L) < i)
  1914. L = L + 0;
  1915. return llListReplaceList(L, v, i, i);
  1916. }
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.  
  1924. key partner_id= "8b3b54aa-4de6-4b49-8c42-146555d26863";
  1925. string partner_name = "Labyrinthstarchild";
  1926.  
  1927. key temp_if_id = "8b3b54aa-4de6-4b49-8c42-146555d26863";
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937. integer accept_link;
  1938. rotation accept_rot_visible = <-0.000000, -0.000000, -0.766031, 0.642804>;
  1939. rotation accept_rot_hidden = <-0.000000, -0.000000, 0.000022, 1.000000>;
  1940.  
  1941.  
  1942.  
  1943. list Index_Inventory_PrimLinks( string prim_desc )
  1944. {
  1945.  
  1946.  
  1947. integer i;
  1948. integer y=1;
  1949. list Grab_prims_list;
  1950. string link_name;
  1951. string order_number;
  1952.  
  1953. for (i = 0; i < llGetNumberOfPrims()+1; i++)
  1954. {
  1955. order_number = llList2String(llGetLinkPrimitiveParams(i,[PRIM_DESC]),0);
  1956. link_name = llGetLinkName(i);
  1957.  
  1958. if (llGetSubString(order_number,0,3) == prim_desc )
  1959. {
  1960. Grab_prims_list += (integer) llGetSubString(order_number,4,llStringLength(order_number) );
  1961. Grab_prims_list += i;
  1962. }
  1963.  
  1964. else if (link_name == "AcceptAction")
  1965. {
  1966. accept_link = i;
  1967. llSay(0,"action link" + (string)accept_link );
  1968. }
  1969. }
  1970.  
  1971.  
  1972. list reordered_list = llListSort(Grab_prims_list, 2, TRUE );
  1973.  
  1974.  
  1975. list link_list;
  1976.  
  1977. for (i = 1; i < llGetListLength(reordered_list); i+=2)
  1978. link_list += llList2Integer(reordered_list,i);
  1979.  
  1980.  
  1981.  
  1982.  
  1983. llSay(0, "Final list - " + llDumpList2String(link_list,",") );
  1984. return link_list;
  1985. }
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995. 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] ;
  1996.  
  1997. 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] ;
  1998.  
  1999.  
  2000.  
  2001. list GL_Temporary_Bucket /*=["Chestnut",10,1,"Pancakes",1,2,"Oyster",2,3,"Orange",3,4]*/;
  2002. list GL_Sell_Bucket;
  2003. list SelfTrade;
  2004. list Gl_IncomingTrade;
  2005. list Gl_IncomingTrade_Prims;
  2006. list inventory_links;
  2007. list Sell_prims;
  2008.  
  2009.  
  2010. string Gl_Use_click_bank;
  2011. integer Gi_old_link;
  2012. integer Gi_old_face;
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018. integer item_name_list_index;
  2019. integer item_amount_list_index;
  2020. integer item_spriteIndex_list_index;
  2021.  
  2022. string inventory_name_s;
  2023. integer inventory__name_index ;
  2024. integer inventory_amount;
  2025. integer inventory_sprite_num ;
  2026. integer menudisplay_index ;
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038. link_click2_inventory_item_name(integer link, integer face, list inventory_l)
  2039. {
  2040.  
  2041.  
  2042. string inventoryprim_num = llGetSubString( llList2String(
  2043. llGetLinkPrimitiveParams(link,[PRIM_DESC]),0) ,4,4 );
  2044.  
  2045. integer itemName_num = (integer)inventoryprim_num;
  2046. itemName_num = (itemName_num*2)-1;
  2047. if (face==4)
  2048. itemName_num +=1;
  2049.  
  2050. inventory_name_s = llList2String (inventory_l, ((itemName_num-1)*3 ) );
  2051.  
  2052. }
  2053.  
  2054. Index_info_grabber(string item_name, list l_Inventory)
  2055. {
  2056.  
  2057. inventory__name_index = llListFindList (l_Inventory, [item_name]);
  2058. inventory_amount = llList2Integer(l_Inventory,inventory__name_index+1);
  2059. inventory_sprite_num = llList2Integer(l_Inventory,inventory__name_index+2);
  2060. menudisplay_index = (inventory__name_index/3)+1;
  2061. }
  2062.  
  2063. Data_Message()
  2064. {
  2065.  
  2066. llSay(0, "Item Name: " + (string)inventory_name_s + ", Name Index: " + (string)inventory__name_index +
  2067. ", Amount: " + (string)inventory_amount + ", Sprite: " + (string)inventory_sprite_num +
  2068. ", MenuDisplayNo :" + (string)menudisplay_index );
  2069. }
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076. Update_Inventory_Display(string changestyle, list Updating_l, list l_Inventory, list l_Inventory_prims,vector colour)
  2077. {
  2078.  
  2079.  
  2080. integer i;
  2081. integer link;
  2082. integer face;
  2083. integer menudisplay_index;
  2084. integer blank_link_offset;
  2085.  
  2086. if (llGetListLength(Updating_l) > 1)
  2087. {
  2088.  
  2089. for(i=0; i <llGetListLength(Updating_l); i+=3)
  2090. {
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096. if (changestyle == "ChangerList")
  2097. {
  2098. inventory_name_s = llList2String(Updating_l,i);
  2099. inventory_amount = llList2Integer(Updating_l,i+1);
  2100. inventory__name_index = llListFindList (l_Inventory, [inventory_name_s]);
  2101. menudisplay_index = (inventory__name_index/3)+1;
  2102. inventory_sprite_num = llList2Integer(l_Inventory,inventory__name_index+2);
  2103. }
  2104.  
  2105. else if (changestyle == "SameList")
  2106. {
  2107. inventory_name_s = llList2String(l_Inventory,i);
  2108. inventory_amount = llList2Integer(l_Inventory,i+1);
  2109. inventory_sprite_num = llList2Integer(l_Inventory,i+2);
  2110. menudisplay_index = (i/3)+1;
  2111. }
  2112.  
  2113.  
  2114. if(menudisplay_index%2 == 0)
  2115. {
  2116. link = llList2Integer(l_Inventory_prims, (menudisplay_index/2)-1 );
  2117. face = 4;
  2118. }
  2119. else
  2120. {
  2121. face = 0;
  2122. link = llList2Integer(l_Inventory_prims, ((menudisplay_index+1)/2)-1 );
  2123. }
  2124.  
  2125. set_link_texture_grid(link, face, "9a5e49c8-896c-ee94-ff8e-c484c30c2a49", inventory_sprite_num-1, 8, 8);
  2126. if (colour != ZERO_VECTOR )
  2127. llSetLinkPrimitiveParamsFast(link, [ PRIM_COLOR, face, colour, 1.0 ]);
  2128.  
  2129. string s_update_amount = (string)inventory_amount;
  2130. integer length = llStringLength(s_update_amount);
  2131.  
  2132. if (length <4)
  2133. {
  2134. integer j;
  2135. for (j=0; j<length; j++)
  2136. {
  2137. string digit = llGetSubString(s_update_amount,j,j);
  2138. integer face = face + j+1;
  2139.  
  2140. if (digit =="0")
  2141. digit = "11";
  2142.  
  2143. set_link_texture_grid(link, face, "6b43cc76-1f9c-6d22-045d-064b32f1b368", (integer)digit -1, 3, 4);
  2144. }
  2145.  
  2146. integer i;
  2147.  
  2148. if (3-length>0)
  2149. {
  2150. for (i=0;i<(3-length);i++)
  2151. {
  2152. integer face = face + 3 - i ;
  2153. set_link_texture_grid(link, face,"6b43cc76-1f9c-6d22-045d-064b32f1b368", (integer)12-1, 3, 4);
  2154. }
  2155. }
  2156.  
  2157. }
  2158.  
  2159. }
  2160. }
  2161.  
  2162.  
  2163. if ( llGetListLength(l_Inventory)/3 < llGetListLength(l_Inventory_prims)*2 /*2 as two face per prim */)
  2164. {
  2165. integer first_blank_face = llGetListLength(l_Inventory)/3+1;
  2166.  
  2167. for (i=first_blank_face ; i < (llGetListLength(l_Inventory_prims)*2)+1 ; i++)
  2168. {
  2169. if(i%2 == 0)
  2170. {
  2171. link = llList2Integer(l_Inventory_prims, (i/2)-1 );
  2172. face = 4;
  2173. }
  2174. else
  2175. {
  2176. face = 0;
  2177. link = llList2Integer(l_Inventory_prims, ((i+1)/2)-1 );
  2178. }
  2179.  
  2180. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
  2181. llSetLinkColor(link,<1,1,1>,face);
  2182. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+1,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
  2183. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+2,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
  2184. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face+3,"094c9a8b-e469-481f-3569-0ab9e406cbc4",<1,1,0>,<0,0,0>,0.0]);
  2185.  
  2186. }
  2187.  
  2188. }
  2189.  
  2190. }
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197. Colour_menu_facesFrom_list(list bucket_l, list changing_l, list prims_to_change_l, vector colour)
  2198. {
  2199.  
  2200.  
  2201.  
  2202. integer i;
  2203. integer link;
  2204. integer face;
  2205.  
  2206. for (i=0; i < (llGetListLength(bucket_l)+1) ; i+=3)
  2207. {
  2208.  
  2209.  
  2210. inventory_name_s = llList2String(bucket_l,i);
  2211.  
  2212. inventory__name_index = llListFindList (changing_l, [inventory_name_s]);
  2213.  
  2214.  
  2215. menudisplay_index = (inventory__name_index/3)+1;
  2216.  
  2217. if(menudisplay_index%2 == 0)
  2218. {
  2219. link = llList2Integer(prims_to_change_l, (menudisplay_index/2)-1 );
  2220. face = 4;
  2221. }
  2222. else
  2223. {
  2224. face = 0;
  2225. link = llList2Integer(prims_to_change_l, ((menudisplay_index+1)/2)-1 );
  2226. }
  2227.  
  2228. llSetLinkPrimitiveParamsFast(link,
  2229. [ PRIM_COLOR,face, colour, 1.0 ]);
  2230. }
  2231.  
  2232. }
  2233.  
  2234.  
  2235. Colour_menu_facesFrom_list_old(list bucket_l, list prims_to_change_l, vector colour)
  2236. {
  2237. integer i;
  2238. integer link;
  2239. integer face;
  2240.  
  2241. for (i=1; i < (llGetListLength(bucket_l)/3)+1 ; i++)
  2242. {
  2243. if(i%2 == 0)
  2244. {
  2245. link = llList2Integer(prims_to_change_l, (i/2)-1 );
  2246. face = 4;
  2247. }
  2248. else
  2249. {
  2250. face = 0;
  2251. link = llList2Integer(prims_to_change_l, ((i+1)/2)-1 );
  2252. }
  2253.  
  2254. llSetLinkPrimitiveParamsFast(link,
  2255. [ PRIM_COLOR,face, colour, 1.0 ]);
  2256. }
  2257.  
  2258. }
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275. list List2List_Update(list Updating_L, list l_Inventory)
  2276. {
  2277.  
  2278.  
  2279. integer i;
  2280. string item_word;
  2281. integer new_amount;
  2282. integer link;
  2283. integer face;
  2284. integer inventory__name_index;
  2285.  
  2286. for(i=0; i<llGetListLength(Updating_L); i+=3)
  2287. {
  2288. item_word = llList2String(Updating_L,i);
  2289. new_amount = llList2Integer(Updating_L,i+1);
  2290.  
  2291. if( llListFindList(l_Inventory, [item_word])!=-1)
  2292. {
  2293. inventory__name_index = llListFindList (l_Inventory, [item_word]);
  2294. l_Inventory = llListReplaceList(l_Inventory,[new_amount],inventory__name_index+1,inventory__name_index+1);
  2295. }
  2296. }
  2297.  
  2298.  
  2299. return l_Inventory;
  2300.  
  2301. }
  2302.  
  2303. integer Gi_contains_zero;
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309. string ModifyLists2( integer amount_change, string change_style, list modifying_l, list taking_l, list l_giving)
  2310. {
  2311.  
  2312.  
  2313.  
  2314. Gi_contains_zero = FALSE;
  2315. list take_list_mod_snip ;
  2316. list give_list_mod_snip ;
  2317. integer new_amount;
  2318. string item_word;
  2319. integer sprite_index;
  2320.  
  2321. string combined_lists;
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328. integer i;
  2329.  
  2330. for(i=0; i<llGetListLength(modifying_l); i+=3)
  2331. {
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339. item_word = llList2String(modifying_l,i);
  2340. llSay(0, item_word );
  2341.  
  2342. if (change_style == "ListChangeGive")
  2343. amount_change = llList2Integer(modifying_l,i+1)*-1;
  2344.  
  2345. else if(change_style == "ListChangeTake")
  2346. amount_change = llList2Integer(modifying_l,i+1);
  2347.  
  2348.  
  2349. integer t_name_index = llListFindList (taking_l, [item_word]);
  2350. integer t_amount = llList2Integer(taking_l,t_name_index +1);
  2351.  
  2352. sprite_index = llListFindList (inventory_main_info, [item_word]);
  2353. integer sprite_number = llList2Integer (inventory_main_info, sprite_index +2);
  2354.  
  2355. integer giving_index = llListFindList (l_giving, [item_word]);
  2356. integer give_amount = llList2Integer(l_giving,giving_index+1);
  2357.  
  2358. integer new_amount = amount_change;
  2359.  
  2360.  
  2361.  
  2362. if (change_style == "SingleAmount")
  2363. {
  2364.  
  2365. if (amount_change > 0)
  2366. {
  2367.  
  2368. if (t_amount < amount_change)
  2369. new_amount = t_amount;
  2370. }
  2371.  
  2372. else if (amount_change < 0)
  2373. {
  2374.  
  2375. if (give_amount < amount_change*(-1) )
  2376. new_amount = give_amount*(-1);
  2377.  
  2378. }
  2379. }
  2380.  
  2381.  
  2382.  
  2383. if (t_name_index !=-1 && t_amount - new_amount <1 )
  2384. {
  2385.  
  2386.  
  2387.  
  2388. taking_l = llDeleteSubList (taking_l, t_name_index,t_name_index+2);
  2389. Gi_contains_zero = TRUE;
  2390. }
  2391.  
  2392. else if (give_amount != -1)
  2393. taking_l = llListReplaceList(taking_l,[ t_amount - new_amount ],t_name_index+1,t_name_index+1);
  2394.  
  2395. else
  2396. taking_l += [item_word,t_amount - new_amount, sprite_number];
  2397.  
  2398. take_list_mod_snip += [item_word,t_amount - new_amount, sprite_number];
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405. if (give_amount!=-1 && give_amount - (new_amount*(-1)) < 1)
  2406. {
  2407. llSay(0, "Giving less than 1");
  2408.  
  2409. l_giving = llDeleteSubList (l_giving, giving_index,giving_index+2);
  2410. }
  2411.  
  2412.  
  2413.  
  2414. else if (giving_index!=-1)
  2415. {
  2416. llSay(0, "1");
  2417. l_giving = llListReplaceList(l_giving,[give_amount + new_amount],giving_index+1,giving_index+1);
  2418. }
  2419.  
  2420. else
  2421. {
  2422. llSay(0, "2");
  2423. l_giving += [item_word,(give_amount + new_amount), sprite_number];
  2424. }
  2425.  
  2426. give_list_mod_snip += [item_word,(give_amount + new_amount), sprite_number];
  2427.  
  2428.  
  2429.  
  2430. }
  2431.  
  2432. combined_lists = "taking_l," + llDumpList2String (taking_l,",") + "|" + "take_snip," + llDumpList2String (take_list_mod_snip,",")
  2433. + "|" + "l_giving," + llDumpList2String (l_giving,",") + "|" + "give_snip," + llDumpList2String (give_list_mod_snip,",") ;
  2434.  
  2435.  
  2436. return combined_lists;
  2437.  
  2438.  
  2439.  
  2440.  
  2441. }
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459. string inventory_state;
  2460.  
  2461. integer DebugMessaging = TRUE;
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468. list tradeInventory;
  2469.  
  2470. float grid_x = 10.0;
  2471. float grid_y = 10.0;
  2472.  
  2473.  
  2474.  
  2475. integer inv_start;
  2476. integer inv_end;
  2477.  
  2478.  
  2479. string item;
  2480. list amount;
  2481. string command;
  2482.  
  2483.  
  2484. set_link_texture_grid(integer link,integer face, string texture, integer num, integer x, integer y)
  2485. {
  2486. float step_x = 1.0 / (float)x;
  2487. float step_y = 1.0 / (float)y;
  2488. integer part_x = num % x;
  2489. integer part_y = num / x;
  2490. float pos_y = -0.5+step_y/2.0 + step_y*(float)(y-part_y-1);
  2491. float pos_x = -0.5+step_x/2.0 + step_x*(float)part_x;
  2492. llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face,texture,<step_x,step_y,0>,<pos_x,pos_y,0>,0.0]);
  2493. }
  2494.  
  2495.  
  2496.  
  2497. integer link_clicked;
  2498. string link_name;
  2499. string link_description;
  2500. integer face_clicked;
  2501.  
  2502. list List_AlterItems_Colour(vector colour, list ListChange, integer list_limit, string inventory_name, integer new_num)
  2503. {
  2504.  
  2505. if ( llList2Vector( llGetLinkPrimitiveParams(link_clicked,[ PRIM_COLOR,face_clicked]),0) == colour)
  2506. {
  2507. llSetLinkPrimitiveParamsFast(link_clicked,[ PRIM_COLOR,face_clicked, <1,1,1>, 1.0 ]);
  2508.  
  2509. if ( llListFindList(ListChange,[inventory_name]) != -1 )
  2510. {
  2511. integer index = llListFindList(ListChange,[inventory_name]);
  2512. ListChange = llDeleteSubList(ListChange,index,index+2);
  2513. }
  2514. }
  2515.  
  2516. else if (llGetListLength(ListChange) > list_limit*3-1)
  2517. llOwnerSay("Only " + (string)list_limit + " items allowed in Trade Bucket, please remove items");
  2518.  
  2519. else if ( llGetListLength(ListChange) < list_limit*3+1)
  2520. {
  2521. llSetLinkPrimitiveParamsFast(link_clicked,
  2522. [ PRIM_COLOR,face_clicked, colour, 1.0 ]);
  2523.  
  2524. if( llListFindList(ListChange,[inventory_name])==-1 )
  2525. ListChange += [inventory_name] + [new_num] + [inventory_sprite_num];
  2526.  
  2527.  
  2528.  
  2529. }
  2530.  
  2531. ListChange = AZ_09Lists2(ListChange,"AZ");
  2532. return ListChange;
  2533. }
  2534.  
  2535.  
  2536.  
  2537. list AZ_09Lists2(list Inventory_list, string command)
  2538. {
  2539.  
  2540.  
  2541. if(command == "AZ")
  2542. {
  2543. list reordered_list_az = llListSort(Inventory_list, 3, TRUE );
  2544.  
  2545. return reordered_list_az;
  2546. }
  2547.  
  2548. if(command == "0-9")
  2549. {
  2550. integer i;
  2551. list numerical;
  2552.  
  2553.  
  2554. for (i=0; i<llGetListLength(Inventory_list); i+=3)
  2555. {
  2556. numerical += llList2Integer(Inventory_list,i+1);
  2557. numerical += llList2String(Inventory_list,i);
  2558. numerical += llList2Integer(Inventory_list,i+2);
  2559. }
  2560.  
  2561. numerical = llListSort(numerical, 3, TRUE );
  2562.  
  2563. return numerical;
  2564. }
  2565.  
  2566.  
  2567. return [];
  2568. }
  2569.  
  2570.  
  2571.  
  2572.  
  2573. string saving;
  2574. integer clicked_times;
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.  
  2585.  
  2586.  
  2587.  
  2588.  
  2589.  
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600. integer comm_chan = -5421422;
  2601. integer action_chan = 42;
  2602. integer menu_chan;
  2603. integer menu_handle;
  2604.  
  2605. set_listens()
  2606. {
  2607.  
  2608. llListen(comm_chan, "", NULL_KEY, "");
  2609.  
  2610.  
  2611. llListen(action_chan, "", owner_id, "");
  2612.  
  2613.  
  2614. llListenRemove(menu_handle);
  2615. menu_chan = ((integer)("0x"+llGetSubString((string)llGetKey(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF;
  2616. menu_handle = llListen(menu_chan, "", NULL_KEY, "");
  2617. }
  2618.  
  2619.  
  2620.  
  2621. list av_names;
  2622. list av_buttons;
  2623. key owner_id;
  2624. string owner_name;
  2625. key player_id;
  2626. string player_name;
  2627.  
  2628. string player_call;
  2629. string cur_action;
  2630. string secondary_action;
  2631.  
  2632. key requesting_avatar_id;
  2633.  
  2634. string trade_emote;
  2635. string Gs_Trade_State;
  2636. list Gl_Trade_agreement;
  2637.  
  2638. trader_menu()
  2639. {
  2640.  
  2641. string text = "\nYour currently trading with " + partner_name + ".\n\nChoose who you would like to next trade with.\n\nNearby Avatars:";
  2642.  
  2643. integer i;
  2644.  
  2645.  
  2646. for (i = 0; i < llGetListLength(av_names); i++)
  2647. {
  2648. text += "\n" + (string)(i+1) + ". " + llList2String(av_names, i);
  2649. }
  2650.  
  2651.  
  2652. llDialog(owner_id, text, av_buttons, menu_chan);
  2653. cur_action = "";
  2654. }
  2655.  
  2656. new_partner(key new_partner)
  2657. {
  2658.  
  2659.  
  2660.  
  2661. if (partner_id != NULL_KEY && partner_id != new_partner)
  2662. llRegionSayTo(partner_id, comm_chan, "not partnered");
  2663.  
  2664. partner_id = new_partner;
  2665. partner_name = llKey2Name(partner_id);
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682. llDialog(owner_id, "\nYour actions will now go to " + partner_name + " until you select another avatar to play with.", ["OK"], menu_chan);
  2683. }
  2684.  
  2685. trade_transaction()
  2686. {
  2687.  
  2688. llRegionSayTo(partner_id, comm_chan, "ConfirmFinish");
  2689. Gs_Trade_State = "";
  2690. Gl_Trade_agreement = [];
  2691.  
  2692.  
  2693. string packed = ModifyLists2(-1000, "ListChangeGive", Gl_IncomingTrade, inventory,[]);
  2694. list bundle = llParseString2List( packed,["|"],[""]);
  2695. inventory = llCSV2List ( llList2String(bundle,0) );
  2696. list inv_update = llCSV2List ( llList2String(bundle,1) );
  2697.  
  2698.  
  2699. packed = ModifyLists2(-1000, "ListChangeTake", GL_Sell_Bucket, inventory,[]);
  2700. inventory = llCSV2List ( llList2String(bundle,0) );
  2701. inv_update += llCSV2List ( llList2String(bundle,1) );
  2702. Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,ZERO_VECTOR );
  2703.  
  2704.  
  2705. GL_Sell_Bucket = [];
  2706. Gl_IncomingTrade = [];
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712. Update_Inventory_Display("ChangerList",[], GL_Sell_Bucket,Sell_prims,ZERO_VECTOR );
  2713. Update_Inventory_Display("ChangerList",[], Gl_IncomingTrade,Gl_IncomingTrade_Prims,ZERO_VECTOR );
  2714.  
  2715. llOwnerSay("Congratulations you have just traded with " + partner_name + " consisting of: " +
  2716. trade_emote );
  2717. }
  2718.  
  2719.  
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791. default
  2792. {
  2793. state_entry()
  2794. {
  2795.  
  2796.  
  2797.  
  2798. llListen(0,"",NULL_KEY,"");
  2799. inventory_links = Index_Inventory_PrimLinks( "Inv:");
  2800. Sell_prims = Index_Inventory_PrimLinks("Sel:");
  2801. Gl_IncomingTrade_Prims = Index_Inventory_PrimLinks("Oth:");
  2802. llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_hidden]);
  2803.  
  2804.  
  2805.  
  2806.  
  2807. list prim_resetTo_white = inventory_links + Sell_prims + Gl_IncomingTrade;
  2808. integer i;
  2809. for (i=0; i < llGetListLength(prim_resetTo_white)+1 ; i++)
  2810. {
  2811. integer prim = llList2Integer(prim_resetTo_white,i);
  2812. llSetLinkPrimitiveParamsFast(prim,
  2813. [ PRIM_COLOR,ALL_SIDES, <1.0,1.0,1.0>, 1.0 ]);
  2814. }
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820. inventory = AZ_09Lists2(inventory,"AZ");
  2821. Update_Inventory_Display("SameList",inventory, inventory,inventory_links,<1,1,1>);
  2822.  
  2823.  
  2824. Update_Inventory_Display("ChangerList",GL_Temporary_Bucket, GL_Sell_Bucket,Sell_prims,<0,1,0>);
  2825. Update_Inventory_Display("ChangerList",[], Gl_IncomingTrade,Gl_IncomingTrade_Prims,ZERO_VECTOR );
  2826.  
  2827. owner_id = llGetOwner();
  2828. owner_name = llKey2Name(owner_id);
  2829. set_listens();
  2830.  
  2831.  
  2832.  
  2833. }
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847. on_rez(integer start_param)
  2848. {
  2849. owner_id = llGetOwner();
  2850. owner_name = llKey2Name(owner_id);
  2851. set_listens();
  2852.  
  2853.  
  2854. if (owner_id == temp_if_id)
  2855. {
  2856. llSay(0, "TempIDFound");
  2857. partner_id= "42e9405d-19f6-4bd5-8b9a-00436a5da1b4";
  2858. partner_name = "Reishi";
  2859. }
  2860. }
  2861.  
  2862.  
  2863.  
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877. touch_start(integer total_number)
  2878. {
  2879. link_clicked = llDetectedLinkNumber(0);
  2880. link_name = llGetLinkName(link_clicked);
  2881. link_description = llList2String( llGetLinkPrimitiveParams(link_clicked,[PRIM_DESC]),0);
  2882. face_clicked = llDetectedTouchFace(0);
  2883.  
  2884.  
  2885.  
  2886. llSay(0, llList2String (llGetLinkPrimitiveParams(accept_link, [ PRIM_ROT_LOCAL ]) ,0) );
  2887. if (link_name=="TempButton")
  2888. {
  2889. trade_transaction();
  2890. llSay(0, llDumpList2String(inventory, ",") );
  2891. }
  2892.  
  2893. if (link_name=="NormalMode")
  2894. {
  2895.  
  2896. llSay(0,link_name );
  2897.  
  2898.  
  2899. Update_Inventory_Display("ChangerList",[], [], Sell_prims,<1,1,1>);
  2900.  
  2901.  
  2902. string packed;
  2903. packed = ModifyLists2(-1000, "ListChangeGive", GL_Sell_Bucket, inventory, []);
  2904. list bundle = llParseString2List( packed,["|"],[""]);
  2905.  
  2906. inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;
  2907. list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
  2908.  
  2909. llSay(0, llDumpList2String(inventory, ",") );
  2910. Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,<1,1,1> );
  2911. llSay(0, "inv_update" + llDumpList2String(inv_update, ",") );
  2912. Colour_menu_facesFrom_list(GL_Temporary_Bucket,inventory, inventory_links, <1,1,1>);
  2913. GL_Temporary_Bucket = [];
  2914. inventory_state = "NormalMode";
  2915. }
  2916.  
  2917. else if (link_name=="BasketState")
  2918. {
  2919.  
  2920. llSay(0, "inv_update" + llDumpList2String(GL_Temporary_Bucket, ",") );
  2921. string packed;
  2922. packed = ModifyLists2(-1000, "ListChangeTake", GL_Sell_Bucket, inventory, []);
  2923. list bundle = llParseString2List( packed,["|"],[""]);
  2924. inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;
  2925. list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
  2926.  
  2927.  
  2928. Update_Inventory_Display("SameList",GL_Sell_Bucket, GL_Sell_Bucket, Sell_prims,<0,1,0>);
  2929. Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,<1,0,0> );
  2930.  
  2931.  
  2932. inventory_state = "BasketState";
  2933. llOwnerSay("Basket State Active");
  2934. }
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942. else if (llGetSubString(link_description,0,3)=="Inv:" || llGetSubString(link_description,0,3)=="Sel:")
  2943. {
  2944. if (llGetSubString(link_description,0,3)=="Inv:")
  2945. {
  2946. link_click2_inventory_item_name(link_clicked,face_clicked,inventory);
  2947. Index_info_grabber(inventory_name_s,inventory);
  2948. }
  2949. else if (llGetSubString(link_description,0,3)=="Sel:")
  2950. {
  2951. link_click2_inventory_item_name(link_clicked,face_clicked,GL_Sell_Bucket);
  2952. Index_info_grabber(inventory_name_s,GL_Sell_Bucket);
  2953. }
  2954.  
  2955.  
  2956. }
  2957.  
  2958. if (inventory_state == "NormalMode")
  2959. {
  2960. if (llGetSubString(link_description,0,3)=="Inv:")
  2961. {
  2962.  
  2963. if (Gl_Use_click_bank!=inventory_name_s)
  2964. {
  2965. llSetLinkPrimitiveParamsFast(Gi_old_link, [ PRIM_COLOR, Gi_old_face,<1,1,1>, 1.0 ]);
  2966. Gi_old_link= link_clicked;
  2967. Gi_old_face= face_clicked;
  2968.  
  2969. llOwnerSay("Are you sure you want to use " + inventory_name_s + ", click item again to confirm");
  2970. Gl_Use_click_bank = inventory_name_s;
  2971. llSetLinkPrimitiveParamsFast(link_clicked, [ PRIM_COLOR, face_clicked,<0.502, 1.000, 1.000>, 1.0 ]);
  2972.  
  2973. }
  2974.  
  2975. else if (Gl_Use_click_bank==inventory_name_s)
  2976. {
  2977. Gl_Use_click_bank;
  2978. llSetLinkPrimitiveParamsFast(link_clicked, [ PRIM_COLOR, face_clicked,<1,1,1>, 1.0 ]);
  2979.  
  2980.  
  2981.  
  2982. if (inventory_amount-1 <1)
  2983. {
  2984. llOwnerSay("You have used all your " + inventory_name_s +"s");
  2985. inventory = llDeleteSubList (inventory, inventory__name_index,inventory__name_index+2);
  2986. Update_Inventory_Display("SameList",inventory, inventory,inventory_links,ZERO_VECTOR );
  2987. }
  2988.  
  2989. else
  2990. {
  2991. llOwnerSay("You used a " + inventory_name_s);
  2992. GL_Temporary_Bucket = [inventory_name_s,inventory_amount-1,inventory_sprite_num]; inventory = List2List_Update(GL_Temporary_Bucket, inventory);
  2993.  
  2994. Update_Inventory_Display("ChangerList",GL_Temporary_Bucket, inventory,inventory_links,ZERO_VECTOR );
  2995.  
  2996. }
  2997.  
  2998. llSay(0, llDumpList2String(inventory,",") );
  2999. Gl_Use_click_bank="";
  3000.  
  3001.  
  3002.  
  3003. }
  3004. }
  3005.  
  3006. }
  3007.  
  3008. if (inventory_state == "BasketState")
  3009. {
  3010. if (face_clicked ==0 || face_clicked == 4)
  3011. {
  3012. if(llGetSubString(link_description,0,3)=="Inv:")
  3013. {
  3014. GL_Temporary_Bucket = List_AlterItems_Colour(<1, 0.445, 0>,GL_Temporary_Bucket,8,inventory_name_s,0);
  3015. llSay(0, "GL_Temporary_Bucket List - " + llDumpList2String(GL_Temporary_Bucket,",") );
  3016. }
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023. }
  3024.  
  3025. if (llGetSubString(link_name,0,6)=="Bucket:" )
  3026. {
  3027. string num = llGetSubString(link_name,7,llStringLength(link_name));
  3028.  
  3029. if (num=="Reset")
  3030. num = "-1000";
  3031.  
  3032. integer amount_change = (integer)num;
  3033.  
  3034.  
  3035.  
  3036. if (llGetListLength(GL_Temporary_Bucket)>2)
  3037.  
  3038. {
  3039.  
  3040.  
  3041. llSay(0,"Sell Bucket before - " + llDumpList2String(GL_Sell_Bucket,",") );
  3042. string packed;
  3043. packed = ModifyLists2(amount_change, "SingleAmount", GL_Temporary_Bucket, inventory, GL_Sell_Bucket);
  3044. list bundle = llParseString2List( packed,["|"],[""]);
  3045. inventory = llListReplaceList( llCSV2List ( llList2String(bundle,0) ),[],0,0 ) ;
  3046. GL_Sell_Bucket = llListReplaceList( llCSV2List ( llList2String(bundle,2) ),[],0,0 ) ;
  3047.  
  3048.  
  3049. llSay(0,"inventory - " + llDumpList2String(inventory,",") );
  3050. llSay(0,"GL_Sell_Bucket - " + llDumpList2String(GL_Sell_Bucket,",") );
  3051. llSay(0,"Sell Bucket Length - " + (string)llGetListLength(GL_Sell_Bucket) );
  3052.  
  3053.  
  3054.  
  3055. llSay(0,"cotains 0 flag - " + (string)Gi_contains_zero);
  3056.  
  3057. if(Gi_contains_zero == TRUE)
  3058. Update_Inventory_Display("SameList",inventory, inventory,inventory_links,ZERO_VECTOR );
  3059.  
  3060. else
  3061. {
  3062. list inv_update = llListReplaceList( llCSV2List ( llList2String(bundle,1) ),[],0,0 ) ;
  3063. Update_Inventory_Display("ChangerList",inv_update, inventory,inventory_links,ZERO_VECTOR );
  3064.  
  3065. }
  3066.  
  3067. Update_Inventory_Display("SameList",GL_Sell_Bucket, GL_Sell_Bucket,Sell_prims,ZERO_VECTOR );
  3068. }
  3069.  
  3070.  
  3071. else if (llGetListLength(GL_Temporary_Bucket)<3)
  3072. llOwnerSay("Active more items in the trade bucket!");
  3073.  
  3074. }
  3075.  
  3076.  
  3077. }
  3078.  
  3079. if (link_name == "TradeRadar")
  3080. {
  3081. cur_action = "partner";
  3082. llSay(0, "?");
  3083. llSay(comm_chan, "?");
  3084.  
  3085. }
  3086.  
  3087.  
  3088. else if (link_name == "ProposeTrade")
  3089. {
  3090. string trade_message = "TradeProposed|" + llDumpList2String(GL_Sell_Bucket,",");
  3091. trade_emote;
  3092. integer i;
  3093.  
  3094. for (i=0; i < llGetListLength(GL_Sell_Bucket) ; i+=3)
  3095. {
  3096.  
  3097. trade_emote += llList2String(GL_Sell_Bucket,i) + "," + llList2String(GL_Sell_Bucket,i+1) + ",";
  3098. }
  3099.  
  3100. llOwnerSay("You have proposed a trade to " + partner_name + " consisting of: " +
  3101. trade_emote );
  3102.  
  3103. llRegionSayTo(partner_id, comm_chan, trade_message);
  3104.  
  3105.  
  3106. llRegionSayTo(partner_id, 0, owner_name + " would like to trade the following items: " + trade_emote);
  3107.  
  3108.  
  3109.  
  3110.  
  3111.  
  3112. if (Gs_Trade_State == "TradeAgreed_Countdown" || llListFindList(Gl_Trade_agreement,["Other"]) !=-1 )
  3113. llOwnerSay("You cancelled the agreement making a new proposal");
  3114.  
  3115. Gl_Trade_agreement = [];
  3116. Gs_Trade_State = "Proposals";
  3117. llSetTimerEvent(0.0);
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125. }
  3126.  
  3127. else if (link_name == "TradeAgree" && Gs_Trade_State != "ConfirmFinish" )
  3128. {
  3129.  
  3130.  
  3131. llRegionSayTo(partner_id, comm_chan, "TradeAgree");
  3132.  
  3133.  
  3134.  
  3135. if (llListFindList(Gl_Trade_agreement,["Other"]) !=-1)
  3136. {
  3137. Gl_Trade_agreement += ["Self"];
  3138. Gs_Trade_State = "TradeAgreed_Countdown";
  3139. 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.");
  3140. llSetTimerEvent(0.1);
  3141.  
  3142. }
  3143.  
  3144. else
  3145. {
  3146. Gl_Trade_agreement = ["Self"];
  3147. llOwnerSay("You have agreed the proposal. If " + partner_name + " agrees you will start the trade count down") ;
  3148. }
  3149.  
  3150. llSay(0, llDumpList2String(Gl_Trade_agreement,",") );
  3151.  
  3152. llSay(0, Gs_Trade_State);
  3153. llSay(0, "Sent - Proposals");
  3154.  
  3155. }
  3156.  
  3157. else if (link_name == "ConfirmFinish" && Gs_Trade_State == "ConfirmFinish")
  3158. {
  3159.  
  3160. llSay(0, "Clicker Confirm Sent");
  3161. llRegionSayTo(partner_id, comm_chan, "ConfirmFinish");
  3162. Gs_Trade_State = "SentMessage";
  3163.  
  3164.  
  3165.  
  3166. llSay(0, Gs_Trade_State);
  3167.  
  3168. }
  3169.  
  3170.  
  3171. else if (link_name == "AcceptAction")
  3172. {
  3173.  
  3174. if (cur_action == "partner")
  3175. {
  3176. llSay(0,(string)face_clicked);
  3177. if (face_clicked == 1)
  3178. {
  3179.  
  3180.  
  3181. llRegionSayTo(requesting_avatar_id, comm_chan, "accepted");
  3182. llOwnerSay("You accept " + partner_name + "'s " + cur_action + " request.");
  3183.  
  3184. llRegionSayTo(requesting_avatar_id, 0, owner_name + " accepted your request to play.");
  3185. new_partner(requesting_avatar_id);
  3186.  
  3187. llSay(0, (string)partner_id );
  3188. }
  3189.  
  3190. else if (face_clicked == 2)
  3191. llRegionSayTo(requesting_avatar_id, 0, owner_name + " turned down your request to play.");
  3192.  
  3193.  
  3194. llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_hidden]);
  3195. }
  3196. }
  3197.  
  3198.  
  3199. }
  3200.  
  3201.  
  3202. listen(integer channel, string name, key id, string msg)
  3203. {
  3204. if (channel == comm_chan)
  3205. {
  3206. llSay(0, "Comm chan message is - " + msg);
  3207.  
  3208. if (msg == "?")
  3209. {
  3210. av_names = [];
  3211. av_buttons = [];
  3212.  
  3213. llRegionSayTo(id, comm_chan, "!");
  3214. }
  3215.  
  3216. else if (msg == "!" && llGetOwnerKey(id) != owner_id )
  3217. {
  3218. string av_name = llKey2Name(llGetOwnerKey(id));
  3219.  
  3220. if (llListFindList(av_names, [av_name]) == -1)
  3221. {
  3222. av_names += av_name;
  3223. av_buttons += (string)(llGetListLength(av_names));
  3224. }
  3225.  
  3226. if (llGetListLength(av_names) == 12)
  3227. {
  3228. trader_menu();
  3229. }
  3230. else
  3231. {
  3232. llSetTimerEvent(1.0);
  3233.  
  3234. }
  3235.  
  3236. }
  3237.  
  3238. else if (msg == "Partner?")
  3239. {
  3240.  
  3241. cur_action = "partner";
  3242. llSetLinkPrimitiveParamsFast(accept_link, [PRIM_ROT_LOCAL, accept_rot_visible]);
  3243.  
  3244. requesting_avatar_id = llGetOwnerKey(id);
  3245. string av_name = llKey2Name(requesting_avatar_id);
  3246.  
  3247. llOwnerSay(av_name + " has sent a " + cur_action + " request.");
  3248.  
  3249. cur_action = "partner";
  3250.  
  3251.  
  3252. requesting_avatar_id = llGetOwnerKey(id);
  3253. }
  3254.  
  3255. else if (msg == "accepted")
  3256. {
  3257.  
  3258.  
  3259.  
  3260. new_partner(llGetOwnerKey(id));
  3261. }
  3262.  
  3263.  
  3264. else if ( llGetSubString(msg,0,13) == "TradeProposed|" /*&& llGetOwnerKey(id) == partner_id*/)
  3265. {
  3266. llSay(0, "Received");
  3267.  
  3268. string incoming_t = llGetSubString(msg,14,llStringLength(msg) );
  3269. Gl_IncomingTrade = llCSV2List(incoming_t);
  3270. Update_Inventory_Display("SameList",Gl_IncomingTrade, Gl_IncomingTrade,Gl_IncomingTrade_Prims,<1, 1,0> );
  3271.  
  3272.  
  3273.  
  3274.  
  3275. if (Gs_Trade_State == "TradeAgreed_Countdown" || llListFindList(Gl_Trade_agreement,["Self"]) !=-1)
  3276. {
  3277. llOwnerSay(partner_name + " has sent a new trade proposal, Agreement has been reset");
  3278. llSetTimerEvent(0.0);
  3279. llSay(0, "A new proposal has been sent by " + partner_name +", Agreement Reset");
  3280.  
  3281. }
  3282.  
  3283. else
  3284. {
  3285. llOwnerSay(partner_name + " has sent a new trade proposal.");
  3286. }
  3287. llSetTimerEvent(0.0);
  3288.  
  3289. Gs_Trade_State = "Proposals";
  3290. Gl_Trade_agreement = [];
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296. }
  3297.  
  3298. else if ( msg == "TradeAgree") /*&& llGetOwnerKey(id) == partner_id*/
  3299. {
  3300.  
  3301. if (llListFindList(Gl_Trade_agreement,["Self"]) !=-1)
  3302. {
  3303. Gl_Trade_agreement += ["Other"];
  3304. Gs_Trade_State = "TradeAgreed_Countdown";
  3305. 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.");
  3306. llSetTimerEvent(0.1);
  3307.  
  3308. }
  3309.  
  3310. else
  3311. {
  3312. Gl_Trade_agreement = ["Other"];
  3313. llOwnerSay(partner_name + " has agreed to the trade. Click agree to confirm or change proposal");
  3314. }
  3315.  
  3316.  
  3317.  
  3318.  
  3319.  
  3320. }
  3321.  
  3322. }
  3323.  
  3324.  
  3325. if ( msg == "ConfirmFinish" && Gs_Trade_State == "SentMessage" )
  3326. {
  3327. trade_transaction();
  3328. }
  3329.  
  3330. else if ( msg == "ConfirmFinish" && Gs_Trade_State == "ConfirmFinish" )
  3331. {
  3332. trade_transaction();
  3333. }
  3334.  
  3335.  
  3336. if (channel == menu_chan && id == owner_id)
  3337. {
  3338.  
  3339.  
  3340.  
  3341.  
  3342. if (llListFindList(av_buttons, [msg]) != -1)
  3343. {
  3344. string av_name = llList2String(av_names, (integer)msg -1);
  3345. string av_id = llName2Key(av_name);
  3346.  
  3347. if (av_id == NULL_KEY)
  3348. {
  3349. llDialog(id, "\n" + av_name + " is no longer in the region. Please select another avatar.", ["OK"], menu_chan);
  3350. }
  3351. else
  3352. {
  3353. llSay(0,"sent");
  3354. llSay(0,(string)av_id );
  3355.  
  3356. llDialog(owner_id, "Sending request to TRADE to " + av_name, ["OK"], menu_chan);
  3357. llRegionSayTo(av_id, comm_chan, "Partner?");
  3358. }
  3359. }
  3360. }
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.  
  3376.  
  3377.  
  3378. }
  3379.  
  3380. timer()
  3381. {
  3382. if(cur_action == "partner")
  3383. {
  3384. if (llGetListLength(av_names) > 0)
  3385. trader_menu();
  3386. else
  3387. llDialog(owner_id, "There are no nearby avatars wearing Sex HUDs found.", ["OK"], menu_chan);
  3388. llSetTimerEvent(0.0);
  3389. }
  3390.  
  3391. if (Gs_Trade_State == "TradeAgreed_Countdown")
  3392. {
  3393. llSay(0, "Proposal Countdown Started - " + Gs_Trade_State);
  3394. llSetTimerEvent(5.0);
  3395.  
  3396. Gs_Trade_State = "FinishedOpen";
  3397. }
  3398.  
  3399. else if (Gs_Trade_State == "FinishedOpen")
  3400. {
  3401.  
  3402. Gs_Trade_State = "ConfirmFinish";
  3403. llSay(0,"State in " + Gs_Trade_State);
  3404.  
  3405.  
  3406. llSetTimerEvent(0.0);
  3407.  
  3408. }
  3409.  
  3410. }
  3411.  
  3412. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement