
-----------------------------------
TruthManifested
Sun Jan 18, 2009 8:52 pm

Game Questions Not Functioning
-----------------------------------
Greetings!

I appreciate the help received here! I'm working on a major programming assignment, it is due tommorow. I i've gotten the code finished, now I'm having some major problems running it. 

Background info:

Essentially, we must program a basic quiz, that asks the user 10 questions (so 10 different screens: Each screen displays a question, and 4 multiple choice options - one being the answer). Now, my problem is this: As I execute (run) the code, the initial animation comes up sucessfully (many rings popping out from the middle in a definite pattern). After this, the introduction screen comes up with a Chemistry picture as the background. On this screen there are 4 buttons - starting from the left: Start, Exit, Credits, Instructions 

Credits, and Instructions both work fine - the problem is with the "start" button. My friend has sucessfully been able to help me somewhat here. Initially, when clicking on the start button, it'd just result in a blank, blue screen coming up - whereas there should have been two difficulty level buttons. We've conquered this problem, now the main one: After clicking on the difficulty level "Normal", nothing comes up. None of the questions/multiple choices (A, B, C, D)...

I've been stuck at this stage for some time, and this is my final day to complete it...I understand that I should have requested help earlier, so lesson learned hehe. 

Any last minute help would be greatly appreciated! 

Here's the code (the one my friend and I have fixed up a bit): 

% Program Created by Fahim Faruk
% Created on December __ - December 27th/08
% This is program will generate a quiz that will ask the user questions about
% Fundamental High school Chemistry


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DECLARING VARIABLES, SETTING UP FONTS, AND OTHER CONSTANT PROCEDURES        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. Import GUI and Setscreen
import GUI
setscreen ("graphics:max;max,nobuttonbar,nocursor,noecho")
GUI.SetBackgroundColour (blue)




% 3. Declare Variables
var key : int := 0
var radio : array 1 .. 4 of int
var a, b, c, d : int
var e, f : int
var g, h : int
var i, j : int
var count, count2 : int := 0
var font, font2, font3 : int
var scoreA, scoreB, scoreH, hardUnlock : int := 0
var score, Xitt, x, y, x1, yy : int := 0
var answer : string
var num : string

% Pictures
var mypi : int := Pic.FileNew ("ChemBackground.jpg")
var mypi2 : int := Pic.FileNew ("wrong.jpg")
var mypi3 : int := Pic.FileNew ("right.jpg")
var mypi4 : int := Pic.FileNew ("ques1.jpg")
var mypi5 : int := Pic.FileNew ("ques2.jpg")
var mypi6 : int := Pic.FileNew ("ques3.jpg")
var mypi7 : int := Pic.FileNew ("ques4.jpg")
var mypi8 : int := Pic.FileNew ("ques5.jpg")
var mypi9 : int := Pic.FileNew ("ques6.jpg")
var mypi10 : int := Pic.FileNew ("ques7.jpg")
var mypi11 : int := Pic.FileNew ("ques8.jpg")
var mypi12 : int := Pic.FileNew ("ques9.jpg")
var mypi13 : int := Pic.FileNew ("ques10.jpg")
var mypi14 : int := Pic.FileNew ("ques11.jpg")
var mypi15 : int := Pic.FileNew ("ques12.jpg")
var mypi16 : int := Pic.FileNew ("ques13.jpg")
var mypi17 : int := Pic.FileNew ("ques14.jpg")
var mypi18 : int := Pic.FileNew ("ques15.jpg")
var mypi19 : int := Pic.FileNew ("ques16.jpg")
var mypi20 : int := Pic.FileNew ("ques17.jpg")
var mypi21 : int := Pic.FileNew ("ques18.jpg")
var mypi22 : int := Pic.FileNew ("ques19.jpg")
var mypi23 : int := Pic.FileNew ("ques20.jpg")



% 4. Create Fonts
font := Font.New ("Comicsans:14:bold,italic")
font2 := Font.New ("arial:20:bold")
font3 := Font.New ("arial:30:bold")


% 5. Music and Sound Effects
process trunks
    loop
        Music.PlayFile ("trunks theme.wav")
    end loop
