It is currently 24 Apr 2024, 23:06
   
Text Size

Script reference - better documentation needed!

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Script reference - better documentation needed!

Postby pufthemajicdragon » 07 Feb 2015, 20:53

I'm trying to teach myself this scripting language as best as I can by making custom cards with custom effects. The trouble is that referencing existing cards doesn't give me much guidance, and there are a million key words, commands, and functions that aren't documented on the wiki.

The ones I'm having trouble with right now are imprinting and remembering cards. But there are so many others that I have trouble with too. Is there an existing reference somewhere that includes all of these functions? Or is it just a trial and error kind of thing?
pufthemajicdragon
 
Posts: 23
Joined: 08 Jan 2013, 04:17
Has thanked: 7 times
Been thanked: 2 times

Re: Script reference - better documentation needed!

Postby Hellfish » 13 Feb 2015, 08:04

It's mostly trial and error / copy pasting, unfortunately. I'll hopefully be able to take an hour this weekend to update at least the trigger wiki page, I just gotta catch up with the added triggers.

What is the problem with imprinting/remembering, specifically?
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
User avatar
Hellfish
Programmer
 
Posts: 1297
Joined: 07 Jun 2009, 10:41
Location: South of the Pumphouse
Has thanked: 110 times
Been thanked: 169 times

Re: Script reference - better documentation needed!

Postby Hexadecimal » 13 Feb 2015, 12:00

Forgive my ignorance, but where can I find the wiki ?
Hexadecimal
 
Posts: 69
Joined: 08 Oct 2013, 20:36
Has thanked: 6 times
Been thanked: 2 times

Re: Script reference - better documentation needed!

Postby elcnesh » 13 Feb 2015, 12:17

Hexadecimal wrote:Forgive my ignorance, but where can I find the wiki ?
http://www.slightlymagic.net/wiki/Forge_API ;)
elcnesh
 
Posts: 290
Joined: 16 May 2014, 15:11
Location: Netherlands
Has thanked: 34 times
Been thanked: 92 times

Re: Script reference - better documentation needed!

Postby pufthemajicdragon » 17 Feb 2015, 18:34

Trial and error has hit a dead end :(

I'm trying to create a custom planeswalker with the ability to put a token into play, which token grants a bonus to its controller's creatures based on the number of loyalty counters on the planeswalker.

Text: -5 loyalty counters: Put an enchantment token into play with: "Each creature you control gains +1/+1 for each loyalty counter on Custom Planeswalker"

When I create the token, I call "ImprintToken" so Planeswalker can always reference its tokens. But I need a way to remember the Planeswalker on the token, so the token knows how many loyalty counters are on Planeswalker. Now I've looked at the code for almost every card that uses the Remember or Imprint key words and for the life of me I can't figure out how they work.

Best guess of how it might look (but this doesn't work):
Code: Select all
A:AB$ Token | Cost$ SubCounter<5/LOYALTY> | Planeswalker$ True | TokenAmount$ 1 | TokenName$ Custom Planeswalker Token | TokenTypes$ Enchantment | TokenOwner$ You | TokenColors$ White | ImprintTokens$ True | Ultimate$ True | SpellDescription$ Put an enchantment token onto the battlefield under your control with "Creatures you control get +1/+1 for each loyalty counter on Custom Planeswalker."
S:Mode$ Continuous | Affected$ Card.IsImprinted | AddStaticAbility$ STPump | AddSVar$ Y & YCleanup
SVar:STPump:Mode$ Continuous | ImprintCards$ OriginalHost | Affected$ Creature.YouCtrl | AddPower$ Y | AddToughness$ 1 | Description$ Creatures you control get +1/+1 for each loyalty counter on Custom Planeswalker.
SVar:Y:Count$TotalCounters_LOYALTY_Card.IsImprinted+namedCustom Planeswalker
With the above code, the token grants +0/+1 to each creature, so I know the pump is working, but the imprinting isn't. Archery Training has been one of the better references I've had to work with, but I've come to the conclusion that "OriginalHost" is a keyword used by auras and won't work for a global enchantment.

The best workaround idea I have is to mimic Saproling Burst and push the number of loyalty counters to the token by adding counters to the token, and then count those counters. But I'd much rather make it work natively.
pufthemajicdragon
 
Posts: 23
Joined: 08 Jan 2013, 04:17
Has thanked: 7 times
Been thanked: 2 times

Re: Script reference - better documentation needed!

Postby Midori » 06 Mar 2015, 23:39

I might be not as skilled at scripting, but have you looked at the code of Gutter Grime already?
Im refering to this line.
Code: Select all
SVar:GutterGrimePT:Remembered$CardCounters.SLIME
This is apparently the line that defines the variable P/T of the Ooze tokens according to the slime counters on Gutter Grime.

The Remembered card is defined in the token creation effect by RememberSource$ True.
Code: Select all
SVar:DBToken:DB$ Token | TokenAmount$ 1 | TokenName$ Ooze | TokenTypes$ Creature,Ooze | TokenOwner$ You | TokenColors$ Green | TokenPower$ 1 | TokenToughness$ 1 | TokenImage$ G X X Ooze ISD | TokenSVars$ GutterGrimePT | RememberSource$ True | TokenStaticAbilities$ Static
I hope this is still helpful after all this time.
Midori
 
Posts: 55
Joined: 20 Apr 2014, 12:43
Has thanked: 1 time
Been thanked: 4 times

Re: Script reference - better documentation needed!

Postby pufthemajicdragon » 06 Mar 2015, 23:46

OMG that looks perfect! I think the "RememberSource$ True" command is exactly what I needed. I'll give it a whirl when I get home from work!
I'd been trying to find a card that closely matched what I was trying to do, but when there are 10,000+ card scripts to read through one by one....

:Edit:
Worked perfectly! You're my new hero!
pufthemajicdragon
 
Posts: 23
Joined: 08 Jan 2013, 04:17
Has thanked: 7 times
Been thanked: 2 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 60 guests


Who is online

In total there are 60 users online :: 0 registered, 0 hidden and 60 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 60 guests

Login Form