GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 GML Code Help » finite timer scripts? » 2016-04-25 01:03:04

Shadowblitz16
Replies: 1

is there someone here that can help me write a finite timer scripts?
I need 3 scripts

timer_get(id,time)
timer_update_all()
timer_delete(id)

timer_get would create a timer and get a string ID and get a time or delay
it would then check if it was 0 or lesser. if it is then it would return true

timer_update_all would update all the timers created by timer_get if they were greater then 0

timer_delete would delete the timer with the given id

I have proto typed a script called wait(id,time) that is basically all three put together
however I am trying to separate them into three scripts so that it can be updated deleted and called in different positions

this is what I currently have

Expand///wait(string,time)
var ID = string(id)+argument0
var Time = argument1
if !ds_map_exists(global.timers,ID) {
  ds_map_add(global.timers,ID,Time)
}
else {
  if ds_map_find_value(global.timers,ID) <= 0 {
    ds_map_delete(global.timers,ID)
    return true
  }
  else {
    ds_map_replace(global.timers,ID,ds_map_find_value(global.timers,ID)-1)
  }
}

the problem is that I can't find a way to iterate though all the ds_map(global.timers,ID) and subtract one from them.
since they use keys instead of indexs however I need these keys so that I can assign a id to them and be checked if they exist or not

#2 GML Code Help » division by zero in refection script » 2016-03-31 16:03:52

Shadowblitz16
Replies: 0

can someone help me
my script seems to be giving me a division by zero error
I got the formula from a irc and I don't know really know how it works

Expand///move_reflect(obj)
vx = argument0.x
vy = argument0.y
lx = lengthdir_x(argument0.speed,argument0.direction)
ly = lengthdir_y(argument0.speed,argument0.direction)
dx =  2 * (vx * lx + vy * ly) / (lx * lx + lx * lx) * lx - vx
dy =  2 * (vx * lx + vy * ly) / (lx * lx + lx * lx) * ly - vy
motion_add(point_direction(vx,vy,dx,dy),argument0.speed)

I'm trying to make an alternative bounce script since the move_bounce functions are buggy and don't work right

#3 Off Topic » (Suggestion) GM8 Palette Swap Scripts/Shader » 2016-01-30 23:05:42

Shadowblitz16
Replies: 2

Can someone make some scripts and shader that uses a png palette to change a sprites colors and alpha to different colors?

I was thinking along the lines of reading the png palette top to bottom, left to right
and storing the color sets in a array or map by calling palette_init

then you could call scripts like
palette_swap(cset) <-- can return
palette_effect(effect) <-- can return
palette_fadeEffect(effect,time) <-- read only

effects being
thermal
negitive
frozen
gray
sepia
ultraViolet

to change the color

Board footer

Powered by FluxBB