Advertisement
abitoftaste

Untitled

Sep 2nd, 2023 (edited)
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. Begin x1DenCurMtS
  2. ; in ANY programming language, identifiers should start with a letter and only include a..z, A..Z letters, 0..9 digits, underscore
  3.  
  4. Short count
  5.  
  6. ; Morrowind scripting is a Basic-like language,
  7. ; a function ( e.g. one starting with Get ) needs to be used by a variable,
  8. ; a procedure ( e.g. RemoveItem ) does not
  9. ; RemoveItem procedure does not work with variables
  10. ; so you need to do 1 move per frame or use a while loop.
  11. ; 1 move per frame will be slow, while could apparently freeze the screen while running.
  12. ; using multiple While loops is usually the preferred method
  13.  
  14. if ( MenuMode )
  15. else
  16. return
  17. endif
  18.  
  19. ; Morrowind scripting parser is very delicate, it easily breaks at runtime
  20. ; if you do not use proper spacing. Also better not use commas.
  21. Set count to ( GetItemCount "x1totem_of_will_masser" )
  22. ; fastest loop would be using binary steps e.g.
  23.  
  24. while ( count >= 16 )
  25. RemoveItem "x1totem_of_will_masser" 16
  26. AddItem "x1totem_of_will" 16
  27. ; decreasing the local variable is faster than calling the function
  28. set count to ( count - 16 )
  29. endwhile
  30.  
  31. while ( count >= 8 )
  32. RemoveItem "x1totem_of_will_masser" 8
  33. AddItem "x1totem_of_will" 8
  34. set count to ( count - 8 )
  35. endwhile
  36.  
  37. while ( count >= 4 )
  38. RemoveItem "x1totem_of_will_masser" 4
  39. AddItem "x1totem_of_will" 4
  40. set count to ( count - 4 )
  41. endwhile
  42.  
  43. while ( count >= 2 )
  44. RemoveItem "x1totem_of_will_masser" 2
  45. AddItem "x1totem_of_will" 2
  46. set count to ( count - 2 )
  47. endwhile
  48.  
  49. if ( count == 1 ) ; last one
  50. RemoveItem "x1totem_of_will_masser" 1
  51. AddItem "x1totem_of_will" 1
  52. endif
  53.  
  54. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement