Closed Unnvaldr closed 5 years ago
requestScaleformMovie should return proper scaleform handled, when loaded in keydown or keyup event
requestScaleformMovie
keydown
keyup
requestScaleformMovie always return 0, when it is in keydown or keyup event
N/A
You have to only execute this code (add some logging for scaleformHandle variable to see it's value) and press F12:
let localPlayer = alt.Player.local; alt.on('keydown', (key) => { if(key == 0x7B) { //F12 var scaleformHandle = null; var boardHandle = null; var renderTargetHandle = null; var renderTargetModel = game.getHashKey('prop_police_id_text'); var renderTargetID = -1; var boardHandle = game.createObject(game.getHashKey('prop_police_id_board'), localPlayer.pos.x, localPlayer.pos.y, localPlayer.pos.z + 1, false, false, false); var boardRenderTargetHandle = game.createObject(renderTargetModel, localPlayer.pos.x, localPlayer.pos.y, localPlayer.pos.z + 1, false, false, false); scaleformHandle = game.requestScaleformMovie('mugshot_board_01'); game.registerNamedRendertarget('id_text'); game.linkNamedRendertarget(renderTargetModel); renderTargetID = game.getNamedRendertargetRenderId('id_text'); new Promise((resolve, reject) => { let interval = alt.setInterval(() => { if(game.hasScaleformMovieLoaded(scaleformHandle) && renderTargetID !== -1) { alt.clearInterval(interval); return resolve(true); } }, 0); }).then(() => { game.beginScaleformMovieMethod(scaleformHandle, 'SET_BOARD'); game.addScaleformMovieMethodParameterString('Everybody'); game.addScaleformMovieMethodParameterString('Gordon Freeman'); game.addScaleformMovieMethodParameterString('~ Black Mesa'); game.addScaleformMovieMethodParameterString('loves'); game.addScaleformMovieMethodParameterInt(0); game.addScaleformMovieMethodParameterInt(30); game.endScaleformMovieMethod(); alt.on('update', () => { game.setTextRenderId(renderTargetID); game.drawScaleformMovie(scaleformHandle, 0.405, 0.37, 0.81, 0.74, 255, 255, 255, 255); game.setTextRenderId(game.getDefaultScriptRendertargetRenderId()); }); }); } });
Most likely related to some gta scripting stuff, as a temp workaround you could wrap it in alt.nextTick
Moved to #231
Expected Behavior
requestScaleformMovie
should return proper scaleform handled, when loaded inkeydown
orkeyup
eventCurrent Behavior
requestScaleformMovie
always return 0, when it is inkeydown
orkeyup
eventPossible Solution
N/A
Steps to Reproduce
You have to only execute this code (add some logging for scaleformHandle variable to see it's value) and press F12:
Context (Environment)
N/A
Detailed Description
N/A
Possible Implementation
N/A