#(drjoenh) Run procedure with context map
52 messages · Page 1 of 1 (latest)
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.
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.
it gets passed through as the keys' names and values iirc
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
Content of Server Log Paste #125030: Denizen Debug Logs From A Minecraft Server... pasted 2024/07/27 07:20:05 UTC-07:00, Paste length: 2781 characters across 31 lines, Content: Java Version: 21.0.3Up-time: 1m 53s
Content of Server Log Paste #125031: Denizen Debug Logs From A Minecraft Server... pasted 2024/07/27 07:21:51 UTC-07:00, Paste length: 2940 characters across 32 lines, Content: Java Version: 21.0.3Up-time: 3m 38s
@mortal pilot it work
you'd just have to do def.a, def.b and def.c if i understood the pure tag correctly
but in your case def is a maptag
it's been so long since i've done anything with denizen, reading debug is confusing 😅
yeah isnt that what you meant
you want to send maps through context
that's what i did
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
oohh i see
i get it now
well i found a quick workaround for you while this isnt implemented yet
yea its actually pretty cool
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
Content of Server Log Paste #125034: Denizen Debug Logs From A Minecraft Server... pasted 2024/07/27 07:35:10 UTC-07:00, Paste length: 4209 characters across 48 lines, Content: Java Version: 21.0.3Up-time: 7m 33s
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
its also object hacking aaaaa
EXACTLY
is it not? why double your definitions just so your code looks better, instead of doing map.a, map.b etc
ye
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?
- 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]>
- 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]>]>
- Overall easier to read if I exactly know what im defining something as
Also, easier to make changes/add new arguments without having to modify the code where it is used
i have good news #denizen-contrib message
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