
-----------------------------------
[Gandalf]
Sun May 22, 2005 9:22 pm

Picture Loaded in Condition Statement?
-----------------------------------
I didn't know how else to state this problem.

How you check if there is a certain picture loaded in an if statement.  For example, what I tried, which obviously didn't work is:


var pic := Pic.FileNew ("pic.bmp")
if pic := Pic.FileNew ("pic.bmp") then
    put "this picture is loaded"
else
    put "there is no picture loaded"
end if


Do I have to make some boolean condition true when the pic is loaded, and then check for that?  It seems like too much hastle...

-----------------------------------
Delos
Sun May 22, 2005 9:39 pm


-----------------------------------
Check the Error.Last and Error.LastMsg things.  They return values after Pic.New is called, so you can use them to determine whether or not the pic has loaded.

-----------------------------------
[Gandalf]
Sun May 22, 2005 9:51 pm


-----------------------------------
Hmm, can you explain this a bit more?  How do you use Error.Last and Error.LastMsg?  If I add what I posted previously, the program doesn't even compile...

-----------------------------------
Bacchus
Sun May 22, 2005 10:51 pm


-----------------------------------
just check to see if the var = 0, if it does then the pic wasnt created :P

-----------------------------------
MysticVegeta
Sun May 22, 2005 10:55 pm


-----------------------------------
unsuccessful pic open error is error # 201

-----------------------------------
zylum
Mon May 23, 2005 12:25 am


-----------------------------------
var pic := Pic.FileNew ("pic.bmp")
if Error.Last not= 0 then
    put "this picture is loaded"
else
    put "there is no picture loaded"
end if 

-----------------------------------
Cervantes
Mon May 23, 2005 8:01 am


-----------------------------------
Heh, you've got it backwards, zylum.  Error.Last returns zero if there is no error.

var pic := Pic.FileNew ("pic.bmp")
if Error.Last = 0 then
    put "this picture is loaded"
else
    put Error.LastMsg
end if


-----------------------------------
MysticVegeta
Mon May 23, 2005 9:28 am


-----------------------------------
Gandalf do you mean if the pic is already open? or the importing file error?

-----------------------------------
zylum
Mon May 23, 2005 9:44 pm


-----------------------------------
Heh, you've got it backwards, zylum.  Error.Last returns zero if there is no error.

yup, you're right  :wink:

-----------------------------------
[Gandalf]
Tue May 24, 2005 10:55 pm


-----------------------------------
Thanks for all that, I was looking for something else, but this helps too.

I found a simple way of doing what I wanted, I was just doing things the wrong, redundant way...  Thanks for all the help.
