How to use scaleforms!

The file structure may vary, but always look for the one that has the same name as the scaleform.

It’ll generally be the scaleform name in all caps (i.e. MP_BIG_MESSAGE_FREEMODE or MISSION_QUIT).

1 Like

Hello !
I’m looking for the blackscreen wasted please :smiley:

you mean this one:

2 Likes

Yes sir ! Because I wanted to trigger a black picture but with scaleform that will fix everything :smiley:

So, I truely doing something wrong and have no clue how to do it right, need help.

I’ve seen

breaking_news
function INITIALISE(mc)
function SET_DISPLAY_CONFIG(_screenWidthPixels, _screenHeightPixels, _safeTopPercent, _safeBottomPercent, _safeLeftPercent, _safeRightPercent, _isWideScreen, _isHiDef, _isAsian)
function SET_TEXT(titleT, subT)
function SET_SCROLL_TEXT(slot, id, str)
function DISPLAY_SCROLL_TEXT(slot, id, scrollSpeed)
function CLEAR_SCROLL_TEXT(slot)
function SHOW_STATIC(staticType)

And tried this:

function breakingnews()
	scaleform = RequestScaleformMovie("breaking_news")
	while not HasScaleformMovieLoaded(scaleform) do
		Citizen.Wait(0)
	end
	
	PushScaleformMovieFunction(scaleform, "SET_DISPLAY_CONFIG")
	PushScaleformMovieParameterInt(1920)
	PushScaleformMovieParameterInt(1080)
	PushScaleformMovieParameterInt(2)
	PushScaleformMovieParameterInt(2)
	PushScaleformMovieParameterInt(2)
	PushScaleformMovieParameterInt(2)
	PushScaleformMovieParameterInt(0)
	PushScaleformMovieParameterInt(0)
	PushScaleformMovieParameterInt(0)
	PopScaleformMovieFunctionVoid()
	
	PushScaleformMovieFunction(scaleform, "SET_TEXT")
	PushScaleformMovieFunctionParameterString("test text 1")
	PushScaleformMovieFunctionParameterString("test text 2")
	PopScaleformMovieFunctionVoid()
	
	PushScaleformMovieFunction(scaleform, "SET_SCROLL_TEXT")
	PushScaleformMovieParameterInt(0)
	PushScaleformMovieParameterInt(1)
	PushScaleformMovieFunctionParameterString("Scrolling text")
	PopScaleformMovieFunctionVoid()
	
	PushScaleformMovieFunction(scaleform, "DISPLAY_SCROLL_TEXT")
	PushScaleformMovieParameterInt(0)
	PushScaleformMovieParameterInt(1)
	PushScaleformMovieParameterInt(100)
	PopScaleformMovieFunctionVoid()
	
	PushScaleformMovieFunction(scaleform, "SHOW_STATIC")
	PushScaleformMovieParameterInt(1)
	PopScaleformMovieFunctionVoid()

	DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255, 0)
end

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
		breakingnews()
    end
end)

With no luck.

Don’t mess with the SET_DISPLAY_CONFIG stuff. AFAIK, it’s all taken care of internally (at least, I’ve never had any issues when not calling this function).

Also, the syntax is PushScaleformMovieFunctionParameterInt and not PushScaleformMovieParameterInt

1 Like

Tnank you, this is just hilarious.
Except second text string from SET_TEXT(titleT, subT) and scrolling text seem not working, sadly.

Huh… I don’t seem to have any issues:

	PushScaleformMovieFunction(scaleform, "SET_TEXT")
	PushScaleformMovieFunctionParameterString("Quit")
	PushScaleformMovieFunctionParameterString("<b>Bold</b> <i>Italics</i> ~r~Coloured ~d~")
	PopScaleformMovieFunctionVoid()
	
	PushScaleformMovieFunction(scaleform, "SET_SCROLL_TEXT")
	PushScaleformMovieFunctionParameterInt(0) -- top ticker
	PushScaleformMovieFunctionParameterInt(0) -- Since this is the first string, start at 0
	PushScaleformMovieFunctionParameterString("This will be displayed at the top")
	PopScaleformMovieFunctionVoid()

	
	PushScaleformMovieFunction(scaleform, "DISPLAY_SCROLL_TEXT")
	PushScaleformMovieFunctionParameterInt(0) -- Top ticker
	PushScaleformMovieFunctionParameterInt(0) -- Index of string
	PopScaleformMovieFunctionVoid()

Indeed, very strange.

Here’s full code:

function breakingnews()
	scaleform = RequestScaleformMovie("breaking_news")
	while not HasScaleformMovieLoaded(scaleform) do
		Citizen.Wait(0)
	end
	
	PushScaleformMovieFunction(scaleform, "SET_TEXT")
	PushScaleformMovieFunctionParameterString("Test header")
	PushScaleformMovieFunctionParameterString("<b>Bold</b> <i>Italics</i> ~r~Coloured ~d~")
	PopScaleformMovieFunctionVoid()
	
	PushScaleformMovieFunction(scaleform, "SET_SCROLL_TEXT")
	PushScaleformMovieFunctionParameterInt(0)
	PushScaleformMovieFunctionParameterInt(0)
	PushScaleformMovieFunctionParameterString("This will be displayed at the top")
	PopScaleformMovieFunctionVoid()
	
	PushScaleformMovieFunction(scaleform, "DISPLAY_SCROLL_TEXT")
	PushScaleformMovieFunctionParameterInt(0)
	PushScaleformMovieFunctionParameterInt(0)
	PopScaleformMovieFunctionVoid()
	
	DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255, 0)
end

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
		breakingnews()
    end
end)

Strange thing: if I update Citizen.Wait(0) to 100 frames, I can see text on two black bars while scaleform is blinking. If I change it back or to 1 - text disappears.

It could be because you’re calling the functions every frame. Try calling the breakingnews function once (before the loop) then, only call the DrawScaleformMovieFullscreen every frame.

Something liike:

Citizen.CreateThread(function()
    breakingnews()
    while true do
        Citizen.Wait(0)
        DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255, 0)
    end
end)

This is actually what I came up to and this is actually it. I am happy, thank you.

I will update my code when I get home to what havoc did :stuck_out_tongue:

Also, share your findings and cool scaleforms! This is a goldmine.

I’m sure he’ll update it on there as well :wink:

Sure, I hope. But there’s “he”, and there’s “us”, as a community.
I hope :wink:

If anyone ever gets the MISSION_COMPLETE stuff looking nicer than what I tried here, please share.
For anyone trying to figure out the phone scaleform, thersy’s done some amazing work and there’s a topic on GTAForums as well.

Let me also plug Supa’s gfx wrapper, similar to the C# api for gfx.

Holy, the lord himself has spoken. But I definitely will check that out, as I’ve seen it before and it definitely has some really neat uses. If I ever get it working it will definitely be on my page :smile:

1 Like

Alibaba cave’s here :https://github.com/FiveM-Scripts/scaleform-docs

1 Like

A list of scaleforms can be found here, instead of looking through the folders:

http://scaleform.devtesting.pizza

thanks to @Vespura

1 Like