enclave's WML Macros questions Thread
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.
Re: enclave's WML Macros questions Thread
There is no WML array of unit types. There is, however, an associative lua table. See LuaWML:Units#wesnoth.unit_types.
As for enabling Shaman advancement, add this to your [campaign] tag:
As for enabling Shaman advancement, add this to your [campaign] tag:
Code: Select all
extra_defines=ENABLE_TROLL_SHAMAN
Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
Re: enclave's WML Macros questions Thread
Thank you very much tamanegi, this should work for me
Thank you vultraz for your lua version, maybe I use it also..
As for [campaign], what if I don't have [campaign] tag because it is a multiplayer scenario? Would I need to add all tags to it, like id, name etc etc?
Thank you vultraz for your lua version, maybe I use it also..
As for [campaign], what if I don't have [campaign] tag because it is a multiplayer scenario? Would I need to add all tags to it, like id, name etc etc?
Re: enclave's WML Macros questions Thread
If you don't have a campaign tag, simply define the macro somewhere inside your scenario's #ifdef, like so:
Code: Select all
#define ENABLE_TROLL_SHAMAN
#enddef
Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
Re: enclave's WML Macros questions Thread
I doubt this will work. Usually the core files are parsed before the addon files so defining a macro in the addon files should have no effect on the core files.vultraz wrote:If you don't have a campaign tag, simply define the macro somewhere inside your scenario's #ifdef, like so:
Code: Select all
#define ENABLE_TROLL_SHAMAN #enddef
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: enclave's WML Macros questions Thread
As soon as I test it I will let you knowgfgtdf wrote:I doubt this will work. Usually the core files are parsed before the addon files so defining a macro in the addon files should have no effect on the core files.vultraz wrote:If you don't have a campaign tag, simply define the macro somewhere inside your scenario's #ifdef, like so:
Code: Select all
#define ENABLE_TROLL_SHAMAN #enddef
But what would be alternative way to add troll shaman into advance_to? Can it be done with [unit] or [modify_unit]? If you know the answer, to save your time, just say "yes" or "no" and I will read help on how to Thanks!
Re: enclave's WML Macros questions Thread
Well, you CAN set up a single unit to advance to the Shaman by adding
to the relevant [unit] you wish to advance. If you want to do it for every single unit that's recruited, you could use a prerecall event and [modify_unit].
Code: Select all
advances_to=Troll Shaman
to the relevant [unit] you wish to advance. If you want to do it for every single unit that's recruited, you could use a prerecall event and [modify_unit].
Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
Re: enclave's WML Macros questions Thread
Question #6
When does prestart even work? Does it work on game reload also? or maybe for saved game observe reload?
I just loaded one of observed saved games from server (http://replays.wesnoth.org/1.12/) and i noticed that something happened like if it was prestart event loaded on turn 5..
it also says "<invalid WML found> [replay] , [statistics] not supported at scenario toplevel"
And as usual is_synced false
Maybe somebody who is really experienced with broken replays could figure out what is wrong and give me some advice where to look?
Thank you!
When does prestart even work? Does it work on game reload also? or maybe for saved game observe reload?
I just loaded one of observed saved games from server (http://replays.wesnoth.org/1.12/) and i noticed that something happened like if it was prestart event loaded on turn 5..
it also says "<invalid WML found> [replay] , [statistics] not supported at scenario toplevel"
And as usual is_synced false
Maybe somebody who is really experienced with broken replays could figure out what is wrong and give me some advice where to look?
Thank you!
Re: enclave's WML Macros questions Thread
Only event activated by a reload is...Prestart and Start events are pretty much "Turn -1" and "Turn 0" events.
I have no clue about how broken can be replays in 1.12
Code: Select all
[event]
name=preload
[/event]
I have no clue about how broken can be replays in 1.12
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
Re: enclave's WML Macros questions Thread
afaik the 1.12 mp server (the 1.13 replay server fixed this so im not 100% sure anymore) is not able to produce valid replays for reloaded games.
At the end of this post http://forums.wesnoth.org/viewtopic.php?f=15&t=40303 it is explained how you can fix those replay files.
At the end of this post http://forums.wesnoth.org/viewtopic.php?f=15&t=40303 it is explained how you can fix those replay files.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: enclave's WML Macros questions Thread
Thanks tekelili, but regarding prestart and start to be turn-1 and turn0 im not sure, because if you use message option (giving player a choice of options) in them, same as on preload, it will cause game to end.. while turn1 works no problem.
Thanks gfgtdf, I think that is the problem then. Now I know that I don't have to investigate more into it or try to fix it myself.
Anyone knows what could cause OOS for Mac user on random maps, which would make player1 appear somewhere on place of player4 and move his units? I suspect Mac user may often see himself as red where everyone else see him as for example purple, so if Mac is a host, he will move purple units (everyone else will see so), and if he is not host, then his turn may be skipped.. depends.. Maybe its also something known problem for 1.12? If not I have to investigate it and try to fix it..
Thanks gfgtdf, I think that is the problem then. Now I know that I don't have to investigate more into it or try to fix it myself.
Anyone knows what could cause OOS for Mac user on random maps, which would make player1 appear somewhere on place of player4 and move his units? I suspect Mac user may often see himself as red where everyone else see him as for example purple, so if Mac is a host, he will move purple units (everyone else will see so), and if he is not host, then his turn may be skipped.. depends.. Maybe its also something known problem for 1.12? If not I have to investigate it and try to fix it..
Re: enclave's WML Macros questions Thread
New question..
I was reading wiki about OOS, it says:
1) How to make WML run at a synchronized time in a moveto event??
2) How to use wesnoth.synchronize_choice to gather information and to make sure that all clients match? Does it mean to use synchronized choice when relying on details like player.controller to change game states? or it means something different?
Thank you!
I was reading wiki about OOS, it says:
If anybody knows what it means, could you please give more details..How to make your code safe
Make the WML run at a synchronized time instead, i.e. in a moveto event.
Use Lua wesnoth.synchronize_choice when gathering informaton to make sure that all clients match. Note that this function only works correct in syncronized events.
1) How to make WML run at a synchronized time in a moveto event??
2) How to use wesnoth.synchronize_choice to gather information and to make sure that all clients match? Does it mean to use synchronized choice when relying on details like player.controller to change game states? or it means something different?
Thank you!
Re: enclave's WML Macros questions Thread
Wiki means you should run your code in ANY synchronized event. A list of such ones is in [event] wiki description.enclave wrote:If anybody knows what it means, could you please give more details..
1) How to make WML run at a synchronized time in a moveto event??
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
Re: enclave's WML Macros questions Thread
Couple of questions to Ravana, because this person has significant experience on subject
If anyone else has something to add please I would love to hear everyone!
1) As we talked before, if we create new [unit type] in any era, then it is required to download add-on to play game without OOS.
As we all know (or some of us), we can avoid creating new unit type, but just use existing ones replacing the image..
So first question is: Is there a way to edit Wesnoth help without needing add-on? (any part of it, add new faction, new terrain, new unit, anything at all). I'm still searching for a way to be able to "do something" when not your turn.. I discovered there are 3 options when you waiting for your turn: a) View unit description b) View terrain description c) something else, useless, clear labels or something..
I'm looking into ways to hack the top 2 for any options, menus.. anything to do, read, while waiting for your turn..
Any ideas anyone?
If somebody knows other ways to hack the "not your turn" thing into something useful.. where you could read something, or ideally have some menus to choose to read from.. please tell me.. (please don't offer labels, scenario objectives or ability descriptions, I do already know these.. actually I just realized I could change objectives every turn for every player.. which would give a nice graphics to read.. thanks forum! u giving ideas before i even posted my questions.. )
1.1) Would changing objectives make a forced popup? any way/hack to keep changes in background?.. and only appear if ctrl+j?
2) I know help says that preload (seems to be the only one?) event is fired also when you load saved game..
But help sometimes tend to miss something.. important. Maybe you know any other events that are fired on start of reloaded game?
2.1) Maybe any extra events that are fired on the observer server when loading game? Because I suspect that my prestart event or part of it works on observed games downloaded from the server.. http://replays.wesnoth.org/1.12/
Maybe anyone knows exactly the list? so I would be able to go through all my events and do something like "if (turn number=1) then {my code} else {do nothing}". In my particular case when I observe reloads from server, the villages are removed, like if I used my map regeneration code in prestart event..
3) Fog clearers.. anything buggy about them? My walls, towers, outposts etc.. are units. Fog clearers.. when i save and load game, they tend to disappear.. some of them remain, some disappear.. I don't have idea.. why.. anything special about them? maybe they known to be buggy? if not then i guess i have to correct the code somewhere.. but it looked fine to me during a quick check..
Thank you very much to everyone who knows the answers... Ravana please I need your answers most Thank you!
If anyone else has something to add please I would love to hear everyone!
1) As we talked before, if we create new [unit type] in any era, then it is required to download add-on to play game without OOS.
As we all know (or some of us), we can avoid creating new unit type, but just use existing ones replacing the image..
So first question is: Is there a way to edit Wesnoth help without needing add-on? (any part of it, add new faction, new terrain, new unit, anything at all). I'm still searching for a way to be able to "do something" when not your turn.. I discovered there are 3 options when you waiting for your turn: a) View unit description b) View terrain description c) something else, useless, clear labels or something..
I'm looking into ways to hack the top 2 for any options, menus.. anything to do, read, while waiting for your turn..
Any ideas anyone?
If somebody knows other ways to hack the "not your turn" thing into something useful.. where you could read something, or ideally have some menus to choose to read from.. please tell me.. (please don't offer labels, scenario objectives or ability descriptions, I do already know these.. actually I just realized I could change objectives every turn for every player.. which would give a nice graphics to read.. thanks forum! u giving ideas before i even posted my questions.. )
1.1) Would changing objectives make a forced popup? any way/hack to keep changes in background?.. and only appear if ctrl+j?
2) I know help says that preload (seems to be the only one?) event is fired also when you load saved game..
But help sometimes tend to miss something.. important. Maybe you know any other events that are fired on start of reloaded game?
2.1) Maybe any extra events that are fired on the observer server when loading game? Because I suspect that my prestart event or part of it works on observed games downloaded from the server.. http://replays.wesnoth.org/1.12/
Maybe anyone knows exactly the list? so I would be able to go through all my events and do something like "if (turn number=1) then {my code} else {do nothing}". In my particular case when I observe reloads from server, the villages are removed, like if I used my map regeneration code in prestart event..
3) Fog clearers.. anything buggy about them? My walls, towers, outposts etc.. are units. Fog clearers.. when i save and load game, they tend to disappear.. some of them remain, some disappear.. I don't have idea.. why.. anything special about them? maybe they known to be buggy? if not then i guess i have to correct the code somewhere.. but it looked fine to me during a quick check..
Thank you very much to everyone who knows the answers... Ravana please I need your answers most Thank you!
Re: enclave's WML Macros questions Thread
For 1.13+ there is easy way to create unsynced menu, for 1.12 I did it, but it is a bit bothersome. You can see it in any ageless era game, when you quickly click and rightclick unit of 1) your side if you are player, 2) active side if you are observer; then it shows menu. Currently I use it mostly for changelogs, you can see how I have it done in https://github.com/ProditorMagnus/Agele ... g#L70-L102. Yes, it is quite complicated, but EoHS where I got the idea(and some code) for menu that observer can use has way more advanced version. (One of the reasons I nominated Elvish_Pillager for UMC pioneer)enclave wrote:Couple of questions to Ravana, because this person has significant experience on subject
If anyone else has something to add please I would love to hear everyone!
1) As we talked before, if we create new [unit type] in any era, then it is required to download add-on to play game without OOS.
As we all know (or some of us), we can avoid creating new unit type, but just use existing ones replacing the image..
So first question is: Is there a way to edit Wesnoth help without needing add-on? (any part of it, add new faction, new terrain, new unit, anything at all). I'm still searching for a way to be able to "do something" when not your turn.. I discovered there are 3 options when you waiting for your turn: a) View unit description b) View terrain description c) something else, useless, clear labels or something..
I'm looking into ways to hack the top 2 for any options, menus.. anything to do, read, while waiting for your turn..
Any ideas anyone?
I have no idea about editing help, never had to do that.
silent=yesIf somebody knows other ways to hack the "not your turn" thing into something useful.. where you could read something, or ideally have some menus to choose to read from.. please tell me.. (please don't offer labels, scenario objectives or ability descriptions, I do already know these.. actually I just realized I could change objectives every turn for every player.. which would give a nice graphics to read.. thanks forum! u giving ideas before i even posted my questions.. )
1.1) Would changing objectives make a forced popup? any way/hack to keep changes in background?.. and only appear if ctrl+j?
For 2 I believe that it is only preload.2) I know help says that preload (seems to be the only one?) event is fired also when you load saved game..
But help sometimes tend to miss something.. important. Maybe you know any other events that are fired on start of reloaded game?
2.1) Maybe any extra events that are fired on the observer server when loading game? Because I suspect that my prestart event or part of it works on observed games downloaded from the server.. http://replays.wesnoth.org/1.12/
Maybe anyone knows exactly the list? so I would be able to go through all my events and do something like "if (turn number=1) then {my code} else {do nothing}". In my particular case when I observe reloads from server, the villages are removed, like if I used my map regeneration code in prestart event..
3) Fog clearers.. anything buggy about them? My walls, towers, outposts etc.. are units. Fog clearers.. when i save and load game, they tend to disappear.. some of them remain, some disappear.. I don't have idea.. why.. anything special about them? maybe they known to be buggy? if not then i guess i have to correct the code somewhere.. but it looked fine to me during a quick check..
Thank you very much to everyone who knows the answers... Ravana please I need your answers most Thank you!
There is lua way to log any events fired.
Fog clearers underlying code has changed between 1.10 and 1.12, might be safer to use some other units, when you override everything of them anyways.
Re: enclave's WML Macros questions Thread
Thank you very much Ravana! You gave me a lot of answers and I have a lot of information to work with! Thank you!
Is there a lot of people on 1.13? It is a separate multiplayer server isn't it?
I will look into your code of menus in ageless, I knew the Elvish version in EoHS, but it was too advanced for me to figure out how it works.. or it would take me a year to figure out
Is there a lot of people on 1.13? It is a separate multiplayer server isn't it?
I will look into your code of menus in ageless, I knew the Elvish version in EoHS, but it was too advanced for me to figure out how it works.. or it would take me a year to figure out