thank you for the advice & ideas.
I should try running input statements in a subroutine immediately after the display setup and before the main loop.
i have done it that way at least once before.
I actually sorted out the faulty screen during the input process myself not long after posting. But i think it could be improved yet more by trying your suggestions.
Yes, i always use globals for true and false, and for black background and white text too hah.
So here goes some explanations and such:
I was happy with input cmds being in a gosub inside the main loop because you
see the clock changing and at any time you can choose to go to that process
or to exist by pressing space.
So it
felt like it was running and not just a blank screen with some questions, if you know what i mean!
it's only the displayed time that freezes after jumping to the process,
but any other altering visuals would freeze too probably.
When the input is finished, it jumps to an end of program label "_endprog"
...the only place i ever use Goto, cause it is the end, haha.
The structure of the code was borrowed from 8 previous programs.
But maybe it needs to change to fit each type of thing i want to do, probably a good idea LOL!
This program is detecting edges in a bitmap, pat of why i was starting off by using load bitmap.
it creates two blank files that i make into bitmaps.
One is a copy of the loaded image and the second is a changed image
based on some byte-level calculations and lots of Point(x,y) commands.
i'm not set on displaying anything until i'm happy with the
part of the code that has all the bit-shifting and point(x,y) variables.
But maybe i will try displaying them anyway since i sorted out the faulty input process.
I'll try doing it with image commands and without sync on too.
This is the altered code than ran better, with some commands cut out so you just see how it's structured:
do
` call function to load & process images
if controlkey() = true then gosub _getimage
loop
_getimage:
<---- all the name variables declared as local here.
` input data for creating the new image
input "name of image to load ? > ",loadname$
loadname$ = loadname$+bmpext$
` call function to check the image exists
_check4image(loadname$,loadnum)
Note: ^^^^^^ this is the check function that the below IF statements borrow the true or false condition from.
` if check was false jump to fail message
if canloadimg = false then gosub _loadfail
` if check was true load the image
if canloadimg = true then load bitmap loadname$,loadnum
blur bitmap loadnum,2
` call function to process image and write data to new file
processimage(sav1,sav2,loadnum,savname$,savname2$,savdir$)
return
Note: this is where the error message is displayed and the code jumps back and asks you to name the image correctly.
_loadfail:
sync off
cls
text 0,20,loadname$+" doesn't exist or filename typed was incorrect!"
wait msgwait*3
cls
text 0,20,"jumping back, try again!"
wait msgwait
cls
` jump back to start of input statements
gosub _getimage
return
Note: SO this is the check function that was called inside "_getimage"
I think this is what fixed the issue.
function _check4image(loadname$,loadnum)
` set a boolean value to decide if...
global canloadimg as boolean
` ...image exists
if file exist(loadname$) = true
canloadimg = true
endif
` ...image doesn't exist
if file exist(loadname$) = false
canloadimg = false
endif
exit
endfunction
Spooky Data