CardCharacteristics containing SVars
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
7 posts
• Page 1 of 1
CardCharacteristics containing SVars
by 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?
Can we simply remove SVars from CardCharacteristics or are there any SVars that cause problems when they persist through a card state change?
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: CardCharacteristics containing SVars
by 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
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
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: CardCharacteristics containing SVars
by 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).
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).
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: CardCharacteristics containing SVars
by 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
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: CardCharacteristics containing SVars
by Sloth » 21 Nov 2011, 12:49
Sounds like a plan. Will you give it a try Hellfish?
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: CardCharacteristics containing SVars
by 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
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: CardCharacteristics containing SVars
by Sloth » 21 Nov 2011, 21:16
Thanks Hellfish. At least Warbreak Trumpeter is fixed now.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 9 guests