It is currently 15 May 2025, 03:00
   
Text Size

New to coding

Moderator: CCGHQ Admins

New to coding

Postby mr friendly guy » 31 Aug 2013, 08:08

Ok, firstly I like to thank the modders here who given me hours of enjoyment playing their decks and also experimenting with decks of my own.

I do have a question about coding. The last time I played with a computer language was way back in high school in the mid 90s, so basically I don't know anything. What I like doing though, is taking things apart, changing a few things and seeing what difference it makes. Basically I am hoping to create original cards, but first I need to see how things work. Here is an attempt that crashed the game.

I started off with the code for Final Judgment (built into the game)

| Open
<?xml version="1.0"?>
<CARD_V2 ExportVersion="13">
<FILENAME text="FINAL_JUDGMENT_362755" />
<CARDNAME text="FINAL_JUDGMENT" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Final Judgment]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Jugement ultime]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Juicio final]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Finales Urteil]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Giudizio Finale]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[最(さい)後(ご)の裁(さば)き]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[최후의 심판]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Последний Суд]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Julgamento Final]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="362755" />
<ARTID value="80778" />
<ARTIST name="Kev Walker" />
<CASTING_COST cost="{4}{W}{W}" />
<FLAVOURTEXT>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“The clashing warriors turned to face O-Kagachi, the greatest kami, and their sigh of awe was their last breath.”
—Great Battles of Kamigawa]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[« Les guerriers se tournèrent vers O-Kagachi, le plus grand de tous les kami, pour l'affronter, et leur soupir d'admiration fut leur dernier souffle. »
—Grandes batailles de Kamigawa]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[“Los guerreros en la batalla se volvieron para enfrentar a O-Kagachi, el más grande de los kami, y su suspiro de admiración fue su último aliento”.
—Grandes batallas de Kamigawa]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[„Die streitenden Krieger wandten sich O-Kagachi zu, dem größten der Kami. Ihr entsetztes Ächzen war ihr letzter Atemzug.“
—Die Großen Schlachten von Kamigawa]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“I guerrieri battaglianti si voltarono per affrontare O-Kagachi, il più grande dei kami, e il loro sospiro di sgomento fu anche il loro ultimo respiro.”
—Le Grandi Battaglie di Kamigawa]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[「混乱した兵士たちが向いた先には、最も偉大なる神である大口縄がいた。彼らが怖れに漏らした息は、彼らの最後の息となった。」――神河大戦記]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA["서로 싸우던 전사들은 칼을 거두고 위대한 신 오오카구치에 맞섰다. 그러나 그들은 겁에 질릴 시간도 없이 죽었다."
—카미가와 전쟁사]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[«Воины, схлестнувшиеся в битве, повернулись и увидели О-Кагачи, величайшего из ками. Вздох изумления стал их последним вздохом».
— Великие битвы Камигавы]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[“Os guerreiros voltaram-se fragorosos para enfrentar O-Kagachi, o melhor dos kamis, e seu suspiro de espanto foi seu último alento.”
— As Grandes Batalhas de Kamigawa]]></LOCALISED_TEXT>
</FLAVOURTEXT>
<TYPE metaname="Sorcery" />
<EXPANSION value="DPI" />
<RARITY metaname="R" />
<SPELL_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Exile all creatures.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Exilez toutes les créatures.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Exilia todas las criaturas.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Schicke alle Kreaturen ins Exil.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Esilia tutte le creature.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[すべてのクリーチャーを追放する。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[모든 생물을 추방한다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Изгоните все существа.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Exile todas as criaturas.]]></LOCALISED_TEXT>
<SFX text="GLOBAL_JUDGEMENT_PLAY" />
<FILTER filter_id="0">
local filter = ClearFilter()
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
</FILTER>
<RESOLUTION_TIME_ACTION filter_id="0">
if FilteredCard() ~= nil then
FilteredCard():Exile()
end
</RESOLUTION_TIME_ACTION>
</SPELL_ABILITY>
<AI_BASE_SCORE score="1800" zone="ZONE_HAND" />
</CARD_V2>


Changed the casting cost and card name.

