Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
Important Add-on
Moderator: CCGHQ Admins
Important Add-on
by nabeshin » 30 Sep 2011, 23:54
Small update to usable function.
In archive - file "1111.lol" with new function - Storage(),
put this here - \DATA_ALL_PLATFORMS\DATA_REQUIRED\FUNCTIONS\.
And 2 cards files as example.
She allows to create personal storehouse for any card in which it is possible to keep any types of values, in a considerable quantity.
syntax:
Objectstore = Storage( Object() ),
and now Objectstore have next fields:
push - .push(value) - add new item to store, ANY value.
get - .get(index) return value
set - .set(index,value)
erase - .erase(index) - remove element from store, with moving all next elements.
count - .count()
test - .test(value) - search in store element == value, return element index if successfully, or -1 if not.
clear - .clear() - total clear store.
----------------------------------------------------
PS: my storage independent from the main program, reliably store your values!
PPS: Works in both parts of DOTP (but in first part, name it 1111.lua)
In archive - file "1111.lol" with new function - Storage(),
put this here - \DATA_ALL_PLATFORMS\DATA_REQUIRED\FUNCTIONS\.
And 2 cards files as example.
She allows to create personal storehouse for any card in which it is possible to keep any types of values, in a considerable quantity.
syntax:
Objectstore = Storage( Object() ),
and now Objectstore have next fields:
push - .push(value) - add new item to store, ANY value.
get - .get(index) return value
set - .set(index,value)
erase - .erase(index) - remove element from store, with moving all next elements.
count - .count()
test - .test(value) - search in store element == value, return element index if successfully, or -1 if not.
clear - .clear() - total clear store.
----------------------------------------------------
PS: my storage independent from the main program, reliably store your values!
PPS: Works in both parts of DOTP (but in first part, name it 1111.lua)
- Attachments
-
add-on.rar- (3.88 KiB) Downloaded 62 times
Last edited by nabeshin on 19 Oct 2011, 20:27, edited 2 times in total.
Re: Important Add-on
by Huggybaby » 03 Oct 2011, 19:19
Yes, you could post this information in the Documentation forum, or maybe better, put it in the WIKI: http://www.slightlymagic.net/wiki/Duels ... neswalkers
To login and edit the WIKI, use the same login and password you use for this forum.
To login and edit the WIKI, use the same login and password you use for this forum.
-

Huggybaby - Administrator
- Posts: 2454
- Joined: 15 Jan 2006, 19:44
- Location: Too close to Atlanta
- Has thanked: 293 times
- Been thanked: 371 times
Re: Important Add-on
by MisterBenn » 07 Oct 2011, 03:46
Hi Nabeshin, I have put this library to use in my Necroskitter as per your suggestion in the other thread. Seems to be working fine, that's such a help thanks!
- MisterBenn
- Posts: 92
- Joined: 19 Mar 2011, 16:19
- Has thanked: 23 times
- Been thanked: 11 times
Re: Important Add-on
by sadlyblue » 26 Feb 2012, 22:01
I know this is kind of an old post, but just needed to thank nabeshin for creating these storage functions.
I've been using on some cards for a couple of decks i was stuck on, and i got to say that it's easier to use them than the game uses. Just needed the correct syntax, the first tries i didn't understood so gave up until now
Just one question, for the card Splinter Twin i needed to use 2 storages, one for the tokens created (to give haste and remove at end of turn, like i have on Kiki-Jiki, Mirror Breaker) and another to track the summoning sickness (that i already have working on Presence of Gond).
Is this possible?
What are your ideas on how to do it?
I've been using on some cards for a couple of decks i was stuck on, and i got to say that it's easier to use them than the game uses. Just needed the correct syntax, the first tries i didn't understood so gave up until now
Just one question, for the card Splinter Twin i needed to use 2 storages, one for the tokens created (to give haste and remove at end of turn, like i have on Kiki-Jiki, Mirror Breaker) and another to track the summoning sickness (that i already have working on Presence of Gond).
Is this possible?
What are your ideas on how to do it?
Re: Important Add-on
by sadlyblue » 27 Feb 2012, 13:26
I didn't quite understood how to do it.
I used local mystore = Storage(Object()) - to declare the storage
Then the basic get, set, count,... to use it.
Can you give me an example of how to use the storekey?
I used local mystore = Storage(Object()) - to declare the storage
Then the basic get, set, count,... to use it.
Can you give me an example of how to use the storekey?
Re: Important Add-on
by Eglin » 03 Mar 2012, 21:32
How does this differ from the data store that's built into the game? This is all new to me, so I would appreciate it if you could explain the benefit of using this.
Re: Important Add-on
by thefiremind » 04 Mar 2012, 09:46
I could list 4 advantages:
1) It's easier to use because by knowing only 1 structure and its few functions you can save anything: pointers to cards, integers...
2) You have more control on the data deletion: the data chests are cleaned when the cards change zone, and it should be possible to prevent this behaviour by using RetainDataChest, but sometimes it doesn't work (I don't know why). This storage is cleaned only when you decide it, guaranteed.
3) You can use pointers to cards as keys for addressing data, while the data chests are always addressed with an integer (COMPARTMENT_ID_etc... are constants that stand for integers). This could allow you to do things that are impossible to do with the data chests.
4) The data chests are used by the game and fiddling with them could produce unwanted results, while this storage is all ours.
For all those who need an example, look here:
viewtopic.php?f=63&t=5469&p=71623#p71657
If you know how Necroskitter works, it shouldn't be hard to understand.
1) It's easier to use because by knowing only 1 structure and its few functions you can save anything: pointers to cards, integers...
2) You have more control on the data deletion: the data chests are cleaned when the cards change zone, and it should be possible to prevent this behaviour by using RetainDataChest, but sometimes it doesn't work (I don't know why). This storage is cleaned only when you decide it, guaranteed.
3) You can use pointers to cards as keys for addressing data, while the data chests are always addressed with an integer (COMPARTMENT_ID_etc... are constants that stand for integers). This could allow you to do things that are impossible to do with the data chests.
4) The data chests are used by the game and fiddling with them could produce unwanted results, while this storage is all ours.
For all those who need an example, look here:
viewtopic.php?f=63&t=5469&p=71623#p71657
If you know how Necroskitter works, it shouldn't be hard to understand.
< DotP2013 (and formerly 2012) modder >
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
-

thefiremind - Programmer
- Posts: 1623
- Joined: 07 Nov 2011, 10:55
- Has thanked: 60 times
- Been thanked: 357 times
Re: Important Add-on
by nabeshin » 07 Mar 2012, 00:03
myswissbankaccount = Storage(hereyouwriteakey),sadlyblue wrote:I didn't quite understood how to do it.
I used local mystore = Storage(Object()) - to declare the storage
Then the basic get, set, count,... to use it.
Can you give me an example of how to use the storekey?
1 - created new, or opened (if exists) storage linked with "hereyouwriteakey"
2 - you set "myswissbankaccount" as variable, which gives control over linked storage.
Re: Important Add-on
by Eglin » 07 Mar 2012, 00:23
That's pretty straight-forward. Thanks, guys. I'm sure that as I improve at coding cards and with Lua in general this functionality will be very useful. You seem to contribute a lot, Nabe - thanks for that.
Re: Important Add-on
by Eglin » 08 Mar 2012, 20:23
Do the index arguments need to be natural numbers, or can they be strings and other arbitrary datatypes? Can I do Storage(Object()).set("two", 2) ?
21 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 0 guests


