Advertisement
Guest User

LSL Parse to list error?

a guest
Apr 23rd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /************************************************
  2. Hi all! Need some help please!!
  3.  
  4. Integer -> String -> List using digits as separators
  5. --> Append 0s to the front to create 4 digits
  6.  
  7. For some reason, works fine except on 88, 89, 98 and 99. Not sure why it's not separating those two digits.
  8. Any ideas? As can be seen in output, 87 works just fine.
  9.  
  10. Output:::
  11.  
  12. Inventory Remaining: 87
  13. INVENTORY COUNT: 0|0|8|7
  14.  
  15. Inventory Remaining: 88
  16. INVENTORY COUNT: 0|0|0|88
  17.  
  18. Inventory Remaining: 89
  19.  INVENTORY COUNT: 0|0|0|89
  20. ***************************************************/
  21.  
  22. updateNumbers()
  23. {
  24.     // faces 1 - 4
  25.     itemCount = llGetInventoryNumber(INVENTORY_OBJECT);
  26.     llSay(0, "Inventory Remaining: " + (string)itemCount);
  27.     list numList = [];
  28.     numList = llParseString2List((string)itemCount, [], ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]);
  29.     if (llGetListLength(numList) > 4)
  30.     {
  31.         numList = ["9", "9", "9", "9"];
  32.     }
  33.     while (llGetListLength(numList) < 4)
  34.     {
  35.         numList = llListInsertList(numList, ["0"], 0);
  36.     }
  37.     llSay(0, "INVENTORY COUNT: " + llDumpList2String(numList,"|"));
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement