It is currently 18 May 2013, 14:14
   
Text Size

Important Add-on

Moderator: CCGHQ Admins

Important Add-on

Postby 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)
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.
User avatar
nabeshin
 
Posts: 207
Joined: 27 Jun 2011, 20:07
Has thanked: 5 times
Been thanked: 29 times

Re: Important Add-on

Postby Huggybaby » 02 Oct 2011, 18:14

Damn, that's interesting, thanks nabeshin!
User avatar
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

Postby nabeshin » 03 Oct 2011, 19:14

It is possible to refer somewhere to this information, specially for programmers?
User avatar
nabeshin
 
Posts: 207
Joined: 27 Jun 2011, 20:07
Has thanked: 5 times
Been thanked: 29 times

Re: Important Add-on

Postby 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.
User avatar
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

Postby 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

Postby nabeshin » 19 Oct 2011, 20:21

I have admitted a stupid error, who has decided to use - take the updated variant.
User avatar
nabeshin
 
Posts: 207
Joined: 27 Jun 2011, 20:07
Has thanked: 5 times
Been thanked: 29 times

Re: Important Add-on

Postby 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?
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: Important Add-on

Postby nabeshin » 27 Feb 2012, 05:47

On call function, you set as parameter - storekey, for each key - personal storehouse
User avatar
nabeshin
 
Posts: 207
Joined: 27 Jun 2011, 20:07
Has thanked: 5 times
Been thanked: 29 times

Re: Important Add-on

Postby 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?
sadlyblue
 
Posts: 175
Joined: 06 Feb 2012, 13:18
Has thanked: 18 times
Been thanked: 16 times

Re: Important Add-on

Postby 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.
User avatar
Eglin
Programmer
 
Posts: 185
Joined: 01 Mar 2012, 14:44
Has thanked: 35 times
Been thanked: 19 times

Re: Important Add-on

Postby 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. :D

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. :wink:
< 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.
User avatar
thefiremind
Programmer
 
Posts: 1623
Joined: 07 Nov 2011, 10:55
Has thanked: 60 times
Been thanked: 357 times

Re: Important Add-on

Postby nabeshin » 07 Mar 2012, 00:03

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?
myswissbankaccount = Storage(hereyouwriteakey),
1 - created new, or opened (if exists) storage linked with "hereyouwriteakey"
2 - you set "myswissbankaccount" as variable, which gives control over linked storage.
User avatar
nabeshin
 
Posts: 207
Joined: 27 Jun 2011, 20:07
Has thanked: 5 times
Been thanked: 29 times

Re: Important Add-on

Postby 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.
User avatar
Eglin
Programmer
 
Posts: 185
Joined: 01 Mar 2012, 14:44
Has thanked: 35 times
Been thanked: 19 times

Re: Important Add-on

Postby 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) ?
User avatar
Eglin
Programmer
 
Posts: 185
Joined: 01 Mar 2012, 14:44
Has thanked: 35 times
Been thanked: 19 times

Re: Important Add-on

Postby nabeshin » 08 Mar 2012, 23:12

yep
User avatar
nabeshin
 
Posts: 207
Joined: 27 Jun 2011, 20:07
Has thanked: 5 times
Been thanked: 29 times

Next

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 0 guests


Who is online

In total there are 0 users online :: 0 registered, 0 hidden and 0 guests (based on users active over the past 10 minutes)
Most users ever online was 177 on 10 Oct 2011, 16:37

Users browsing this forum: No registered users and 0 guests

Login Form