[allow_undo] in moveto events

The place to post your WML questions and answers.

Moderators: Developers, 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: Firing event all x turns

Postby Dugi » December 25th, 2013, 2:11 pm

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.
Author of Legend of the Invincibles.
I am human, stronger than any god. -Joe Tiberi
User avatar
Dugi
 
Posts: 4693
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Re: Firing event all x turns

Postby Paulomat4 » December 25th, 2013, 5:25 pm

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
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Firing event all x turns

Postby Dugi » December 25th, 2013, 7:41 pm

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.
Author of Legend of the Invincibles.
I am human, stronger than any god. -Joe Tiberi
User avatar
Dugi
 
Posts: 4693
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Forcing an advancement

Postby Paulomat4 » March 30th, 2014, 3:27 pm

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
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Forcing an advancement

Postby James_The_Invisible » March 30th, 2014, 3:40 pm

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}
My content: For Power series
Ports: Danse Macabre
Royal Guard/Silver Mage
User avatar
James_The_Invisible
 
Posts: 360
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces

Re: Forcing an advancement

Postby Paulomat4 » March 30th, 2014, 3:58 pm

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
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Forcing an advancement

Postby James_The_Invisible » March 30th, 2014, 4:08 pm

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.
My content: For Power series
Ports: Danse Macabre
Royal Guard/Silver Mage
User avatar
James_The_Invisible
 
Posts: 360
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces

wesnoth closing itself during loading

Postby Paulomat4 » April 14th, 2014, 5:59 pm

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
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: wesnoth closing itself during loading

Postby iceiceice » April 14th, 2014, 7:30 pm

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. 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
iceiceice
Developer
 
Posts: 1055
Joined: August 23rd, 2013, 2:10 am

Re: wesnoth closing itself during loading

Postby Paulomat4 » April 14th, 2014, 7:50 pm

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
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: wesnoth closing itself during loading

Postby iceiceice » April 14th, 2014, 9:08 pm

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
iceiceice
Developer
 
Posts: 1055
Joined: August 23rd, 2013, 2:10 am

Re: wesnoth closing itself during loading

Postby Paulomat4 » April 15th, 2014, 11:07 am

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
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: wesnoth closing itself during loading

Postby iceiceice » April 15th, 2014, 10:52 pm

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
User avatar
iceiceice
Developer
 
Posts: 1055
Joined: August 23rd, 2013, 2:10 am

Re: wesnoth closing itself during loading

Postby Max » April 16th, 2014, 8:03 am

can you attach the save game?

increasing the debug output might help to get an idea what's going on:
viewtopic.php?f=4&t=39726#p564352
Max
Forum Regular
 
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: wesnoth closing itself during loading

Postby Paulomat4 » April 16th, 2014, 1:25 pm

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 67 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
User avatar
Paulomat4
 
Posts: 658
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

PreviousNext

Return to WML Workshop

Who is online

Users browsing this forum: No registered users and 2 guests