It is currently 01 Nov 2025, 14:28
   
Text Size

CardCharacteristics containing SVars

Post MTG Forge Related Programming Questions Here

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

CardCharacteristics containing SVars

Postby Sloth » 20 Nov 2011, 13:41

At the moment CardCharacteristics contains SVars so they get overwritten whenever a card changes state, but some SVars need to persist through cards changing state: For example AF Animate can grant SVars that belong to granted abilities, Warbreak Trumpeter needs "SVar:X:Count$xPaid" while morphed and there might be cards that need the SVar ChosenX in multiple states.

Can we simply remove SVars from CardCharacteristics or are there any SVars that cause problems when they persist through a card state change?
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: CardCharacteristics containing SVars

Postby Hellfish » 20 Nov 2011, 14:02

Nah, should be fine. Some cards have the samenamed SVar in both states but that's an easy fix. I'll get right on it.

EDIT: On second thoughts, LQ picture URL SVars are different for each state.. :S
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: CardCharacteristics containing SVars

Postby Sloth » 21 Nov 2011, 08:32

Good point, Hellfish. So basically there are SVars that should be copied and some which should have seperate values. :(

I came up with two possible solutions, one is easy to implement, the other will look cleaner:
1. Easy solution: setState will copy all SVars from the old cardCharacteristic to the new one with the exception of LQPic and Rarity (and maybe some selected others).

2. Cleaner solution: We differentiate our SVars. We give LQPic and Rarity a new type like CVars or something.

I can implement solution 1 without problems, but for solution 2 I would need some help (i.e. writing a script that replaces "SVar:Picture:" with "CVar:Picture:" and uploading 9700+ txt files).
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: CardCharacteristics containing SVars

Postby Hellfish » 21 Nov 2011, 08:41

Another option is to eliminate the Rarity SVar altogether (it's not referenced in code anywhere that I can see) and change the only place that uses the Picture SVar (the LQ Picture Downloader) to grab all SVars whose name starts with Picture. I think this makes the most sense, since it only requires immediate change on DFCs and Flips and the Rarity SVar can later be incrementally eliminated.
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: CardCharacteristics containing SVars

Postby Sloth » 21 Nov 2011, 12:49

Sounds like a plan. Will you give it a try Hellfish?
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: CardCharacteristics containing SVars

Postby Hellfish » 21 Nov 2011, 16:27

Done! :)
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: CardCharacteristics containing SVars

Postby Sloth » 21 Nov 2011, 21:16

Thanks Hellfish. At least Warbreak Trumpeter is fixed now.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 9 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 9 guests

Login Form