It is currently 24 Oct 2017, 09:47
   
Text Size

Implementing NEW stuff to Magarena

Moderators: melvin, beholder, ubeefx, ShawnieBoy, Lodici, CCGHQ Admins

Implementing NEW stuff to Magarena

Postby rasdel » 28 May 2012, 23:11

Hello everyone! I been playing with Magarena for the last few days and i am impressed.

The other day I posted in "card wishlist" since there are some cards i would like to see that have not been implemented yet.

In there pcastellazzi (thanks a lot by the way) told me that there are some cards that one can implement by adding scripts. He was very patient and tried to help me, and finally i got what i was doing wrong... it was part of the code.

I am writing this JUST in case there is someone out there like me that just came up with this gem and wants too add some cards but finds it difficult. I hope we can use this thread as a more updated "instruction manual" of some sort, until it is updated in the official site, and who knows maybe it can go further than that.

I've read this, even though outdated it's very well explained>
http://code.google.com/p/magarena/wiki/ ... ntingCards

and here's our conversation on "card wishlist" thread>
viewtopic.php?f=82&t=3700&start=45

I think it would be usefull to understand this to be able to implement the more "simple" cards out there... maybe just to add some more bells & whistles, since it would open up some variety on the actual set of cards. The devs are making one hell of a job updating Magarena, so it would be nice for some of us to help them is this simple tasks like adding simple cards to the mix. This could increase the number of cards and the variety of decks that could be build and leave them with time to "script" the more difficult cards and keep improving the engine.

One thing i notices is that the scripts in Magarena (at least in mine) once i open them look like this>
Code: Select all
name=AEther Figmenturl=http://magiccards.info/zen/en/40.htmlimage=http://magiccards.info/scans/en/zen/40.jpgvalue=2rarity=Utype=Creaturesubtype=Illusioncolor=uconverted=2cost={1}{U}pt=1/1ability=unblockabletiming=mainrequires_card_code
And even though from what i've learned a script shouldn't be a single line, the ones that come with Magarena work so i am not changing them... but when you make NEW card, they should look like this>
Code: Select all
name=AEther Figment
url=http://magiccards.info/zen/en/40.html
image=http://magiccards.info/scans/en/zen/40.jpg
value=2
rarity=U
type=Creature
subtype=Illusion
color=u
converted=2
cost={1}{U}
pt=1/1
ability=unblockable
timing=main
requires_card_code
Moving on... I've always like this little card called Prodigal Sorcerer, and i wanted to implement it.

Here's the "code" of the card i was trying to implement>
Code: Select all
name=Prodigal Sorcerer
url=http://magiccards.info/7e/en/94.html
image=http://magiccards.info/scans/en/7e/94.jpg
value=3
rarity=C
type=Creature
subtype=Wizard
color=b
converted=3
cost={2}{B}
pt=1/1
ability=ping1
timing=fmain
While using this code Magarena would not even start. I started to wonder if i was missing something. I read everything i could but nothing came up. So i revised the code once more... and tried this...

Here's the "code" that worked>
Code: Select all
name=Prodigal Sorcerer
url=http://magiccards.info/7e/en/94.html
image=http://magiccards.info/scans/en/7e/94.jpg
value=3
rarity=C
type=Creature
subtype=Wizard
color=b
converted=3
cost={2}{B}
pt=1/1
ability=ping 1
timing=fmain
THE ONLY difference between codes was a space in the ability -_- ... I honestly don't understand much of the abilities yet. And i am probably going to start to "script" some of the more simple cards just to add more of them to the actual pool. But i would like to know what does "ping 1" mean XD. I guess it's "1 damage" or something like that... since the ability causes target creature or player to lose 1 hp.

On the other hand, i would like to know what other "ability" words i could use to script cards. In the "implementing cards" manual there is a list... but this "ping 1" isn't there so i wonder if this is some sort of "internal code" or something only Magarena uses... and if there are any more of this "words/codes" i need to know to start scripting new cards.

I would like to take some time to talk about the "text" folder and what is it there for? I am currently using my Prodigal Sorcerer without a "text file" and it's working fine... should i make a "text file" though?

