Data Realms Fan Forums
http://forums.datarealms.com/

How, oh how, do we make our missions invisible?
http://forums.datarealms.com/viewtopic.php?f=73&t=20928
Page 2 of 3

Author:  Roast Veg [ Wed Dec 29, 2010 9:49 pm ]
Post subject:  Re: How, oh how, do we make our missions invisible?

I suppose the alternative is to combine all of the Lua files and have huge if statements all the way through. That would be an entertaining read.

Author:  TheLastBanana [ Wed Dec 29, 2010 9:57 pm ]
Post subject:  Re: How, oh how, do we make our missions invisible?

It would also be about as efficient as a car running on condensed hamburger meat, so I would suggest against it :P

Author:  Roast Veg [ Wed Dec 29, 2010 10:03 pm ]
Post subject:  Re: How, oh how, do we make our missions invisible?

No-no, I respect that your way is better. I'm going to have to work out the exact properties of a dofile, though.

Author:  TheLastBanana [ Wed Dec 29, 2010 10:16 pm ]
Post subject:  Re: How, oh how, do we make our missions invisible?

Dofile does exactly what you'd think. It runs the script in a file. So, let's say you have a file called "FileA.lua":
Code:
function foo()
   print("Hello world");
end

function bar()
   dofile("FileB.lua");
end

And let's say "FileB.lua" contains this:
Code:
function foo()
   print("Function overwritten");
end

If you call the "foo()" function, it prints "Hello world". However, if you call "bar()", the "foo()" function is overwritten, and then it prints "Function overwritten".
Hopefully that helps a bit.

Author:  Roast Veg [ Wed Dec 29, 2010 10:23 pm ]
Post subject:  Re: How, oh how, do we make our missions invisible?

I think you meant FileB.lua to have a print rather than a dofile, but otherwise that makes perfect sense.

Author:  TheLastBanana [ Wed Dec 29, 2010 10:27 pm ]
Post subject:  Re: How, oh how, do we make our missions invisible?

Oops, yeah, my bad. I fixed that in the last post.

Author:  Roast Veg [ Wed Dec 29, 2010 11:36 pm ]
Post subject:  Re: How, oh how, do we make our missions invisible?

Presumably I enter the entire ScriptPath in dofile.

Author:  mail2345 [ Wed Dec 29, 2010 11:37 pm ]
Post subject:  Re: How, oh how, do we make our missions invisible?

Roast Veg wrote:
I suppose the alternative is to combine all of the Lua files and have huge if statements all the way through. That would be an entertaining read.

That was actually what I was suggesting in the first place(except with function calls in the ifs instead of the code), but dofile does work alot better now that I remember it.
EDIT:
And yes, you put the path from the main CC dir.

Author:  Roast Veg [ Wed Dec 29, 2010 11:47 pm ]
Post subject:  Re: How, oh how, do we make our missions invisible?

How do I control the scene a script is going to start in?

Author:  TheLastBanana [ Wed Dec 29, 2010 11:50 pm ]
Post subject:  Re: How, oh how, do we make our missions invisible?

Check SceneMan.Scene.PresetName.

Author:  Roast Veg [ Thu Dec 30, 2010 12:00 am ]
Post subject:  Re: How, oh how, do we make our missions invisible?

Well, it's being run through:
Code:
ActivityMan:StartActivity("GAScripted" , self.MissionActivityToLaunch);


How can I choose beforehand which scene to run?

Author:  TheLastBanana [ Thu Dec 30, 2010 12:03 am ]
Post subject:  Re: How, oh how, do we make our missions invisible?

Put the check I described in the StartActivity function for the mission script.

Author:  Roast Veg [ Thu Dec 30, 2010 12:06 am ]
Post subject:  Re: How, oh how, do we make our missions invisible?

No, in Unmapped Lands when the mission is begun from the strategy screen, using the above code, I need to pre-emptively choose a scene.

Author:  TheLastBanana [ Thu Dec 30, 2010 12:11 am ]
Post subject:  Re: How, oh how, do we make our missions invisible?

Exactly.
All of your activities should be exactly the same, but with a different scene and a different name. They should all point to one master script.
In that script, the StartActivity function checks what the current scene is and calls dofile on the actual script file.
That should be all you have to change.

Author:  Roast Veg [ Thu Dec 30, 2010 12:16 am ]
Post subject:  Re: How, oh how, do we make our missions invisible?

Except I'm trying to go from one activity to another, but I can't force it to go to a different scene.

Page 2 of 3 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/