maartenl / Land-of-Karchan

Where one can change into a hero with a single swipe of his sword.
http://www.karchan.org
GNU General Public License v3.0
7 stars 3 forks source link

Possible wielding issue? #220

Closed wastedshame closed 1 year ago

wastedshame commented 1 year ago

I decided to make a new command for something today, but I experienced an issue that I could not manage to get around.

I made a new item that was to be tied to a command, but no matter what I did with the method, I could not get the script to acknowledge that I was wielding the item.

I checked to make sure it was the right item number a billion times.

I thought maybe it's an issue with the item being brand new (3699), but I tested the command with an older item that has existed for awhile, and got the same problem.

After trying everything under the sun, I decided to reach out here. I've done commands where things needed to be wielded a million times, so I am frustrated this would not work.

The method is witchice2.

Any advice or guidance is appreciated. I have no idea why it will not work.

maartenl commented 1 year ago

Hi, For me also, I need to dig into the problem always. I use person.personal("stuff") to debug.

Here's what I found:

if (toperson === null)
{
toperson.personal("That person is not here.<br/>");
return;
}

If toperson is null, you cannot call .personal on it. I assume you meant: person.personal("etc.");

I mentioned in the previous issues that it's no longer possible to access properties directly, and you need to go through the getter if you need something. if (comb != null && comb.itemdef == itemdefid) should be: if (comb != null && comb.getItemdef() == itemdefid)

I've created "karntest" method that seems to work. (used the iron pick thing as that's what's in my inventory).

Let me know if I can be of any more assistance.

wastedshame commented 1 year ago

Thank you so much for the feedback. I'm still getting used to the whole "get" thing. I appreciate you taking the time to correct me. :)

maartenl commented 1 year ago

Closing this.