SphereCommunity
Way to store value like TAG.X in 51a - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Expired/Outdated Versions (/Forum-Expired-Outdated-Versions)
+--- Forum: Sphere 51a Help (/Forum-Sphere-51a-Help)
+--- Thread: Way to store value like TAG.X in 51a (/Thread-Way-to-store-value-like-TAG-X-in-51a)

Pages: 1 2


Way to store value like TAG.X in 51a - Confusioner - 01-29-2014 01:27 AM

Hi,

I am looking for a way to store information permanently (string, position, number) into an item. MORE, MOREP etc. are not enough for this item. I need to save at least 30~ different key/value pair. In 55i, 56b we can use

Code:
TAG.SOMEKEY = VALUE

Is there a way to implement this in 51a?


RE: Way to store value like TAG.X in 51a - RanXerox - 01-29-2014 05:13 AM

VAR

But all VAR are global, so they all need a unique name... Since UID is unique, I would use that. For example,

VAR.Item<UID>.SomeKey=

However, if there ends up being a lot of these, then searching them will be slower and slower... so make sure to delete the VAR when you are done with it.


RE: Way to store value like TAG.X in 51a - Confusioner - 01-30-2014 04:10 AM

Thanks for your answer, I really appreciate it. But there must be something wrong, because I can't get it to work.


Code:
[7b56]
ID=0e3b
NAME=Book of Test
COLOR=070d
TYPE=12
MOREX=0
MOREZ=3
MOREY=1

VAR.TEST<UID>.SomeKey=TestOne
VAR.TST=TestTwo

ONTRIGGER=DCLICK
    src.message Test1: <VAR.TEST<UID>.SomeKey>
    src.message Test2: <VAR.TST>
    return 1

[Image: mXZNm9A.png]

Both returns empty.


RE: Way to store value like TAG.X in 51a - XuN - 01-30-2014 05:58 AM

Can VARs be assigned in the itemdef section? I don't think so, try with tags instead in this case.

However, old versions (don't know if 51a had this behaviour too) needed to use try to set value<string>, so the item should be like this:

Code:
[7b56]
ID=0e3b
NAME=Book of Test
COLOR=070d
TYPE=12
MOREX=0
MOREZ=3
MOREY=1

TAG.TST=TestTwo

ONTRIGGER=CREATE
try TAG.TEST<UID>.SomeKey=TestOne //Also this one SHOULD NOT WORK in the item creation, as this section is for static keys, you should use ONTRIGGER=CREATE to set this one because until  CREATE the item does not have uid.

ONTRIGGER=DCLICK
    src.message Test1: <TAG.TEST<UID>.SomeKey>
    src.message Test2: <TAG.TST>
    return 1



RE: Way to store value like TAG.X in 51a - Confusioner - 01-30-2014 07:29 AM

Thanks XuN,

But it seems, it does not even recognize the TAG to parse it. Still looking for solution.

[Image: 32efj4D.png]


RE: Way to store value like TAG.X in 51a - XuN - 01-30-2014 07:40 AM

Dark told me on IRC that maybe TAG didn't exists on 51a, so the post from Ranxerox makes more sense now ^^. Try changing the TAG to VAR and moving both to ONTRIGGER=CREATE, lets see what happens Smile


RE: Way to store value like TAG.X in 51a - x77x - 01-30-2014 07:44 AM

oh if only the secrets of 51a wasnt in someones moms attic...



not sure if anything is on here, but this is a site i find myself going back to over and over year after year...


http://www.geocities.co.jp/Playtown-Yoyo/3333/


RE: Way to store value like TAG.X in 51a - XuN - 01-30-2014 08:08 AM

I don't understand a shit ^^, 56c is ways better btw.


RE: Way to store value like TAG.X in 51a - Confusioner - 01-30-2014 08:29 AM

First: yeah you are god damn right, its old as hell. I don't like either. But this is a nostalgia shard. Trying to make small changes.

On the subject:

1) Turns out there is NO ONTRIGGER=CREATE method on 51a. I looked others scripts and they all created first initialization on ONTRIGGER=TIMER, with TIMER set to 0.
2) <VAR.TST> DOES work on session. But when you save the world, it disappears. Useless for permanent value storage.
3) I set TIMER to -1 to avoid looping.

Code:
[7b56]
ID=0e3b
NAME=Book of Test
COLOR=070d
TIMER=0
ATTR=24

ONTRIGGER=TIMER
SAY Item Created
VAR.TST=TestTwo
VAR.TEST<UID>.SomeKey=TestOne
TIMER=-1
return 1

ONTRIGGER=DCLICK
    src.message Test1: <VAR.TEST<UID>.SomeKey>
    src.message Test2: <VAR.TST>
    return 1

[Image: 65WSgdC.png]

There must be some way to store multiple data to single item. Otherwise how come sphere save guild membership info of players?


RE: Way to store value like TAG.X in 51a - XuN - 01-30-2014 05:31 PM

Thats not good, I thought that vars were permanent back in 51a too. However, guild's information is stored in a single item (memory_guild) placed in each member/candidate wich is linked to the guildstone.