ScaleformUI icon indicating copy to clipboard operation
ScaleformUI copied to clipboard

2 or more menus showing up

Open RealMrCactus opened this issue 1 year ago • 16 comments
trafficstars

RegisterCommand("echeveria", function ()
    menu:Visible(true)
end, false)

RegisterKeyMapping("echeveria", "Opens the trainer", "KEYBOARD", "f1")

thats how ive been opening it and there is only one menu declared

RealMrCactus avatar Jul 17 '24 19:07 RealMrCactus

I have no experience on key mappings 🤔 but on ticks this doesn't happen.. might happen that commands are executed twice tho 🤔

manups4e avatar Jul 17 '24 19:07 manups4e

Also.. if you restart your script without closing the menu first.. a new instance will open.. that's scaleforns..

manups4e avatar Jul 17 '24 19:07 manups4e

i dont think so because if i do the command manually it still happens

RealMrCactus avatar Jul 17 '24 19:07 RealMrCactus

Also.. if you restart your script without closing the menu first.. a new instance will open.. that's scaleforns..

yeah ive been making sure to close it

RealMrCactus avatar Jul 17 '24 19:07 RealMrCactus

image

RealMrCactus avatar Jul 17 '24 19:07 RealMrCactus

the menu opens twice only when visible is set to true 🤔 unless you set Visible(true) twice there's no logic way to make it appear twice i made multiple checks into that.. unless your command is executing twice 🤔

manups4e avatar Jul 17 '24 20:07 manups4e

image well im not sure then

RealMrCactus avatar Jul 17 '24 23:07 RealMrCactus

On my side when closed I need to send command twice so it opens after being closed (esc) Lua

Slyker avatar Jul 18 '24 07:07 Slyker

I don't use commands so I can't say why this happens.. if you check the example.lua I open the menu via classic IsControlJustPressed native 🤔 and it works flawlessly 🤔 I'll try to investigate but I can't control commands natives

manups4e avatar Jul 18 '24 07:07 manups4e

I don't use commands so I can't say why this happens.. if you check the example.lua I open the menu via classic IsControlJustPressed native 🤔 and it works flawlessly 🤔 I'll try to investigate but I can't control commands natives

i perfer registerKeybind and command so people can set a different keybind if they want

RealMrCactus avatar Jul 19 '24 17:07 RealMrCactus

ok so... i've been trying to use this

RegisterCommand("echeveria", function ()
    CreateMenu()
end, false)

RegisterKeyMapping("echeveria", "Opens the trainer", "KEYBOARD", "f1")

and everything is working fine with example menu

manups4e avatar Jul 30 '24 13:07 manups4e

RegisterCommand("echeveria", function ()
    menu:Visible(true)
end, false)

RegisterKeyMapping("echeveria", "Opens the trainer", "KEYBOARD", "f1")

thats how ive been opening it and there is only one menu declared

You can put like this:

RegisterCommand('openptfxmenu', function()
    if menu and not MenuHandler:IsAnyMenuOpen() then
        menu:Visible(true)
    end
end)

CreateThread(function()
    CreatePtfxMainMenu() -- create menu 
    RegisterKeyMapping('openptfxmenu', 'Open PTFX Test Menu', 'KEYBOARD', 'F1') -- keybind
end)

Swellington-Soares avatar Aug 21 '24 08:08 Swellington-Soares

Thanks for the hint I'll test this in the next days and report 🤔

manups4e avatar Aug 21 '24 08:08 manups4e

using the code you provided i did

RegisterCommand('openptfxmenu', function()
    if exampleMenu and not MenuHandler:IsAnyMenuOpen() then
        exampleMenu:Visible(true)
    end
end)

CreateThread(function()
CreateMenu() -- create menu 
    RegisterKeyMapping('openptfxmenu', 'Open PTFX Test Menu', 'KEYBOARD', 'L') -- keybind
end)

and this is the result

image

i would suggest you to use the correct quake command alike intended for this feature.. so

image

as you can see i added a minus before the command this is intended for commands that we want to execute once without toggling things.

quick explanation: image

if you want it to be a +command in this case the command would be

RegisterCommand('+openptfxmenu', function()
    if exampleMenu and not MenuHandler:IsAnyMenuOpen() then
        exampleMenu:Visible(true)
    else 
	MenuHandler:CloseAndClearHistory()
    end
end)

manups4e avatar Aug 30 '24 16:08 manups4e

What's this issue's status ?

Mathu-lmn avatar Sep 01 '24 02:09 Mathu-lmn

Busy with stuff ATM but will test stuff ASAP

RealMrCactus avatar Sep 01 '24 03:09 RealMrCactus

it's been almost 2 months.. closing for now but will keep comments on.

manups4e avatar Oct 26 '24 07:10 manups4e