Storing units in an array and interface to unstore them

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
Legend_Rider
Posts: 35
Joined: June 20th, 2018, 4:51 pm

Storing units in an array and interface to unstore them

Post by Legend_Rider »

Pentarctagon requested that I post this current progress on the forums, so here it is.

Working on a little modification (very rough and unfinished / probably has some bugs).
The issue that I have is in attempting to store units in an array and unstore them via an option.
Have yet to accomplish this in my attempts, which have simply given an empty message from anonymous local player.

I guess the cat's out of the bag now!
Super embarrassed putting my noobliness of a project up for people to see in it's unfinished state... :oops:


Notes:
I have used Notepad++ to edit this and used tab as opposed to four spaces when formatting (I intend to fix this before finalization)
Going to go through and put some polish and refinement in the WML at some point (where needed).
Please feel free to give me any tips on keeping it clean / putting things where they belong.
Attachments
ships_mod.zip
(5.39 KiB) Downloaded 156 times
User avatar
Pentarctagon
Project Manager
Posts: 5528
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Storing units in an array and interface to unstore them

Post by Pentarctagon »

As background, the goal is to dynamically create a set of options based on an array of stored units, which would mean using [insert_tag].

I'm assuming the relevant code is around ships_mod.cfg:251, looking at which the first issue being:

Code: Select all

[insert_tag]
	name=shipventory_menu
	variable=shipventory
[/insert_tag]
The value of the name must be a valid WML tag name, since that's what [insert_tag] does - it wraps each index of the WML array in the tag given by the name attribute. However, there is no WML tag named [shipventory_menu]. Here it really should be name=option.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Legend_Rider
Posts: 35
Joined: June 20th, 2018, 4:51 pm

Re: Storing units in an array and interface to unstore them

Post by Legend_Rider »

Pentarctagon wrote: January 28th, 2021, 1:35 am As background, the goal is to dynamically create a set of options based on an array of stored units, which would mean using [insert_tag].

I'm assuming the relevant code is around ships_mod.cfg:251, looking at which the first issue being:

Code: Select all

[insert_tag]
	name=shipventory_menu
	variable=shipventory
[/insert_tag]
The value of the name must be a valid WML tag name, since that's what [insert_tag] does - it wraps each index of the WML array in the tag given by the name attribute. However, there is no WML tag named [shipventory_menu]. Here it really should be name=option.
Oh... wow, I feel really dumb rn, it’s always these little things isn’t it?
User avatar
Legend_Rider
Posts: 35
Joined: June 20th, 2018, 4:51 pm

Re: Storing units in an array and interface to unstore them

Post by Legend_Rider »

If [option] elements are present, then each option will be displayed in a menu for the user to select one option. Note: Messages with options will not be shown at all in prestart events
Something interesting, I changed the [event] name to “start”, still hasn’t solved the issue, but it probably needed to be done.
User avatar
Legend_Rider
Posts: 35
Joined: June 20th, 2018, 4:51 pm

Re: Storing units in an array and interface to unstore them

Post by Legend_Rider »

For simplicity I moved this topic to a new post that focuses on the core desired function instead of having it all mixed up in the middle of an unfinished mod.

https://forums.wesnoth.org/viewtopic.php?f=21&t=53902
Post Reply