simon816 / Command-Block-Assembly

Compile high-level code into Minecraft commands
https://www.simon816.com/minecraft/assembler
MIT License
271 stars 29 forks source link

Some features I would love to see (if possible, of course) #13

Closed FinnT730 closed 4 years ago

FinnT730 commented 4 years ago

Hello, So I wanna see some things that I think would be helpful to people.

  1. Array support What I mean by that, is that we can store, and modify, and delete array values.

  2. Get player data (like Motion, position or rotation) and safe it into a variable

For now this is all I could think of. Thank you for making such a amazing tool!, Keep up the good work.

simon816 commented 4 years ago

Rudimentary support for arrays are actually already implemented. Currently it's just int[] arrays. (https://github.com/simon816/Command-Block-Assembly/blob/master/cbl/array_support.py) I've been rewriting the type system and most of that finished yesterday so I hope to improve array support with the new design.

There is a basic Entity API, which allows getting and setting an entity's position - https://github.com/simon816/Command-Block-Assembly/blob/master/cbl/include/__builtin__#L94 More APIs will come as I get the fundamental features finished.

Thanks for the suggestions!

FinnT730 commented 4 years ago

Hi, I forgot something to ask, will you also make a example on how to use the array system? Since, yes, I can create them, read them, but then when I do this: int test[1]; and then test[0] = 5; It gives me errors. I don't know what is causing this, but I though that I would let you know about it.

simon816 commented 4 years ago

I'd like to document all parts of CBL and Command IR. There's a lot to write about so I haven't got around to doing everything yet, just the grammar is documented.

Arrays have similar grammar to C/C++, an example:

int arr[10];
int n = 2;
int elem = arr[n];
arr[n] = elem * 2;

I just tried your array example, it should work, but it does appear to break on the old type system implementation. It works as expected on the latest commit (though my web demo is not updated yet). Thanks for letting me know though.

FinnT730 commented 4 years ago

Ah yes... That might be the problem yes, I was using the web demo :p

simon816 commented 4 years ago

Web demo has been updated to latest compiler version now.

FinnT730 commented 4 years ago

Thanks!