end trunks

process swoosh
    Music.PlayFile ("swoosh.wav")
end swoosh

process clap
    Music.PlayFile ("Clap.wav")
end clap

process wrong
    Music.PlayFile ("wrong.wav")
end wrong

process beep
    Music.PlayFile ("Beep.wav")
end beep

process pop
    Music.PlayFile ("pop.wav")
end pop

process boo
    Music.PlayFile ("boo3.wav")
end boo

fork trunks
% 6. Animation
proc slide
    var xmove, ymove : int := 0
    fork swoosh
    for z3 : 1 .. 130
        xmove := xmove + 10
        ymove := 50
        drawfilloval (xmove, ymove, 150, 50, brightblue)
        drawoval (xmove, ymove, 150, 50, black)
        drawline (maxx div 2, maxy div 2, 300, 300, black)

        drawfilloval (xmove, ymove + 100, 150, 50, red)
        drawoval (xmove, ymove + 100, 150, 50, black)
        drawline (maxx div 2, maxy div 2, 300, 300, black)

        drawfilloval (xmove, ymove + 200, 150, 50, green)
        drawoval (xmove, ymove + 200, 150, 50, black)
        drawline (maxx div 2, maxy div 2, 300, 300, black)

        drawfilloval (xmove, ymove + 300, 150, 50, brightblue)
        drawoval (xmove, ymove + 300, 150, 50, black)
        drawline (maxx div 2, maxy div 2, 300, 300, black)

        drawfilloval (xmove, ymove + 400, 150, 50, red)
        drawoval (xmove, ymove + 400, 150, 50, black)
        drawline (maxx div 2, maxy div 2, 300, 300, black)

        drawfilloval (xmove, ymove + 500, 150, 50, green)
        drawoval (xmove, ymove + 500, 150, 50, black)
        drawline (maxx div 2, maxy div 2, 300, 300, black)

        drawfilloval (xmove, ymove + 600, 150, 50, brightblue)
        drawoval (xmove, ymove + 600, 150, 50, black)
        drawline (maxx div 2, maxy div 2, 300, 300, black)
    end for
    cls
end slide

proc nothing

    GUI.Quit
end nothing

proc qquit
    quit
end qquit

proc lose
    mypi2 := Pic.Scale (mypi2, 1050, 800)
    Pic.Draw (mypi2, -35, -100, picCopy)
    Pic.Free (mypi2)
end lose

proc winner
    mypi3 := Pic.Scale (mypi3, 1050, 800)
    Pic.Draw (mypi3, -35, -100, picCopy)
    Pic.Free (mypi3)
end winner


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INTRO BUTTON PROCS                                                                %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% 1. Start Button's Procedure

proc start
    fork beep
    key := 1
    cls
    GUI.Quit
    cls
end start


% 2. Instruction Button's Procedure
proc ins
    fork beep
    cls
    Font.Draw ("This quiz will test out your knowledge of one of the physical sciences!", 100, maxy - 100, font2, black)
    delay (400)
    Font.Draw ("You will answer 10 questions related to Chemistry in NORMAL mode.", 90, maxy - 150, font2, black)
    delay (400)
    Font.Draw ("Each question includes 3 multiple choices, and only one is correct.", 60, maxy - 200, font2, black)
    delay (400)
    Font.Draw ("If you answer a question correctly, you will be rewarded 100 points!", 98, maxy - 250, font2, black)
    delay (400)
    Font.Draw ("If you answer a question incorrectly, you will suffer a loss of 50 points", 98, maxy - 300, font2, black)
    delay (400)
    locate (35, 52)
    put "


Mod Edit: Remember to use syntax tags! Thanks :) [syntax="turing"]Code Here[/syntax]

-----------------------------------
TruthManifested
Sun Jan 18, 2009 8:56 pm

Re: Game Questions Not Functioning
-----------------------------------
Note: when I take out      "Pic.Draw (picNormal (o), 300, 10, picCopy)" 

- The first question comes up, but none of the actual multiple choice options (only the letters, i.e. a, b, c, d - but not the actual choices that are with each letter) 

Also, the background picture (different one for each question) does not come up either.
