#(drjoenh) Run procedure with context map

52 messages · Page 1 of 1 (latest)

mortal pilot
#

Im suggesting a new way to give context to procedures by using MapTags. We could have something like <proc[stg].context_map[MapTag(definition=value)]>

crisp canyonBOT
#

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.

south galeBOT
#
Changed to Feature

Thread is now a Feature thread. This indicates a request for a new feature to the plugin, that both (A) does not already exist and (B) reasonably can be added. If you are unsure whether this applies, use </helpthread:1028674284870180883> to change back to a normal help thread.

north ginkgo
#

you already can though

#

just define your map and then <proc[a].context[<[map]>]>

mortal pilot
#

waaat

#

no way

#

imma test it out hold up

north ginkgo
#

it gets passed through as the keys' names and values iirc

mortal pilot
#

thats cap

#

isnt that only for task scripts?

north ginkgo
#

unsure

#
my_task:
    type: task
    script:
    - definemap map:
        a: 1
        b: 2
        c: 3
    - announce <[map].proc[my_proc]>

my_proc:
    type: procedure
    definitions: def
    script:
    - determine <queue.definition_map>

https://paste.denizenscript.com/View/125030
also works with <proc[my_proc].context[<[map]>]>
https://paste.denizenscript.com/View/125031

#

@mortal pilot it work

#

you'd just have to do def.a, def.b and def.c if i understood the pure tag correctly

mortal pilot
#

but in your case def is a maptag

north ginkgo
#

it's been so long since i've done anything with denizen, reading debug is confusing 😅

north ginkgo
#

you want to send maps through context

#

that's what i did

mortal pilot
#

what i want is to act keys in a maptag as definition names and values as those values

#
elementHelper_mod:
    type: procedure
    debug: false
    definitions: param[ElementTag]|mod[ElementTag]
    description: Returns remainder.
    script:
        - define ans <[param].mod[<[mod]>]>
        - if <[ans].power[<[mod]>]> < 0 && <[ans]> != 0:
            - define ans:+:<[mod]>
        - determine <[ans]>
  • narrate <proc[elementHelper_mod].context[<map[param=-6;mod=7]>]> for example
#

basically I want to request run defmap:<map> for procedures

#

like proc.context_map or sth

north ginkgo
#

oohh i see

#

i get it now

#

well i found a quick workaround for you while this isnt implemented yet

mortal pilot
#

yea its actually pretty cool

north ginkgo
#
my_task:
    type: task
    script:
    - narrate <map[param=-6;mod=7].proc[my_proc]>

my_proc:
    type: procedure
    definitions: def
    script:
    - foreach <[def]>:
        - define <[key]> <[value]>
    - debug log <[param]>
    - debug log <[mod]>
    - determine <queue.definition_map>

https://paste.denizenscript.com/View/125034

as you can see they're right there, usable as their key names

#

just kinda cringe imo because it basically doubles the queue's definitions

#

i'd just stick with def.a, def.b and def.c nonetheless

mortal pilot
#

its also object hacking aaaaa

north ginkgo
#

not obj hacking

#

just malpractice lel

mortal pilot
#

well theyre dynamic definitions

#

if some helper saw that

#

we are dead

north ginkgo
#

kek

#

even more reason to add the feature, so we stop doing this

#

mwahahha

mortal pilot
#

EXACTLY

weak hinge
#

Oh I see what you did there

north ginkgo
# weak hinge why

is it not? why double your definitions just so your code looks better, instead of doing map.a, map.b etc

north ginkgo
mortal pilot
#

To sum up. I would like to request a way to run procedure script by passing a definitions map ([definition1=value1;definition2=value2]).

For example:

some_proc:
    type: procedure
    definitions: other_player[PlayerTag]|categories[ListTag]|all[(ElementTag(boolean)/true)]
    script:
        - if <[all].if_null[true]>:
            - foreach <[categories]> as:category:
                - if <player.flag[trp.<[category]>.all].contains[<[other_player].uuid>]>:
                    - determine true
            - determine false
        
        - foreach <[categories]> as:category:
            - if <player.flag[trp.<[category]>].contains[<[other_player].uuid>]>:
                - determine true
        - determine false

With tag proc.context_map[definition=value]

Why would that be useful?

  1. Easier to pass list as single key definition (instead of using single_lists):
  • <proc[some_proc].context_map[other_player=<[pl]>;categories=<list[attack|defend]>;all=false]>
  1. Easier to define optional arguments, right now I can only have one optional argument and it has to be last definition:
  • <proc[some_proc].context_map[categories=<list[speed]>;other_player=<[pl]>]>
  1. Overall easier to read if I exactly know what im defining something as
ocean geyser
mortal pilot
mortal pilot
south galeBOT
#
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.)

#

@mortal pilot