Computer Science Canada

Procedure help

Author:  pr0xiler [ Fri Mar 11, 2005 11:16 pm ]
Post subject:  Procedure help

I'm making a GUI program.. and im having trouble with procedures....

Is there a way to make a procedure return to the begining of the program from the top as in:

%top of program i want to return to

var random : int

put "Hi, welcome to my program"

procedure return1
(code to return to top here)
end return1

I then want to use this "return1" value in other procedures to return to the beginning of the program(marked by "%")

Basically what it does is open a new page after you click a button taking you somewhere.. and I want to make a back button(I already know how to make buttons) to return to the very beginning where the program started.

Thanks

Author:  mike200015 [ Fri Mar 11, 2005 11:30 pm ]
Post subject: 

theres a few different ways you could do it, 1 way is , make the begining of the program into a procedure, and name it return 1, and then in the program when u type in return 1, then it will go back and run the begining of the program

Author:  Tony [ Fri Mar 11, 2005 11:30 pm ]
Post subject: 

think loops

Author:  pr0xiler [ Fri Mar 11, 2005 11:34 pm ]
Post subject:  re

alright, i tried both ways... and a procedure cant be declared inside another procedure... and procedures cant be declared in loops.

Author:  mike200015 [ Fri Mar 11, 2005 11:37 pm ]
Post subject: 

if ur doing my way, then make them 2 seperate procedures, and if your doin tony's way then u dont need to make another procedure

Author:  pr0xiler [ Fri Mar 11, 2005 11:46 pm ]
Post subject: 

could you please give me an example of how i could do this with loops? (BTW I have lots of procedures in the body of my code that i want to return to the top of also).

Thanks guys

Author:  mike200015 [ Fri Mar 11, 2005 11:50 pm ]
Post subject: 

can u post ur code.. or like 1 procedure of it.. so i can c wat ur programs like?

Author:  pr0xiler [ Fri Mar 11, 2005 11:53 pm ]
Post subject: 

Heres the program (attatched)

Author:  mike200015 [ Fri Mar 11, 2005 11:54 pm ]
Post subject: 

k.. ill take a look.. and c if i can get it

Author:  pr0xiler [ Fri Mar 11, 2005 11:55 pm ]
Post subject: 

Thank you Very Happy

Author:  Tony [ Fri Mar 11, 2005 11:56 pm ]
Post subject: 

I wrote a tutorial on how to use loops to move around your program. I think you should read that.

While at it, read another tutorial to find out how to use procedures.

Author:  mike200015 [ Fri Mar 11, 2005 11:56 pm ]
Post subject: 

ok.. so what part do you want to return to.. the main screen wit all the buttons?

Author:  pr0xiler [ Fri Mar 11, 2005 11:56 pm ]
Post subject: 

Thank you Very Happy

(I want to return it to the screen that shows on the startup of the program, when you press the back button)

Author:  pr0xiler [ Fri Mar 11, 2005 11:57 pm ]
Post subject: 

Quote:

ok.. so what part do you want to return to.. the main screen wit all the buttons?


Thats right

Author:  mike200015 [ Fri Mar 11, 2005 11:59 pm ]
Post subject: 

so that part is at the bottom right now, correct?

Author:  pr0xiler [ Sat Mar 12, 2005 12:00 am ]
Post subject: 

yes

Author:  mike200015 [ Sat Mar 12, 2005 12:07 am ]
Post subject: 

a few questions: 1. what is procedure program?.. it doesnt look like it does anything
2. wheres the code for the the background colour and that title at the top?

Author:  mike200015 [ Sat Mar 12, 2005 12:09 am ]
Post subject: 

ok.. here.. check this out and tell me if this is what you wanted

Author:  pr0xiler [ Sat Mar 12, 2005 12:16 am ]
Post subject: 

Quote:
a few questions: 1. what is procedure program?.. it doesnt look like it does anything
2. wheres the code for the the background colour and that title at the top?


1. The program is incomplete.. but its supposed to open a new page up and do various calculations on them once its done.

2. the background color is set on top
GUI.SetBackgroundColour (67)
and the title is set as:
var label1 := GUI.CreateLabel (35, 385, "The Runescape Experience Calculator")

about the program, when a button is pressed i need the screen to clear and the buttons to dispose... leading to the back button which when clicked brings you back to the first page.

Thanks for your help

Author:  pr0xiler [ Sat Mar 12, 2005 12:24 am ]
Post subject: 

I got it working Very Happy . I didnt know of the "forward" and "bdoy procedures until you used them in the program.. i figured it out, thanks a lot.

Author:  mike200015 [ Sat Mar 12, 2005 12:25 am ]
Post subject: 

k ill c if i can get it to go to a blank screen n stuff.. i dont work wit GUI's so i dont know much about them, but ill giv it a shot

Author:  mike200015 [ Sat Mar 12, 2005 12:28 am ]
Post subject: 

ok.. so what u have to do is, after it says the button thing, then do dispose, but, it doesnt remove the gui's from the screen, i gotta chek how to do that

Author:  pr0xiler [ Sat Mar 12, 2005 12:29 am ]
Post subject: 

ok, thanks

Author:  mike200015 [ Sat Mar 12, 2005 12:39 am ]
Post subject: 

ok, i didnt totaly get it, but heres the idea of how to get rid of the GUI's.. run the program, and just wait a second, and the gui's will erase.

Author:  Bacchus [ Sat Mar 12, 2005 12:47 am ]
Post subject: 

Quote:
body proc hide
GUI.Hide (strengthButton)
GUI.Hide (attackButton)
GUI.Hide (defenceButton)
GUI.Hide (rangedButton)
GUI.Hide (prayerButton)
GUI.Hide (magicButton)
GUI.Hide (runecraftingButton)
end hide


main
delay (500)
hide
loop
exit when GUI.ProcessEvent
end loop

straight from ur code, see after the delay it hides the 1st column

Author:  pr0xiler [ Sat Mar 12, 2005 12:56 am ]
Post subject: 

Thanks for everyone's help, i finally got everything done! I attatched the final program just to show the final code of the results. 8)

Author:  mike200015 [ Sat Mar 12, 2005 1:22 am ]
Post subject: 

nice.. works great.. u didnt even need to use GUI.Hide? Idea

Author:  person [ Sat Mar 12, 2005 11:13 am ]
Post subject: 

y didnt use GUI.Hide?? if u used it u wouldnt have to declare the buttons over and over again


: