NEED HELP WITH BEGINNER CODE "Expecting end file"

BlitzPlus Forums/BlitzPlus Beginners Area/NEED HELP WITH BEGINNER CODE "Expecting end file"

pine(Posted 2014) [#1]
I cant figure out why i continually recieve an "end of file" error every time i go to launch the code. Please let me know if you can find out what is wrong.

Graphics 640.480.0.1
SetBuffer BackBuffer()

Global backgroundimage = LoadImage("background.png")

While Not KeyHit(1)
Cls

Flip
Wend

End

Function fdrawimage()

DrawImage(backgroundimage.0.0)

End Function


H&K(Posted 2014) [#2]
background.png Is corrupt?

You need to call fdrawimage between while and wend


RemiD(Posted 2014) [#3]
in functions, each reference/variable needs to be separated by a comma, not by a dot.


GfK(Posted 2014) [#4]
in functions, each reference/variable needs to be separated by a comma, not by a dot.
And just to be clear, Graphics is also a function.


Floyd(Posted 2014) [#5]
"Expecting end of file" really just means the compiler can't make sense of your code.

If you look carefully when the compile fails the cursor is located just after Graphics 640.480

The Graphics command expects some numerical values separated by commas. 640.480 is a number, albeit a strange one for Graphics.

But as soon as the compiler reaches Graphics 640.480. the code has become meaningless.


H&K(Posted 2014) [#6]
lol dumb me


Hotshot2005(Posted 2014) [#7]
should be

Graphics 640,480,0,1
SetBuffer BackBuffer()

Global backgroundimage = LoadImage("background.png")

While Not KeyHit(1)
      Cls
      fdrawimage()
      Flip
Wend

End

Function fdrawimage()

DrawImage(backgroundimage,0,0)

End Function 


That should have your background on :)


dna(Posted 2014) [#8]
Does using the drawimage Inside of a function do something to improve the program flow?

From what I can see, that program should work when using

DrawImage(backgroundimage,o,o)

in the spot where

fdrawimage()

is being called.


Matty(Posted 2014) [#9]
Umm..why are you using "." instead "," between parameters?


Hotshot2005(Posted 2014) [#10]
Sorry about that ! Matty

Correction done !