Picking your own team color
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Picking your own team color
I want the player to pick his own team color. In the "team-colors.cfg", the colors are listed. There are the usual colors: Red, Blue, Green, Purple, Black, Brown, Orange, White, and Teal. But there is also Light Red, Dark Red, Light Blue, Bright Green, Bright Orange, and Gold.
I want the player to pick from a list of five or six colors, and I'd like the list to include a few of the unusual colors. I'm reserving a few colors for my enemy units, such as purple.
I thought the code was going to be a piece of cake. Nope. Once again I'm back to my usual method of trying random things, hoping I'll stumble upon the solution. Of all my failures to make the code work, here's the bit of code that I'm pretty sure is the most likely to be least wrong.
Any help would be appreciated.
I want the player to pick from a list of five or six colors, and I'd like the list to include a few of the unusual colors. I'm reserving a few colors for my enemy units, such as purple.
I thought the code was going to be a piece of cake. Nope. Once again I'm back to my usual method of trying random things, hoping I'll stumble upon the solution. Of all my failures to make the code work, here's the bit of code that I'm pretty sure is the most likely to be least wrong.
Any help would be appreciated.
Code: Select all
[message]
speaker=narrator
message= _ "Pick a team color."
[option]
message= _ "Gold."
[command]
[set_variable]
name=my_color
value=gold
[/set_variable]
[/command]
[/option]
[option]
message= _ "Light blue."
[command]
[set_variable]
name=my_color
value=light blue
[/set_variable]
[/command]
[/option]
[/message]
[modify_side]
side=1 # side 1 is default, but just in case...
[set_variable]
name=color
to_variable=my_color
[/set_variable]
[/modify_side]
Last edited by Helmet on October 22nd, 2020, 1:39 am, edited 2 times in total.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
Re: Picking your own team color
I haven't tested this, but think it should be:
Code: Select all
[modify_side]
side=1
color=$my_color
[/modify_side]
Re: Picking your own team color
That was actually the first or second thing I tried, and it didn't work. Thanks, though. I don't know why it doesn't work. It makes sense.
After all, this changes the color to blue.
After all, this changes the color to blue.
Code: Select all
[modify_side]
side=1
color=blue
[/modify_side]
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
Re: Picking your own team color
I think the problem is the variable "color". I tried another method of making "color" accept the value of "my_color", but it didn't work either.
EDIT: Hmm. Maybe this is one of those times when you need change the variable in an array...
EDIT: Maybe [store_side] is involved somehow. Evidently [store_side] can be used to capture the value of a side's color...
Code: Select all
[modify_side]
[filter]
side=1
[/filter]
[set_variable]
name=color
to_variable=my_color
[/set_variable]
[/modify_side]
EDIT: Maybe [store_side] is involved somehow. Evidently [store_side] can be used to capture the value of a side's color...
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
Re: Picking your own team color
I solved the problem. This was my main error: I was doing my tests with the new colors, but I was using the wrong
I changed the value of
Functional code example:
Note to self: when writing code, check to make sure the
id
for those colors. For example, the id
for Bright Red is not Bright Red
or even bright red
, Bright Red is brightred
. I changed the value of
color
directly within the [option]
tag.Functional code example:
Code: Select all
[message]
speaker=narrator
message= _ "Pick a team color."
[option]
message= _ "Dark red."
[command]
[modify_side]
color=darkred
[/modify_side]
[/command]
[/option]
[option]
message= _ "Bright green."
[command]
[modify_side]
color=brightgreen
[/modify_side]
[/command]
[/option]
id
is correct.Thanks, octalot, your solution would've worked after all, if I hadn't used the wrongoctalot wrote: ↑October 22nd, 2020, 1:22 am I haven't tested this, but think it should be:
Code: Select all
[modify_side] side=1 color=$my_color [/modify_side]
id
for the colors.Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.