Iris2.de http://iris2.de/forum/ |
|
RunUO Iris2 Support ? http://iris2.de/forum/viewtopic.php?f=15&t=1376 |
Page 3 of 4 |
Author: | Sehlor [ Fri Apr 24, 2009 1:03 am ] |
Post subject: | |
An Error Will Blow Up My Mind... Need Help With That Code! I Registered A Listener, That Works, But I'm Trying To Set My Gumppic Width i looked in healthbar.lua and doing same thing but whatever i tried, it doesn't Error: HotBar.lua line 85: "attempt to call method 'GetCtrlByName' (a nil value) .... The name Parameter Comes from Another function as you can see... Help Help Need Help Code: -- Register Listeners.
RegisterListener("Mobile_UpdateHealth", function (mobile, oldcur, oldmax, curvalue, maxvalue) UpdateHotBar(mobile) end) -- Created 24.04.2009 00:52:12, with GumpStudio & Iris2 Lua Export Plugin -- Exported Iris2 GumpExporter ver 1.0. local HotBarGump = {} HotBarGump.dialogId = 5000011 HotBarGump.x = 0 HotBarGump.y = 0 HotBarGump.Data = "{ page 0 }" .. "{ gumppic 0 0 13200 hotbarpic }" .. "{ text 197 103 0 0 lblSlotTwo }" .. "{ text 246 103 0 1 lblSlotThree }" .. "{ text 294 103 0 2 lblSlotFour }" .. "{ text 342 103 0 3 lblSlotFive }" .. "{ text 393 103 0 4 lblSlotSiz }" .. "{ text 441 103 0 5 lblSlotSeven }" .. "{ text 487 103 0 6 lblSlotEight }" .. "{ text 568 103 0 7 lblSlotPrimaryAbility }" .. "{ text 615 103 0 8 lblSlotSecondaryAbility }" .. "{ gumppic 137 48 13201 imghits }" .. "{ text 347 40 1153 9 lblhits }" .. "{ gumppic 385 62 13203 imgStam }" .. "{ text 146 103 0 10 lblSlotOne }" .. "{ gumppic 137 62 13202 imgMana }" .. "{ text 221 54 1153 11 lblmana }" .. "{ text 473 54 1153 12 lblstam }" .. "" HotBarGump.textline = { [0] = "2", [1] = "3", [2] = "4", [3] = "5", [4] = "6", [5] = "7", [6] = "8", [7] = "Q", [8] = "W", [9] = "67/128", [10] = "1", [11] = "67/128", [12] = "67/128", } kHealthBarFullWidth = 471 -- GumpParser( manualGump ) gHotBarGumps = {} SetMacro("1", function() ShowHotBar(GetPlayerMobile()) end) function ShowHotBar(mobile) if gNoRender then return end if mobile == nil then return end if (gHotBarGumps[mobile.serial]) then return end local dialog = GumpParser(HotBarGump, true) gHotBarGumps[mobile.serial] = dialog --AddFadeLines(mobile.stats.curHits) dialog.controls["lblhits"].gfx:SetText(mobile.stats.curHits .. "/" .. mobile.stats.maxHits) dialog.controls["lblmana"].gfx:SetText(mobile.stats.curMana.. "/" .. mobile.stats.maxMana) dialog.controls["lblstam"].gfx:SetText(mobile.stats.curStamina.. "/" .. mobile.stats.maxStamina) SetHealthBarImage(mobile, 0.5) 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"].gfx:SetText(mobile.stats.curHits .. "/" .. mobile.stats.maxHits) dialog.controls["lblmana"].gfx:SetText(mobile.stats.curMana.. "/" .. mobile.stats.maxMana) dialog.controls["lblstam"].gfx:SetText(mobile.stats.curStamina.. "/" .. mobile.stats.maxStamina) SetHealthBarImage(mobile, mobile.stats.curHits / mobile.stats.maxHits) 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 |
Author: | SiENcE [ Fri Apr 24, 2009 6:45 am ] |
Post subject: | |
Try to set Code: HotBarGump.bSupportsGuiSys2 = true between HotBarGump.y = 0 <-- HotBarGump.Data = . You can analyze an Array by printing out the whole data via: Code: print(" ",vardump(dialog))
I think you mixed guisystem1 code with guisystem2 code :-/. We have a new guisystem and an old one which is obsolete, but we haven't converted all clientside gumps yet. Also the gfx you used for gumppic is not existent by me 13200, 13201, 13202, 13203. |
Author: | Sehlor [ Fri Apr 24, 2009 3:19 pm ] |
Post subject: | |
SiENcE wrote: Try to set
Code: HotBarGump.bSupportsGuiSys2 = true between HotBarGump.y = 0 <-- HotBarGump.Data = . You can analyze an Array by printing out the whole data via: Code: print(" ",vardump(dialog)) I think you mixed guisystem1 code with guisystem2 code :-/. We have a new guisystem and an old one which is obsolete, but we haven't converted all clientside gumps yet. Also the gfx you used for gumppic is not existent by me 13200, 13201, 13202, 13203. 13200, 13201, 13202, 13203 are my new hotbur gump pics I'll Try new Gui System i'm at university now i'll back to home and try thanks for reply. |
Author: | Sehlor [ Fri Apr 24, 2009 7:52 pm ] |
Post subject: | |
That Works But I Have another Problem, I Must Change Text Font How can I Do It ? I Tried Code: dialog.controls["lblhits"].gfx:SetFont(gFontDefs["Gump"].name)
dialog.controls["lblhits"]:SetFont(gFontDefs["Gump"].name) |
Author: | SiENcE [ Fri Apr 24, 2009 8:14 pm ] |
Post subject: | |
take a look at config_declarations.lua |
Author: | Sehlor [ Fri Apr 24, 2009 8:21 pm ] |
Post subject: | |
i looked but there is some declarations only, when i try to use SetFont function it says (a nil value) i tried to use: .gfx:SetFont :SetFont but both of them gives me same error |
Author: | SiENcE [ Fri Apr 24, 2009 9:46 pm ] |
Post subject: | |
If something in guisystem is nil, it's mostly the wrong guisystem. think SetFont was only the old guisystem. |
Author: | Sehlor [ Fri Apr 24, 2009 10:15 pm ] |
Post subject: | |
then i won't set the font hmm k |
Author: | Sehlor [ Sat Apr 25, 2009 6:47 pm ] |
Post subject: | |
A Question Again; Can't Show My HotBar When Player Log in To game. I make my hotbar (gui.hotbar.lua) I Put it To lua/gui folder and tried: Code: RegisterListener("Hook_StartInGame", function () AddFadeLines("Started In game") ShowHotBar() AddFadeLines("Showing Hot Bar") end) It Writes "Showing Hot Bar" But Not Showing Bar. My ShowHotBar Function: Code: function ShowHotBar()
if gNoRender then return end local mobile = GetPlayerMobile() if mobile == nil then 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) AddFadeLines("Showing HotBar") dialog.on_mouse_left_down = function (self) self:BringToFront() if IsTargetModeActive() then CompleteTargetModeWithTargetMobile(self.mobile) else return end end end Help Please.. |
Author: | ghoulsblade [ Sun Apr 26, 2009 10:49 am ] |
Post subject: | |
try InvokeLater(10*1000,function () ShowHotBar() end) instead of ShowHotBar() directly. Hook_StartInGame is triggered rather early, GetPlayerMobile() might still return nil at this point. best put a print in the if mobile == nil then return end line as well |
Author: | Sehlor [ Sun Apr 26, 2009 1:46 pm ] |
Post subject: | |
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 |
Author: | SiENcE [ Sun Apr 26, 2009 1:57 pm ] |
Post subject: | |
Plugins are loaded dynamically. If you put your script into the gui folder, you have to specify a reference in gui.main.lua. But you shouldn't do that, because you can get easily conflicts when updating. Just put it into the Plugin Folder and everything is ok. |
Author: | Sehlor [ Sun Apr 26, 2009 2:00 pm ] |
Post subject: | |
got it, thanks. |
Author: | Sehlor [ Sun Apr 26, 2009 5:31 pm ] |
Post subject: | |
Another Error Will Make Me Crazy...! I'm Trying To Add Weapon Abilities to my hot bar then i create a function Code: function UpdateWeaponAbilities(mobile) local dialog = gHotBarGumps[mobile.serial] if not (dialog) then print("#####NO DIALOG") InvokeLater(5*1000, function () UpdateWeaponAbilities(mobile) end) return end local PrimaryAbility,SecondaryAbility = GetWeaponSpecialsForMobile(GetPlayerMobile()) local PrimaryAbilityName = glWeaponAbilities[PrimaryAbility] and glWeaponAbilities[PrimaryAbility].name or "?" local PrimaryAbilityIconId = glWeaponAbilities[PrimaryAbility].gumpicon or 0x5200 local SecondaryAbilityName = glWeaponAbilities[SecondaryAbility] and glWeaponAbilities[SecondaryAbility].name or "?" local SecondaryAbilityIconId = glWeaponAbilities[SecondaryAbility].gumpicon or 0x5200 local widget = dialog:GetCtrlByName("btnPrimaryAbility") if not widget then AddFadeLines("Primary: "..PrimaryAbilityIconId.." Secondary: "..SecondaryAbilityIconId) else local changearr = { gump_id = PrimaryAbilityIconId, gump_id_pressed = PrimaryAbilityIconId } print(vardump(changearr)) widget:ChangeParams( changearr ) end end But It Gives Me Error: ChangeParams (a nil value) My Gump Supports New Gui System; On The Other Hand This Function Works Correctly For Me In Another Function: Code: local widget = GetWidgetUnderMouse()
if(IsSkillButton(widget)) then if not (IsWeaponAbility(widget)) then print(vardump(widget.params)) widget:ChangeParams( { gump_id = 0x3394, gump_id_pressed = 0x3394 } ) end end Regards... |
Author: | Sehlor [ Mon Apr 27, 2009 9:48 am ] |
Post subject: | |
Sehlor wrote: Another Error Will Make Me Crazy...!
I'm Trying To Add Weapon Abilities to my hot bar then i create a function Code: function UpdateWeaponAbilities(mobile) local dialog = gHotBarGumps[mobile.serial] if not (dialog) then print("#####NO DIALOG") InvokeLater(5*1000, function () UpdateWeaponAbilities(mobile) end) return end local PrimaryAbility,SecondaryAbility = GetWeaponSpecialsForMobile(GetPlayerMobile()) local PrimaryAbilityName = glWeaponAbilities[PrimaryAbility] and glWeaponAbilities[PrimaryAbility].name or "?" local PrimaryAbilityIconId = glWeaponAbilities[PrimaryAbility].gumpicon or 0x5200 local SecondaryAbilityName = glWeaponAbilities[SecondaryAbility] and glWeaponAbilities[SecondaryAbility].name or "?" local SecondaryAbilityIconId = glWeaponAbilities[SecondaryAbility].gumpicon or 0x5200 local widget = dialog:GetCtrlByName("btnPrimaryAbility") if not widget then AddFadeLines("Primary: "..PrimaryAbilityIconId.." Secondary: "..SecondaryAbilityIconId) else local changearr = { gump_id = PrimaryAbilityIconId, gump_id_pressed = PrimaryAbilityIconId } print(vardump(changearr)) widget:ChangeParams( changearr ) end end But It Gives Me Error: ChangeParams (a nil value) My Gump Supports New Gui System; On The Other Hand This Function Works Correctly For Me In Another Function: Code: local widget = GetWidgetUnderMouse() if(IsSkillButton(widget)) then if not (IsWeaponAbility(widget)) then print(vardump(widget.params)) widget:ChangeParams( { gump_id = 0x3394, gump_id_pressed = 0x3394 } ) end end Regards... any solution ? |
Page 3 of 4 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |