GnaspGames / Smelt

A CLI tool for Minecraft map makers
http://smelt.gnasp.com
MIT License
19 stars 4 forks source link

Refer to function name with plugins #79

Closed byAdam closed 7 years ago

byAdam commented 8 years ago

One useful feature I believe, when writing plugins, would be the ability to be able to refer to the name of the function the bang command is in. This would let plugin writers save information to the entity without having to create another, or having to get the user to input the function name as an argument

GnaspGames commented 8 years ago

Hey!

I'm not sure that I understand what you mean. Could you provide some demo code showing what you mean?

byAdam commented 8 years ago

Yes, sure. I didn't explain it very well. As a component of possibly the command block (?) but could be of the smelt object, have a string which contains the name of the function the bang command is ran in. Take this mcc file

#Test !example

and this bang command js file

example.Execute = function(smelt) { console.log(smelt.GetCurrentFunctionName()); };

when compiling the file it would output 'Test'.

GnaspGames commented 7 years ago

Sorry for the slow reply on this. I'm just getting back into Smelt development.

I think the issue here is a missunderstanding of how I intend the # row marker feature to be used. These are not meant to be anchors for executing off, although I know some have used them that way. These are purely visual labels for giving a row of cmd blocks a label that you can read in-game.

You can use the 'markerTag' feature to create an entity for executing commands from (http://smelt.gnasp.com/syntax.html)

Also, you can pass parameters into bang commands as such:

!example Test

See http://smelt.gnasp.com/bangcommands.html