manups4e / ScaleformUI

ScaleformUI is a GTA menu styled API made with custom Scaleforms to be lighter, faster and visually better
Other
147 stars 49 forks source link

attempt to call a nil value (method 'ToArgb') #216

Closed RealMrCactus closed 4 months ago

RealMrCactus commented 4 months ago

image

local menu = UIMenu.New("Echeveria", "Mod Trainer", 10, 10, false, "uh", "fuck", false, 0.1)
local plropt = UIMenuItem.New("Player Options", "Options related to the player", "HUD_COLOUR_PAUSE_BG", "HUD_COLOUR_BLUE", "HUD_COLOUR_BLACK", "HUD_COLOUR_BLACK")

menu:AddItem(plropt)

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

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

also Please PLEASE PLEASE add value types to the lua examples because where i wrote "uh" and "fuck" i had no idea what i needed to put there

manups4e commented 4 months ago

Oh and fuck are custom texture dictionary and custom texture name Besides that.. toargb is working fine on my end and it applies only on the SColor meta class.. can you provide your code with the error instead of asking for 2 problems mixed? Value types should also be described in the UIMENU metaclass as you can see here https://github.com/manups4e/ScaleformUI/blob/c37266507af64cad796bec60f0d408199e89297a/ScaleformUI_Lua/src/Menus/UIMenu/UIMenu.lua#L103 So please PLEASE PLEASE make sure to read before you ask 😊

RealMrCactus commented 4 months ago

Oh and fuck are custom texture dictionary and custom texture name Besides that.. toargb is working fine on my end and it applies only on the SColor meta class.. can you provide your code with the error instead of asking for 2 problems mixed? Value types should also be described in the UIMENU metaclass as you can see here

https://github.com/manups4e/ScaleformUI/blob/c37266507af64cad796bec60f0d408199e89297a/ScaleformUI_Lua/src/Menus/UIMenu/UIMenu.lua#L103

So please PLEASE PLEASE make sure to read before you ask 😊

I did give you my code

manups4e commented 4 months ago

So the ToArgb error appears on loading without you calling it? Are you on latest version?

RealMrCactus commented 4 months ago

So the ToArgb error appears on loading without you calling it?

I presume the menu creation causes it, it only happens after I attempt to press the bind to open the menu

manups4e commented 4 months ago

All right 😊 I'll check it in 10 mins and release a fix asap

manups4e commented 4 months ago

can i ask what version are you on? I just tried loading latest released version image and everything looks just fine

manups4e commented 4 months ago

ok i found your bug

local plropt = UIMenuItem.New("Player Options", "Options related to the player", "HUD_COLOUR_PAUSE_BG", "HUD_COLOUR_BLUE", "HUD_COLOUR_BLACK", "HUD_COLOUR_BLACK")

you set the colors as strings.. bad.. colors are not strings but SColor instances

local scrollingAnimationItem = UIMenuListItem.New("Choose the scrolling animation", animations, exampleMenu:AnimationType(),"~BLIP_BARBER~ ~BLIP_INFO_ICON~ ~BLIP_TANK~ ~BLIP_OFFICE~ ~BLIP_CRIM_DRUGS~ ~BLIP_WAYPOINT~ ~INPUTGROUP_MOVE~~n~You can use Blips and Inputs in description as you prefer!~n~⚠ 🐌 ❤️ 🥺 💪🏻 You can use Emojis too!", SColor.HUD_Freemode_dark, SColor.HUD_Freemode)```
I suggest checking the example.lua provided with the library in release to see how colors are applied to the menu items :)

Your corrected item would become:
```lua
local plropt = UIMenuItem.New("Player Options", "Options related to the player", SColor.HUD_Pause_bg, SColor.HUD_Blue, SColor.HUD_Black, SColor.HUD_Black)

Also since the textColor and HighlightedTextColor are disabled by R* in scaleforms if you want your text to remain black always i suggest you to set it in the text via text markdown using ~HC_BLACK~ before your text :)

RealMrCactus commented 4 months ago

Ah alright I know Lua lmfao just not necessarily FiveMs extension to it

RealMrCactus commented 4 months ago

how would i find the texture dicts and what not that are already in the game?

manups4e commented 4 months ago

you can find them on google.. an example: https://wiki.rage.mp/index.php?title=Textures for the default menu texture use "commonmenu", "interaction_bgd"

RealMrCactus commented 4 months ago

thanks i went down the rabbit hole of scaleforms hoping that might be it lol

RealMrCactus commented 4 months ago

how do i use OnItemSelect is it :OnItemSelect(function or .OnItemSelect or something else?

manups4e commented 4 months ago
    bigMessageExampleMenu.OnItemSelect = function(sender, item, index)
        if item == uiItemDisposeBigMessage then
            ScaleformUI.Scaleforms.BigMessageInstance:Dispose()
        end
    end

As i already told you.. check the example.lua to see every feature of the menus

manups4e commented 4 months ago

locking as completed and derailing from an issue to a how-to request