Card Development Questions
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Card Development Questions
by Iran » 24 Sep 2011, 01:26
Tryingo to script River Kelpie, but when i put this card in cardsfolder/r directory and execute the forge i see the following crash reports. What´s wrong with this card?
And after i close the first crash
- River Kelpie | Open
- Name:River Kelpie
ManaCost:3 U U
Types:Creature Beast
Text:no text
PT:3/3
K:Persist
T:Mode$ ChangesZone | ValidCard$ Permanent | Origin$ Graveyard | Destination$ Battlefield | Execute$ DBDraw | TriggerZones$ Battlefield | TriggerDescription$ Whenever River Kelpie or another permanent is put onto the battlefield from a graveyard, draw a card.
T:Mode$ ChangesZone | ValidCard$ Card | Origin$ Graveyard | Destination$ Stack | Execute$ DBDraw | TriggerZones$ Battlefield | TriggerDescription$ Whenever a player casts a spell from a graveyard, draw a card.
SVar:DBDraw:DB$Draw | Cost$ 0 | NumCards$ 1
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/river_kelpie.jpg
End
- This is a Crash Report | Open
- This is a Crash Report. An error has occurred. Please save this message to a file.
Please follow the instructions at this address to submit this Crash Report, plus what you were doing at the time:
http://tinyurl.com/3zzrnyb
Reporting bugs in Forge is very important. We thank you for your time.
String index out of range: 0
Version:
Forge version 1.1.4, build ID 10643
OS: Windows XP Version: 5.1 Architecture: x86
Java Version: 1.6.0_25 Vendor: Sun Microsystems Inc.
Detailed error trace:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at forge.CardReader.loadCard(CardReader.java:324)
at forge.CardReader.loadCard(CardReader.java:434)
at forge.CardReader.loadCardsUntilYouFind(CardReader.java:235)
at forge.CardReader.run(CardReader.java:188)
at forge.card.cardFactory.PreloadingCardFactory.readCards(PreloadingCardFactory.java:80)
at forge.card.cardFactory.PreloadingCardFactory.<init>(PreloadingCardFactory.java:53)
at forge.AllZone.getCardFactory(AllZone.java:228)
at forge.view.swing.ApplicationView.setModel(ApplicationView.java:122)
at forge.view.swing.Main.main(Main.java:43)
at forge.Gui_NewGame.main(Gui_NewGame.java:27)
And after i close the first crash
- This is a Crash Report 2 | Open
- This is a Crash Report. An error has occurred. Please save this message to a file.
Please follow the instructions at this address to submit this Crash Report, plus what you were doing at the time:
http://tinyurl.com/3zzrnyb
Reporting bugs in Forge is very important. We thank you for your time.
CardDb has not yet been initialized, run setup() first
Version:
Forge version 1.1.4, build ID 10643
OS: Windows XP Version: 5.1 Architecture: x86
Java Version: 1.6.0_25 Vendor: Sun Microsystems Inc.
Detailed error trace:
java.lang.NullPointerException: CardDb has not yet been initialized, run setup() first
at forge.item.CardDb.instance(CardDb.java:31)
at forge.item.ItemPool.<init>(ItemPool.java:17)
at forge.deck.Deck.setMain(Deck.java:145)
at forge.deck.DeckManager.readDeck(DeckManager.java:308)
at forge.deck.DeckManager.readAllDecks(DeckManager.java:255)
at forge.deck.DeckManager.<init>(DeckManager.java:93)
at forge.AllZone.getDeckManager(AllZone.java:430)
at forge.view.swing.OldGuiNewGame.<init>(OldGuiNewGame.java:61)
at forge.view.swing.ApplicationView$4.run(ApplicationView.java:140)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Re: Card Development Questions
by Hellfish » 24 Sep 2011, 09:24
Works for me here. (The card loading, unable to test the card currently) Try copy pasting from your post into the card file, there may have been an extra line somewhere that mucks things up.
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
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
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: Card Development Questions
by Iran » 24 Sep 2011, 23:32
It works, I copy the post and test this card (River Kelpie) on forge. It functions well (with persist, flashback, etc...).The only problem I found is when a play lands from my graveyard (with Crucible of Worlds), the first trigger ability of the River Kelpie don't work.Hellfish wrote:Works for me here. (The card loading, unable to test the card currently) Try copy pasting from your post into the card file, there may have been an extra line somewhere that mucks things up.
Why? The first trigger ability of the River Kelpie would must works how it is scripted.
Re: Card Development Questions
by Jorch72 » 27 Sep 2011, 01:18
I've tried the search function, but it appears that it's not working or what I'm looking for is not here. So, I'll just ask...
Is there any document explaining how to script cards?
Is there any document explaining how to script cards?
- Jorch72
- Posts: 3
- Joined: 26 Nov 2009, 15:33
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card Development Questions
by friarsol » 27 Sep 2011, 01:47
Start here: http://www.slightlymagic.net/wiki/Forge_APIJorch72 wrote:I've tried the search function, but it appears that it's not working or what I'm looking for is not here. So, I'll just ask...
Is there any document explaining how to script cards?
It's not 100% up-to-date but it's a good start. Also, reading existing card scripts can give you an idea of how it works.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card Development Questions
by jeffwadsworth » 27 Sep 2011, 12:49
Find a card you like. Search for a similar card that is already scripted. Bear in mind that pretty much all the "easy" cards are done.Jorch72 wrote:I've tried the search function, but it appears that it's not working or what I'm looking for is not here. So, I'll just ask...
Is there any document explaining how to script cards?
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Re: Card Development Questions
by Iran » 27 Sep 2011, 18:15
I agree with you, several cards I see use "Divide as you choose" and not known amount of damage that cards causes.friarsol wrote:Fireball is actually a different scenario since the number is divided evenly. (I think Fireball might be actually scriptable)jeffwadsworth wrote:Check out the java-coded Fireball. No way to script these just yet.Iran wrote:I see in forge not exists cards like Comet Storm, Conflagrate, Rock Slide, Magmatic Core, Meteor Shower, etc...
Cards that deals X damage divided as you choose among any number of target creatures (and/or players)
Exists any impediments to script then?
Thanks
The cards Iran is talking about are "Divide as you choose." We do have a few cards that "fake" this like Pyrotechnics, but this only works for a known amount of damage. It'd be nice to have a "Divided" parameter for Damage and for any other AF that uses it. (PutCounter I think, maybe Pump)
Re: Card Development Questions
by Iran » 30 Sep 2011, 16:37
Anyone knows if the parameter RememberDiscarded was placed in AF_Discard?
thanks
thanks
Re: Card Development Questions
by slapshot5 » 30 Sep 2011, 19:00
It has not.Iran wrote:Anyone knows if the parameter RememberDiscarded was placed in AF_Discard?
thanks
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Card Development Questions
by Iran » 01 Oct 2011, 07:33
Exists in forge any keyword or AF that have the effect below?
Target creature blocks CARDNAME this turn if able.
I would like to script Sisters of Stone Death. With her i can do a Gorgon Deck with Gaze of the Gorgon, Gorgon Recluse, Infernal Medusa, etc...
Other card that can use the effect above is Matsu-Tribe Decoy
Thanks
Target creature blocks CARDNAME this turn if able.
I would like to script Sisters of Stone Death. With her i can do a Gorgon Deck with Gaze of the Gorgon, Gorgon Recluse, Infernal Medusa, etc...
Other card that can use the effect above is Matsu-Tribe Decoy
Thanks
Re: Card Development Questions
by slapshot5 » 01 Oct 2011, 18:53
Well, the AF that Gideon Jura uses is meant for this.Iran wrote:Exists in forge any keyword or AF that have the effect below?
Target creature blocks CARDNAME this turn if able.
I would like to script Sisters of Stone Death. With her i can do a Gorgon Deck with Gaze of the Gorgon, Gorgon Recluse, Infernal Medusa, etc...
Other card that can use the effect above is Matsu-Tribe Decoy
Thanks
Nope, check that. That was for attacks. I'd need to write another AF for blocks in a similar fashion. I'll do that sometime this weekend, but the Brewers are on right now, so it won't be now!

