It is currently 01 Sep 2025, 02:00
   
Text Size

Issue with Custom Card Script Failing to Execute

Post MTG Forge Related Programming Questions Here

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

Issue with Custom Card Script Failing to Execute

Postby seleeenaaa112 » 27 Jun 2024, 05:22

Helllo,

I am currently working on a custom card script for MTG Forge ; and I am facing an issue where the script fails to execute properly. Below are the details:
Card Name: Mystic Apprentice
Script:

<CARD>
<NAME>Mystic Apprentice</NAME>
<TYPE>Creature</TYPE>
<SUBTYPE>Human Wizard</SUBTYPE>
<COST>{1}{U}</COST>
<POWER>2</POWER>
<TOUGHNESS>2</TOUGHNESS>
<TEXT>
Whenever Mystic Apprentice enters the battlefield, draw a card.
</TEXT>
<CODE>
AB$ Draw | Cost$ 0 | NumCards$ 1 | SubAbility$ SBTrigger
SB$ Trigger | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ DrawCard
SB$ DrawCard | NumCards$ 1
</CODE>
</CARD>

When I test the card ; it appears on the battlefield but the draw effect doesn't trigger. There are no errors displayed in the console; and I am not sure where the script is going wrong.
I have Verified the syntax of the script. Checked other similar card scripts to ensure consistency. Restarted MTG Forge to clear any cached data.

Could anyone help me identify what might be wrong with this script or suggest debugging steps I could take?


Thanks in advance for your assistance!


Thank you
seleeenaa
seleeenaaa112
 
Posts: 6
Joined: 25 Jun 2024, 09:51
Has thanked: 0 time
Been thanked: 0 time

Re: Issue with Custom Card Script Failing to Execute

Postby Marek14 » 28 Jun 2024, 05:28

That is not a trigger. That is an activated ability (AB$) with zero activation cost.

For comparison, here is how the ability is written for Merchant of Secrets:
Code: Select all
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDraw | TriggerDescription$ When CARDNAME enters the battlefield, draw a card.
SVar:TrigDraw:DB$ Draw | Defined$ You | NumCards$ 1
Note:
"T:" -- this is used to define triggers.
Variable names -- you have none. In particular, you have "SubAbility$ SBTrigger", but there is nothing called "SBTrigger" in the code.
Triggers have modes, without a mode, yours doesn't know that it's supposed to trigger on something changing zone. That's what "Mode$ ChangesZone" is for.
You use "DrawCard" but the actual effect is "Draw".
Marek14
Tester
 
Posts: 2773
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 303 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 24 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 24 users online :: 0 registered, 0 hidden and 24 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 24 guests

Login Form