How to rotate picture with script? - SOLVED

Hello!

Trying to rotate a picture with script. I think using the angle parameter would allow me to change it the way I want based on a wait command instead of the RTP arbitrary speed function.

I don't know how to reference the picture with the below code, if its even the correct call...
Code:
Game_Picture.prototype.updateRotation = this._angle + 15

I don't know how to refer to the proper picture index and also how to even write the code for it.

EDIT: Seems to be closer to:
JavaScript:
$gameScreen.picture(31).angle = 15
This just breaks the game though since it's not a function. Still searching for answers.

EDIT: Here we go, solved.
JavaScript:
$gameScreen._pictures[31]._angle = Math.floor($gameScreen._pictures[31]._angle + 15)
Using a script call to rotate picture at precise angle is fair.
Though I already make a plugin that actually "rotate" instead of "spin" the picture indefinitely (check my signature for Pictures Alternative), the eventing way to do it is by calculate the rotation timing.

FYI for alternative, RPG maker rotate the picture by simply halven the speed value you have input, then update it per frame.
rotation += value / 2

So if you want to rotate the picture at precisely 45 degree for example, just input speed 90 and wait 1 frame, then stop it with speed 0. The picture will stop exactly at 45 degree.
1596636808601.png


90 degree = speed 90 + wait for 2 frame.
180 degree = speed 90 + wait for 4 frame.
etc etc. The rest is just doing the math.
Using a script call to rotate picture at precise angle is fair.
Though I already make a plugin that actually "rotate" instead of "spin" the picture indefinitely (check my signature for Pictures Alternative), the eventing way to do it is by calculate the rotation timing.

FYI for alternative, RPG maker rotate the picture by simply halven the speed value you have input, then update it per frame.
rotation += value / 2

So if you want to rotate the picture at precisely 45 degree for example, just input speed 90 and wait 1 frame, then stop it with speed 0. The picture will stop exactly at 45 degree.
View attachment 154129

90 degree = speed 90 + wait for 2 frame.
180 degree = speed 90 + wait for 4 frame.
etc etc. The rest is just doing the math.
Well, I decided to just go with this:
This one will update every second with 1/12 movement. That is very close to approximation but it will drift.
JavaScript:
var TimeKeeper = $gameVariables.value(264);
$gameScreen._pictures[TimeKeeper]._angle = $gameScreen._pictures[TimeKeeper]._angle + (1/12)
Because of the drift, every in-game hour the below code corrects it.
JavaScript:
var TimeKeeper = $gameVariables.value(264);
$gameScreen._pictures[TimeKeeper]._angle = $gameScreen._pictures[92]._angle = Math.floor((360/2)+(360/2)*Math.cos((Math.PI/12)*$gameVariables.value(3)))/2

Original thread: https://forums.rpgmakerweb.com/threads/how-to-rotate-picture-with-script-solved.124937/