another problem ghoulsblade,
when i put my lua script to gui folder it doesn't works
bu if i put my script to plugins folder, it works correctly :S What i'm doing wrong ?
Thats all of my script(gui.hotbar.lua):
Code:
-- Created 24.04.2009 00:52:12, with GumpStudio & Iris2 Lua Export Plugin
-- Exported Iris2 GumpExporter ver 1.0.
local HotBarGump = {}
HotBarGump.dialogId = 5000012
HotBarGump.x = 0
HotBarGump.y = 0
HotBarGump.bSupportsGuiSys2 = true
HotBarGump.Data =
"{ page 0 }" ..
"{ gumppic -1 0 13200 }" ..
"{ button 588 78 20994 20994 1 0 0 btnPrimaryAbility }" ..
"{ button 538 78 20992 20992 1 0 1 btnSecondaryAbility }" ..
"{ button 457 78 21019 21019 1 0 2 btnSlotEight }" ..
"{ button 409 78 21019 21019 1 0 3 btnSlotSeven }" ..
"{ button 361 78 21019 21019 1 0 4 btnSlotSix }" ..
"{ button 312 78 21019 21019 1 0 5 btnSlotFive }" ..
"{ button 263 78 21019 21019 1 0 6 btnSlotFour }" ..
"{ button 116 78 21019 21019 1 0 7 btnSlotThree }" ..
"{ button 165 78 21019 21019 1 0 8 btnSlotTwo }" ..
"{ button 214 78 21019 21019 1 0 9 btnSlotOne }" ..
"{ text 243 102 0 0 lblSlotThree }" ..
"{ text 292 102 0 1 lblSlotFour }" ..
"{ text 341 102 0 2 lblSlotFive }" ..
"{ text 390 102 0 3 lblSlotSix }" ..
"{ text 438 102 0 4 lblSlotSeven }" ..
"{ text 486 102 0 5 lblSlotEight }" ..
"{ text 569 102 0 6 lblPrimaryAbility }" ..
"{ gumppic 139 48 13201 imghits }" ..
"{ text 347 44 1153 7 lblhits }" ..
"{ gumppic 387 62 13203 imgstam }" ..
"{ gumppic 139 62 13202 imgmana }" ..
"{ text 221 58 0 8 lblmana }" ..
"{ text 473 58 0 9 lblstam }" ..
"{ text 148 102 0 10 lblSlotOne }" ..
"{ text 616 102 0 11 lblSecondaryAbility }" ..
"{ text 194 102 0 12 lblSlotTwo }" ..
""
HotBarGump.textline = {
[0] = "3",
[1] = "4",
[2] = "5",
[3] = "6",
[4] = "7",
[5] = "8",
[6] = "Q",
[7] = "67/128",
[8] = "67/128",
[9] = "67/128",
[10] = "1",
[11] = "W",
[12] = "2",
}
kHotBarWidth = 750
kHotBarHeight = 127
kHealthBarFullWidth = 471
kManaBarFullWidth = 233
kStaminaBarFullWidth = 223
-- GumpParser( manualGump )
gHotBarGumps = {}
function ShowHotBar()
if gNoRender then return end
local mobile = GetPlayerMobile()
if mobile == nil then
print("Mobile is nil!")
InvokeLater(5*1000, function () ShowHotBar() end)
return
end
if (gHotBarGumps[mobile.serial]) then return end
local dialog = GumpParser(HotBarGump, true)
gHotBarGumps[mobile.serial] = dialog
dialog.mobile = mobile
UpdateHotBar(mobile)
local width,height = GetViewportSize()
local posx = width - kHotBarWidth
local posy = height - kHotBarHeight
dialog:SetPos(posx, posy)
dialog.on_mouse_left_down = function (self)
self:BringToFront()
if IsTargetModeActive() then
CompleteTargetModeWithTargetMobile(self.mobile)
else
return
end
end
--AddFadeLines(mobile.stats.curHits)
--AddFadeLines("I'm Invoking. Step ShowHotBar")
--dialog.gfx:SetPos(0, 0)
end
function UpdateHotBar(mobile)
local dialog = gHotBarGumps[mobile.serial] if (not dialog) then return end
--dialog.controls["lblhits"]:SetFont(gFontDefs["Gump"].name)
dialog.controls["lblhits"]:SetText(mobile.stats.curHits .. "/" .. mobile.stats.maxHits)
dialog.controls["lblmana"]:SetText(mobile.stats.curMana.. "/" .. mobile.stats.maxMana)
dialog.controls["lblstam"]:SetText(mobile.stats.curStamina.. "/" .. mobile.stats.maxStamina)
SetHealthBarImage(mobile, mobile.stats.curHits / mobile.stats.maxHits)
SetManaBarImage(mobile, mobile.stats.curMana / mobile.stats.maxMana)
SetStaminaBarImage(mobile, mobile.stats.curStamina / mobile.stats.maxStamina)
end
function SetStaminaBarImage(mobile, x)
HotBar_ChangeParams(mobile.serial, "imgstam" , {tiled=true,width=kStaminaBarFullWidth * max(0,min(1,x))})
end
function SetManaBarImage(mobile, x)
HotBar_ChangeParams(mobile.serial, "imgmana" , {tiled=true,width=kManaBarFullWidth * max(0,min(1,x))})
end
function SetHealthBarImage(mobile, x)
HotBar_ChangeParams(mobile.serial, "imghits", {tiled=true,width=kHealthBarFullWidth * max(0,min(1,x))})
end
function HotBar_ChangeParams (serial, ctrlname, changearr)
local dialog = gHotBarGumps[serial] if (not dialog) then return end
local widget = dialog:GetCtrlByName(ctrlname) if (not widget) then return end
widget:ChangeParams(changearr)
end
-- Register Listeners
RegisterListener("Mobile_UpdateStats", function(mobile)
if not (IsPlayerMobile(mobile)) then return end
if not (GetPlayerMobile().serial == mobile.serial) then return end
UpdateHotBar(mobile)
end)
RegisterListener("Hook_StartInGame", function ()
ShowHotBar()
end)
Thanks For Help