
-----------------------------------
MichaelM
Sun Aug 12, 2007 11:28 am

Executing one Turing File from another
-----------------------------------
Im was working on an RPG, and to start I made the main game (walking around etc.) and the battle system in different files. I am now at the point where I want to put them together, to make random battles etc. My plan was to make the whole battle program into a procedure using enemy type, enemy HP and so on as the parameters. However, this is giving me problems: 
      -outside varialbes such as your HP and other attributes are not being imported
      -also, the battle program has procedures of its own, so theres a million errors that say:
            "procedure's may only be declared at the program, module, or monitor level"

So I see two possibilities that both give me problems. First, to make the battle program a procedure, use every variable I'll need as a parameter, but then theres still the problem of "procedure's may only be declared..." bla bla bla

Then I thought, maybe I could just run/execute my battle program from the main game whenever I wanted a battle to occur. 

Is there anyone who could give me help as to which method will work, if any, and how to do it? Or maybe a link to a tutorial that will help (I couldn't find one)

thanks!

PS - Im not sure if it will effect the way I fix this problem, but just so you know, I only have Turing 3.1.1A or something like that

-----------------------------------
Nick
Sun Aug 12, 2007 3:04 pm

Re: Executing one Turing File from another
-----------------------------------
ok as far as i can tell your importing your battle right but im not sure if your exporting right...

this is what it should look like:

unit

module battle

import hp,maxhp,enemyhp,enemyMaxhp,other vars
export all procedures

enemy atack
declare inbattle vars here
end enemy attack

then ur main program

import ("other thing")
export all your battle vars

and that should work

also be sure ur using the battle.enemy attack instead of something like
battle or just enemy attack

im using the same format for my game execpt the battles are in the main program but the cutscenes are bing imported so ive hit my computer severeal times over this... good luck :P

-----------------------------------
Clayton
Sun Aug 12, 2007 7:13 pm

RE:Executing one Turing File from another
-----------------------------------
Could we see some code? I have a funny feeling I know what your problem is, but it's kind of difficult to explain without seeing your code.

-----------------------------------
MichaelM
Mon Aug 13, 2007 10:42 am

Re: Executing one Turing File from another
-----------------------------------
Okay heres some of the code for the battle, but Im asuming you don't want to see all 400 lines of it, and I'm afraid you wont be able to run it because it involves some battle animations using .bmps that you wont have, but take a look

This is only the procedures for drawing your stats, your normal attack move, and the enemy's normal attack move.
and in case your wondering, all the areas with delays and things like e_g1(x,y) are the animations. I also left out most variables 
 
setscreen("graphics:400;400")
drawline(0,60,400,60,black)
drawline(0,295,400,295,black)
var battlesummary:= GUI.CreateTextBoxFull (10, 305, 380, 85, GUI.INDENT, 0)

b_back(225,100)
e_g1(100,200)

procedure stats(h,p:int)
    tempHP:=tempHP-h
    if tempHP