
-----------------------------------
equs
Thu Apr 08, 2004 8:36 pm

procedures in procedures/functions/process
-----------------------------------
im having a problem.IM trying to make a frid for my game Snake and i cant declare proc or functions or processes in my array. I heard you can call procedures inside a procedures and etc. Does anyone know the comand and how to do this?
ty

-----------------------------------
Dan
Thu Apr 08, 2004 8:54 pm


-----------------------------------
u are trying to call a futtion in a array?  :eh:

arrays are things that holed more then one of the same data type and futtions are like miny progames. so u can't put fucttions in arrays. 

u call a procedure in a procedure the same way u whould a procedure that is not in a procedure. just do not put the code for a procedure in a procedure, put it above it like u ushely whould

-----------------------------------
Delos
Thu Apr 08, 2004 9:03 pm


-----------------------------------
I believe that the poster is saying this:


procedure one
procedure two
end two
end one


This is not possible in Turing.  Do not attempt to do it.  Arrays work like this:


var nameOfArray : array 1..# of 

Procedures:


procedure procName


More info?
Rite here.
http://www.compsci.ca/v2/viewtopic.php?t=407

-----------------------------------
Catalyst
Thu Apr 08, 2004 9:10 pm


-----------------------------------
you actually can have arrays of functions  :D


fcn test1 () : int
    result 1
end test1
fcn test2 () : int
    result 2
end test2
fcn testThree () : int
    result 3
end testThree

var fcnArray : array 1 .. 3 of fcn test () : int

fcnArray (1) := test1
fcnArray (2) := test2
fcnArray (3) := testThree

for i : 1 .. 3
    put fcnArray (i) ()
end for


probably not was he needs tho

-----------------------------------
equs
Thu Apr 08, 2004 9:24 pm


-----------------------------------
i misspelled it. IM not trying to call functions in arrays but like proceudre sin procedures and functins in procedure and so  forth and so forth

-----------------------------------
AsianSensation
Thu Apr 08, 2004 10:47 pm


-----------------------------------
you actually can have arrays of functions  :D

 :shock:  :shock:  :shock:  :shock:  :shock:  :shock:  :shock:  :shock:  :shock:  :shock:  :shock:  :shock:  :shock:  :shock:  :shock:  :shock: 


Fo' the Shiznit?!?!?!?!?!

that is pretty cool.

Though do you have to initialize the array of functions like that? (Just can't be satisfied  :P )

-----------------------------------
Tony
Fri Apr 09, 2004 12:13 am


-----------------------------------
eh? :? well this is exactly how turing's GUI works. You know how you specify which procedure gets called when you create a button? That procedure gets passed as an argument and is saved in one of internal variables of the button module (or w/e GUI element).

In fact - you could write and export a method that could change the procedure to be called, so same button could do multiple functions depending on various conditions

-----------------------------------
equs
Fri Apr 09, 2004 11:40 am


-----------------------------------
but can i call procedures in procedures. Is there a command? or like functions in procedures. Beucase i have a button and when i pres start the game is suppoed to start which is snake. And i cant make the grid without functions or processes or procedures. And i have to cal them inside the start button procedures so the game wil start. Any help?
ty Joshua

-----------------------------------
Catalyst
Fri Apr 09, 2004 12:37 pm


-----------------------------------
like this?



proc GridSomthing

end GridSomthing


proc Start

    GridSomthing
end Start

-----------------------------------
equs
Sun Apr 11, 2004 11:49 am


-----------------------------------
no something like this
procedure start
code with procedures/functions/processes
end start
start button code

whenever i try to put procedures/functions/processes in a procedure it says it has ot be at the monitor level. Is there a comand i can call procedures in procedures and so forth or at least put them in 1 procedure?

-----------------------------------
Catalyst
Sun Apr 11, 2004 12:14 pm


-----------------------------------
why do want other procedures in another procedure?

-----------------------------------
AsianSensation
Sun Apr 11, 2004 1:46 pm


-----------------------------------
if you really want to do procedures in another procedure, use modules, it's not technically proc in proc, but it's close enough. Though I agree with Catalyst, why would you?

-----------------------------------
Tony
Sun Apr 11, 2004 2:37 pm


-----------------------------------
the reason you can't declear a procedure within another procedure is because each time that outter procedure is called, inner one would have to be decleared again :? But even if you could do that, I fail to see the reasoning behind it...

-----------------------------------
equs
Sun Apr 11, 2004 7:18 pm


-----------------------------------
the reason is that i have a start button on a menu screen. Its a sanke game. When i press the start button the game is supposed to start. When the game start all the code should start. Now the button has a procedure. And the game has a procedure. So i have to call procedures for the game inside the start button procedure. Ill look into modules. But if anyone can figure this out it would be helpful. 
ty Joshua

-----------------------------------
Catalyst
Sun Apr 11, 2004 7:27 pm


-----------------------------------
calling a procedure inside another isnt the same as declaring it inside another
why wouldnt something like this work?




%% intro goes here

proc game
   %%Game goes here
end game


proc start
   game
end start


-----------------------------------
Catalyst
Sun Apr 11, 2004 7:28 pm


-----------------------------------
calling a procedure inside another isnt the same as declaring it inside another
why wouldnt something like this work?



proc game
   %%Game goes here
end game


proc start
   game
end start


-----------------------------------
equs
Mon Apr 12, 2004 10:11 am


-----------------------------------
ty very much i finnally get it. 
ty Joshua
