#(sebii) Is there a way to set definitions for a world script, before it is being run?
115 messages · Page 1 of 1 (latest)
(sebii) Is there a way to set definitions for a world script, before it is being run?
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.
You would set the definitions to the first couple lines, and they would carry over for the rest of the script
i have multiple events set for that script
So i'd have to be something i can use before the events
Or you could use a task script and set definitions through the run command
!l task script
Task script containers are generic script containers for commands that can be run at
any time by command.
Generally tasks will be ran by !command run or !command inject.
The only required key on a task script container is the 'script:' key.
Task_Script_Name:
type: task
# When intending to run a task script via the run command with the "def:" argument to pass data through,
# use this "definitions" key to specify the names of the definitions (in the same order as the "def:" argument will use).
# You can optionally document a definition with [square brackets]
definitions: name1|name2[description here]|...
script:
- your commands here
Script Container System
!c run
queue
run [<script>] (path:<name>) (def:<element>|.../defmap:<map>/def.<name>:<value>) (id:<name>) (speed:<value>/instantly) (delay:<value>)
Runs a script in a new queue.
Runs a script in a new queue.
You must specify a script object to run.
Optionally, use the "path:" argument to choose a specific sub-path within a script.
Optionally, use the "def:" argument to specify definition values to pass to the script,
the definitions will be named via the "definitions:" script key on the script being ran,
or numerically in order if that isn't specified (starting with <[1]>).
Alternately, use "defmap:<map>" to specify definitions to pass as a MapTag, where the keys wi...
would that be more likely to data scripts?
#
# QUEST CSDAILY
dgtwo_quest_check:
type: world
events:
# START QUEST
after quests player starts quest:
- define quest_id <context.quest>
- if <context.quest> contains 000051:
- flag <player> quest_000051_kills:0
# KILL GHOUL
after player kills npc:
- if <player.quests.active_ids> contains 000051:
- if <server.npcs_named[Ghoul]> contains <npc>:
# [quest_000051_stage] = QUEST STAGE FLAG from #STAGE CHANGE LOGIC
- if <player.flag[quest_000051_stage]> = 2:
- flag <player> quest_000051_kills:++
- if <player.flag[quest_000051_kills]> = 10:
- narrate "<&color[<color[orange]>]>You have killed<&color[<color[aqua]>]> <player.flag[quest_000051_kills]>/10<&color[<color[orange]>]> Ghouls." targets:<player>
- quests set quest:000051 stage:2
- else if <player.flag[quest_000051_kills]> < 10:
- narrate "<&color[<color[orange]>]>You have killed<&color[<color[aqua]>]> <player.flag[quest_000051_kills]>/10<&color[<color[orange]>]> Ghouls" targets:<player>
# END QUEST
after quests player completes quest:
- if <context.quest> contains 000051:
- flag <player> quest_000051_kills:!
This is the script... how would i efficiently do this whole thing.
(i have a world_script that handles the quest_xxxxx_stage value.)
Still W.I.P with other stuff in mind
they can act as configs
i want to be able to let the kills, quest ID, stage number to be set manually
Data script containers are generic script containers for information that will be referenced by other scripts.
No part of a 'data' script container is ever run as commands.
There are no required keys.
Generally, data is read using the !tag ScriptTag.data_key tag.
data_script_name:
type: data
# Your data here
some_key: some value
some_list_key:
- some list value
some_map_key:
some_subkey: some value
Script Container System
make a task script that defines everything
then just inject that in every event in your world script
i constantly do this. example:
on player right clicks block with:skills_item_supernova flagged:skills.supernova:
- determine passively cancelled
- ratelimit <player> 0.5s
- define id supernova
- inject skills_inject_cooldown_handler
...
skills_inject_cooldown_handler:
type: task
debug: false
script:
- inject skills_inject_skills_get_player_skill_info
...
skills_inject_skills_get_player_skill_info:
type: task
debug: false
script:
- define name <player.flag[skills].keys.first.if_null[null]>
- define info <player.flag[skills.<[name]>].if_null[null]>
lengthy example aside, i inject skills_inject_cooldown_handler in all relevant events, and then it just figures out a ton of things for me, especially the name and info definitions
as for what you're definining, i agree with joenh that you should be using a data script
as to how, i'd use what i just sent an example of
I'm still kinda new to denizen, i understand what you are doing there but its still a little overwhelming 😅
HAHAHAHAHAH no worries man, we've all been through there
except for saturo gojo ofc
The big thing for me, is when its simple.
So just a simple copy pastable file that he can edit.
I just dont know how i would make it work flawlessly with the world script.
Basically a "never touch world script" situation.
wtf
????am i wrong on doing that?? 😟 should i not teach that to him?
!paste
Help us help you by pasting your script to https://paste.denizenscript.com/New/Script and linking it back here.
could you upload that script here please
Content of Denizen Script Paste #138836: csdaily_quest... pasted 2026/01/26 09:52:29 UTC-08:00, Paste length: 1322 characters across 25 lines, Content: # # QUEST CSDAILY dgtwo_quest_check: type: world
- Every quest_questid_kills or _stage i want to be variable.
- The hard coded stage numbers and kills i want to be variable aswell.
- The hardcoded "contains 000051" i want to be variable aswell.
- NPC name i also want variable.
I know how to do the above.
i just dont know how i can make it easy for my homie to just set
QuestID, NPCName, kills, stage...
Thats what i want to be easy to use for him.
cuz there are a shit-ton of quests that will follow. Unique NPC Names, kills depending on the quest, and stages depending on the setup of the stage.
in that case you probably want a data script like drjoenh said above
and have maybe a data script per quest
or put everything into a single data script
and the logic will happen from relevant world events that read a players state and compare it to the data script
e.g. a quest requires you to kill 10 zombies
yeah, that was my idea atm aswell... But there is a check at the top that checks for "active_ids".
How am i able to not hardcode values in that.
so you flag the player with the task
and then let the kill event read what the player has to kill, compare it to the flag and do your things
actually - looking into your script - it seems like you are using a quest plugin?
yes, "Quests" by Pikamug
"why not let the quest plugin handle what you are doing there?"
rather "why not let denizen handle everything"
Cuz its much more complicated and we started without denizen
we're running 1.21.8 and i am usually not a fan of dev versions
but we're run into a couple of problems, so we kinda start needing it
so i'm running dev version 7222 rn, which works
AND
I'm hella new to denizen
Denizen by itself is already kinda overwhelming
also, the answer to this question: https://discord.com/channels/315163488085475337/1464590962276696261
Oh
denizen is fairly stable
and My friend would need to learn denizen aswell
and any person thats able to make quests
and using a simple gui that everyone already knows is easier, than me making my own solution 🫠
there is just no release because mojingle pushes a new version every week
i know, not the problem
not a fan of a "dev version" on a live-server, but it is what it is
I'm testing the scripts on my local test server ofc.
and then transfer them
the quest plugin has a small quirk ->
If you have a "kill npc" quest, it has to have an amount of kills per npc thats set.
So if its 100 ghosts, you'd have to kill each unique ghost once
because its distinguished by uuid
thats why we are going to denizen with this issue
have the actual npc in another world, so the quest plugin doesnt trigger its progress response, with copies in the actual world where the player needs to go, and move the quest further using the denizen script
but yeah...
Data Container, World container, task container... now i just need to figure out how to put all that together...
oh, another quick question.
Can i create subfolders within the scripts folder?
to sort the scripts neatly
yes
yay c:
thanks
+> YAY!!!
Thread closed as resolved.
ok, i do need help with something attached to this xD
Thread was manually reopened by @wise granite.
how do i check if a key on a map exists?
type: data
000051:
npcname: Ghoul
kill_amount: 10
kill_stage: 1
quest_type: kill
Thats the map.
i already found out, how i can read the map with <script[nameofscript].data_keys[nameofmap.npcname]> for example.
i just need to know how i can check if the map exists.
So in this case -> 000051 exists, but 000052 doesnt.
How can i do an if command, so that it just checks, if it exists?
!t script.contains_key
Did you mean to search for elementtag.contains_text?
if i would know

list_keys is already giving me a list, that i can atleast work with, thank you!
because rn, it replies with "li@000051|type|"
and so i can just do = quest_id and it will work. Great, thanks!
oh
is there a general "exists" operator form?
but what exactly you want?
If there is an operator to use in an if command, that denouncens existence of something...
So for example:
- if <player.flag[hahahahalmaooooo]> exists
So when its null, it doesnt start the codeblock below
!t objecttag.exists
Returns true if the object exists (is non-null). Returns false if the object doesn't exist, is null, or the tag errored.
This functions as a fallback - meaning, if the tag up to this point errors, that error will be hidden.
ElementTag(Boolean)
ah
in that case you can ofc use flaggableobject.has_flag[hahahalmaooooo]
and because it then replies with "true", i dont need an "= true" at the end of my if statement
yup
If the object is null (or the tag errors), this will return the input object.
If the object isn't null, the input won't be parsed, and the original object will be returned.
For example, "<player.if_null[<npc>]>" will return the player if there is a player, and otherwise will return the NPC.
This functions as a fallback - meaning, if the tag up to this point errors, that error will be hidden.
ObjectTag
which i love even more