[remove_shroud] and [terrain] question

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
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Firing event all x turns

Post by Dugi »

To make it fire every 2 turns do this (it is analogous for other periods):
Name the event 'even turn start' (or something similar, but think of the changes it would require in the code I am adding), use first_time_only=no, and put this event into the scenario:

Code: Select all

[event]
  name=new turn
  first_time_only=no
  {VARIABLE remain $turn_number}
  {VARIABLE_OP remain modulo 2}  #you can change the number 2 to something else to change frequency
  [if]
    [variable]
      name=remain
      equals=0
    [/variable]
    [then]
      [fire_event]
        name=even turn start  #change this if you're naming your event differently!
      [/fire_event]
    [/then]
  [/if]
  {CLEAR_VARIABLE remain}
[/event]
You can place your code that should execute every second turn into the contents of the [then] tag as well if you want.
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Firing event all x turns

Post by Paulomat4 »

thx, that works :)
what does this macro

Code: Select all

{VARIABLE_OP remain modulo 2}
mean?
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Firing event all x turns

Post by Dugi »

It's a shortcut for:

Code: Select all

[set_variable]
  name=remain
  modulo=2
[/set_variable]
It just returns the remain of division by 2, so the result is 1 if the number is odd and 0 if it is even.
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Forcing an advancement

Post by Paulomat4 »

I'm back at working on my campaign. This time i'd like to force an elvish fighter to advance to an elvish hero. How would I do this?
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
James_The_Invisible
Posts: 534
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces
Contact:

Re: Forcing an advancement

Post by James_The_Invisible »

Some time ago, I wanted to do exactly this thing. I have found one solution in WML. I stored the unit into a variable, set its attribut advances_to to Elvish Hero and then unstored the unit. An example:

Code: Select all

[store_unit]
  [filter]
   id=elf1
  [/filter]
  variable=temp_store
[/store_unit]
{VARIABLE temp_store.advances_to (Elvish Hero)}
[unstore_unit]
  variable=temp_store
  find_vacant=no
[/unstore_unit]
{CLEAR_VARIABLE temp_store}
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Forcing an advancement

Post by Paulomat4 »

Thanks. that worked. The example code was not needed, i found it out myself.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
James_The_Invisible
Posts: 534
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces
Contact:

Re: Forcing an advancement

Post by James_The_Invisible »

I expected you to know it. It was rather meant for people who could have the same problem in the future and was not sure how to write it in WML.
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

wesnoth closing itself during loading

Post by Paulomat4 »

Hey, while testing my add-on wesnoth suddenly closed itself during loading of a save, without giving an error message. the stderr.txt file says the following:

Code: Select all

Ran out of memory. Aborted.
I have removed everything I newly added, but can not locate the error. Even excluding the entire scenario I was working on did not help.
preinstalleed campaigns as httt work fine.
Any ideas?
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: wesnoth closing itself during loading

Post by iceiceice »

Did you try restarting your system / closing all other programs that are open?

That message is only given one place in the code, right here: https://github.com/wesnoth/wesnoth/blob ... e.cpp#L732
It can only happen when wesnoth asks your operating system for memory and it won't give it: http://www.cplusplus.com/reference/new/bad_alloc/

If you think that it must be the wesnoth engine doing something inefficient and taking all the memory, then you can provide us a backtrace and we can take a look. http://forums.wesnoth.org/viewtopic.php?f=4&t=16163

Edit: You might be able to do something with command line flags to control how much memory wesnoth gets, as a workaround? I don't remember off hand.
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: wesnoth closing itself during loading

Post by Paulomat4 »

Did you try restarting your system / closing all other programs that are open?
Yes, both didn't helped. Also I mostly only have my browser opened and notepad++
If you think that it must be the wesnoth engine doing something inefficient and taking all the memory, then you can provide us a backtrace and we can take a look. viewtopic.php?f=4&t=16163
Unfortunately I'm running windows on the standard build.
Edit: You might be able to do something with command line flags to control how much memory wesnoth gets, as a workaround? I don't remember off hand.
I have no idea how to do this
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: wesnoth closing itself during loading

Post by iceiceice »

Hmm I looked at the command line flags, (wesnoth --help), but I didn't see anything about memory so I must be confused with another game or program.

Do you know about this bug? https://gna.org/bugs/?20126
Are you accidentally doing infinitely recursive macros somehow?

Idk what other help I can offer, sorry. Maybe someone else knows other things to watch out for.
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: wesnoth closing itself during loading

Post by Paulomat4 »

Do you know about this bug? https://gna.org/bugs/?20126
I don't have a gna account right now, and unfortunaly don't have time to create one right now, but i'll look at this as soon as possible.
Are you accidentally doing infinitely recursive macros somehow?
What would that be for macros? The part I was currently writing used a lot of macros (though easy ones as variable changing).

But i removed that part again, and it's still not working.

today I retried again, and this is the current output in the stderr.txt:

20140415 13:01:37 error general: Unbekanntes Szenario: '01_the_outpost'

Which of course doesn't tell us much.

EDIT: well, I can't even create agna account, since I have no idea what the answer to this question is supposed to be.
"What VCS has its name inspired from a British slang/insult?"

I'm neither british, nor do I know anything about VCS (and googling it didn't helped)

So, non-british people are considered Spam now ? :shock:
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: wesnoth closing itself during loading

Post by iceiceice »

The answer to the question is "git", tbh I had no idea even though I should have and had to make a few guesses :?

You shouldn't need to register for gna to just look at the list of bugs, its only to report bugs.

Anyways I guess we are hoping to move to a better bug tracker like redmine... Idk what the status is on that project though.
http://wiki.wesnoth.org/WesnothGIT#Bug_tracker
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: wesnoth closing itself during loading

Post by Max »

can you attach the save game?

increasing the debug output might help to get an idea what's going on:
http://forums.wesnoth.org/viewtopic.php ... 26#p564352
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: wesnoth closing itself during loading

Post by Paulomat4 »

can you attach the save game?
this bug is independent from savegames. It also happens if you start the campaign from the mmapaign dialogue.
I reinstalled wesnoth, to see if something was wrong with it. But, as said, the bug also happens if you start the campaign from the beginning. So, i'm attaching my add-on (with images removed). Just starting it from the beginning should produce the bug;
The_Rising.zip
(381.87 KiB) Downloaded 320 times
increasing the debug output might help to get an idea what's going on:
viewtopic.php?f=4&t=39726#p564352
I didn't get that to work. my path to wesnoth in the shortcut is:

Code: Select all

"C:\Users\Raymond\Documents\My Games\wesnoth 1.11.12\wesnoth.exe"
The answer to the question is "git", tbh I had no idea even though I should have and had to make a few guesses :?

Anyways I guess we are hoping to move to a better bug tracker like redmine... Idk what the status is on that project though.
http://wiki.wesnoth.org/WesnothGIT#Bug_tracker
Got an account, but "the item is private". I still can't see it.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
Post Reply