Last but not least, i have been adding some stuff to my own Magarena. I noticed there are some "user made" avatars in there. But i wanted to make my own, so i made 30 new avatars. I was wondering if anyone is interested in "new avatars" taken from the MTG site? (i'll leave a screen showing them just in case).

I would also like to make some themes but don't know where to start. Been looking around but haven't fine anything yet. Any idea where can i learn to do that?

I leave a shot of my avatars just in case>
| Open
Image


Cheers
Last edited by rasdel on 02 Jun 2012, 10:01, edited 1 time in total.
rasdel
 
Posts: 20
Joined: 26 Dec 2009, 16:41
Has thanked: 0 time
Been thanked: 4 times

Re: Implementing NEW stuff to Magarena

Postby pcastellazzi » 29 May 2012, 03:22

A few notes:

The everything in one line is not a Magarena problem. Your text editor is ignoring unix file endings (Windows Notepad is known to do this). Try with Wordpad or a more decent text editor like notepad+.

Prodigal Sorcerer subtype should be Human,Wizard as per the latest oracle text.

The text file is created when you use "download images" from the menu, if not delete the card image and try again.
The lights then came up and the crowd erupted in applause, because that's what the crowd does after it watches destruction on a large screen.
— Ben Kuchera, Mordern Warfare 3 review.
User avatar
pcastellazzi
 
Posts: 184
Joined: 25 Apr 2012, 00:40
Location: Montevideo, Uruguay
Has thanked: 11 times
Been thanked: 30 times

Re: Implementing NEW stuff to Magarena

Postby rasdel » 29 May 2012, 03:39

The everything in one line is not a Magarena problem. Your text editor is ignoring unix file endings (Windows Notepad is known to do this). Try with Wordpad or a more decent text editor like notepad+.
ç

That explains a lot. I'll check it out then using Wordpad.

Prodigal Sorcerer subtype should be Human,Wizard as per the latest oracle text.
K, i'll update that right up, thanks.

The text file is created when you use "download images" from the menu, if not delete the card image and try again.
Didn't check it... i actually had a .txt prepared done manually. It's good to know that it's not necessary.

Thanks a lot. BTW i finally found "How to cutomize" Magarena here >
http://code.google.com/p/arena-card-gam ... ngMagarena

I just had to look a little better.
rasdel
 
Posts: 20
Joined: 26 Dec 2009, 16:41
Has thanked: 0 time
Been thanked: 4 times

Re: Implementing NEW stuff to Magarena

Postby melvin » 29 May 2012, 12:48

I'm really happy to see the card script being used. The whole idea of it was to make it possible for users to add new cards without programming. Thanks to rasdel and pcastellazzi for starting the discussions.

Special thanks to pcastellazzi for pointing out the change in the card script format in 1.26. In putting out the release, I forgot to update the wiki page. That has been fixed. Hopefully the syntax of the script in 1.26 is a little more regular now, every card property is defined using the "property name" = "value" syntax.

rasdel wrote:On the other hand, i would like to know what other "ability" words i could use to script cards. In the "implementing cards" manual there is a list... but this "ping 1" isn't there so i wonder if this is some sort of "internal code" or something only Magarena uses... and if there are any more of this "words/codes" i need to know to start scripting new cards.
Kudos to beholder for creating https://code.google.com/p/magarena/wiki ... ntingCards On that page, the meaning of ping is described as "Tap: this card deals n damage to target creature or player". So ping 1 is exactly the ability of Prodigal Sorcerer. I've just updated the page to match the card script as of 1.26. Everything about the card script is on that page.

Do let us know how we can improve the page and make it more accessible.

rasdel wrote:I would like to take some time to talk about the "text" folder and what is it there for? I am currently using my Prodigal Sorcerer without a "text file" and it's working fine... should i make a "text file" though?
The text folder is to store the oracle text of the cards, the oracle text is downloaded from the url property. The purpose is to facilitate text search in the deck editor.
User avatar
melvin
AI Programmer
 
Posts: 1011
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 437 times

Re: Implementing NEW stuff to Magarena

Postby melvin » 29 May 2012, 12:57

rasdel wrote:
Code: Select all
name=Prodigal Sorcerer
url=http://magiccards.info/7e/en/94.html
image=http://magiccards.info/scans/en/7e/94.jpg
value=3
rarity=C
type=Creature
subtype=Wizard
color=b
converted=3
cost={2}{B}
pt=1/1
ability=ping 1
timing=fmain
Some additional comments on this particular script:

The color blue is abbreviated as U instead of B, as B is taken by black. This is the convention on gatherer, which is adopted by most programs. So the color should be "color=u" and the cost should be "cost={2}{U}"

The timing here is listed as fmain which means "first main". The timing part is more of a hint to the AI. In this case, there is no particular reason to limit the AI to only casting Prodigal Sorcerer during the first main, so it will be better to have "timing=main" i.e. either first main or second main, let the AI decide.
User avatar
melvin
AI Programmer
 
Posts: 1011
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 437 times

Re: Implementing NEW stuff to Magarena

Postby Huggybaby » 29 May 2012, 16:03

There is good info in this thread, so I'm going to sticky it and see how it goes.
User avatar
Huggybaby
Administrator
 
Posts: 3053
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 562 times
Been thanked: 567 times

Re: Implementing NEW stuff to Magarena

Postby rasdel » 01 Jun 2012, 18:46

Thanks...

Prodigal Sorcerer works like a charm BTW. I'll try to add around 10 new cards and then post a link if anyone is interrested in having them added to their stock.

This days i've been reading an twiching some stuff. For example... somehow my tokens appeared way bigger than my cards when expanded. Since i didn't like that i made every TOKEN the same size as the cards... so everything look more coherent. AND... I changed some of the old TOKEN images for some new ones. If anyone is interested in a link for them let me know (i will eventually open another thread with my uploads just in case).

That said... i am having trouble with my second card. Go figure =D>

Heres the code:
Code: Select all
name=Firescreamer
url=http://magiccards.info/in/en/106.html
image=http://magiccards.info/scans/en/in/106.jpg
value=1
rarity=C
type=Creature
subtype=Kavu
color=B
converted=4
cost=3{B}
timing=main
ability=pump {R} +1/+0
I checked everything in the Gatherer and i am pretty sure everything is fine, except for the "value" which i don't know where to check that or how to know which is the base value of each card. AND the timing... but i compared it with Drifting Shade (whos pump should work exactly the same) and it should be main.

Any ideas??
rasdel
 
Posts: 20
Joined: 26 Dec 2009, 16:41
Has thanked: 0 time
Been thanked: 4 times

Re: Implementing NEW stuff to Magarena

Postby melvin » 02 Jun 2012, 01:41

rasdel wrote:I'll try to add around 10 new cards and then post a link if anyone is interrested in having them added to their stock.
I would love to include them in the next release of Magarena. Prodigal Sorcerer has been added in https://code.google.com/p/magarena/sour ... 74fc9dabd8

rasdel wrote:For example... somehow my tokens appeared way bigger than my cards when expanded.
That's odd. All expanded images should be scaled to the same size by the program, could be a bug. Can you post some screenshots of what it looks like? Perhaps one screenshot showing the much larger expanded token image and one showing the expanded image of a regular card.

rasdel wrote:That said... i am having trouble with my second card. Go figure =D>
Heres the code:
Code: Select all
name=Firescreamer
url=http://magiccards.info/in/en/106.html
image=http://magiccards.info/scans/en/in/106.jpg
value=1
rarity=C
type=Creature
subtype=Kavu
color=B
converted=4
cost=3{B}
timing=main
ability=pump {R} +1/+0
I checked everything in the Gatherer and i am pretty sure everything is fine, except for the "value" which i don't know where to check that or how to know which is the base value of each card. AND the timing... but i compared it with Drifting Shade (whos pump should work exactly the same) and it should be main.
Your script is almost right, just one line is using the wrong syntax (missing the '{' and '}'). Hint: when Magarena crashes/fails to start, look in Magarena/crash.log, there will be a message saying what's wrong.

The "value" property is a hint to the AI as to the intrinsic worth of the card given its casting cost and abilities. So a card with low casting cost and good abilities would have a higher value than a card with high cast cost and not much abilities. No hard and fast rule of determining this number, just base it on how good you think the card is.
User avatar
melvin
AI Programmer
 
Posts: 1011
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 437 times

Re: Implementing NEW stuff to Magarena

Postby rasdel » 02 Jun 2012, 09:39

Great thanks... Firescreamer is uploaded and working fine.

Here i leave the token images...

1st - The look of a land card size
| Open
Image


2nd - The look of the "fixed" token after resize (after resizing manually all tokens have the exact size of the card)
| Open
Image


Last but not least... The look of the original tokens
| Open
Image


I'll open a new thread soon with my uploads. Just let me know if i have to add the "original size" tokens or my "fixed" resize ones.

Cheers and on to the next card! :mrgreen:

p.d> Just noticed that the Firescreamer code was missing a line... the atk/toughness (if u don't put that in, it appears as a 1/1 creature) AND... i don't know if THAT was IT but when he used the ability it turn off the sound. The rest of the duel was soundless. After adressing the issue and adding the missing line Firescreamer seems to work fine and even using the ability wont show any problems.

NEW Firescreamer CODE
Code: Select all
name=Firescreamer
url=http://magiccards.info/in/en/106.html
image=http://magiccards.info/scans/en/in/106.jpg
value=3
rarity=C
type=Creature
subtype=Kavu
color=B
converted=4
cost={3}{B}
pt=2/2
timing=main
ability=pump {R} +1/+0
Last edited by rasdel on 02 Jun 2012, 10:42, edited 1 time in total.
rasdel
 
Posts: 20
Joined: 26 Dec 2009, 16:41
Has thanked: 0 time
Been thanked: 4 times

Re: Implementing NEW stuff to Magarena

Postby melvin » 02 Jun 2012, 10:39

Hmm, can you open the preferences dialog (Arena -> Preferences) and see if you have "Show card images in original size" checked?

If so, try disabling that option and see if that solves the problem of tokens and card having different sizes for the full image.

When that option is enabled, the program shows the full images as they are without any scaling. Since the tokens are using higher resolution images, they will appear bigger if the option is enabled. When the option is disabled, all full images are scaled to the same size.
User avatar
melvin
AI Programmer
 
Posts: 1011
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 437 times

Re: Implementing NEW stuff to Magarena

Postby rasdel » 02 Jun 2012, 10:49

Darn... you are right melvin. It was checked. If i only knew sooner... i would have save A LOT OF TIME XD

I'll Start updating my tokens to "full size" and see if i can upload them some time this week with some of the new avatars i did.

BTW i edited my previous message, seems Firescreamer's code was missing a line.

I hope to have around 10 new cards eventually... i'll be posting my progress here and upload my "finished" work in a different thread.

Cheers and thanks
rasdel
 
Posts: 20
Joined: 26 Dec 2009, 16:41
Has thanked: 0 time
Been thanked: 4 times

Re: Implementing NEW stuff to Magarena

Postby melvin » 02 Jun 2012, 11:49

That's weird. If pt is not specified, it defaults to 0/0. I just tried the previous script (without pt) and Firescreamer goes to the graveyard immediately after it enters the battlefield. It should not be 1/1.
User avatar
melvin
AI Programmer
 
Posts: 1011
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 437 times

Re: Implementing NEW stuff to Magarena

Postby rasdel » 02 Jun 2012, 12:47

Weird... i saw it on the battlefield and it was 1/1 and the AI used the ability and all. Maybe there was some kind of "enchantment" in the works... like bad moon or something that i didn't noticed.

Anyway, it's working fine now, tried it plenty of times and the AI picks it up and plays it great too...

I'll leave the third card now... this time and artifact... tested, works.

Code: Select all
name=Drake-Skull Cameo
url=http://magiccards.info/in/en/302.html
image=http://magiccards.info/scans/en/in/302.jpg
value=3
rarity=U
type=Artifact
converted=3
cost={3}
ability=tap add mana {U} or {B}
timing=artifact
Cheers
rasdel
 
Posts: 20
Joined: 26 Dec 2009, 16:41
Has thanked: 0 time
Been thanked: 4 times

Re: Implementing NEW stuff to Magarena

Postby rasdel » 02 Jun 2012, 13:39

Sorry for double posting but this is a new card, and therefore a new subject.

I am trying to implement Noble Panther but somehow Magarena won't start. I checked the "crashlog" and it says>

| Open
CRASH REPORT FOR MAGARENA THREAD Thread[main,5,main]
CREATED ON 2012/06/02 10:29:06
MAGARENA VERSION 1.26, JRE 1.6.0_24, OS Windows 7_6.1 amd64

Exception from controller.runGame: Unsupported card property: r a r i t y
java.lang.RuntimeException: Unsupported card property: r a r i t y
at magic.data.CardDefinitions.setProperty(CardDefinitions.java:39)
at magic.data.CardDefinitions.prop2carddef(CardDefinitions.java:84)
at magic.data.CardDefinitions.loadCardDefinition(CardDefinitions.java:116)
at magic.data.CardDefinitions.loadCardDefinitions(CardDefinitions.java:126)
at magic.MagicMain.initializeEngine(MagicMain.java:81)
at magic.MagicMain.initialize(MagicMain.java:100)
at magic.MagicMain.main(MagicMain.java:53)


Here's the code>
Code: Select all
name=Noble Panther
url=http://magiccards.info/in/en/257.html
image=http://magiccards.info/scans/en/in/257.jpg
value=3
rarity=R
type=Creature
subtype=Cat
color=gw
converted=3
cost={1}{G}{W}
pt=3/3
ability=gains {1} first strike
timing=main
Everything seems fine, and it should be working but somehow the "rarity" property is affecting the script in some way.

Any ideas?
rasdel
 
Posts: 20
Joined: 26 Dec 2009, 16:41
Has thanked: 0 time
Been thanked: 4 times

Re: Implementing NEW stuff to Magarena

Postby melvin » 02 Jun 2012, 14:20

I copy and pasted your script and it works fine for me. From the log you posted, it looks like there are extra spaces between the letters, i.e. instead of "rarity" it is "r a r i t y". Could be some issue with encoding of the text or there are some invisible characters.

Try creating a new file by copy and pasting the code from your post and see if it works.
User avatar
melvin
AI Programmer
 
Posts: 1011
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 437 times

Next

Return to Magarena

Who is online

Users browsing this forum: No registered users and 6 guests


Who is online

In total there are 6 users online :: 0 registered, 0 hidden and 6 guests (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 6 guests

Login Form