Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / All about functions.

Author
Message
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 16th Aug 2005 21:15
I was making a codebase of functions recently. And now I found it time to show off my functions. You may have seen some of the funcions already in my previous posts. But these are ALL of them.

The functions

1- Math

We'll start with the math.

- round
syntax: round(number#, accuracy)

number#: the max number
accuracy: the number of digits after the comma. (0 = rnd())



- Modulus
syntax: mod(val1,val2)
the best way is an example:
mod(10,3) = 1 because 10/3 = 3 and 1 that remains.



2- 2D

- arrows
syntax: arrow(x,y,tx,ty,size,angle#)
x,y: coords of start point
tx,ty: coords of end point
size: size of arrow
angle#: determines the angle of the arrow.



- rotated box
syntax: box_rotated(x,y,width,height,angle#)
x,y: coords of the center of the box
width,height: size of the box
angle#: the angle of the box



- dotted line
syntax: dotted_line(x,y,tx,ty,n)
x,y: start coords
tx,ty: end coords
n: number of "smaller" lines.



3- 3D

- camera follow
syntax: cam_follow(id,distance#,height#)
id: number of the object
distance#: distance to object
height#: height above object



- camera controls
syntax: camcontrols()

standard controls:
mousemovement = rotate
left mouseclick = move forward
right mouseclick = move backward

when controlkey is pressed:
left mouseclick = zoom in
right mouseclick = zoom out



- camera top
syntax: top_camera(id,height#)
id: object to follow
height#: height above object



4- Text functions

- Capitalize
syntax: Cap(string$)



- text in a circle
syntax: circtext(x,y,txt$,radius,start#)
x,y: coords of center
txt$: the text
radius: radius of the circle
start#: start angle



- wave text
syntax: curvetext(x,y,string$,m,q)
x,y: coords of the start point of the text
string$: the text
m: determines the height difference
q: determines the number of waves



- effect1
syntax: effect1(x,y,text$,color1,color2)
x,y: start coords
text$: the text
color1,color2: from color1 -> color2



- effect2
syntax: effect2(x,y,text$,color1,color2)
x,y: start coords
text$: the text
color1,color2: color1 with a color2 border



- mid2$
syntax: mid2$(text$,start)
text$: the text
start: from this character to the last one will be returned.



- mid3$
syntax: mid3$(txt$,start,length)
txt$: the text
start: start from this character
length: the length of the string that will be returned.



- text reversed
syntax: reverse$(text$)
the text will be reversed.



- shadow text
syntax: shadow(x,y,text$,color)
x,y: coords of the text
text$: the text
color: the color of the text



- colored text
syntax: textcolors(x,y,text$)
x,y: the coords of the text
text$: the text



5- Misc

- browserwindow
syntax: browser_window(x,y,sizex,sizey,startdir$,color,move,resize)
x,y: coords of the window
sizex,sizey: size of the window
startdir$: the starting directory
color: the color theme
move,resize: 1: the window is movable/resizable.0 it isn't



- calculator
syntax: calc(x,y,color,move)
x,y: coords of window
color: color theme
move: 1 = the window is movable.



- inputbox
syntax: inputprompt(x,y,maxc,color)
x,y: coords of the window
maxc: maximum number of chars
color: color theme



- LoadMedia (DBC version)
syntax: LoadMedia()
load all the media in the current folder.
(To change the folder: use the cd or set dir command)



- Clock
syntax: clock(x,y,size)
x,y: center of clock
size: size of the clock



-------------------------------------------------------------

That was all.
No credit required.

REQUEST
!!!! Please post your functions on this thread !!!!

Thanks for your attention

cheers!

Immunity and Annihalation makes Immunihalation...
thinkdigital
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 16th Aug 2005 23:36
I have these, pretty common, but still:


Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 17th Aug 2005 01:11
hey sven b, you wouldnt mind if i used the circle and wave texts in my loading screen would ya?

"Well if she dies it'll teach her not to do it again..." - Me
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 17th Aug 2005 17:25 Edited at: 17th Aug 2005 17:26
Like I said. Use everything. I ask nothing for it.

another function I forgot to show.

- find string
syntax: find(searchstr$,searchedstr$)
searchstr$: the string that has to be searched
searchedstr$: the string that is searched
the command will return a 1 if the searched string is found.



EDIT: I just saw thinkdigital's code was doing kinda the same. Sorry

Immunity and Annihalation makes Immunihalation...
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 17th Aug 2005 21:12
Another wave of functions:
Specialized in sprites.
(I've posted these already a while ago, but just for the completiness)



centersprite(spr,x,y)
spr: the sprite
x,y: coords of the centre

circsprite(spr,to_spr,x,y,radius,start)
spr, to_spr: the range of sprites that should be placed in a circle. There may be wholes in the sprite sequence, this will only cause a "space" in the circle.
x,y: the centet coords
radius: the radius of the circle
start: the starting angle

spritewave(spr,to_spr,x,y,m,radius,start)
spr,to_spr: same as inc circsprite()
x,y: starting point of the wave
m,radius: this will have influence on the waveness.
start: the starting angle.

Immunity and Annihalation makes Immunihalation...

Login to post a reply

Server time is: 2025-05-22 14:09:22
Your offset time is: 2025-05-22 14:09:22