Proposed radical WML changes
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.
Theese two ideas are very compatible, let's start!toms wrote:IMO WML should _not_ become a programming language. It was originally made to be able to write scenarios in a simple way.
Sometimes WML is not enough though, that's why I suggested this.
Just my 2¢.
/tsr
By 'functions', do you mean that values are written in between parentheses, for example
would be an open tag for the start event? This would work well for some types of events, but for others, you want a syntax more like this:
where the [remove_this_event /] command means that the event is no longer executed, i.e. first_time_only=yes.
Of course, this could also work for the initial event:
Although in this case the event could not possibly trigger before the conditions were met, so all that is necessary is
Do you set these attributes at the beginning of the scenario file? For example:
Maybe tags could be used to represent array elements or elements with subelements:
hmm... this looks something like existing syntax
For units you should actually have a new object, unit_type, produced by unit.type and which has elements
...I can't figure out what 'decesead' means though, it must be a typo.
Code: Select all
[event type="onTurn(1,1)"]
Code: Select all
[event type=attack]
[if attacker.side=1 and defender.side=3]
[then]
{CODE}
[remove_this_event /]
[/then]
[/if]
[do_event /]
[/event]
Of course, this could also work for the initial event:
Code: Select all
[event type=turn]
[if turn=1 and side=1]
[then]
{CODE}
[remove_this_event /]
[/then]
[/if]
[do_event /]
[/event]
Code: Select all
[event type=turn]
{CODE}
[remove_this_event /]
[do_event /]
[/event]
Do you set these attributes at the beginning of the scenario file? For example:
Code: Select all
name= _"The Elvish Woods"
time_of_day_cycle = {DAWN},{MORNING},{AFTERNOON},{DUSK},{FIRST_WATCH},{SECOND_WATCH}
max_turns=30
Code: Select all
[side]
[leader]
type=Elvish Hero
canrecruit=yes
[/leader]
recruitable=Elvish Fighter,Elvish Archer
[unit]
type=Elvish Fighter
hex=$side.keep
hex.x += 1
[/unit]
[unit]
type=Elvish Fighter
[hex]
x,y=13,14
[/hex]
[/unit]
[/side]

For units you should actually have a new object, unit_type, produced by unit.type and which has elements
Code: Select all
unit_type.name
unit_type.level
unit_type.alignment
unit_type.ability[array]
unit_type.movetype
unit_type.moves
unit_type.experience## experience needed to advance
unit_type.hitpoints## max hitpoints
unit_type.attack[array]
hmm... if you can change units' attributes directly, it seems there is no need for the [store_unit] tag. The other use of [store_unit] is to have units disappear for a scenario, like this:
Code: Select all
[message]
unit=Leader Merman## this is like 'description=Leader Merman'
message= _"We must leave now"
[/message]
[for unit=side[1].unit]
[if unit.type.name="Merman"]
[then]
unit.hex=NULL
[/then]
[/if]
[/for]
Code: Select all
[for unit=side[1].unit]
[if unit.hex=NULL and unit.type.name="Merman"]
[then]
[unit.hex]
terrain=c,s
x,y=3-8,7-11## make them start out in water near the player
[find_vacant_hex /]## finds a hex with the specified properties
[/hex]
[/then]
[/if]
[/for]
[message]
unit=Leader Merman
message= _"We are back to help you"
[/message]
Mmmh, actually the values in the paranthesis are passed by the game engine.Dacyn wrote:By 'functions', do you mean that values are written in between parentheses, for exampleCode: Select all
[event type="onTurn(1,1)"]
For example, on turn five of side 3 do something
Code: Select all
[event type="onTurn"]
[IF side==1 AND turn==5]
[THEN]
{CODE}
[/THEN]
[/IF]
[DOEVENT /]//well here is not very useful
[/event]
More actions in one event, Konrad gets double exp attacking and another unit changed side if attacked.
Code: Select all
[event type="onAttack"]
[IF attacker.name=='Konrad' and defender.type=='skeleton']
[THEN]
attacker.experience+=2
[/THEN]
[/IF]
[IF defender.name=='coward']// or [ELSEIF] ?
[THEN]
defender.side=attacker.side
[/THEN]
[/IF]
[DOEVENT /]
[/event]
Yes, you're right.For units you should actually have a new object, unit_type, produced by unit.type and which has elementsCode: Select all
unit_type.name unit_type.level unit_type.alignment unit_type.ability[array] unit_type.movetype unit_type.moves unit_type.experience## experience needed to advance unit_type.hitpoints## max hitpoints unit_type.attack[array]
It's a list of units of each side that has been killed, it can be usefull in many situations and wouldn't cost much in developer and cpu time....I can't figure out what 'decesead' means though, it must be a typo.
Or maybe to keep an object approach:Dacyn wrote:[message]
unit=Leader Merman## this is like 'description=Leader Merman'
message= _"We must leave now"
[/message]
[for unit=side[1].unit]
[if unit.type.name="Merman"]
[then]
unit.hex=NULL
[/then]
[/if]
[/for]
Code: Select all
[event type="onScenarioEnd"]
[IF isVictory==1]
[THEN]
[FOR unit=side[1].units]
[IF unit.name=='Leader Merman']
globals.merman=unit
unit.side=NULL//a unit without side can't exist
[/IF]
[/FOR]
[/THEN]
[/IF]
[/event]
Code: Select all
[event type="onScenarioEnd"]
[IF isVictory==1]
[THEN]
[FOR unit=side[1].units]
[IF unit.type.name=='Merman']
[ADD side[1].storedunits]unit[/ADD]//add item to an array
[REMOVE side[1].units]unit[/REMOVE]//remove item from an array
[/IF]
[/FOR]
[/THEN]
[/IF]
[/event]