New to denizen, issues assigning WIP script

MrFF

Member
Nov 5, 2019
5
0
0
Hi guys, I'm new to this, and the old videos are.. well, not super helpful, (mostly outdated stuff), and the new guide is nowhere near finished, so, here I am, I'm wondering if there's any way to see why certain scripts just simply dont load, I can see no problem with them, though naming is apparently an issue

What's the process denizen goes through to check if an assignment to an NPC is valid?

Also if you want the script i'm starting on, I'll include it below, It's nowhere near finished but I don't want to get all the work done, only for some blaring issue to be staring me in the face for future scripts when I know more about the plugin


file name is "jg.yml"

Code:
jg:
    type: assignment
    actions:
        on assignment:
        - trigger name:click state:true
        - trigger name:chat state:true
    interact scripts:
    - jg_interact
    
cchat:
    type: format 
        format: "<npc.name><&co> <text>"
#Make a colour code here^
     
jg_interact:
    type: interact
    steps:
        1:
        click trigger:
        script:
            - narrate format:cchat "Welcome to the gladiator arena"
            #Make a check for if player has been in arena before
            # if <player.has_flag[hasbia]>
            # zap whatever step
            #if !<player.has_flag[hasbia]>
                - wait 2s
            - narrate format:cchat "Would you like some information about"
            - narrate format:cchat "the arena?"
            - wait 3s
            #Need actual colour code hereVVV
            - narrate "yes no"
        
        chat trigger:
            1:
                trigger: "/Yes/ I would"
                script:
                    - narrate format:cchat "We're a business that's over a thousand"
                        - wait 1s
                    - narrate format:cchat "years old, this is an old blood sport."
                    - narrate format:cchat "I'm one of the last of the Azcyngos,"
                    - narrate format:cchat "filler"
 

n0nnie

Active member
First step to find issues is to watch your logs for errors. Denizen does well in saying what is wrong during loading of a script. Even if you do /ex reload it will tell you in console if somethings wrong.

If you changed debug bahviour in the config add debug: true to your scripts so you can see what is wrong with the script itself.

Also check your identions. I do not know if this happened with pasting it here or it is actually in the script but type and format in cchat script have to be on the same place. Also click trigger and chat trigger have to be one step to the right und the 1: I think
 

MrFF

Member
Nov 5, 2019
5
0
0
Oh, so indentation matters and it's not just to make it look pretty? On C# afaik it's compiled all in one line so if you really wanted to you could just write it all in one line.

When I do "/npc assign --set jg", the debug doesnt show anything, but, upon doing /ex reload it shows an error in parsing jg.yml, I'll check that out.

... several minutes later

Yep, it was literally just that, also, I had no idea how powerful the Debug denizen provides is, giving me the exact line and column that it's having trouble with, very cool! :D

it assigns once the
Code:
                              type: format
                              format: "xyz"
issue is fixed.
Thanks for your help mate.

Question, though, as I don't wanna make a second thread; is there any way to execute commands for a player, for example "/mg join" or "/home" or any number of other commands, but just, on the player's behalf?
 

mcmonkey

Administrator
Staff member
Helper
Yes, indentation matters.
To execute a command as a player, - execute as_player "mg join"

Also, if you haven't already, I'd recommend joining the Discord https://discord.gg/Q6pZGSR
 

MrFF

Member
Nov 5, 2019
5
0
0
Thanks a ton!

I'd love to join the discord but being a minor means my dad has control over such things, so, no luck there :(

I'll see if I can't just get my girlfriend to relay stuff for me.
Again, thanks a ton man!