#Global Hooks $GameInit: [ --lA = {2,2,11,99) -- x1, y1, x2, y2 --rA = {1013,2,1023,99} drawLeftArrow = function() gr.setColor(16,21,16) gr.drawRectangle(1,1,12,100,false) gr.setColor(79,104,79) gr.drawLine(2,50,11,2) gr.drawLine(2,50,11,99) gr.drawLine(11,2,11,99) end drawRightArrow = function() gr.setColor(16,21,16) gr.drawRectangle(1012,1,1024,100,false) gr.setColor(79,104,79) gr.drawLine(1013,2,1023,50) gr.drawLine(1013,99,1023,50) gr.drawLine(1013,2,1013,99) end drawPanel = function(number) gr.setColor(16,21,16) gr.drawRectangle(12+(200*number),1,212+(200*number), 100, false) gr.drawRectangle(13+(200*number),2,211+(200*number), 99, false) end scrollPanel = function(curScroll, change) curScroll = curScroll + change return curScroll end ] $HUD: [ if missionInit == nil then missionInit = 42 topScroll = 1 end shipInFocus = mn.Ships['GTC Orff'] numFocusSubsys = #shipInFocus numShips = #mn.Ships io.setMouseHidden(false) drawLeftArrow() --PANEL STUFF! for i = 0, 4 do drawPanel(i) thisPanel = topScroll + i textStart = (200*(i+1)) - 180 thisSubsystem = shipInFocus[thisPanel] --This Subsystem's Handle thisSubsystemName = thisSubsystem:getName() --This Subsystem's Name thisSubsysTargetPos = thisSubsystem.Target.Position --This Subsystem's Target thisSubsysHealth = (thisSubsystem.HitpointsLeft / thisSubsystem.HitpointsMax)*100 --This Subsystem's Health (why doesn't this work?) --Something doesn't work here... if thisSubsystem.PrimaryBanks:isValid() == true then --do we have Primaries? thisWeaponName = thisSubsystem.PrimaryBanks[1].WeaponClass.Name --Sorta hackish, I'm just going to assume the first bank is the same as the rest elseif thisSubsystem.SecondaryBanks:isValid() == true then --or Secondaries? thisWeaponName = thisSubsystem.SecondaryBanks[1].WeaponClass.Name else --or uh, nothing at all? thisWeaponName = nil end -- realTarget = nil for j=1, numShips do targetShip = mn.Ships[j] thisPosition = targetShip.Position if thisSubsysTargetPos[1] == thisPosition[1] and thisSubsysTargetPos[2] == thisPosition[2] and thisSubsysTargetPos[3] == thisPosition[3] then realTarget = targetShip.Name end end -- --DRAWING PANEL INFO STARTS HERE gr.setColor(79,104,79) gr.drawString("Panel " .. thisPanel, textStart, 10) --Draw Subsystem Number gr.drawString(thisSubsystemName, textStart, 20) --Draw Subsystem Name --...Or something doesn't work here... if thisWeaponName ~= nil then --Draw Subsystem Weapon (if any) gr.drawString("Weapon: " .. thisWeaponName, textStart, 30) end if realTarget == nil then --Draw Subsystem Target gr.drawString("Target: None",textStart,40) else gr.drawString("Target: " .. realTarget,textStart,40) end if thisSubsysHealth < 25 then gr.setColor(192,0,0) elseif thisSubsysHealth < 50 then gr.setColor(255,242,0) elseif thisSubsysHealth < 75 then gr.setColor(247,148,29) end gr.drawString("Strength: " .. thisSubsysHealth .. "%",textStart,50) --Draw Subsystem Health end drawRightArrow() --Need to clean this up so one click = one panel change --Go down panel list if io.isButtonDown(MOUSE_LEFT_BUTTON) and io.getX() > 2 and io.getY() > 2 and io.getX() < 11 and io.getY() < 99 then if topScroll > 1 then topScroll = scrollPanel(topScroll, -1) end end --Go up panel list if io.isButtonDown(MOUSE_LEFT_BUTTON) and io.getX() > 1013 and io.getY() > 2 and io.getX() < 1023 and io.getY() < 99 then if (topScroll + 4) < numFocusSubsys then topScroll = scrollPanel(topScroll, 1) end end ] #End