Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Problem with types in subroutines

Author
Message
Jaeg
18
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Indiana
Posted: 6th Feb 2011 03:28 Edited at: 6th Feb 2011 03:36



Unless you have the Zombie Apocalypse pack for FPSC you'll have to modify it to run it.
My problem. If you look under the sub SetupCharacters you'll see I have created a zombie named Test based on the zombie type I declared near the beginning of the program. Now if I go and use AnimateMobZombie(Test.obj) in the main DO LOOP part of my program the compile shoots back an error saying Test doesn't exist. BUT if I copy the code from the SetupCharacters routine and place it right before the DO LOOP it'll work just fine. Any insight on this? Am I simply missing a syntax rule here?

EDIT
It was something simple. I'm guessing you have to create the member of the type outside of a sub in order for it to work. Once it's created you can still do whatever to it. It's really weird though...

Go ahead. Walk into Mordor.

Ball State University - Biology Major
enderleit
17
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 16th Feb 2011 14:32
It has to be declared before it's used in the code, which means that when the compiler reaches your main loop Test has not been declared yet. It should be declared at the top of the program.

You could also make it a global which would make it accessible all over... Still needs to be declared before it is used though...

Login to post a reply

Server time is: 2024-11-23 02:25:35
Your offset time is: 2024-11-23 02:25:35