Yes, I got the filename thing sorted - it was because I'd merged the Save/Save-as routines into one and not done it properly. Clicking Save-as generated a new titlebar image, saying:
Lightning Limbs - " + UserInput$
ProjectTitle$ = UserInput$
Yet clicking Save did exactly the same thing - only then UserInput$ = "".
When entering text, I do use Entry$ because it's slightly more accurate at detecting keystrokes. I call this at startup (to set up keystate numbers, as these may vary from computer to computer)
DeleteKeyNo = 211
Cursor$ = "|"
and this when I click to enter a textbox (so nothing's there)
Line$ = ""
One$ = ""
Two$ = ""
then I just call this Gosub:
EnterString:
New$ = Entry$()
For N = 1 to Len(New$)
Temp$ = Mid$(New$,n)
rem Backspace key pressed
If Asc(Temp$) = 8 and CanMoveBackspace = 1
One$ = Left$(One$, Len(One$)-1)
CanMoveBackspace = 0
BackspaceTimer = Timer()
else
If Len(One$)+Len(Two$)+1<=MaxLength
rem Allow any letter key, or space key
If (Asc(Temp$)>=33 and Asc(Temp$)<=126) or Temp$ = " "
One$ = One$ + Temp$
endif
endif
endif
Next N
Clear Entry Buffer
rem Slide the cursor left or right
If CursorCanMove = 1
If Rightkey() = 1
One$ = One$ + Mid$(Two$, 1)
Two$ = Right$(Two$, Len(Two$)-1)
Cursor$ = "|"
CursorCanMove = 0
CursorMoveTimer = Timer()
endif
If Leftkey() = 1
Two$ = Mid$(One$, Len(One$)) + Two$
One$ = Left$(One$, Len(One$)-1)
Cursor$ = "|"
CursorCanMove = 0
CursorMoveTimer = Timer()
endif
endif
rem Press delete key
If CanDelete = 1
If Keystate(DeleteKeyNo) = 1
Two$ = Right$(Two$, Len(Two$)-1)
DeleteTimer = Timer()
Candelete = 0
endif
endif
If CursorMoveTimer + 100 < Timer() then CursorCanMove = 1
If BackspaceTimer + 100< Timer() then CanMoveBackspace = 1
If DeleteTimer + 100 < Timer() then CanDelete = 1
Line$ = One$+Two$
return
To display the text, simply call this:
Text x, y, Line$
Text (x-1) + Text Width(One$), y, Cursor$
The (x-1) part is to keep the cursor aligned at the end of the text - it'll almost certainly be different with different font settings and sizes, but it works with Arial Size 16.
To create a flashing cursor (so that it changes every half second), I call this at the top of each program loop:
If CursorTimer+500<Timer()
If Cursor$ = "|" then Cursor$="" else Cursor$ = "|"
CursorTimer = Timer()
endif
This particular GoSub only allows letter keys (caps or lower case) and the space key. I have made a couple of variations, allowing numbers only (for integers) and numbers with a single decimal point (for floats):
Integers:
EnterInteger:
New$ = Entry$()
For N = 1 to Len(New$)
Temp$ = Mid$(New$, n)
rem Backspace key pressed
If Asc(Temp$) = 8 and CanMoveBackspace = 1
One$ = Left$(One$, Len(One$)-1)
CanMoveBackspace = 0
BackspaceTimer = Timer()
else
If Len(One$)+Len(Two$)+1<=MaxLength
rem If number key is pressed
If ASC(Temp$)>=48 and ASC(Temp$)<=57
One$ = One$ + Temp$
endif
endif
endif
Next N
Clear Entry Buffer
rem Slide the cursor left or right
If CursorCanMove = 1
If Rightkey() = 1
One$ = One$ + Mid$(Two$, 1)
Two$ = Right$(Two$, Len(Two$)-1)
Cursor$ = "|"
CursorCanMove = 0
CursorMoveTimer = Timer()
endif
If Leftkey() = 1
Two$ = Mid$(One$, Len(One$)) + Two$
One$ = Left$(One$, Len(One$)-1)
Cursor$ = "|"
CursorCanMove = 0
CursorMoveTimer = Timer()
endif
endif
rem Press delete key
If CanDelete = 1
If Keystate(DeleteKeyNo) = 1
Two$ = Right$(Two$, Len(Two$)-1)
DeleteTimer = Timer()
Candelete = 0
endif
endif
If CursorMoveTimer + 100 < Timer() then CursorCanMove = 1
If BackspaceTimer + 100< Timer() then CanMoveBackspace = 1
If DeleteTimer + 100 < Timer() then CanDelete = 1
Line$ = One$+Two$
return
Floats:
EnterAngle:
New$ = Entry$()
For N = 1 to Len(New$)
Temp$ = Mid$(New$, n)
rem Backspace key pressed
If Asc(Temp$) = 8 and CanMoveBackspace = 1
One$ = Left$(One$, Len(One$)-1)
CanMoveBackspace = 0
BackspaceTimer = Timer()
else
If Len(One$)+Len(Two$)+1<=MaxLength
rem If just a dp is typed
If One$ = "" and Temp$ = "." and NoDps(One$+Two$) = 0
One$ = "0."
endif
rem If number key is pressed
If (ASC(Temp$)>=48 and ASC(Temp$)<=57) or Temp$ = "."
If (Temp$<> "." or NoDps(One$+Two$) = 0) then One$ = One$ + Temp$
endif
endif
endif
Next N
Clear Entry Buffer
rem Slide the cursor left or right
If CursorCanMove = 1
If Rightkey() = 1
One$ = One$ + Mid$(Two$, 1)
Two$ = Right$(Two$, Len(Two$)-1)
Cursor$ = "|"
CursorCanMove = 0
CursorMoveTimer = Timer()
endif
If Leftkey() = 1
Two$ = Mid$(One$, Len(One$)) + Two$
One$ = Left$(One$, Len(One$)-1)
Cursor$ = "|"
CursorCanMove = 0
CursorMoveTimer = Timer()
endif
endif
rem Press delete key
If CanDelete = 1
If Keystate(DeleteKeyNo) = 1
Two$ = Right$(Two$, Len(Two$)-1)
DeleteTimer = Timer()
Candelete = 0
endif
endif
If CursorMoveTimer + 100 < Timer() then CursorCanMove = 1
If BackspaceTimer + 100< Timer() then CanMoveBackspace = 1
If DeleteTimer + 100 < Timer() then CanDelete = 1
Line$ = One$+Two$
return
Function NoDps(Input$)
dp = 0
For D = 1 to Len(Input$)
If Mid$(Input$, D) = "."
dp = dp+1
endif
Next D
EndFunction dp
Hope this isn't too much information!
As regards Lightning Limbs, I'm afraid I'll have to put the finish date back a bit. My brother came down with a cold last week and oh-so-kindly shared it with me. I haven't felt up to coding the last few days, but I'm starting to get back into it now.
There's a host of new features been added - you can choose to "flip" the mouse buttons round, set prop properties at each keyframe (just imagine, you can make an object go ghosted for a few frames!), delete props and safely delete keyframes. I'm also rewriting the file format, to make the .Lim project files more logical and less wasteful of memory - if you open one up in Notepad, most of it is just blank spaces!
It is said there are 10 types of people in this world - those who understand binary, and those who have friends!