View unanswered posts | View active topics It is currently Thu Dec 26, 2024 6:18 pm



Reply to topic  [ 44 posts ]  Go to page Previous  1, 2, 3  Next
 How, oh how, do we make our missions invisible? 
Author Message
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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.


Wed Dec 29, 2010 9:49 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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


Wed Dec 29, 2010 9:57 pm
Profile WWW
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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.


Wed Dec 29, 2010 10:03 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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.


Wed Dec 29, 2010 10:16 pm
Profile WWW
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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.


Wed Dec 29, 2010 10:23 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: How, oh how, do we make our missions invisible?
Oops, yeah, my bad. I fixed that in the last post.


Wed Dec 29, 2010 10:27 pm
Profile WWW
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: How, oh how, do we make our missions invisible?
Presumably I enter the entire ScriptPath in dofile.


Wed Dec 29, 2010 11:36 pm
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post 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.


Wed Dec 29, 2010 11:37 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: How, oh how, do we make our missions invisible?
How do I control the scene a script is going to start in?


Wed Dec 29, 2010 11:47 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: How, oh how, do we make our missions invisible?
Check SceneMan.Scene.PresetName.


Wed Dec 29, 2010 11:50 pm
Profile WWW
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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?


Thu Dec 30, 2010 12:00 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: How, oh how, do we make our missions invisible?
Put the check I described in the StartActivity function for the mission script.


Thu Dec 30, 2010 12:03 am
Profile WWW
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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.


Thu Dec 30, 2010 12:06 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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.


Thu Dec 30, 2010 12:11 am
Profile WWW
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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.


Thu Dec 30, 2010 12:16 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 44 posts ]  Go to page Previous  1, 2, 3  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.185s | 13 Queries | GZIP : Off ]