Solved Help With Click on air

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Dynamic___

Member
Jun 17, 2018
2
0
0
21
Hello, I'm currently trying to log every creeper egg placed by a player. I tried two approach to this but both don't seem to work.

My first attempt is here:

code_language.skript:
on place a spawner_egg:50:
    log "%player% placed CreeperEgg in %world% at %location of block%" to "creeper/creeperplacement.yml"
    message "Test"

This doesn't bring up any error but it doesn't log the placement since a creeper egg isn't a block

My second attempted was to do a click event:

code_language.skript:
on click:
    if event-block is not air:
        if held item is a spawner_egg:50:
            log "%player% placed CreeperEgg in %world% at %location of block%" to "creeper/creeperplacement.yml"
            message "hi"

In this case "if event-block is not air" doesn't seem to work, it still logs if the player clicks on air.
Thanks in advance
 
Quick heads up,
Making a logger with .yml is extremely ineffective.(It reads and writes the whole thing each time you access the file)

Forget about this, sorry for the confusion
 
Last edited:
Quick heads up,
Making a logger with .yml is extremely ineffective.(It reads and writes the whole thing each time you access the file)
I don't really think the file extension matters here, because it just adds a line whatever the extension may be.
 
Hello, I'm currently trying to log every creeper egg placed by a player. I tried two approach to this but both don't seem to work.

My first attempt is here:

code_language.skript:
on place a spawner_egg:50:
    log "%player% placed CreeperEgg in %world% at %location of block%" to "creeper/creeperplacement.yml"
    message "Test"

This doesn't bring up any error but it doesn't log the placement since a creeper egg isn't a block

My second attempted was to do a click event:

code_language.skript:
on click:
    if event-block is not air:
        if held item is a spawner_egg:50:
            log "%player% placed CreeperEgg in %world% at %location of block%" to "creeper/creeperplacement.yml"
            message "hi"

In this case "if event-block is not air" doesn't seem to work, it still logs if the player clicks on air.
Thanks in advance
Try using "on rightclick" instead of "on click"
 
Try using if clicked block is set instead of if event-block is not air
 
I don't really think the file extension matters here, because it just adds a line whatever the extension may be.
Nope I tried with skutitlites and it rewrites the whole file every time you add a line.
I confirmed this fact by looking at the source code.
 
Nope I tried with skutitlites and it rewrites the whole file every time you add a line.
I confirmed this fact by looking at the source code.
Yeah, but does it only do that with .yml or with every file?
 
Status
Not open for further replies.