Ok, I haven't got the functions and stuff up on my site, but I'll just post them here for now. Here they are:
Useful function for creating an outline of a button
Function HollowBox(X1,Y1,X2,Y2,FColor,BColor)
Ink FColor,BColor
Line X1,Y1,X1,Y2 : Line X1,Y2,X2,Y2
Line X2,Y2,X2,Y1 : Line X2,Y1,X1,Y1
EndFunction
Creates a button:
Function CreateButton(Id,X1,Y1,X2,Y2,Click,Delay)
If File Open(1)=1 Then Close File 1
If File Open(2)=1 Then Close File 2
If File Exist("ButtonTemp.dat")=1 Then Delete File "ButtonTemp.dat"
If File Exist("Button.dat")=1
Copy File "Button.dat","ButtonTemp.dat"
Delete File "Button.dat"
Else
Make File "ButtonTemp.dat"
EndIf
Open To Read 1,"ButtonTemp.dat"
Open To Write 2,"Button.dat"
LineNum=0
Repeat
Inc LineNum
Read String 1,Data$
Write String 2,Data$
Until File End(1)=1
Close File 1 : Delete File "ButtonTemp.dat"
Write String 2,"Id: "+Str$(Id)
Write String 2,Str$(X1)
Write String 2,Str$(Y1)
Write String 2,Str$(X2)
Write String 2,Str$(Y2)
Write String 2,Str$(Click)
Write String 2,Str$(Delay)
Write String 2,""
Close File 2
EndFunction
Checks to see if a certain button is being clicked or not:
Function CheckButton(Id)
ReturnValue=0
If File Open(1)=1 Then Close File 1
Open To Read 1,"Button.dat"
Repeat
Read String 1,Data$
If Data$="Id: "+Str$(Id) Then Exit
Until File End(1)=1
Read String 1,X1$ : X1=Val(X1$)
Read String 1,Y1$ : Y1=Val(Y1$)
Read String 1,X2$ : X2=Val(X2$)
Read String 1,Y2$ : Y2=Val(Y2$)
Read String 1,Click$ : Click=Val(Click$)
Read String 1,Delay$ : Delay=Val(Delay$)
ReturnValue=0
If MouseX()=>X1 and MouseY()=>Y1 and MouseX()=<X2 and MouseY()=<Y2 and MouseClick()=Click
ReturnValue=1
Wait Delay
EndIf
Close File 1
EndFunction ReturnValue
Returns a value of 1 if any button is being clicked, else returns 0
Function CheckButtons()
ReturnValue$="0"
If File Open(1)=1 Then Close File 1
Open To Read 1,"Button.dat"
Repeat
Read String 1,Data$
If Left$(Data$,4)="Id: "
Read String 1,X1$ : X1=Val(X1$)
Read String 1,Y1$ : Y1=Val(Y1$)
Read String 1,X2$ : X2=Val(X2$)
Read String 1,Y2$ : Y2=Val(Y2$)
Read String 1,Click$ : Click=Val(Click$)
Read String 1,Delay$ : Delay=Val(Delay$)
If MouseX()=>X1 and MouseY()=>Y1 and MouseX()=<X2 and MouseY()=<Y2 and MouseClick()=Click
ReturnValue$=Right$(Data$,Len(Data$)-4) : EndFunction ReturnValue$
EndIf
EndIf
Until File End(1)=1
Close File 1
EndFunction ReturnValue$
Clears all button data:
Function ClearButtons()
If File Open(1)=1 Then Close File 1
If File Open(2)=1 Then Close File 2
If File Exist("Button.dat")=1 Then Delete File "Button.dat"
If File Exist("ButtonTemp.dat")=1 Then Delete File "ButtonTemp.dat"
Wait 100
EndFunction
You probably should put these functions in a seperate .dba file and use the #Include command to attach them to your main .dba file. I've already written a tutorial on this, but I need to update it first. I'll put the functions, tutorial, and samples up on my site soon, but I don't have time right now.
One last thing.......METALLICA!