View Full Version : Program flow question (using a function that's not declared yet)
Cigue
07-11-2010, 07:10 PM
http://img704.imageshack.us/img704/9296/programflow.th.png (http://img704.imageshack.us/i/programflow.png/)
Uploaded with ImageShack.us (http://imageshack.us)
This is the program flow I'm trying to achieve. The bubbles are functions. How do I do it? For necessity's sake, misc_error is at the top of the program, and main_fullrun is at the bottom.
Edit: Frement fixed it for me. Thanks man !
Cstrike
07-12-2010, 12:52 AM
Can you explain the script a little more? I'm not following (but this is probably because I'm ill, so dont worry!)
I'm just going to throw this out there, maybe it's a solution or not, but you can Forward; a function and I think this does something that MAY help you. I had to use it in a project once because I ran into a problem that may be similar to this.
Chances are I know less than you so hopefully this helps in some way, if not maybe I can assist when I get better :)
Yeah, all you need to do is use forward.
Cigue
07-12-2010, 02:49 AM
Can you explain the script a little more? I'm not following (but this is probably because I'm ill, so dont worry!)
I'm just going to throw this out there, maybe it's a solution or not, but you can Forward; a function and I think this does something that MAY help you. I had to use it in a project once because I ran into a problem that may be similar to this.
Chances are I know less than you so hopefully this helps in some way, if not maybe I can assist when I get better :)
I'm sorry, I could have been more clear :D In the end it really was forward; that got me out of trouble, but thank you for your quick answer :)
If you'd like to do teamwork on a project, I'd like to partner up with someone as sensible as you cstrike :)
Also, hey Sex, glad to see you're still around !
Xtensity
07-13-2010, 11:16 PM
If you want to use call functions that haven't been declared yet, meaning the one that's calling it is above it.
For each of your functions do this
Here's one from one of my scripts.
I got this function.
function CheckDemon:Boolean;
begin
writeln('OutOfPlanks!')
FindColorTolerance(x,y,2108777,0,0,429,219,5)
Mouse(x,y,0,0,false)
repeat
wait(50)
untiL(ChooseOption('Fetch'))
WaitFor(203,389,0,5)
Mouse(203,389,0,0,true)
end;
At the top of ALL my functions I would put(meaning at the top of the script in general... I got mine right below my variable declaration. Like this:
program New;
{.include srl/srl.scar}
var
x,y,z,Build,Remove:integer;
function CheckDemon:Boolean; Forward;
function CheckDemon:Boolean; Forward;
All you do is copy each functions name and add Forward; to the end of it.
If you do it to all your custom functions and put the list at the top of your script; each function will be able to call each one, regardless of order. Hope it makes sense, since I'm kind of stoned at the moment. :S Good Luck.
Frement
07-13-2010, 11:17 PM
Yes, I explained forward on MSN :)
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.