#Does it has latency to call surface_set_target from a script?

1 messages · Page 1 of 1 (latest)

glossy berry
#

So, basically my surface_set_target is called thru a script while surface_reset_target is in another one. If I were to use the surface_set_target directly rather than using my custom script, this won't happen. So I'm wondering if there is a higher latency to call surface_set_target from a script?

sand spindle
#

the surface stack is, well, a stack

#

you have to make sure that there's one surface_reset_target for every surface_set_target otherwise you get that error

#

if you're calling the script multiple times but only resetting the target once, for example

glossy berry
#

when my funni script only consist of this

function Battle_Masking_Start() {
    
    var board = battle_board;
    if instance_exists(board) and depth >= board.depth
    {
            var surface = board.clip_surface;
            surface_set_target(surface);
        
    }
}
#

if I were to use Battle_Masking_Start, the stack happens

#

but when I straight up using surface_set_target, there is no bug

#

when the purpose is literally the same

sand spindle
#

including accounting for the if statement?

glossy berry
#

Unless the if statement actually contribute to the latency?

sand spindle
#

trust me, there is no latency

#

is the comma after battle_board supposed to be there?

glossy berry
#

Sorry this is the simplified version of the actual code

#

I just cut it but didnt watch out

#

Because originally there were other local var being set

#

Ok I fixed code

#

But the difference is non existent