coolsquid / React

Scriptable reactions to events
The Unlicense
3 stars 0 forks source link

[Suggestion] Allow React to send commands #1

Closed jonqrandom closed 6 years ago

jonqrandom commented 6 years ago

please will you add a "command" action to React that executes a command as console? this would make it a massively more powerful tool, as you'd be able to trigger e.g. .mcfunction files without having to have a main loop constantly running and testing various values!

the ability to substitute %target_type% with an appropriate value* would be awesome, but in all honesty i'd be very happy to even have the option to have React send commands at all.

*(i.e. to substitute the appropriate UUID for the target %player% , %mob% , %sender% , %attacker% or %tamer%, the %dimension% number, or the x y z for the target %block%)

coolsquid commented 6 years ago

A "command" action will be added in the next release.

player_log_in=[
    {
        action=server_command
        parameters {
            command="tell %%%player.uuid%%% Hello!"
        }
        conditions {
            side=server
        }
    }
]

the ability to substitute %target_type% with an appropriate value would be awesome, but in all honesty i'd be very happy to even have the option to have React send commands at all. (i.e. to substitute the appropriate UUID for the target %player% , %mob% , %sender% , %attacker% or %tamer%, the %dimension% number, or the x y z for the target %block%)

Instead of simply using %player%, %mob%, and so on, I've added a number of "properties" for each target type. Properties are used in combination with a target, e.g. "%%%mob.name%%%" or "%%%player.uuid%%%". For example, this:

player_sleep=[
    {
        action=log
        parameters {
            log_name=sleep # Newly added parameter, the log will be saved to logs/react/sleep.log
            message="%%%player.name%%% (id: %%%player.uuid%%%, position: %%%player.position%%%) has gone to bed."
        }
        conditions {
            side=server
        }
    }
]

Produces this:

[26.11.2017-13:57:14] [INFO]: Player735 (id: fd6f2cd7-e2c4-325a-9688-114cce28bfc9, position: [x=-31.301430173440238,y=64.0,z=95.4435380922974]) has gone to bed.`

As an additional enhancement for servers, the log action has been expanded to support custom log files, and can be used with the new target property system to create detailed, customizable server logs.

jonqrandom commented 6 years ago

sorry i haven't seen this sooner - that looks amazing, thank you! i checked r/feedthebeast and you don't seem to have posted a link to this, would you like to/would it be ok if i did? i think a lot of people there would appreciate it too! :)
EDIT: when your new update is on curseforge, anyways - sorry, i kinda jumped the gun there! :blush:

coolsquid commented 6 years ago

I have added the following "target properties":

Mobs:

Players:

Blocks:

Miscellaneous:

Should anything else be added?

i checked r/feedthebeast and you don't seem to have posted a link to this, would you like to/would it be ok if i did?

I did mention it in my 1.12 update post. Feel free to post it again, though.

jonqrandom commented 6 years ago

that's wonderful, that really is!

Should anything else be added?

this is my fault, i should've remembered it when i first made the issue; uuid probably wants to be available as uuid_most and uuid_least too, as that's how they're stored in nbt tags, and minecraft commands don't have any way of natively using the uuid as it's commonly expressed :/

the current HP and maybe armour for mobs would likely be very handy.

if you feel like it, you could (is "recursively" the right word here?) add the mob/block target properties of whatever the mob in question is targeting.
so potentially a script could use %%%mob.target.position%%% to occasionally set fires or place particles where a mob is looking. or maybe even %%%mob.target.target.position%%% - i can see that one being useful in .mcfunction scripts, f'rinstance, so checking if %%%mob.uuid%%% == %%%mob.target.target.uuid%%% would let you figure out if two entities are mutually targeting each other. in combination with e.g. fake players, being able to "daisy-chain" targeting could be powerful.
i appreciate this could be way out of scope, so please take this last one as just me thinking out loud?

I did mention it in my 1.12 update post. Feel free to post it again, though.

i think this update is worth mentioning, i reckon a lot of packmakers will absolutely love the functionality you're including! thank you again! =)

coolsquid commented 6 years ago

I will be releasing the next version later today.

the current HP and maybe armour for mobs would likely be very handy.

Added.

this is my fault, i should've remembered it when i first made the issue; uuid probably wants to be available as uuid_most and uuid_least too, as that's how they're stored in nbt tags, and minecraft commands don't have any way of natively using the uuid as it's commonly expressed :/

Are you sure? I seem to be able to use /kill with my UUID...

if you feel like it, you could (is "recursively" the right word here?) add the mob/block target properties of whatever the mob in question is targeting.

That would require too much work, I'm afraid. Maybe later.

jonqrandom commented 6 years ago

Are you sure? I seem to be able to use /kill with my UUID...

oh, sweet, then i'm totally wrong! the wiki gave me the opposite impression but it's all good =)

That would require too much work, I'm afraid. Maybe later.

no, i totally understand, that really was an "as long as i'm dreaming" kinda thing! seriously, thank you ever so much again, the extra scope you've just given me and other packmakers (those of us who can't code anyway) is amazing! <3

coolsquid commented 6 years ago

Version 1.1.0 has been released on GitHub, and will be uploaded to CurseForge as soon as I've finished the changelog.