GetEvent isn't a command that should be used inside the if structure in this case.
You see, using GetEvent gives eventSource(), eventType(), eventData() and eventDataEx() values, and those values can be used for events.
Since your GetEvent is inside
if eventsource()=loadit and eventtype()=MOUSE_CLICK
, eventSource() and eventType() won't hold any values.
This is what your code probably should be:
do
`!!!!!!!!!!!!!!!!!!!!
GetEvent
`!!!!!!!!!!!!!!!!!!!!
`*** When the button is pressed get the text of the gadget ***
if eventsource()=loadit and eventtype()=MOUSE_CLICK
spritename$(num)=getgadgettext(spritename)
`*** Show open dialog for the sprite ***
spritefile$(num)=opendialog("Open Sprite Image","JPEG Image (*.jpg)|*.jpg|BMP Image (*.bmp)|*.bmp|TGA Image (*.tga)|*.tga|DDS Image (*.dds)|*.dds|DIB Image (*.dib)|*.dib|PNG Image (*.png)|*.png|All Files (*.*)|*.*")
`*** Load the Image ***
load image spritefile$(num),num,1
`*** Make a Sprite out of it ***
sprite num,screen width()/2,screen height()/2,num
additem sprites,spritename$(num)
setgadgetvisible loadwindow,0
gosub start
endif
loop
It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.