top of page

Cardgame Framework Scripting Language

To ease up the development of games, I developed a custom scripting language to conditions and effects in my Cardgame Framework. The rules for the system are described below.

1. Triggers

 

The following triggers are implemented. They are events that happen in the game that fire the execution of commands/effects.

​

  • OnMatchStarted

  • OnMatchEnded

  • OnTurnStarted

  • OnTurnEnded

  • OnPhaseStarted

  • OnPhaseEnded

  • OnCardUsed

  • OnZoneUsed

  • OnCardEnteredZone

  • OnCardLeftZone

  • OnActionUsed

  • OnVariableChanged

  • OnRuleActivated

​

2. Commands (or Effects)

​

The commands/effects are instructions the game can execute, like moving a card, adding a tag, etc.

​

  • EndCurrentPhase

  • EndTheMatch

  • EndSubphaseLoop

  • UseAction

  • StartSubphaseLoop

  • Shuffle

  • UseCard

  • UseZone

  • MoveCardToZone

  • SetCardFieldValue

  • SetVariable

  • AddTagToCard

  • RemoveTagFromCard

​

3. Match Variables

​

  • matchNumber

  • turnNumber

  • phase

  • actionName

  • message

  • variable

  • newValue

  • oldValue

  • rule

  • ruleName

  • usedCard

  • movedCard

  • newZone

  • oldZone

  • usedZone

  • additionalInfo

  • this

​

4. Selections

​

Card - c ( … )

​

  • i: = card with this id or variable. Ex.: c(i:c0012) or c(i:usedCard)

  • z: = card in a zone with this tag or variable. Ex.: c(z:Deck) or c(z:usedZone)

  • f: = card with field value. Ex: c(f:Suit=Spades)

  • t: = card with this tag. Ex: c(t:King) or c(t:King|Queen)

  • x: = this quantity of cards from top. Ex: c(z:Deck,x:3)

  • b: = this quantity of cards from bottom. Ex: c(z:Deck,b:3)

  • n: = index of card in zone. Ex: c(z:Stack,n:<=5)

 

Zone - z( … )

​

  • i: = zone with this id or variable. z(i:usedZone)

  • t: = zone with tag. Ex: z(t:Deck)

  • c: = zone that returns something with this card selection. Ex: z(c:c(f:Suit=Spades,t:Flipped))

​

Rule - r( … )

​

  • i: = rule with this id or variable.

  • t: = rule with tag.

​

allCards

allZones

​

5. Value Getters

​

  • nc (<card selection>)  -  number of cards in selection

  • nz (<zone selection>)  -  number of zones in selection

  • cf (fieldName, <card selection>)  -  card field value. If the selection returns more than one card, only the first card field value will be returned.

  • rn (fromInclusive, toInclusive)  -  random number

  • ic (<card selection>)  -  index of card in current zone. If the selection returns more than one card, only the index of the first card will be returned.

​

​

bottom of page