Sure thing;
Here's some String functions... Pretty self-explanitory
RemStart Functions contained in this file;
_strip_space(part,sstr)
str is the string to be striped.
part can be 1, 2 or 3.
1 to strip space at the start of the string
2 to strip space at the end of the string
3 to strip all space in the string
Will return "ERROR" if failed, otherwise, will return modified string
_str_delim(sstr$,fchar$,lchar$,num)
sstr$ is the string to be searched
fchar$ is the first character to search from
lchar$ is the second character to search two
num is the occurance of the fchar$ and lchar$ to get between
if this is 0, the characters from the start of the string to the first fchar$
if it is greater than the number of occurances in str, null string will be returned
Will return the string between fchar$ and lchar$ in sstr$
_insert_str(str,instr,pos)
Inserts 'instr' into 'str' between 'pos' and 'pos' + 1
Returns the new string
_cut_str(str,pos1,pos2)
Removes all the characters from pos1 to pos2 inclusive from str
Returns the new string
_str_change(str,oldchar,newchar)
Replaces all occurances of oldchar in str with newchar
_src_str(str,src,num)
Finds the 'num'th occurance of 'src' in 'str'
Returns the position of this
_mid_str(str,pos1,pos2)
Returns the String from pos1 to pos2 in 'str' inclusive
RemEnd
Function _strip_space(part As Integer,sstr As String)
`str is the string to be striped.
`part can be 1, 2 or 3.
`1 to strip space at the start of the string
`2 to strip space at the end of the string
`3 to strip all space in the string
strlen = Len(sstr)
tmpstr$ = ""
If part = 1
For i = 1 To strlen
If Mid$(sstr,i) <> " "
tmpstr$ = Right$(sstr,strlen - i + 1)
ExitFunction tmpstr$
EndIf
Next i
EndIf
If part = 2
For i = strlen To 1 Step -1
If Mid$(sstr,i) <> " "
tmpstr$ = Left$(sstr,i)
ExitFunction tmpstr$
EndIf
Next i
EndIf
If part = 3
For i = 1 To strlen
If Mid$(sstr,i) <> " "
tmpstr$ = tmpstr$ + Mid$(sstr,i)
EndIf
Next i
ExitFunction tmpstr$
EndIf
EndFunction "Error"
Function _str_delim(sstr$,fchar$,lchar$,num)
`sstr$ is the string to be searched
`fchar$ is the first character to search from
`lchar$ is the second character to search two
`num is the occurance of the fchar$ and lchar$ to get between
`if this is 0, the characters from the start of the string to the first fchar$
`if it is greater than the number of occurances in str, null string will be returned
`Example:
` _str_delim("Hello [World] I'm great","[","]",1) will return 'World'
` _str_delim("Bli^ng& Bling Means ^Money&","^","&",2) will return 'Money'
sstr$ = sstr$ + Chr$(10)
strlen = Len(sstr$)
delimstr$ = ""
found = 0
strmid$ = ""
delstart = 0
delend = 0
delcur = 0
For i = 1 To strlen
strmid$ = Mid$(sstr$,i)
If found = 0
If strmid$ = fchar$
Inc delcur
If i < strlen - 2 And ( delcur = num Or num = 0 )
If num = 0
delend = i - 1
Exit
Else
delstart = i
EndIf
found = 1
EndIf
EndIf
Else
If strmid$ = lchar$
delend = i - 1
Exit
EndIf
EndIf
Next i
If delend = 0 Then ExitFunction ""
delimstr$ = Left$(sstr$,delend)
delimstr$ = Right$(delimstr$,Len(delimstr$) - delstart)
EndFunction delimstr$
Function _insert_str(str As String,instr As String,pos As Integer)
`This function will,
` insert 'instr' into 'str' between 'pos' and 'pos' + 1
` and, will return the new string
str = Left$(str,pos) + instr + Right$(str,Len(str) - pos)
EndFunction str
Function _cut_str(str As String,pos1 As Integer,pos2 As Integer)
`Removes all the characters from pos1 to pos2 inclusive from str
`Returns the new string
str = Left$(str,(pos1 - 1)) + Right$(str,Len(str) - pos2)
EndFunction str
Function _str_change(str As String, oldchar As String, newchar As String)
retval As String
char As String
char = ""
retval = ""
For i = 1 To Len(str)
char = Mid$(str,i)
If char = oldchar Then char = newchar
retval = retval + char
Next i
EndFunction retval
Function _src_str(str As String,src As String,num As Integer)
retval As Integer
char As Integer
counter As Integer
char = 1
For i = 1 To Len(str)
If Lower$(Mid$(str,i)) = Lower$(Mid$(src,char))
If char = Len(src)
Inc counter
If counter = num
retval = i + 1 - Len(src)
ExitFunction retval
Else
char = 1
EndIf
Else
Inc char
EndIf
Else
char = 1
EndIf
Next i
EndFunction 0
Function _mid_str(str As String,pos1 As Integer,pos2 As Integer)
str = Left$(Right$(str,Len(str) - (pos1 - 1)),pos2 - pos1 + 1)
EndFunction str
Here's my Input Routines (
Need the above string functions to work);
RemStart
These functions have a dependancy on my (JessTicular's) String functions,
so don't forget to include them in your project too :)
Functions in this file;
_input_init(x,y,innum,max)
x = xPos when initializing, will stay at this position unless manually changed
y = yPos when initializing.
num = flag, if 0, will allow both numbers and characters,
if 1, Will only allow numbers to be entered,
if 2, will allow only characters
max = Maximum allowed characters
Returns an Integer reference to the input feild
_input()
Will not work for keys that have an InKey$() function associated with them
Before you call this function, once ( and only once ), possibly at the start
of your app, call the "Clear Entry Buffer" command
You must also call the _init_input() function to initialize an input gadget
_input_change(num,str)
Will change the string of input number 'num' to 'str'
_input_set_active(num)
Will give focus to input field number 'num'
_input_get(num)
Returns the string of the input field 'num'
_input_get_active()
Returns the current input feild that has focus
====*******************************====
`This following Block of code must be put in the main source file
` before the main loop, and before any use of the input functions.
====*******************************====
`######## -- Initialize variables for Input gadgets -- ########
Global totinp As Integer :`Total input feilds
Global ld As Boolean :`LeftKey Down?
Global rd As Boolean :`RightKey Down?
Global td As Boolean :`TabKey Down?
Type uin
str As String `The input string
strlen As DWord `The length of the input string
x As Integer `The x screen coord of the string
y As Integer `The y screen coord
pos As DWord `The cursor position in the string
posx As Integer `The x screen coord of the cursor
posy As Integer `The y screen coord of the cursor
flashtime As DWord `The time between flash's
flash As DWord `The time of the last flash
carret As String `The string used to be the cursor
onoff As Integer `If the cursor is to be shown or not
act As Boolean `Is this input gadget active?
num As Integer `What type of input is this? ( see _init_input() for types )
max As Integer `Maximum amount of characters that can be entered
tab As Integer `Tab Order of input boxes ( 1 is the first Tab and so on )
EndType
totinp = 0 :`There is no input gadgets yet
Global Dim in(totinp) As uin
in(0).x = 100
in(0).y = 100
in(0).flashtime = 400
in(0).carret = "|"
in(0).act = 1
`######## -- End Input initialization -- ########
remend
Function _input_init(x As Integer, y As Integer,innum As Integer,max As Integer)
`x = xPos when initializing, will stay at this position unless manually changed ( not recomended )
`y = yPos when initializing.
`num = flag, if 0, will allow both numbers and characters,
` if 1, Will only allow numbers to be entered,
` if 2, will allow only characters
`max = Maximum allowed characters
`Returns a reference to the input feild
Array Insert At Bottom in(0) :`Add a new item for input
Inc totinp :`Reflect this in the total input amount
in(totinp).x = x :`Initialize all the variables
in(totinp).y = y
in(totinp).num = innum
in(totinp).carret = "|"
in(totinp).max = max
in(totinp).tab = totinp
EndFunction totinp
Function _input()
`Notes,
`Will not work for keys that have an InKey$() function associated with them
` this is because when InKey$() is called, DBP clears the value from the Entry Buffer
`Before you call this function, once ( and only once ), possibly at the start
` of your app, call the "Clear Entry Buffer" command
`You must also call the _init_input() function to initialize an input gadget
Local tmpstr As String :`Set up local variables
Local tmppos As Integer
Local entry As String
Local tmpentry As String
Local ascentry As Integer
Local anyentry As Boolean
Local nexttab As Integer
`Get the new part of the entry string ( if there is one )
`and, if the buffer has been cleared, then get the entire string
in(0).str = Entry$()
If in(0).strlen < Len(in(0).str)
entry = Right$(in(0).str,Len(in(0).str) - in(0).strlen)
Else
entry = ""
EndIf
`Store the lengthe of the entry string, so next loop it can be used above
in(0).strlen = Len(Entry$())
For inp = 1 To totinp :`For each input gadget
If in(inp).act = 1 :`Only update if it is the active gadget
If Len(entry) > 0 :`No need to continue if nothing has been entered
anyentry = 1 :`Used later to mimic window's cursor
`Fix up the entry string so that it only has the desired characters
`Simply removes the unwanted characters from the entry string
If in(inp).num > 0
For i = 1 To Len(entry)
ascentry = Asc(Mid$(entry,i))
If in(inp).num = 1 :`If Only Numerical characters allowed
If (( ascentry <= 57 ) And ( ascentry >= 48 )) Or ( ascentry = 46 ) Or ( ascentry = 8 )
tmpentry = tmpentry + Mid$(entry,i)
EndIf
Else :`If Only Non-Numerical Characters allowed
If ( ascentry > 57 ) Or ( ascentry < 48 )
tmpentry = tmpentry + Mid$(entry,i)
EndIf
EndIf
Next i
entry = tmpentry
EndIf
tmpentry = ""
`Special characters that we don't want in the string ( 9 = TAB, 13 = RETURN )
For i = 1 To Len(entry)
ascentry = Asc(Mid$(entry,i))
If ( ascentry <> 9 ) And ( ascentry <> 13 )
tmpentry = tmpentry + Mid$(entry,i)
EndIf
Next i
entry = tmpentry
`Determine if the string is at it's maximum length,
`if so, and BackSpace ISN'T pressed, then skip the string functions
`However, if BackSpace IS pressed, then continue on to fix up the string
If in(inp).max <> 0
If Len(in(inp).str) >= in(inp).max
For i = 1 To Len(entry)
If Asc(Mid$(entry,i)) <> 8 Then GoTo _end
Next i
EndIf
EndIf
tmpstr = ""
tmppos = 0
in(inp).strlen = Len(in(inp).str)
in(inp).str = _insert_str(in(inp).str,entry,in(inp).pos) :`insert the Entry buffer into the string for the input gadget
in(inp).pos = in(inp).pos + (Len(in(inp).str) - in(inp).strlen) :`Fix up the position of cursor
in(inp).strlen = Len(in(inp).str)
tmppos = in(inp).pos
For i = in(inp).pos To 1 Step -1 :`Step through string, backwards
If Asc(Mid$(in(inp).str,i)) = 8 :`If the last values are that of the Backspace
Dec in(inp).pos :`The length of the string should be 2 less ( the backspace + the key before it ) ( this only removes backspace, the key before is removed next )
Else
If in(inp).pos <> tmppos Then Dec in(inp).pos :`Here :)
Exit :`If the next character is indeed a character, then jump out of the loop
EndIf
Next i
`Fix up the string if characters have been removed with "BackSpace"
in(inp).str = Left$(in(inp).str,in(inp).pos) + Right$(in(inp).str,in(inp).strlen - tmppos)
in(inp).strlen = Len(in(inp).str)
_end:
EndIf
`Do this even if there is no entry
If KeyState(203) Or KeyState(75) : If ld = 0 :`LEFT KEY
`** On Down **
ld = 1
If in(inp).pos > 0 Then Dec in(inp).pos :`Move the cursor left if pressed
anyentry = 1 :`Used later to mimic window's cursor
Else
`** While Held **
EndIf : Else : If ld = 1
`** On Up **
ld = 0
EndIf : EndIf
If KeyState(205) Or KeyState(75) : If rd = 0 :`RIGHT KEY
`** On Down **
rd = 1
If in(inp).pos < in(inp).strlen Then Inc in(inp).pos :`Move the cursor Right if pressed
If in(inp).pos > in(inp).strlen Then in(inp).pos = in(inp).strlen
anyentry = 1 :`Used later to mimic window's cursor
Else
`** While Held **
EndIf : Else : If rd = 1
`** On Up **
rd = 0
EndIf : EndIf
`Get the screen coords of the position of the cursor for the active gadget
in(inp).posx = in(inp).x + Text Width(Space$(in(inp).pos)) - (Text Width(in(inp).carret)/2)
in(inp).posy = in(inp).y
`If the gadget is due to be shown, then show it
If ( in(inp).onoff = 1 ) Or ( anyentry = 1 )
Text in(inp).posx,in(inp).posy,in(inp).carret
If anyentry = 1 :`If there was entry, to mimic windows, do this:
in(inp).onoff = 1
in(inp).flash = Timer()
EndIf
EndIf
If KeyState(15) : If td = 0 :`TabKey()
`** On Down **
td = 1
If in(inp).tab = totinp
nexttab = 1
Else
nexttab = in(inp).tab + 1
EndIf
For i = 1 To totinp
If in(i).tab = nexttab
_input_set_active(i)
EndIf
Next i
Else
`** While Held **
EndIf : Else : If td = 1
`** On Up **
td = 0
EndIf : EndIf
EndIf
`Do even if it is not active
Text in(inp).x,in(inp).y,in(inp).str :`Print the results
`Determine the time since last flash of the gadgets cursor
If (Timer() - in(inp).flash) >= in(0).flashtime
in(inp).onoff = Abs(in(inp).onoff - 1)
in(inp).flash = Timer()
EndIf
Next inp
EndFunction
Function _input_change(num As Integer,str As String)
`Will change the string of the specified input, and will fix up all associated values
`Num is an array index from 1 To totinp
`str is the new string to replace what is currently there
in(num).str = str
in(num).strlen = Len(str)
in(num).pos = in(num).strlen
`Get the screen coords of the position of the cursor for the active gadget
in(num).posx = in(num).x + Text Width(Space$(in(num).pos)) - (Text Width(in(num).carret)/2)
in(num).posy = in(num).y
EndFunction
Function _input_set_active(num As Integer)
`Will change the focus to the specified input string
`Num is an array index from 1 To totinp
For i = 1 To totinp
If in(i).act = 1 Then in(i).act = 0
Next i
in(num).act = 1
in(num).pos = in(num).strlen
`Get the screen coords of the position of the cursor for the active gadget
in(num).posx = in(num).x + Text Width(Space$(in(num).pos)) - (Text Width(in(num).carret)/2)
in(num).posy = in(num).y
EndFunction
Function _input_get(num As Integer)
`Returns the current input string
`Num is an array index from 1 To totinp
Local str As String
str = in(num).str
EndFunction str
Function _input_get_active()
`Returns the current input feild that has focus-+
For i = 1 To totinp
If in(i).act = 1 Then ExitFunction i
Next i
EndFunction i
Function _input_set_tab_order(num As Integer,tab As Integer)
in(num).tab = tab
For i = 1 To totinp
If ( i <> num ) And ( in(i).tab >= tab ) Then in(i).tab = in(i).tab + 1
Next i
EndFunction
Here's how you use it;
Sync On : Sync Rate 0
`######## -- Initialize variables for Input gadgets -- ########
Global totinp As Integer :`Total input feilds
Global ld As Boolean :`LeftKey Down?
Global rd As Boolean :`RightKey Down?
Global td As Boolean :`TabKey Down?
Type uin
str As String `The input string
strlen As DWord `The length of the input string
x As Integer `The x screen coord of the string
y As Integer `The y screen coord
pos As DWord `The cursor position in the string
posx As Integer `The x screen coord of the cursor
posy As Integer `The y screen coord of the cursor
flashtime As DWord `The time between flash's
flash As DWord `The time of the last flash
carret As String `The string used to be the cursor
onoff As Integer `If the cursor is to be shown or not
act As Boolean `Is this input gadget active?
num As Integer `What type of input is this? ( see _init_input() for types )
max As Integer `Maximum amount of characters that can be entered
tab As Integer `Tab Order of input boxes ( 1 is the first Tab and so on )
EndType
totinp = 0 :`There is no input gadgets yet
Global Dim in(totinp) As uin
in(0).x = 100
in(0).y = 100
in(0).flashtime = 400
in(0).carret = "|"
in(0).act = 1
`######## -- End Input initialization -- ########
first = _input_init(170,60,0,0)
_input_init(170,80,1,0)
_input_init(170,100,2,0)
_input_init(170,120,2,3)
_input_set_active(first)
While Not EscapeKey()
Cls
_input()
Text 0,0,"JessTicular's Input routines Example"
Text 0,20,"Press TAB to cycle through the available inputs"
Text 0,60,"Text and Numbers >>"
Text 0,80,"Numbers Only >>"
Text 0,100,"Text Only >>"
Text 0,120,"3 Letter Word >>"
Text 0,SCreen Height() - 20,"Screen FPS() = " + Str$(Screen FPS())
Sync
EndWhile
Here's the features;
Mutltiple input fields.
Does not stop your program like the 'Input' command does.
Can specify type of input ( Numbers, Characters, or both ).
Can specify maximum length of input ( 0 for unlimited ).
Can set the state of the input to any String at any time.
Can (de)activate fields at any time.
Can TAB between input devices.
Supports use of Cursor Keys and backspace.
Uses a flashing carret.
Here's some simple 2D functions;
Remstart Funcitons contained;
_inzone(x,y,x1,y1,x2,y2)
Will return non-zero if x,y is inside the coordinates defined by x1,x2,y1,y2
_centre_justify(x1,y1,x2,y2,str,encase,ptr)
Vertically and Horizontally justify's the given string
If encase is not 0, a white box is drawn around the string with the buffer of value encase.
ptr Should be a pointer to a pre-created memory area of 9 bytes,
this is used to return the values, in the form:
xpos, 4 BYTES ( DWord )
ypos, 4 BYTES ( DWord )
inbox, 1 BYTE ( BYTE )
_wrap_text(x,y,width,str)
Will wrap and paste the text within x and x+ width, starting at y.
Returns the final y position of the pasted text.
There is no limit on height of text.
_2D_dist(x1,y1,x2,y2)
Gets the distance between (x1,y1) and (x2,y2)
_box(x1,y1,x2,y2)
Draws an unfilled box using (x1,y1) as the upper left coord and (x2,y2) as the lower right coord
_octagon(x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8)
Draws an unfilled octagon using the provided coordinates
RemEnd
Function _inzone(x As Integer,y As Integer,x1 As Integer,y1 As Integer,x2 As Integer,y2 As Integer)
Local result As Boolean
result = 0
If x2 < x1 :`Swap X values if x2 < x1
Local x3 As Integer
x3 = x2 : x2 = x1 : x1 = x3
EndIf
If y2 < y1 :`Swap Y values if y2 < y1
Local y3 As Integer
y3 = y2 : y2 = y1 : y1 = y3
EndIf
If ( x >= x1 ) And ( x <= x2 ) And ( y >= y1 ) And ( y <= y2 )
result = 1
EndIf
EndFunction result
Function _centre_justify(x1 As Integer,y1 As Integer,x2 As Integer,y2 As Integer,str As String,encase As Integer,ptr As Dword)
`Vertically and Horizontally justify's the given string
`If encase is not 0, a white box is drawn around the string with the buffer of value encase.
`ptr Should be a pointer to a pre-created memory area of 9 bytes,
` this is used to return the values, in the form:
` xpos, 4 BYTES ( DWord )
` ypos, 4 BYTES ( DWord )
` inbox, 1 BYTE ( BYTE )
inbox As Byte
strlen As Integer
strhei As Integer
cx As Integer
cy As Integer
strx As DWord
stry As DWord
inbox = 0
strlen = Text Width(str)
strhei = Text Height(str)
cx = Int((x2 + x1) / 2) :`The centre of the justify'd position (x)
cy = Int((y2 + y1) / 2) :`The centre of the justify'd position (y)
strx = cx - (strlen / 2) :`The top-left position of the string
stry = cy - (strhei / 2)
If encase > 0
boxx1 = (strx - encase)
boxy1 = (stry - encase)
boxx2 = (strx + strlen + encase)
boxy2 = (stry + strhei + encase)
Line boxx1,boxy1,boxx2,boxy1 :`Top Line Of Box
Line boxx2,boxy1,boxx2,boxy2 :`Right Line
Line boxx2,boxy2,boxx1,boxy2 :`Bottom Line
Line boxx1,boxy2,boxx1,boxy1 :`Left Line
inbox = _inzone(MouseX(),MouseY(),boxx1,boxy1,boxx2,boxy2)
Else
inbox = _inzone(MouseX(),MouseY(),strx,stry,strx + strlen,stry + strhei)
EndIf
*ptr = strx : Inc ptr,4
*ptr = stry : Inc ptr,4
*ptr = inbox
EndFunction
Function _wrap_text(x As Integer,y As Integer,width As Integer,str As String)
`Wraps the text inside the given area
height As Integer
space As Integer
start As Integer
strx As DWord
stry As DWord
ptr As DWord
retval As Integer
height = Text Height("|")
space = 0
start = 1
ptr = Make Memory(9)
retval = 0
For i = 1 To Len(str)
If Mid$(str,i) = " " Then space = i
tmpstr$ = Right$(Left$(str,i),i - start)
If (Text Width(Right$(Left$(str,(space - 1)),space - start)) * 2) > width
_centre_justify(x,y,width + x,y + height,Right$(Left$(str,(space - 1)),space - start),0,ptr)
strx = *ptr : Inc ptr,4
stry = *ptr : Dec ptr,4
Text strx,stry,Right$(Left$(str,(space - 1)),space - start)
Inc y,height
start = space + 1
Else
If i = Len(str)
_centre_justify(x,y,width + x,y + height,Right$(Left$(str,i),i - (start - 1)),0,ptr)
strx = *ptr : Inc ptr,4
stry = *ptr : Dec ptr,4
Text strx,stry,Right$(Left$(str,i),i - (start - 1))
EndIf
EndIf
Next i
Delete Memory ptr
retval = (y + height)
EndFunction retval
Function _2D_dist(x1 As Integer,y1 As Integer,x2 As Integer,y2 As Integer)
retval = 0
retval = Sqrt((x2 - x1)^2 + (y2 - y1)^2)
EndFunction retval
Function _box(x1 As Integer,y1 As Integer,x2 As Integer,y2 As Integer)
Line x1,y1,x2,y1
Line x2,y1,x2,y2
Line x2,y2,x1,y2
Line x1,y2,x1,y1
EndFunction
Function _octagon(x1 As Integer,y1 As Integer,x2 As Integer,y2 As Integer,x3 As Integer,y3 As Integer,x4 As Integer,y4 As Integer,x5 As Integer,y5 As Integer,x6 As Integer,y6 As Integer,x7 As Integer,y7 As Integer,x8 As Integer,y8 As Integer)
`Draws an eight sided plain figure
Line x1,y1,x2,y2
Line x2,y2,x3,y3
Line x3,y3,x4,y4
Line x4,y4,x5,y5
Line x5,y5,x6,y6
Line x6,y6,x7,y7
Line x7,y7,x8,y8
Line x8,y8,x1,y1
EndFunction
Here's an extension to the string functions, allowing parsing of filenames/directories;
Function _get_file_name(str As String)
For i = Len(str) To 1 Step -1
If Mid$(str,i) = "\"
str = Right$(str,Len(str) - i)
ExitFunction str
EndIf
Next i
EndFunction str
Function _get_file_dir(str As String)
For i = Len(str) To 1 Step -1
If Mid$(str,i) = "\"
str = Left$(str,i)
ExitFunction str
EndIf
Next i
EndFunction str
Function _get_file_type(str As String)
For i = Len(str) To 1 Step -1
If Mid$(str,i) = "."
str = Right$(str,Len(str) - i)
ExitFunction str
EndIf
Next i
EndFunction str
Here's an example of how to use them;
Sync On : Sync Rate 0
myfile As String
myfile = "C:\Music\Coolio - Gangsters Paradise.mp3"
While NOT EscapeKey()
Text 0,0,myfile
Text 0,20,_get_file_name(myfile)
Text 0,40,_get_file_dir(myfile)
Text 0,60,_get_file_type(myfile)
Sync
EndWhile
Here's a nice way to detect Up/Down/Held Key Presses;
`This is a mimic of the functions you may see in event-driven languages.
`Find out the scancode of the key you want to check, and replace the 'x' with that
`Make a variable called whatever you want ( something like KEY_e or KEY_i etc )
`and replace keyx with that.
If KeyState(x) = 1 : If keyx = 0 : keyx = 1
`** On KeyDown **
`** End On Down **
Else
`** While KeyHeld **
`** End Held **
EndIf : Else : If keyx = 1 : keyx = 0
`** On KeyUp **
`** End On Up **
EndIf : EndIf
Hope they're self-explanitory enough, and people find a use for them
Jess.