[modification] [options] conditions [solved]

The place to post your WML questions and answers.

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.
Post Reply
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

[modification] [options] conditions [solved]

Post by The_Gnat »

Basically i have a modification with some options. But want a player only to be able to choose 1 condition.

For example:

Code: Select all

     [options]
	[checkbox]
	    id=drg_rps
	    name=_"The Rock Paper Scissors Alliance"
	    description=_"."
	    default=yes
	[/checkbox]
	[checkbox]
	    id=drg_dec
	    name=_"The Declaration Alliance"
	    description=_"."
	    default=no
	[/checkbox]
	[checkbox]
	    id=drg_none
	    name=_"Default Alliance"
	    description=_"."
	    default=no
	[/checkbox]
     [/options]
What can i do to make it so that only 1 checkboxe can be selected?
Last edited by The_Gnat on July 14th, 2017, 4:28 am, edited 3 times in total.
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: [modification] [options] [checkbox] conditions [solved]

Post by The_Gnat »

I solved this problem in record time :D ^_^ The answer is: Use a combo box!
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

[campaign] [options] problem

Post by The_Gnat »

Unfortunately i am having another problem which seems to be appearing for no reason.

In 1.12 i have created a slider in a [campaign] and in a [options] tag. Unfortunately it shows no options in the "Configure Game" menu.
Spoiler:

Code: Select all

# ...
   [options]
      [slider]
			id=drg_alliances_slider
			name=_"Dragon Lair ..."
			description=_"Choose a ..."
			default=0
			min=0
			max=2
			step=1
     [/slider]
   [/options]
[/campaign]	
Have i done something wrong here?

Thank you! :D
SigurdFireDragon
Developer
Posts: 546
Joined: January 12th, 2011, 2:18 am
Location: Pennsylvania, USA

Re: [campaign] [options] problem

Post by SigurdFireDragon »

In 1.12, options for a campaign need to be in the first [scenario].

Your example should work as is for 1.13, as in 1.13, as there options need to be directly in [campaign].
Co-Author of Winds of Fate
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: [modification] [options] conditions

Post by The_Gnat »

Oh :whistle: that is why it worked in 1.13 and no matter what i did it wouldn't in 1.12...

Thank you very much! I would have probably never figured it out (perhaps someone could put a note in this wiki page :D )
SigurdFireDragon
Developer
Posts: 546
Joined: January 12th, 2011, 2:18 am
Location: Pennsylvania, USA

Re: [modification] [options] conditions

Post by SigurdFireDragon »

The_Gnat wrote:...(perhaps someone could put a note in this wiki page :D )
Updated, thanks.
Co-Author of Winds of Fate
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: [modification] [options] conditions

Post by The_Gnat »

Unfortunately even when i put the [options] inside the [scenario] it did not work. The options load now and a combo box appears... But it does not do anything.

Here is my code:

Code: Select all

[scenario]
	#ifver WESNOTH_VERSION < 1.13.0
	 [options]
		[combo]
			id=drg_alliances_op
			name=_"Dragon Lair alliance system"
			description=_"Choose what alliance system to use."
			default=none
			[item]
				name="The Rock Paper Scissors Alliance"
				value=rockpaperscissors
			[/item]
			[item]
				name="The Declaration Alliance"
				value=declare
			[/item]
			[item]
				name="The Default Wesnoth Alliance"
				value=none
			[/item]
		[/combo]
     [/options]
	#endif

# ... the rest of the scenario
Like i said it shows the combo box but does not create a variable from it... :?

Thank you for your help! :D
SigurdFireDragon
Developer
Posts: 546
Joined: January 12th, 2011, 2:18 am
Location: Pennsylvania, USA

Re: [modification] [options] conditions

Post by SigurdFireDragon »

The_Gnat wrote:Unfortunately even when i put the [options] inside the [scenario] it did not work. The options load now and a combo box appears... But it does not do anything.

Here is my code:

Code: Select all

[scenario]
	#ifver WESNOTH_VERSION < 1.13.0
	 [options]
		[combo]
			id=drg_alliances_op
			name=_"Dragon Lair alliance system"
			description=_"Choose what alliance system to use."
			default=none
			[item]
				name="The Rock Paper Scissors Alliance"
				value=rockpaperscissors
			[/item]
			[item]
				name="The Declaration Alliance"
				value=declare
			[/item]
			[item]
				name="The Default Wesnoth Alliance"
				value=none
			[/item]
		[/combo]
     [/options]
	#endif

# ... the rest of the scenario
Like i said it shows the combo box but does not create a variable from it... :?

Thank you for your help! :D

Not sure what's going with your situation. I tested the #ifver / [option] code by plugging it into Random Campaign for 1.12, and it created the drg_alliances_op variable just fine.
Co-Author of Winds of Fate
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [modification] [options] conditions

Post by Ravana »

1.12 has another options bug, if you have options saved in your preferences file, they wont work correctly after you change them in scenario.
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: [modification] [options] conditions

Post by The_Gnat »

@SigurdFireDragon - That is odd... :hmm: i have attached the add-on so you can look at it, perhaps i made some mistake in the scenario which is causing issues (however, it is odd because before when i had my [options] in a [modification] tag it worked fine)

@Ravana - So is there something i can do about this?

Thank you again! :D
Attachments
Dragon_Lair.zip
(454.22 KiB) Downloaded 161 times
SigurdFireDragon
Developer
Posts: 546
Joined: January 12th, 2011, 2:18 am
Location: Pennsylvania, USA

Re: [modification] [options] conditions

Post by SigurdFireDragon »

The_Gnat wrote:@SigurdFireDragon - That is odd... i have attached the add-on so you can look at it, perhaps i made some mistake in the scenario which is causing issues (however, it is odd because before when i had my [options] in a [modification] tag it worked fine)
Tested it with 1.12.6, the variable was created fine.
Ravana wrote:1.12 has another options bug, if you have options saved in your preferences file, they wont work correctly after you change them in scenario.
There's a good chance the error could be this.

It's a bug with option handling that I believe has been fixed for 1.13
To fix it in 1.12, open your userdata/preferences file and look for the [options] section

Below is what it showed for me in the preferences file when I got it to work. You want to make sure that none of the id values below are repeated elsewhere in the [options] section, & that the ones in the file match with your add-on for all id's. Once the conflicts are removed, it should work.

Code: Select all

	[multiplayer]
		id="01_dragon_lair"
		[option]
			id="drg_alliances_op"
			value="none"
		[/option]
	[/multiplayer]
Co-Author of Winds of Fate
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: [modification] [options] conditions [solved]

Post by The_Gnat »

Ah yes!! :D That worked prefectly thank you Ravana and SigurdFireDragon!
Post Reply