-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Card Development Questions
by slapshot5 » 02 Oct 2011, 23:31
I'm trying to add Goblin Sappers:
-slapshot5
- Code: Select all
Name:Goblin Sappers
ManaCost:1 R
Types:Creature Goblin
Text:no text
PT:1/1
A:AB$ Pump | Cost$ R R T | ValidTgts$ Creature | TgtPrompt$ Select target creature | KW$ HIDDEN Unblockable | SubAbility$ DestroySelfTgtEOC | SpellDescription$ Target creature you control is unblockable this turn. Destroy it and CARDNAME at end of combat.
SVar:DestroySelfTgtEOC:DB$ DelayedTrigger | Mode$ Phase | Phase$ EndCombat | ValidPlayer$ Each | Execute$ DestroySelf | TriggerDescription$ Destroy target and CARDNAME.
SVar:DestroySelf:AB$ Destroy | Cost$ 0 | Defined$ Self | SubAbility$ DestroyTgt
SVar:DestroyTgt:DB$ Destroy | Defined$ Targeted
A:AB$ Pump | Cost$ R R R R T | ValidTgts$ Creature | TgtPrompt$ Select target creature | KW$ HIDDEN Unblockable | SubAbility$ DestroyTgtEOC | SpellDescription$ Target creature you control is unblockable this turn. Destroy it at end of combat.
SVar:DestroyTgtEOC:DB$ DelayedTrigger | Mode$ Phase | Phase$ EndCombat | ValidPlayer$ Each | Execute$ DestroyOnlyTgt | TriggerDescription$ Destroy target.
SVar:DestroyOnlyTgt:AB$ Destroy | Cost$ 0 | Defined$ Targeted
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/goblin_sappers.jpg
End
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Card Development Questions
by Iran » 03 Oct 2011, 02:23
If you use Defined$ TriggeredSource, Will this works?slapshot5 wrote:I'm trying to add Goblin Sappers:For the AB$ Destroy, Defined$ Targeted doesn't work. Do I need some kind of Triggered variable here?
- Code: Select all
Name:Goblin Sappers
ManaCost:1 R
Types:Creature Goblin
Text:no text
PT:1/1
A:AB$ Pump | Cost$ R R T | ValidTgts$ Creature | TgtPrompt$ Select target creature | KW$ HIDDEN Unblockable | SubAbility$ DestroySelfTgtEOC | SpellDescription$ Target creature you control is unblockable this turn. Destroy it and CARDNAME at end of combat.
SVar:DestroySelfTgtEOC:DB$ DelayedTrigger | Mode$ Phase | Phase$ EndCombat | ValidPlayer$ Each | Execute$ DestroySelf | TriggerDescription$ Destroy target and CARDNAME.
SVar:DestroySelf:AB$ Destroy | Cost$ 0 | Defined$ Self | SubAbility$ DestroyTgt
SVar:DestroyTgt:DB$ Destroy | Defined$ Targeted
A:AB$ Pump | Cost$ R R R R T | ValidTgts$ Creature | TgtPrompt$ Select target creature | KW$ HIDDEN Unblockable | SubAbility$ DestroyTgtEOC | SpellDescription$ Target creature you control is unblockable this turn. Destroy it at end of combat.
SVar:DestroyTgtEOC:DB$ DelayedTrigger | Mode$ Phase | Phase$ EndCombat | ValidPlayer$ Each | Execute$ DestroyOnlyTgt | TriggerDescription$ Destroy target.
SVar:DestroyOnlyTgt:AB$ Destroy | Cost$ 0 | Defined$ Targeted
SVar:RemAIDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/goblin_sappers.jpg
End
-slapshot5
Re: Card Development Questions
by slapshot5 » 03 Oct 2011, 03:16
No, it doesn't. I'm not even sure a triggered variable works here. I don't think that all gets set up in a DelayedTrigger.Iran wrote:If you use Defined$ TriggeredSource, Will this works?
I believe Defined$ Targeted is what is desired, but is possibly not preserved (or can't be traced back through) the DelayedTrigger.
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Card Development Questions
by jeffwadsworth » 03 Oct 2011, 04:02
It would be nice if "remembered" was extended to all the AB's.
- jeffwadsworth
- Super Tester Elite
- Posts: 1172
- Joined: 20 Oct 2010, 04:47
- Location: USA
- Has thanked: 287 times
- Been thanked: 70 times
Who is online
Users browsing this forum: No registered users and 42 guests