#(colossal) Using Map Keys as data in a script

1 messages · Page 1 of 1 (latest)

vocal raven
#

I was curious if using map keys inside a script is considered bad practice?

For example; a key named Mining that contains the values MATERIAL, DESCRIPTION, and LEVEL.

If i wanted to show this to a player and give it a name as well, could I use the Mining KEY, or should i add a NAME value inside the map?

flat bloomBOT
#

(colossal) Using Map Keys as data in a script

flat bloomBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

inner bone
#

i dont get it, do you mean you have:

mining:
  material: value
  description: value
  level: value

?

vocal raven
#

yea

inner bone
#

what would be the "name"

vocal raven
#

Mining

#

could i use the key as the name, or should I add a name value to that

#

basically

shadow zinc
#

i mean why not keys

inner bone
#

huh, big language barrier rn bc i have no clue what you mean

vocal raven
#

<[my_map].key> AND <[my_map].get[name]> would both return "Mining" in this case, but one of them is using the key for information

inner bone
#

oooohhh

shadow zinc
#

buuuut pretty sure there isnt key tak

#

just keys

vocal raven
#

(maptags don't have-

#

yeah

#

for example sake to make it easier to understand lol

shadow zinc
#

gotcha

#

i do also have bunch of things with names as keys

#

for example my server warps

#

my_warp:
loc: idk
perm: idk.1

vocal raven
#

so it would display my_warp as the name?

shadow zinc
#

yup

#

soo my warp names are list of keys on that huge map

#

my_warp, other_warp....

vocal raven
#

in my case I lose that key name information since im defining the map to a definition to use later on in my script

inner bone
#

yeah you cant get the map name, just the keys

#

have a name key with "mining" value

vocal raven
#

yeah

#

that's the way i'd like to do it

steady vale
#

Do you have a script sample on what you would like to do

vocal raven
#

it's kinda big but yeah

steady vale
#

saaaample

vocal raven
#

ok ok lol igotcha

#

so at the start im getting 3 maps that have data to display to the player

#

i feel like 20 21 and 22 could be done better lol

steady vale
#

holy crap

#

can you uhh

vocal raven
#

hmm

steady vale
#

post the cfg_traits data script

vocal raven
#

ye

steady vale
#

aaand a debug recording helpful

vocal raven
#

i added the display_name to them all but technically the key could be used as the name

steady vale
#

Why do you have to get the key by a number of a list

#

Oh I kinda get it now

vocal raven
#

it's in an order

#

im not really sure how i could go about it another way

#

that basically controls the items it selects when scrolling

#

there's not really a way to get a key in a list like fashion i guess

steady vale
vocal raven
#

that's true

#

i'd still get a number value i'd need to work with tho

steady vale
#

but less .get tags

vocal raven
#

yeah that'

#

s true

steady vale
#

doesn't seem to be a bad way with working with a data script that may change it's size whenever you add another trait into it

#

or removing one

vocal raven
#

yay

crimson fiberBOT
#

+> YAY!!!

vocal raven
#

i guess that strayed a bit from the main question i made this thread for tho lol

steady vale
#

oh wasn't that the original question lol

vocal raven
#

i was asking if using map keys as data in a script is a bad thing or not

#

for example

#

<[my_map].key> AND <[my_map].get[name]> would both return a NAME called MINING

steady vale
vocal raven
#

that's what i figured

steady vale
#

so you can add colors and formatting and wotnot

vocal raven
#

to me it seemed like bad practice to use the key

steady vale
#

can do <[my_map.name]> by the way

vocal raven
#

since it's meant more as a pointer

#

yeah

steady vale
#

if the definition is a map

vocal raven
#

gotcha

#

i guess like

#

should <[my_map].key> EVER be used at all for displaying a name?

#

my thought is that it's an !itworks scenario

steady vale
#

I wouldn't use keys for displaying text

#

it might depends on the use case though

vocal raven
#

makes sense

agile shoreBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@vocal raven