Is possible to add custom [section] and [topic] inside help?

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
Elrood
Posts: 17
Joined: September 27th, 2007, 5:44 pm

Is possible to add custom [section] and [topic] inside help?

Post by Elrood »

New problem:
I'm currently trying to add custom section into in-game help system. After few researches, I think it may be possible from the engine point of view, but i have no idea how can I add [help][toplevel][/toplevel][/help] tags. It looks like wesnoth consider only those in core data and then dismiss all others :(. If anyone has any idea how it can be done, or know where it was done, please, consider sharing that knowledge.

Old problem:
Well, i want the player to be able to read some text data shown from [set_menu_item] even if it is not his turn. Eventually, i would like to link the command to help files like you can do about units. Is that possible? How should i start? Current problem is that [message] tag ask for side, and i have no idea how can i distinguish which side is player who want to read my novels :P .
Last edited by Elrood on January 13th, 2011, 1:19 pm, edited 1 time in total.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Text informations for player whos side isn't active?

Post by Sapient »

The custom menu item commands are disabled on non-player turns for synchronization protection. Unfortunately, this means you can't use them for browsing any informational popups when it's not your turn. However, you could allow the active player to send the information popup to all the inactive player sides via a custom menu item.

AFAIK, the only change to gamestate that may be initiated by a non-player side is the renaming of units. So you may be able to key an event based off of that, but it would really be an ugly hack.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Text informations for player whos side isn't active?

Post by Anonymissimus »

You could auto-display (that is, fired by an engine event like side turn) something side-specific using side_for= key. That key only works if the message hasn't input however. And then the user would need to dismiss it if he doesn't want to read.

(Maybe you can make it so that while the player has his turn he chooses an option "Do you want to read the help (or whatever) while the others have their turn ?" and if yes it gets auto-displayed when he ends his turn. When the turn bell rings he can dismiss the message. (Would need to check whether the turn bell rings under this circumstances, and if not there should be some mean to notify the player.) Would be particularly useful in e.g. my MP addon so people can do something while they are waiting.)

EDIT
Um, no. The turn bell rings only after the player has dismissed messages displayed to him (from a side turn event previously to his side's side turn event. Would be nice to have some mean here if this is compatible with the engine.)
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Elrood
Posts: 17
Joined: September 27th, 2007, 5:44 pm

Re: Is possible to add custom [section] and [topic] inside h

Post by Elrood »

Forcing player to dismiss every turn or even side change, is what i don't like. Well, there is one more thing i can try. Will have to check if message inside objectives can support options. If so, all my troubles end there . That way i would have callable "help" like system in game on player request.

edit:

Well, thats not the option .

edit2:

Well, there is a possibility of using themes. Now the main question is: is there a way to display scenario variable inside theme. For the moment i think the answer is "no" but still looking, as the threads i found so far are at least a year old.
Not with 1.8.5
Well, i will have to stay with [message] option showing at the end of turn + at request in menu when side is active .

Actually, there is still hope. I only have to find how tag [help] works.

Edit3:
New problem:
I'm currently trying to add custom section into in-game help system. After few researches, I think it may be possible from the engine point of view, but i have no idea how can I add [help][toplevel][/toplevel][/help] tags. It looks like wesnoth consider only those in core data and then dismiss all others . If anyone has any idea how it can be done, or know where it was done, please, consider sharing that knowledge.
User avatar
pauxlo
Posts: 1049
Joined: September 19th, 2006, 8:54 pm

Re: Is possible to add custom [section] and [topic] inside h

Post by pauxlo »

Elrood wrote: Edit3:
New problem:
I'm currently trying to add custom section into in-game help system. After few researches, I think it may be possible from the engine point of view, but i have no idea how can I add [help][toplevel][/toplevel][/help] tags. It looks like wesnoth consider only those in core data and then dismiss all others . If anyone has any idea how it can be done, or know where it was done, please, consider sharing that knowledge.
I didn't try it, but I would try to put it in the _main.cfg, outside any other tag (but inside of the campaign #ifdef):

Code: Select all

  [+help]
    [+toplevel]
       sections=...
       topics=...
    [/toplevel]
    # new sections and topics
    [section]
       ...
    [/section]
    [topic]
       ...
    [/topic]
    ...
  [/help]
If I understand right, you can't "add" new [toplevel] tags, since there should be only one in the (only) help tag. So instead change it and overwrite its attributes.
Elrood
Posts: 17
Joined: September 27th, 2007, 5:44 pm

Re: Is possible to add custom [section] and [topic] inside h

Post by Elrood »

Unfortunately it didn't work.

Intresting fact, in cache + disappeared from [+help] and [+toplevel]. This file is created with all macros already are resolved.

Well, i'm pretty sure now, that even if it is possible to add additional sections into in-game help system, it is impossible to do it from add-ons :(. Probably (i don't have enough time now to dive into source code and check it) [help] tag is resolved only once, before the add-ons. Any later changes are ommited, as unrecognized :( . Pity.

Thanks for help Sapient, Anonymissimus, pauxlo.
Post Reply