LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Function Requests!

Root / General / [.]

MicalobiaCreated:
I will be taking requests for functions that you guys want, need, or think would be useful. I am not the best at making programs, so this is what I am going to do while I'm not working on my game due to frustration.

These are functions I made a while back for storing numbers up to 65536 on the graphics screen, despite the color buffer
COMMON DEF GNSET X%, Y%, N%
'Stops if number is out of range
 IF N%>65536 OR N%<0 THEN STOP
 VAR A% = N% MOD 2
 VAR R% = FLOOR(N% / 2) MOD 32
 VAR G% = FLOOR(N% / (32*2)) MOD 32
 VAR B% = FLOOR(N% / (32 * 32 *2)) MOD 32
 GPSET X%, Y%, RGB(A% * 255, R% * 8, G% * 8, B% * 8)
END

COMMON DEF GNFILL X%, Y%, X2%, Y2%, N%
'Stops if number is out of range
 IF N%>65536 OR N%<0 THEN STOP
 VAR A% = N% MOD 2
 VAR R% = FLOOR(N% / 2) MOD 32
 VAR G% = FLOOR(N% / (32*2)) MOD 32
 VAR B% = FLOOR(N% / (32 * 32 *2)) MOD 32
 GFILL X%, Y%, X2%, Y2%, RGB(A%, R% * 8, G% * 8, B% * 8)
END

COMMON DEF GNSPOIT(X%, Y%)
 VAR A%, R%, G%, B%, T%
 RGBREAD GSPOIT(X%, Y%) OUT A%, R%, G%, B%
 T% = 0
 INC T%, A%>1
 INC T%, R%/8 * 2
 INC T%, (G%/8) * 32 * 2
 INC T%, (B%/8) * 32 * 32 * 2
 RETURN T%
END
Snail helped me realize that I could double the number with the alpha channel, and I feel he deserves credit for that.

A function for reading definitions created by SBANM
COMMON DEF SPADEF G%[]
 DIM V%[4096,10]
 FOR I=0 TO 3
  EAT SHIFT(G%)
 NEXT
 COPY V%, G%
 FOR I = 0 TO 4095
  U=V%[N,0]:V=V%[N,1]
  W=V%[N,2]:H=V%[N,3]
  X=V%[N,4]:Y=V%[N,5]
  A=1
  A=A OR (V%[N,7]<<4)
  A=A OR (V%[N,8]<<3)
  A=A OR (V%[N,9]<<1)
  SPDEF N,U,V,W,H,X,Y,A
 NEXT
END

DEF EAT N END

I recommend that you use the more standard
DEF EAT SAND END
oh and I suppose I should make a request. uh.... make a function that converts degrees to radians but make it so that COS(RAD(270)) is actually 0 (for example) I'm not sure if this is possible.

I recommend that you use the more standard
DEF EAT SAND END
oh and I suppose I should make a request. uh.... make a function that converts degrees to radians but make it so that COS(RAD(270)) is actually 0 (for example) I'm not sure if this is possible.
Hmm... With some testing, it's a problem with the cosine function, and not the radian function. Which is annoying, to say the least. Working on solution now EDIT: As a side note, why is the standard eat sand? it's not like it make that much of a difference, but...

Couldn't figure out a solution that didn't take forever, and the sin function has the same problem. The margin of error is about 2e-16 max, so it's not the biggest deal.

I recommend that you use the more standard
DEF EAT SAND END
EDIT: As a side note, why is the standard eat sand? it's not like it make that much of a difference, but...
Because N can't be eaten, now can it. The sand can be eaten. Thus DEF EAT SAND END.