
-----------------------------------
jasonlin6868
Sat May 24, 2008 11:38 pm

How to turn back?
-----------------------------------
I am doing a encyclepedia project and got a problem. I write the first page, and when I turn to second page I don't know how to turn back to the first page. Do I have to copy the whole procedure at first page or you guys have a better way to da that?

-----------------------------------
TheGuardian001
Sat May 24, 2008 11:41 pm

Re: How to turn back?
-----------------------------------
it depends on how you're writing the code for each page. If you're just putting everything in nested loops (not recommended if its gonna be big) then just exit until you're back in the first page.

the easiest way to do it would be to make each page a procedure. then you just need to call the procedure, instead of copy pasting tons of lines of code.

-----------------------------------
jasonlin6868
Sun May 25, 2008 1:31 pm

RE:How to turn back?
-----------------------------------
so how do I do that? var the whole procedure? I am really fustrated. It's due Tuesday! Man is my summative! I am doom!

-----------------------------------
Sean
Sun May 25, 2008 1:35 pm

Re: How to turn back?
-----------------------------------


procedure Example
    %Your Code
end Example

procedure Example2
    %Your Code
 if return_answer = "Y" then
      cls
      Example
 end if
end Example2

%Main Program
Example
Example2


Works like this.

-----------------------------------
jasonlin6868
Sun May 25, 2008 2:37 pm

RE:How to turn back?
-----------------------------------
I am using mousewhere button. So when I click the back button will turn back and forward button will turn forware, So how can I put the procedure within the loop?

-----------------------------------
jasonlin6868
Sun May 25, 2008 3:14 pm

RE:How to turn back?
-----------------------------------
var yesNo : string (1)
var font := Font.New ("TimesNewRoman:36")
var text := "Shark!"
var width := Font.Width (text, font)
var x, y, b : int
var mx, my, mb : int
var lesson := "Lesson"

procedure Menue
    %shark screen
    setscreen ("graphics:909;663")
    Pic.ScreenLoad ("shark.BMP", 0, 0, picCopy)
    %Button
    drawbox (310, 240, 600, 420, black)
    locate (33, 16)
    Font.Draw (text, round (maxx / 2 - width / 2), maxy div 2, font, black)
    colour (black)
    colourback (white)
    locate (maxrow, 1)
    put "Press Shark button to do lesson"
    put "Press QUiz button to do quiz"
end Menue

%Lesson 1
procedure Lesson
    setscreen ("graphics:642;402")
    colourback (white)
    colour (black)
    Pic.ScreenLoad ("rightarrow.BMP", 560, 0, picCopy)
    Font.Draw (lesson, 1, 360, font, red)
    locate (4, 1)
    colour (blue)
    put "  Defination: Sharks (superorder Selachimorpha) are a type of fish with a full"
    put "cartilaginous skeleton and a streamlined body." ..
    put ""
    put "  They respire with the use of five to seven gill slits. Sharks have a covering of dermal denticles that protect their skin from damage and parasites and"
    put "improve fluid dynamics; they also have replaceable teeth." ..
    Pic.ScreenLoad ("Sharks part.BMP", 80, 25, picCopy)
    Font.Draw ("Page 1/3", 0, 0, font, red)
    Pic.ScreenLoad ("rightarrow.BMP", 560, 0, picCopy)
end Lesson

procedure Lesson2
    colourback (red)
    cls
    Font.Draw ("Shark's Teeth", 1, 360, font, blue)
    locate (4, 1)
    put "  The teeth of carnivorous sharks are not attached to the jaw, but embedded in "
    put "the flesh, and in many species are constantly replaced throughout the " ..
    put " shark's  life; some sharks can lose 30,000 teeth in a lifetime." ..
    Pic.ScreenLoad ("rightarrow.BMP", 560, 0, picCopy)
    Pic.ScreenLoad ("leftarrow.BMP", 450, 0, picCopy)
    Font.Draw ("Page 2/3", 0, 0, font, blue)
    Pic.ScreenLoad ("shark_teeth.JPG", 220, 60, picCopy)
    %arrow
end Lesson2

procedure Lesson3
    Font.Draw ("Page 3/3", 0, 0, font, blue)
    Pic.ScreenLoad ("rightarrow.BMP", 560, 0, picCopy)
    Pic.ScreenLoad ("leftarrow.BMP", 450, 0, picCopy)
    Font.Draw ("Lifespan", 1, 360, font, yellow)
    put
        "Maximum shark ages vary by species. Most sharks live for 20 to 30 years, while the spiny dogfish lives a record lifespan of more than 100 years. [12] Whale sharks (Rhincodon typus) have been hypothesized to also live over 100 years."
end Lesson3


Menue
loop
    Mouse.Where (mx, my, mb)
    if mx >= 310 and mx = 240 and my = 550 and mx = 0 and my = 450 and mx = 0 and my = 550 and mx = 0 and my = 450 and mx = 0 and my = 550 and mx = 0 and my = 310 and mx = 240 and my = 550 and mx = 0 and my = 450 and mx = 0 and my = 310 and mx = 240 and my = 310 and mx = 240 and my = 550 and mx = 0 and my = 450 and mx = 0 and my = 550 and mx = 0 and my = 310 and mx = 240 and my = 550 and mx = 0 and my = 450 and mx = 0 and my 