| Open
<?xml version="1.0"?>
<CARD_V2 ExportVersion="13">
<FILENAME text="MASTER_SPELL_123456767" />
<CARDNAME text="MASTER_SPELL" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Master Spell]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Jugement ultime]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Juicio final]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Finales Urteil]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Giudizio Finale]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[最(さい)後(ご)の裁(さば)き]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[최후의 심판]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Последний Суд]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Julgamento Final]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="123456767" />
<ARTID value="123456767" />
<ARTIST name="Crossgen Comics" />
<CASTING_COST cost="{2}{W}{W}" />
<FLAVOURTEXT>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[“Think the Unthinkable, Do the Undoable, Reach into the Mind and Cast the Master Spell]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[« Les guerriers se tournèrent vers O-Kagachi, le plus grand de tous les kami, pour l'affronter, et leur soupir d'admiration fut leur dernier souffle. »
—Grandes batailles de Kamigawa]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[“Los guerreros en la batalla se volvieron para enfrentar a O-Kagachi, el más grande de los kami, y su suspiro de admiración fue su último aliento”.
—Grandes batallas de Kamigawa]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[„Die streitenden Krieger wandten sich O-Kagachi zu, dem größten der Kami. Ihr entsetztes Ächzen war ihr letzter Atemzug.“
—Die Großen Schlachten von Kamigawa]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[“I guerrieri battaglianti si voltarono per affrontare O-Kagachi, il più grande dei kami, e il loro sospiro di sgomento fu anche il loro ultimo respiro.”
—Le Grandi Battaglie di Kamigawa]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[「混乱した兵士たちが向いた先には、最も偉大なる神である大口縄がいた。彼らが怖れに漏らした息は、彼らの最後の息となった。」――神河大戦記]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA["서로 싸우던 전사들은 칼을 거두고 위대한 신 오오카구치에 맞섰다. 그러나 그들은 겁에 질릴 시간도 없이 죽었다."
—카미가와 전쟁사]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[«Воины, схлестнувшиеся в битве, повернулись и увидели О-Кагачи, величайшего из ками. Вздох изумления стал их последним вздохом».
— Великие битвы Камигавы]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[“Os guerreiros voltaram-se fragorosos para enfrentar O-Kagachi, o melhor dos kamis, e seu suspiro de espanto foi seu último alento.”
— As Grandes Batalhas de Kamigawa]]></LOCALISED_TEXT>
</FLAVOURTEXT>
<TYPE metaname="Sorcery" />
<EXPANSION value="DPI" />
<RARITY metaname="R" />
<SPELL_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Exile all creatures.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Exilez toutes les créatures.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Exilia todas las criaturas.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Schicke alle Kreaturen ins Exil.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Esilia tutte le creature.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[すべてのクリーチャーを追放する。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[모든 생물을 추방한다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Изгоните все существа.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Exile todas as criaturas.]]></LOCALISED_TEXT>
<SFX text="GLOBAL_JUDGEMENT_PLAY" />
<FILTER filter_id="0">
local filter = ClearFilter()
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
</FILTER>
<RESOLUTION_TIME_ACTION filter_id="0">
if FilteredCard() ~= nil then
FilteredCard():Exile()
end
</RESOLUTION_TIME_ACTION>
</SPELL_ABILITY>
<AI_BASE_SCORE score="1800" zone="ZONE_HAND" />
</CARD_V2>


Next I unpacked someone else's WAD, emptied the cards from the Card folder and art from Art assets/ Illustration folder etc, and put in my new files. I left the header.xml files in there as I never had a problem before when I did that with the cards people created for me in the "formal request thread". Obviously I renamed this folder, repacked it as a WAD file and then copied it into my games folder.

I got the card to display in Rik's deck builder with associated art, but when I tried creating a deck with the new "Master Spell" in it, DoTP won't load up. I tried a similar thing with Supreme Verdict by changing where it says Destroy to Exile (leaving every other symbol and character intact) and again same problem. Game won't load.

Can anyone explain why this crashes the game? Is it a problem with ID's, because I tried several different numbers to see what happens, and always the same result.
mr friendly guy
 
