Author |
Message |
Roast Veg
Data Realms Elite
Joined: Tue May 25, 2010 8:27 pm Posts: 4521 Location: Constant motion
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
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
|
Wed Dec 29, 2010 9:57 pm |
|
|
Roast Veg
Data Realms Elite
Joined: Tue May 25, 2010 8:27 pm Posts: 4521 Location: Constant motion
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
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 |
|
|
Roast Veg
Data Realms Elite
Joined: Tue May 25, 2010 8:27 pm Posts: 4521 Location: Constant motion
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
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 |
|
|
Roast Veg
Data Realms Elite
Joined: Tue May 25, 2010 8:27 pm Posts: 4521 Location: Constant motion
|
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 |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
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 |
|
|
Roast Veg
Data Realms Elite
Joined: Tue May 25, 2010 8:27 pm Posts: 4521 Location: Constant motion
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: How, oh how, do we make our missions invisible?
Check SceneMan.Scene.PresetName.
|
Wed Dec 29, 2010 11:50 pm |
|
|
Roast Veg
Data Realms Elite
Joined: Tue May 25, 2010 8:27 pm Posts: 4521 Location: Constant motion
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
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 |
|
|
Roast Veg
Data Realms Elite
Joined: Tue May 25, 2010 8:27 pm Posts: 4521 Location: Constant motion
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
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 |
|
|
Roast Veg
Data Realms Elite
Joined: Tue May 25, 2010 8:27 pm Posts: 4521 Location: Constant motion
|
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 |
|
|
|