GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 Re: Script Submission » mergefromto » 2009-03-04 20:38:44

hey, awesome script
tongue

I have the same exact function, but I like calling it merge_number() instead
I've been using it for pretty much everything since I figured it out a few years ago

Also useful in this area of number merging are these scripts:

unmerge_number(merged value,n1,n2), the reverse of merge number. for example, merge_number(n1,n2,unmerge_number(x,n1,n2)) will always return x

Expand// unmerge_number(merged number, n1, n2)
if argument2-argument1!=0
return ((argument0-argument1)/(argument2-argument1))
else return 0

and

merge_direction(dir1,dir2,merge),  which works the same as merge number but will merge two directions, even if they are outside of 360 degrees (however it will not always return a direction between 0 and 360)

Expand//merge_direction(num1,num2,merging value)

while argument0>360 argument0-=360
while argument1>360 argument1-=360
while argument0<0 argument0+=360
while argument1<0 argument1+=360

if argument0>=180 {if argument1<180 and argument1<argument0-180 argument1+=360}
else if argument0<180 {if argument1>=180 and argument1>argument0+180 argument1-=360}

return merge_number(argument0,argument1,argument2)

Board footer

Powered by FluxBB