Advertisement
Syndran

Mudlet GMCP Group for Avatar

Apr 29th, 2020
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 5.73 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE MudletPackage>
  3. <MudletPackage version="1.001">
  4. <TimerPackage>
  5.         <Timer isActive="yes" isFolder="no" isTempTimer="no" isOffsetTimer="no">
  6.             <name>GroupUpdate</name>
  7.             <script>sendGMCP("char.Group.List")</script>
  8.             <command></command>
  9.             <packageName></packageName>
  10.             <time>00:00:10.000</time>
  11.         </Timer>
  12.     </TimerPackage>
  13.     <ScriptPackage>
  14.         <Script isActive="yes" isFolder="no">
  15.             <name>GroupUpdate</name>
  16.             <packageName></packageName>
  17.             <script>-------------------------------------------------
  18. --         Put your Lua functions here.        --
  19. --                                             --
  20. -- Note that you can also use external scripts --
  21. -------------------------------------------------
  22. function GroupUpdate()
  23.  
  24.  
  25. --hide all the labels
  26. for M,K in pairs(GroupieTable) do
  27. GroupieTable[M]:hide()
  28. end
  29.  
  30. --added test code for sleeping
  31. MyState = ""
  32. TheirState = ""
  33.  
  34. for k,v in ipairs(gmcp.Char.Group.List) do
  35.  
  36. GroupieTable[k]:show()
  37.  
  38. if(v.name == gmcp.Char.Status.character_name) then
  39. --this is what your doing
  40. MyState = v.position
  41. elseif(v.position == "Fight") then
  42. --someone else is fighting
  43. TheirState = "Fight"
  44. end
  45.  
  46.  
  47. NameLabel = Geyser.Label:new({
  48.   name = "NameLabel"..tostring(k),
  49.   x = "0", y = "0",
  50.   width = "22%", height = "90%",
  51.   fgColor = "yellow",
  52.   message = [["&lt;left&gt;"..v.name"..&lt;/left&gt;]]
  53. }, GroupieTable[k]) -- this is where we tell it what container to go into
  54. NameLabel:setColor(0,0,0,0)
  55. if(v.leader == true) then
  56. NameLabel:echo("&lt;b&gt;&lt;left&gt;&lt;span style='color: rgb(255,0,0)'&gt;"..v.name.."&lt;/left&gt;&lt;/b&gt;")
  57. else
  58. NameLabel:echo("&lt;left&gt;"..v.name.."&lt;/left&gt;")
  59. end
  60.  
  61. GroupInfoLabel = Geyser.Label:new({
  62.   name = "GroupInfoLabel"..tostring(k),
  63.   x = "22%", y = "0",
  64.   width = "13%", height = "90%",
  65.   fgColor = "yellow",
  66.   message = [["&lt;left&gt;"..v.name"..&lt;/left&gt;]]
  67. }, GroupieTable[k]) -- this is where we tell it what container to go into
  68. GroupInfoLabel:setColor(0,0,0,0)
  69. GroupInfoLabel:echo("&lt;left&gt;" .. v.race .. "-" .. v.class .. "&lt;/left&gt;")
  70.  
  71.  
  72. PositionLabel = Geyser.Label:new({
  73.   name = "PositionLabel"..tostring(k),
  74.   x = "36%", y = "0",
  75.   width = "12%", height = "90%",
  76.   fgColor = "white",
  77.   message = [["&lt;left&gt;"..v.name"..&lt;/left&gt;]]
  78. }, GroupieTable[k]) -- this is where we tell it what container to go into
  79. PositionLabel:setColor(0,0,0,0)
  80.  
  81. if(v.position == "Busy" or v.position == "STUN") then
  82. PositionLabel:echo("&lt;right&gt;&lt;span style='color: rgb(128,0,128)'&gt;" .. v.position .. "&lt;/right&gt;")
  83. elseif(v.position == "Rest") then
  84. PositionLabel:echo("&lt;right&gt;&lt;span style='color: rgb(0,255,0)'&gt;" .. v.position .. "&lt;/right&gt;")
  85. elseif(v.position == "Fight") then
  86. PositionLabel:echo("&lt;right&gt;&lt;span style='color: rgb(255,0,0)'&gt;" .. v.position .. "&lt;/right&gt;")
  87. elseif(v.position == "Stand") then
  88. PositionLabel:echo("&lt;right&gt;&lt;span style='color: rgb(0,255,0)'&gt;" .. v.position .. "&lt;/right&gt;")
  89. else
  90.  
  91. PositionLabel:echo("&lt;right&gt;" .. v.position .. "&lt;/right&gt;")
  92.  
  93. end
  94.  
  95. --GroupieTable[k]:echo(v.name.. "      " .. v.hp .. "/" .. v.maxhp .. "&lt;br&gt;".. v.mp .. "/" .. v.maxmp .. "        " .. v.position .. "&lt;br&gt; " )
  96.  
  97. hpbar = Geyser.Gauge:new({
  98.   name="hpbar"..tostring(k),
  99.   x="45%", y="3%",
  100.   width="25%", height="80%",
  101. },GroupieTable[k])
  102.  
  103. hpbar.front:setStyleSheet([[background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #f04141, stop: 0.1 #ef2929, stop: 0.49 #cc0000, stop: 0.5 #a40000, stop: 1 #cc0000);
  104.     border-top: 1px black solid;
  105.     border-left: 1px black solid;
  106.     border-bottom: 1px black solid;
  107.     border-radius: 2;
  108.     padding: 3px;]])
  109. hpbar.back:setStyleSheet([[background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FFFFFF, stop: 1 #FFFFFF);
  110.     border-width: 1px;
  111.     border-color: black;
  112.     border-style: solid;
  113.     border-radius: 2;
  114.     padding: 3px;]])
  115.  
  116. manabar = Geyser.Gauge:new({
  117.   name="manabar"..tostring(k),
  118.   x="72%", y="3%",
  119.   width="25%", height="80%",
  120. },GroupieTable[k])
  121. manabar.front:setStyleSheet([[background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #000099, stop: 0.1 #000099, stop: 0.49 #3399ff, stop: 0.5 #0000ff, stop: 1 #0033cc);
  122.     border-top: 1px black solid;
  123.     border-left: 1px black solid;
  124.     border-bottom: 1px black solid;
  125.     border-radius: 2;
  126.     padding: 3px;]])
  127. manabar.back:setStyleSheet([[background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FFFFFF, stop: 1 #FFFFFF);
  128.     border-width: 1px;
  129.     border-color: black;
  130.     border-style: solid;
  131.     border-radius: 2;
  132.     padding: 3px;]])
  133.    
  134.     temphp = v.hp
  135.     tempmax = v.maxhp
  136.     if(tonumber(temphp)&gt;tonumber(tempmax)) then temphp = tempmax end
  137.    
  138.     hpbar:setValue(tonumber(temphp),tonumber(tempmax),"&lt;center&gt;&lt;font-size ='4px'&gt;&lt;span style='color: rgb(0,0,0)'&gt;".. v.hp .. "/" .. v.maxhp .. "  HP&lt;/center&gt;")
  139.  
  140.     tempmana = v.mp
  141.     tempmaxmana = v.maxmp
  142.     if(tonumber(tempmana)&gt;tonumber(tempmaxmana)) then tempmana = tempmaxmana end
  143.    
  144. if(v.maxmp == null or v.maxmp == nill or v.maxmp == "0") then
  145. manabar:setValue(1,1,"&lt;center&gt;&lt;font-size ='5px'&gt;No MP&lt;/center&gt;")
  146. else
  147. manabar:setValue(tonumber(tempmana),tonumber(tempmaxmana),"&lt;center&gt;&lt;font-size ='4px'&gt;&lt;span style='color: rgb(0,0,0)'&gt;".. v.mp .. "/" .. v.maxmp .. "&lt;/center&gt;")
  148. end
  149.  
  150. end
  151. --outside of loop.. report back findings
  152. if(MyState == "Sleep" and TheirState == "Fight") then
  153. echo("groupies fighting")
  154. end
  155. --end function
  156. end
  157. </script>
  158.             <eventHandlerList>
  159.                 <string>gmcp.Char.Group.List</string>
  160.             </eventHandlerList>
  161.         </Script>
  162.     </ScriptPackage>
  163. </MudletPackage>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement