To put a long problem short,
How do I change the main menu mid-game?
[s]I have two custom menus - I'll be using Menu One (which disables items) in one chapter, and Menu Two (which enables items) in the other.
During a plotscript between the two chapters, I'll need to switch which one is brought up with Escape/Alt/whatever. How should I go about this?[/s] Mystery solved, use tags to switch individual options on/off.
On a similar note, because I am clumsy with choreography in plotscripts, I want to replace the "Order" option in the menu with a "Shuffle" option, which should be a plotscript that detects how many heroes are in the party and rearranges them accordingly.
In a 2-hero party, Shuffle would reverse the heroes' locations.
In a 3-hero party, Shuffle would make formation [1, 2, 3] become [2, 3, 1] then [3, 1, 2] and back to [1, 2, 3] again.
I'm sure I can pull this off, but if anyone has a pre-existing script for this sort of thing, I'd love to see it.
Shuffle
Moderators: Bob the Hamster, marionline, SDHawk
- Bob the Hamster
- Lord of the Slimes
- Posts: 7658
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
Oh-oh-ohhhh, that's whatJames Paige wrote:it would be way easier to just edit your regular menu and make the Items option require a tag to be enabled.
Right
I got it. And I can't believe how simple it is! Just switch a tag on to make the option selectable. I think I can apply this to future menu-thingies I've been planning, too.
- Bob the Hamster
- Lord of the Slimes
- Posts: 7658
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
I have a question about your shuffle plans.
You mentioned that your motivation for doing this is that you want to be clumsy with choreography in plotscripts. Are you doing that just because you want to make sure that the party is always in the first slots, so you are never organized like [A, B, Empty, B] or [Empty, A, B, C]?
If that is the reason, then I have an alternate suggestion. Call the standard order menu from a script, and then force them all to the front afterwards.
Something like this
Let me know if this works for you. I haven't tested it in a game yet.
You mentioned that your motivation for doing this is that you want to be clumsy with choreography in plotscripts. Are you doing that just because you want to make sure that the party is always in the first slots, so you are never organized like [A, B, Empty, B] or [Empty, A, B, C]?
If that is the reason, then I have an alternate suggestion. Call the standard order menu from a script, and then force them all to the front afterwards.
Something like this
Code: Select all
plotscript, gapless order menu, begin
order menu
variable(who, other)
who := 0
while(true) do(
if(hero by slot(who) == -1) then(
# found a gap
other := who + 1
while(true) do(
if(other >= 4) then(break)
if(hero by slot(other) >= 0) then(
#found another hero!
swap by position(who, other)
break
)
other += 1
)
)else(
# no gap here, continue
who += 1
if(who >= 4) then(break)
)
)
end
- JSH357
- Liquid Metal Slime
- Posts: 1341
- Joined: Mon Oct 15, 2007 7:38 pm
- Location: Columbia, SC
- Contact:
Fun fact: When I read "Shuffle" I thought you meant as in randomizing a group of variables, and it made me cry because this was such a hassle to code in Motrya (The script I used to randomize the position of 9 cards took an obscene amount of code that I can barely read because the slice commands have such long names).
My website, the home of Motrya:
http://www.jshgaming.com
http://www.jshgaming.com
Yes, that's exactly why.James Paige wrote:Are you doing that just because you want to make sure that the party is always in the first slots, so you are never organized like [A, B, Empty, B] or [Empty, A, B, C]?
I noticed when testing an earlier build that the player could switch characters around, and this interfered with all of my scripted movements, making dumb scenarios where invisible heroes ran around killing a dragon with their bare hands or whatever.
I'll test your code as soon as I can.
The lazy coder's shuffle:JSH357 wrote:Fun fact: When I read "Shuffle" I thought you meant as in randomizing a group of variables, and it made me cry because this was such a hassle to code in Motrya (The script I used to randomize the position of 9 cards took an obscene amount of code that I can barely read because the slice commands have such long names).
Code: Select all
for(i, 0, BIG_NUMBER) do (
swap(random card 1, random card 2)
)