Request for a New Sticky Topic and a few other questions
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.
Request for a New Sticky Topic and a few other questions
How about a new sticky topic, for working wml code? Or one for stable and one for dev. The lack of example uses for every tag in the documentation, could be offset by people being able to see others working code. I know you can look into other campaigns, but having a one stop place for a large amount of code examples would probably help a lot of people out. Maybe a wiki page would be better, not sure.
Also, I am trying to figure out how to put monster names into an array. I want to be able to use them to call a monster placement macro so do they need to be with the ()'s or could I put the variable in ()'s when I call it. Basically, how do I successfully make an array that I can use to place a Vampire Bat and a Walking Corpse since there is a space in between the names.
I built some code that lays monsters randomly, but want it much more efficient since it is a huge amount of repetitive wml.
Also, I am trying to figure out how to put monster names into an array. I want to be able to use them to call a monster placement macro so do they need to be with the ()'s or could I put the variable in ()'s when I call it. Basically, how do I successfully make an array that I can use to place a Vampire Bat and a Walking Corpse since there is a space in between the names.
I built some code that lays monsters randomly, but want it much more efficient since it is a huge amount of repetitive wml.
Doing
gives you an empty array <my_variable> with <my_desired_length> elements. You can set, shirnk or enlarge any array in this way at any place in any event. Just remember that you can't assign values in following way each array member needs an container to hold the value like this
And about that sticky request :
It's not a good idea, it's hard to properly present the code on the forums and hard to properly search trough a thread content. The wiki is much better place for this.
Code: Select all
{VARIABLE <my_variable>.length <my_desired_length>}
Code: Select all
<my_variable>[<any_number>]=<some_value>
Code: Select all
<my_variable>[<any_number>].<some_container>=<some_value>
It's not a good idea, it's hard to properly present the code on the forums and hard to properly search trough a thread content. The wiki is much better place for this.
Somewhere, between the sacred silence and sleep.
Disorder.
Disorder.
This information is incorrect.Mist wrote:Doinggives you an empty array <my_variable> with <my_desired_length> elements. You can set, shirnk or enlarge any array in this way at any place in any event.Code: Select all
{VARIABLE <my_variable>.length <my_desired_length>}
The other information was correct.
array.length should be considered a read-only value. changing it has no effect. array size is increased as it is needed.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."