needing some help towards my first program


Job Open: Blitz3D/C++ DLL RPLidar Programming. View Job Posting
(Posted 5 months ago) dispenacode

hiya guys

everytime when i try to run my program. I'm always greeted with 'Expecting end-of-line' and i have found no soulution to this problem whatsoever. Here's the code in question:

Graphics 800,600,2
AppTitle "Nicky's program"

Global fntArial

fntArial=LoadFont("Arial",13,False,False,True) 

SetFont fntArial
Text 400,30,"If you guess nicky's age, you'll earn a prize!", True

turnsleft=5
age=Rnd(20)
While (turnsleft>0)
turnsleft=turnsleft-1
guess=Input("Come on... Guess my age:")
If guess<age Then Print "I'm older tham that!"
If guess>age Then Print "I'm not that old!"
If guess=age Then Exit ; thinking of something here 
Wend
If turnsleft=0 Then Print "you failed" Else "good job"

Thanks.

(Posted 5 months ago)

Looks like you're not separating commands with newline or semi-colon :

(Posted 5 months ago)

Sorry, I don't know why it did that

Here's a better image https://imgur.com/a/CtwQFkq

(Posted 5 months ago)

Hi dispenacode, Welcome to the forums!

Aside from the newline or semi-color error that Mark pointed out, it seems you are missing a Print command after Else "good job"

Try this:

If turnsleft=0 Then Print "you failed" Print Else "good job"

P.S. I edited your post so you can edit (view) again and check how posting code and formatting works.

hope that helps, cheers.

(Posted 5 months ago)

thanks

so now everytime im trying to boot up my program im getting memory access violations. i stillhavenot found the solution

Graphics 800,600,16,2
AppTitle "Nicky's program"
; Made and developed by St. Peter Byzstockwski. 

Global fntArial ; font

fntArial=LoadFont("Arial",20,True,False,False) 

SetFont fntArial
Text 400,35,"If you guess nicky's age, you'll earn a prize!", True

turnsleft=6

age=15 ; guess game

While (turnsleft>0)

turnsleft=turnsleft-1

guess=Input("Come on... Guess my age:")

 If guess<age Then Print "I'm older than that!"

 If guess=16 Then Print "You're getting warmer..."

 If guess=17 Then Print "I'm a slightly younger than that..."

 If guess>17 Then Print "I'm not that old!"

 If guess=age Then Exit

Wend

 If guess=age Then Print "Have my reddit gold, kind stranger!" Else Print "SCREAMER!" ; add screamer with sound

gold = LoadImage("penis.png") If guess=15 Then LoadImage gold ; gold image
ResizeImage gold,400,300
DrawImage gold,200,150
MaskImage gold,255,255,255
Delay(0)

screamer = LoadImage("noobelli.jpg") If turnsleft=0 Then LoadImage screamer ; scarymazeface
ResizeImage screamer,400,300
DrawImage screamer,200,150
MaskImage screamer,255,255,255
Delay(0)

Global tada 
tada = LoadSound("tada.ogg") ; roblox badge sound/ windows startup sound
PlaySound tada If guess=15
Delay(1350)

FreeImage gold
FreeImage screamer
FreeSound tada

EndIf

any help will be helpful

(Posted 5 months ago)

Sure thing and that's a good start..

With that latest code, it seems you might be getting MAV errors due to missing resources, make sure you test and check your images and sound file path first for errors. The EndIf on the bottom part is no longer needed and also causing errors.. I have replaced the image for quick testing and commented the sound.

Here's an updated version for debugging, just create a new file without saving and run (will be saved in your Blitz3D tmp folder)

Graphics 800,600,0,2
AppTitle "Nicky's program"
; Made and developed by St. Peter Byzstockwski. 

Global fntArial ; font

fntArial=LoadFont("Arial",20,True,False,False) 

SetFont fntArial
Text 400,35,"If you guess nicky's age, you'll earn a prize!", True

turnsleft=6

age=15 ; guess game

While (turnsleft>0)

turnsleft=turnsleft-1

guess=Input("Come on... Guess my age:")

 If guess<age Then Print "I'm older than that!"

 If guess=16 Then Print "You're getting warmer..."

 If guess=17 Then Print "I'm a slightly younger than that..."

 If guess>17 Then Print "I'm not that old!"

 If guess=age Then Exit

Wend

 If guess=age Then Print "Have my reddit gold, kind stranger!" Else Print "SCREAMER!" ; add screamer with sound

gold = LoadImage("../bin/b3dlogo_small.png") If guess=15 Then LoadImage gold ; gold image
ResizeImage gold,400,300
DrawImage gold,200,150
MaskImage gold,255,255,255
Delay(0)

screamer = LoadImage("../bin/b3dlogo_small.png") If turnsleft=0 Then LoadImage screamer ; scarymazeface
ResizeImage screamer,400,300
DrawImage screamer,200,150
MaskImage screamer,255,255,255
Delay(0)

Global tada 
;tada = LoadSound("tada.ogg") ; roblox badge sound/ windows startup sound
;PlaySound tada If guess=15
Delay(1350)

FreeImage gold
FreeImage screamer
;FreeSound tada

;EndIf

Reply To Topic

Please log in to reply