Illegal picture ID number 0
Author |
Message |
ayubelwhishi
|
Posted: Tue Apr 22, 2014 9:48 am Post subject: Illegal picture ID number 0 |
|
|
After trying to fix this for days now, I've finally decided to post the problem here. I'm doing a turing school project and I'm trying to load up images for the project except they keep coming up with Illegal picture ID number 0 "(probable cause: picture was not successfully loaded)" even though I've quadruple checked the path. The name is correct, it is in the same file as the program, the picture is in the correct format (I tried changing them to .jpeg and .bmp but still no success). I'm hoping one of you guys might be able to help with the problem.
code: | %%% Program Name: Abandoned
%%% Program Date: 01/04/2014
%%% Programmer: Ayub
%Importing GUI
import GUI
%Getting the mouse variables so the user can click on images and objects
var mx, my, mb : int
mb := 0
%Setting the font varibales
var font1 : int := Font.New ("chiller:50")
var font2 : int := Font.New ("chiller:40")
%Grabbing the images for the program
var asylum_outside : int := Pic.FileNew ("dskirkbride.jpg")
var asylum_hall1 : int := Pic.FileNew ("HauntedHallway.jpg")
var asylum_kitchen : int := Pic.FileNew ("Kitchen II.jpg")
var asylum_hall2 : int := Pic.FileNew ("download.jpg")
var asylum_room1 : int := Pic.FileNew ("asylum_room_by_RUCgost.jpg")
var asylum_room2 : int := Pic.FileNew ("HDR-haunted-bed-in-a-haunted-room-in-a-haunted-hospital-in-a-haunted-city-in-a-.....well-you-get-the-idea.jpg")
var asylum_room3 : int := Pic.FileNew ("paddedcell.jpg")
var asylum_room4 : int := Pic.FileNew ("canehillasylumdentist.jpg")
var asylum_picture1 : int := Pic.FileNew ("insane-asylum-patients1.jpe")
var asylum_picture2 : int := Pic.FileNew ("Maats_Beer_Yaakov_Asylum_Kitchen.jpg")
var asylum_picture3 : int := Pic.FileNew ("Magdalen-asylum.jpg")
var circle : int := Pic.FileNew ("ToM_EnsoCircle.jpg")
var background : int := Pic.FileNew ("bloody_background.jpg")
var static : int := Pic.FileNew ("Static.gif")
var dead1 : int := Pic.FileNew ("4e86a4677ce249d2a86caeca3463df49.jpg")
var dead2 : int := Pic.FileNew ("_origin_The-Expressionless-3.jpg")
var logo : int := Pic.FileNew ("satanlogo.jpg")
%The window settings and screen settings for the "movie"
View.Set ("graphics:1000;800,nobuttonbar")
colorback (black)
cls
GUI.HideMenuBar
%Making the Title Screen. I'm gonna add some music and a title screen
process DoMusic
loop
Music.PlayFile ("Scary and creepy piano improv (Yamaha DGX-630).mp3")
end loop
end DoMusic
fork DoMusic
for c : 16 .. 31
Draw.Text ("Ayub Presents...", 400, 400, font2, c)
delay (50)
end for
delay (1000)
for decreasing c : 31 .. 16
Draw.Text ("Ayub Presents...", 400, 400, font2, c)
delay (50)
end for
cls
delay (1000)
for c : 16 .. 31
Draw.Text ("Abandoned", 400, 600, font1, c)
delay (50)
end for
for c : 16 .. 31
Draw.Text ("Play", 450, 400, font1, c)
delay (50)
end for
loop
Mouse.Where (mx, my, mb)
if mb = 0 and mx > 450 and mx < 550 and my > 400 and my < 450
then
Draw.Text ("Play", 450, 400, font1, red)
else
Draw.Text ("Play", 450, 400, font1, white)
end if
if mb = 1 and mx > 450 and mx < 550 and my > 400 and my < 450
then
for decreasing c : 31 .. 16
Draw.Text ("Play", 450, 400, font1, c)
Draw.Text ("Abandoned", 400, 600, font1, c)
delay (50)
end for
cls
exit
end if
end loop
%Drawing the first level and image
Pic.Draw (asylum_outside, 0, 0, 0) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Raknarg
|
Posted: Tue Apr 22, 2014 10:13 am Post subject: RE:Illegal picture ID number 0 |
|
|
a lot of these pictures seem very poorly named. You're sure they're all spelled perfectly?
Also, this one worries me: "HDR-haunted-bed-in-a-haunted-room-in-a-haunted-hospital-in-a-haunted-city-in-a-.....well-you-get-the-idea.jpg" |
|
|
|
|
|
evildaddy911
|
Posted: Tue Apr 22, 2014 2:37 pm Post subject: RE:Illegal picture ID number 0 |
|
|
when the program crashes, it should highlight a line. which line is highlighted? which picture variable is causing the problem? |
|
|
|
|
|
ayubelwhishi
|
Posted: Wed Apr 23, 2014 8:48 am Post subject: Re: RE:Illegal picture ID number 0 |
|
|
Raknarg @ Tue Apr 22, 2014 10:13 am wrote: a lot of these pictures seem very poorly named. You're sure they're all spelled perfectly?
Also, this one worries me: "HDR-haunted-bed-in-a-haunted-room-in-a-haunted-hospital-in-a-haunted-city-in-a-.....well-you-get-the-idea.jpg"
I'm copy and paste sure.
evildaddy911 wrote:
when the program crashes, it should highlight a line. which line is highlighted? which picture variable is causing the problem?
It's this one that always highlights and the one I'm trying to fix.
code: | Pic.Draw (asylum_outside, 0, 0, 0) |
|
|
|
|
|
|
evildaddy911
|
Posted: Thu Apr 24, 2014 8:40 pm Post subject: RE:Illegal picture ID number 0 |
|
|
oh whoops, i didnt notice those last 2 lines, i had assumed you were only posting part of your code. okay, so try (temporarily) replacing that line with Pic.Draw (asylum_hall1, 0, 0, 0) then Pic.Draw (asylum_kitchen, 0, 0, 0), and so on, testing each picture. do all the pictures give the same error? |
|
|
|
|
|
Raknarg
|
Posted: Thu Apr 24, 2014 8:50 pm Post subject: RE:Illegal picture ID number 0 |
|
|
Try replacing the last 0 with picCopy. i doubt it will change the error but it is worth a shot.
The last argument in Pic.Draw function is an integer telling the function how to handle drawing the picture. There are four preset numbers which are picCopy, picXor, picMerge, picUnderMerge. You have to use one of them. picCopy is most likely the number you actually want to use. |
|
|
|
|
|
Insectoid
|
Posted: Thu Apr 24, 2014 9:12 pm Post subject: RE:Illegal picture ID number 0 |
|
|
code: | put picCopy
put picXor
put picMerge
put picUnderMerge |
Try running this Raknarg. 0 is a perfectly acceptable argument. |
|
|
|
|
|
Raknarg
|
Posted: Thu Apr 24, 2014 9:22 pm Post subject: RE:Illegal picture ID number 0 |
|
|
Huh. Didn't bother to check it. I figured it wouldn't doing anything considering the error message... Thanks Insectoid
The only other advice I can give given the info here is try changing the image type. A long time ago when I was using Turing, for some reason bmp's worked but all jpeg's did not. If at the end if you can't figure out what the problem is, you can try that. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
evildaddy911
|
Posted: Fri Apr 25, 2014 2:49 pm Post subject: RE:Illegal picture ID number 0 |
|
|
i had a similar problem to raknarg's the first time i tried to use picture graphics, but the problem was i was trying to use .pngs (because it was either fireworks or MSPaint and i didnt understand exporting). thing is, turing doesnt support that format. so thinking i was being clever, i renamed them from "bar.png" and "foo.png" to "foo.bmp" and "bar.bmp". that didnt work at all, because the extension is there to tell the computer how to interpret the 1s and 0s (its like giving somebody a letter written in morse code and telling them its a picture if they stand far enough away. amusing, but they wont be able to understand the message)
Anyways, to save you from wasting several hours trying to figure it out, open your .jpg in an editor and export as .bmp or vice versa |
|
|
|
|
|
ayubelwhishi
|
Posted: Tue Apr 29, 2014 8:54 am Post subject: RE:Illegal picture ID number 0 |
|
|
evildaddy911 fixed the problem. Thanks so much man. |
|
|
|
|
|
ylcc23
|
Posted: Thu Dec 04, 2014 10:59 pm Post subject: RE:Illegal picture ID number 0 |
|
|
I'm having a problem fairly similar to ragnar's problem, and this is my first time using graphics. I'm attempting to put in a picture of a friend of mine just cause I'm bored and feel like screwing around a little. Every time I try to load the image, I get one of two errors. Either: Illegal picture ID number "0" (probable cause: picture was not successfully loaded) or Illegal extended character in string literal. I've tried evildaddy911's solution of exporting my jpg to a bmp and I'm still getting the same error.
This iteration gives me The illegal extended character error
and this iteration gives me the illegal picture id error.
The picture is in the same dir as the program, and the file name is spelled correctly. |
|
|
|
|
|
Zren
|
Posted: Thu Dec 04, 2014 11:11 pm Post subject: RE:Illegal picture ID number 0 |
|
|
That's because when creating strings, the backslash character is used in combination with another character following it to represent characters that are harder to represent with a single glyph.
Example:
\n to represent a newline (what you insert when pressing the Enter key).
\t to represent the a tabbed indent.
\\ to represent a literal backslash character \
http://compsci.ca/holtsoft/doc/explicitstringconstant.html
Since backslashes are a common occurance in Windows filepaths, you'll need to get used to escape characters when using strings to represent them.
Eg:
Turing: |
var filepath := "C:\\Users\\user\\Downloads\\test.txt"
|
|
|
|
|
|
|
|
|