Belthazor,
Use the
ink command, along with the
rgb command, placed before your
text or
print commands, to change the color of the text.
Example:
ink rgb(255,255,255),0
text 0,0,"This text is white"
ink rgb(0,0,0),0
text 0,15,"This text is black"
ink rgb(255,0,0),0
text 0,30,"This text is red"
If you do not understand rgb values, just know this. That, r/g/b stands for red/green/blue. Either value can be up to 255. The value stands for how much of that color is being output. A mixture of values will give out different colors of the color wheel. There is a possibility of up to 16,581,375 colors.
About buttons, they are quite simple. To make a button that works, we must first compare the coordinates of the box with coordinates of the mouse. A box will have 4 coordinates(left side, top side, right side, bottom side).
In the example above, the box's coordinates are:
left side = 0
top side = 0
right side = 100
bottom side = 50
How would we check if the mouse is inside the box? We check if it is to the right of the left side of the box
and to the left of the right side of the box. Also, if it below the top of the box
and above the bottom of the box. If all of these conditions are true, then the mouse is within the box, as shown above.
Example:
xpos = mousex()
ypos = mousey()
if xpos => 0 and xpos =< 100 and ypos => 0 and ypos =< 50 then inbox = 1
Now, to make a functional button from here, is extremely simple. Use the same code above, with a little mouseclick() checking, to see if the mouse is clicked while inside the box.
Example:
xpos = mousex()
ypos = mousey()
if xpos => 0 and xpos =< 100 and ypos => 0 and ypos =< 50
if mouseclick() = 1
run needed code
endif
endif
Note, that this code may need to be set up differently to do what you need it to do. Let us say that the last example above is placed in a do loop. The code where it states "run needed code", will be executed each loop until the mouse is let off off. If a program refreshes 60 times in a second, then if the user hold the mouse button down within the button for one second, then the needed code will be executed 60 times within that second.
To counter this is simple, once you understand the method. Check the example below.
Example:
xpos = mousex()
ypos = mousey()
if xpos => 0 and xpos =< 100 and ypos => 0 and ypos =< 50
if mouseclick() = 1 and runcode = 0
runcode = 1
run needed code
endif
endif
I have thrown in a variable named
runcode, which its value is changed to 1 when the button is pressed. Therefore, the
if mouseclick() = 1 and runcode = 0 will only be true the first time the button is pressed. So, the needed to be ran code will only be executed once, no matter how long the user holds down the mouse button.
Using this method, the button is technically disabled after its first use. To enable the button for later use, would take a simple line of code
runcode = 0.
+NanoBrain+