Skript icon indicating copy to clipboard operation
Skript copied to clipboard

there's no player/console event in the plant growth event?

Open JavierKasunic opened this issue 10 years ago • 3 comments

Hey Bensku, when I used this code:

on plant grow of wheat:
    send "Yeah!"

And this technically need work but this says there's no player in that event and I'm pretty sure the unique can grow a plant is a player so...

JavierKasunic avatar Jun 24 '16 13:06 JavierKasunic

I think this event fires when a plant grows naturally. If you want to detect a player bonemealing a plant, you could use:

on right click on wheat:
    player's tool is bonemeal
    data value of clicked block < 7
    send "%player%"

Checking the data value makes sure it's not fully grown (wheat:7 is fully grown wheat).

TheBentoBox avatar Jun 24 '16 14:06 TheBentoBox

The problem is that you are trying to send a message to the player of the event but there is no player in that event because the growth event has nothing to do with players.

If you want to see the debug message you should, for example, send the message to the console, ie:

on plant grow of wheat:
    send "Yeah!" to console

You could also broadcast the debug message for everyone to see:

on plant grow of wheat:
    broadcast "Yeah!"

Or you could loop the players and choose which ones to send the message to:

on plant grow of wheat:
    loop players:
        if "%loop-player%" is "SomeDude" or "AnotherDude" or "WhatEver":
            send "Yeah!" to loop-player

Or you could send the message to a certain player by using this neat trick:

on plant grow of wheat:
    send "Yeah!" to "SomePlayer" parsed as player

Pick which ever suits you the best. But this is not a bug.

Pilvinen avatar Jun 24 '16 14:06 Pilvinen

Uh, I understand now, thanks for the both responses

JavierKasunic avatar Jun 24 '16 15:06 JavierKasunic