Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. make a new script file.. caled UpdateGroup in name at top middle (or right) i think this is the function it will call for the handlers...
  2.  
  3. in add user event handler: right side, middle small little text box put "msdp.HEALTH" and press enter
  4. this means this script will get msdp updates.. and it gets all at once so just really need one to activate
  5.  
  6. CODE BELOW:
  7.  
  8.  
  9.  
  10.  
  11.  
  12. -- check if you are in a group right now..
  13. function in_group()
  14. count = 0
  15.  
  16. for a,b in pairs(msdp.GROUP) do
  17. count = count + 1
  18. end
  19.  
  20. if count > 1 then
  21. return true
  22. end
  23.  
  24. return false
  25. end
  26.  
  27. -- how many users in the group? (i check if its above 3-4 so i know its a major xp run so i can ignore some things)
  28. function groupcount()
  29. local gcount = 0
  30. for a,b in pairs(msdp.GROUP) do
  31. gcount = gcount + 1
  32. end
  33. return gcount
  34. end
  35.  
  36. -- check if a user is a member of your group.. so you can do bigger triggers more dynamic
  37. function group_member(which)
  38. for a,b in pairs(msdp.GROUP) do
  39. if b["NAME"] == which then
  40. return true
  41. end
  42. end
  43. return false
  44. end
  45.  
  46. -- get the name of specific position in your group ie, Leader
  47. function group_position(which)
  48. for a,b in pairs(msdp.GROUP) do
  49. if b["POSITION"] == which then
  50. return b["NAME"]
  51. end
  52. end
  53. return false
  54. end
  55.  
  56.  
  57. function makegroup()
  58. if in_group() ~= true then
  59. return
  60. end
  61. height = 250
  62. createMiniConsole("GroupWindow",0,0,350,height)
  63. setMiniConsoleFontSize("GroupWindow", 12)
  64. setBackgroundColor("GroupWindow",255,200,0,20)
  65. end
  66.  
  67. function pairsByKeys (t, f)
  68. local a = {}
  69. for n in pairs(t) do table.insert(a, n) end
  70. table.sort(a, f)
  71. local i = 0 -- iterator variable
  72. local iter = function () -- iterator function
  73. i = i + 1
  74. if a[i] == nil then return nil
  75. else return a[i], t[a[i]]
  76. end
  77. end
  78. return iter
  79. end
  80.  
  81. function cechowin(win,s)
  82. for colour, text in string.gmatch("<white>"..s, "<([a-z_]+)>([^<>]+)") do
  83. setFgColor(win, color_table[colour][1], color_table[colour][2], color_table[colour][3])
  84. echo(win,text)
  85. stats_linecount = stats_linecount + 1
  86. end
  87. --echo(win,"\n")
  88. end
  89.  
  90.  
  91. -- display stats in window
  92. function gstats()
  93. clearWindow("GroupWindow")
  94. line_count = 0
  95.  
  96. for n,e in pairsByKeys(msdp.GROUP) do
  97. cechowin("GroupWindow",e["NAME"].." ["..e["CLASS"].."]")
  98. l = string.len(e["NAME"])
  99. for i = 12 - l, 1, -1 do
  100. cechowin("GroupWindow"," ")
  101. end
  102.  
  103. hp_color = "white"
  104. hp_str = " H:<"..hp_color..">"..e["HITPOINTS"].."<white>/"..e["MAX_HITPOINTS"]..""
  105. cechowin("GroupWindow",hp_str)
  106. l = string.len(hp_str)
  107. for i = 29 - l, 1, -1 do
  108. cechowin("GroupWindow"," ")
  109. end
  110.  
  111.  
  112. mana_color = "white"
  113. mp_str = " M:<"..mana_color..">"..e["MANA"].."<white>/"..e["MAX_MANA"]..""
  114. cechowin("GroupWindow",mp_str)
  115. l = string.len(mp_str)
  116. for i = 29 - l, 1, -1 do
  117. cechowin("GroupWindow"," ")
  118. end
  119.  
  120. move_color = "white"
  121. mv_str = " V:<"..move_color..">"..e["MOVES"].."<white>/"..e["MAX_MOVES"]..""
  122. cechowin("GroupWindow",mv_str)
  123. l = string.len(mv_str)
  124. for i = 29 - l, 1, -1 do
  125. cechowin("GroupWindow"," ")
  126. end
  127.  
  128.  
  129.  
  130.  
  131.  
  132. cechowin("GroupWindow","\n")
  133.  
  134. line_count = line_count + 1
  135. end
  136.  
  137. height = line_count * 20
  138. createMiniConsole("GroupWindow",0,0,580,height)
  139. end
  140.  
  141.  
  142.  
  143.  
  144. function UpdateGroup()
  145. stat_linecount = 0
  146.  
  147. if in_group() == true and group_hide ~= true then
  148. makegroup()
  149. showWindow("GroupWindow")
  150. clearWindow("GroupWindow")
  151. gstats()
  152. if always_invisible == true then
  153. always_invisible = false
  154. end
  155. else
  156. hideWindow("GroupWindow")
  157. end
  158. end
  159.  
  160.  
  161.  
  162. -------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement