#(JustinS) Entity is null but still exists?!?!

44 messages · Page 1 of 1 (latest)

turbid fog
#

I have this script that chokes other entities when looking at them, for x duration. If, during choking, I look away, I should have a very short chance at looking at another entity to choke instead, before everything cancels. It almost works, besides the fact that when I DO NOT look at an entity, - narrate "target exists: <[target].exists>" returns TRUE. HOW!??!?!
https://paste.denizenscript.com/View/123088

soft torrentBOT
#

(JustinS) Entity is null but still exists?!?!

soft torrentBOT
#

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.

turbid fog
#

Ill get some logs

#

In this scenario I look at the polar bear for 2 hits (2x - hurt command), look away for 2 hits, and look at a different polar bear for 2 hits
https://paste.denizenscript.com/View/123089
What should happen:
The polar bear gets hurt twice, and because I looked away for 2 hits, it should stop the script and all the force powers should get their cooldown removed if applicable (see the foreach)

#

Im lost

woven jetty
#

parens in an if command need spaces on both sides of em - ie they need to be independent arguments

#

otherwise they just become part of the text

#

can use /denizen debug -v to see debug about how the if command is parsing

#
    - define a false
    - define b false
    - if (<[a]> && <[b]>) || (<[a]> || <[b]>):
        - narrate hi

this for example will do the narrate despite all inputs being "false" because the inputs are actually (false and false) both of which aren't false exactly

turbid fog
#

Alright so I did that

#

but narrate "target exists: <[target].exists>" still returns true

tired warren
#

What does it say when you narrate <[target]>?

turbid fog
#

so it is null, but it also exists

#

Am I using exists wrong?

#

!tag exists

ionic elkBOT
# turbid fog !tag exists
Cannot Specify Searched Tag

Multiple possible tags: <schematic[<name>].exists>, <ObjectTag.exists>, <server.scoreboard[<board>].exists>.

turbid fog
#

!tag objecttag.exists

ionic elkBOT
# turbid fog !tag 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.

Returns

ElementTag(Boolean)

turbid fog
#

no it should work

tired warren
#

Yea so you set a fallback to null

#

So this definition exists now.

#

You put a string "null" to it.

#

You'd have to make a null check

#
- if <[target]> == null:
  - narrate "<&[error]>Target does not exist!"
  - stop
turbid fog
#

...

#

alright

#

It was suggested to me to use .exists instead of == null so I did that and now I need the opposite lol

tired warren
#

It always depends on how you handle things.

turbid fog
#

I changed all of them to != null, and now it doesnt hurt the polar bear anymre

tired warren
#

!info haste debug

ionic elkBOT
#
Info: debug

If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!

turbid fog
#

wait I messed up

#

1 sec

#

ooooh yes it almost works

#

I just had a few != set to == or vice versa

austere geode
turbid fog
#

fuck yes it finally works

#

thanks guys!