Posts: 85
Joined: 23 Aug 2013, 12:03
Has thanked: 2 times
Been thanked: 1 time

Re: New to coding

Postby BloodReyvyn » 31 Aug 2013, 08:59

If you had overwritten the old wad and still had decks from that wad installed, the cards are no longer there and the game will crash on startup whenever it can't find a card for a deck.

You also have to change the file path in the header file to correspond to the new path you made when you renamed any folders or the program won't see the path at all.

I assume you renamed the file to the new card filename...
"There's an experience worse than blindness - it's the certainty that your vision is perfect and the horror that there's no world around you to see."
User avatar
BloodReyvyn
 
Posts: 421
Joined: 19 May 2013, 13:29
Has thanked: 53 times
Been thanked: 40 times

Re: New to coding

Postby mr friendly guy » 31 Aug 2013, 09:37

Changing the file path in the header file seems to have worked. The card works as far as I can tell, but script log says

[lua] ?:0: attempt to index a nil value
[lua] ?:0: attempt to index a nil value
Not sure of the significance.
mr friendly guy
 
Posts: 85
Joined: 23 Aug 2013, 12:03
Has thanked: 2 times
Been thanked: 1 time

Re: New to coding

Postby thefiremind » 31 Aug 2013, 09:55

[lua] ?:0: attempt to index a nil value
[lua] ?:0: attempt to index a nil value
Those errors are hard to debug... as far as I could discover by Googling, it's something that the Lua interpreter can't even load, so it can't tell you where the error is (hence the "?").
I get that error if I create a new persona with a random ID that creates a gap between the last declared persona ID and mine, but I'm sure there are many other circumstances that can issue the same error.

Why don't you create a deck with Riiak's Deck Builder and then create the needed folders (CARDS, ART_ASSETS, ILLUSTRATIONS) inside it? You'll have a fresh new WAD to put all your stuff in. Or you could just use the "custom data folder" command in the Deck Builder, which is supposed to be used exactly for those needs.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 722 times

Re: New to coding

Postby mr friendly guy » 31 Aug 2013, 10:21

I am still learning all the functions of Riaak's Deck Builder. So far I have decks from pre-existing cards and sort of coded Glimpse the Unthinkable by myself by adjusting a few details on a Mind Sculpt card.

What I am doing now is to see if its possible make cards which mill the opponent by exiling instead of discarding to the Graveyard, as milling decks pretty much lose when coming up against some Eldrazi cards which cause players to shuffle graveyard into library if that card enters the graveyard, eg Kozilek. I was hoping to get cards that exile the same amount that existing cards would mill.

Unfortunately I have no idea how to do that. I am stuck with mixing and matching code from various cards that can exile from the library eg Lord of the void, but so far nothing happens.
mr friendly guy
 
Posts: 85
Joined: 23 Aug 2013, 12:03
Has thanked: 2 times
Been thanked: 1 time

Re: New to coding

Postby Zarroc » 31 Aug 2013, 11:27

It is possible to mill the opponent deck by exiling. If you have no clue how code a card its always a good idea to look at these 3 pages:
http://www.slightlymagic.net/wiki/DotP_2014:_Functions
http://www.slightlymagic.net/wiki/DotP_2014:_XML_Tags
http://www.slightlymagic.net/wiki/DotP_ ... L_contents

Especially the list of functions helped me very much when i began coding cards. If you use it together with the filters of Riiaks Deckbuilder you can easily figure out how any of these functions work.
I uploaded two screenshots to show you how you can use them:
http://s14.directupload.net/images/130831/26bylx8l.jpg
This filter allows you to search specific text from the abilities of a card.

http://s1.directupload.net/images/130831/f6lxe8a2.jpg
This filter allows you to search text from the xml code of all the cards the deckbuilder detected.

For your specific Problem look at the Functions "Library_GetTop" and "Exile"
User avatar
Zarroc
 
Posts: 16
Joined: 28 Jun 2013, 13:06
Has thanked: 1 time
Been thanked: 3 times


Return to 2014

Who is online

Users browsing this forum: No registered users and 22 guests


Who is online

In total there are 22 users online :: 0 registered, 0 hidden and 22 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 22 guests

Login Form