#Flare - Next Generation Datapack Development

1 messages · Page 2 of 1

glacial void
#

noice returning also seems to work

#
execute unless score windcharge_enabled tbs.server_data = !_1 __tg__constant__ run return fail

why do you use a constant here instead of matches?

glacial void
#

yes

median notch
#

Okay one second probably because I tried to optimize unless

#

(And visibly failed)

glacial void
#

lol

median notch
#

Thankfully everything's modular and structured well so I can just search fast ChillBar_pray

#

Like you can use the constant feature too

#

getscore(5) gives the constant score

#

But you don't ever need to :p

median notch
glacial void
#

nice it works

#

thanks

median notch
#

Finally finished this in the way you said Bolt did it ChillBar_pray

#

Unified all the generated functions into the same file structuring

#

If you make a function like ns:a/b/c and make a while inside it it will put it in ns:a/b/_c folder

glacial void
#

damn that was quick

median notch
#

I already had a unified function generator :p

#

Changed the destination from ns:tempname to the new structure

#

I think I'll sleep

glacial void
#

yea me too

median notch
#

Good night!

glacial void
#

also what's your timezone?

#

you too!

median notch
#

UTC+3 Istanbul

#

1:44AM

#

What time is it for you?

glacial void
#

aha mine currently UTC + 2

glacial void
median notch
#

Ooh we are close

glacial void
#

yea

#

not that far away

#

If I start walking now I'll be in Istanbul in 1 month

glacial void
#

ok I should go sleep now. Otherwise I'll look like --> husk

median notch
#

I forgot to include n in the command validator tokenizer

glacial void
#

thanks :)

median notch
#

I'm very happy that I finally completely figured out a solution to every problem Radon had, Flare is like the perfected version of Radon with no design flaws (https://oguzhanumutlu.com/radon)

#

You can even define your own types in Flare

#

Like if float32 type didn't already exist you could convert flop into a type

#

There's even implicit casting so you can make your own type and every other existing type immediately supports it:

x = flop(10.5) # my type
y = fixed[3](10.532)
y = x # you defined the conversion of flop to fixed and this immediately calls that
#

All explained in the internals page but I might make a page for defining types

glacial void
#

have never heard of radon but damn that's really cool

median notch
#

Thanks ❤️

glacial void
#

I'm on version 0.9.13

median notch
#

Can you send that function

glacial void
#

like the whole file?

median notch
#

Just the function should be enough

#

Because this works for me

glacial void
median notch
#

No like as text

#

So I can try it myself

glacial void
#
@export('score_menu/incr_score')
def incr_score():
    score_menu['#correct'] += 1
    score_menu['#streak'] += 1
    score_menu['#total'] += 1

    update_menu()

    if score_menu['#streak'] % 10 == 0:
        playsound minecraft:block.decorated_pot.shatter master @a ~ ~ ~ 10 0
        playsound minecraft:entity.player.levelup master @a ~ ~ ~ 0.2 1.2
    else:
        playsound minecraft:entity.armadillo.brush master @a ~ ~ ~ 10 1.5
        playsound minecraft:block.trial_spawner.spawn_item_begin master @a ~ ~ ~ 0.3 1.2
        
    with @n[type=text_display,tag=main].at(@s):
        particle minecraft:cloud ~ ~1.2 ~1.5 0 0 0 0.2 5 force
median notch
#

I can't seem to replicate it

#

Oh I see okay

#

The error is not actually at the end there

#

I think the pre-tokenizer preprocessing breaks errors

#

I'll fix both that and this error

#

Like that's not where update_menu is written

#

I'll fix this and your error

glacial void
#

also would be nice to know which line of code generated the error maybe you can add this to the error message

#

I've had multiple errors which I wasn't sure where they occured

median notch
#

On it

median notch
#

It should still error but this time you will see the error correctly hopefully

#

Also the problem was not on this function I think

glacial void
#

yes it's on the last with line. If I remove it, it works

median notch
#

Hmm

#

I had a little hacky solution in the command processor and it's unnecessary at this point, maybe it caused both of the problems at the same time

#

Because mine compiles fine now

glacial void
#

Found another issue. I have a function called enable somewhere

median notch
#

What

#

You type enable but it calls disable?

#

Wait no the namespace is different too

glacial void
#

tbh I think it's a good idea to use your interpolation syntax here
so only theblackswitch:__version__/easing/~enable~
to make it be replaced

glacial void
#

that's a plugin of mine

#

yep the enabling is also a mistake on my part :P

median notch
#

Wait so

#

Oh I see okay okay okay

median notch
median notch
#

So it was splitting the single identifier into like 3 easing and / and enable

#

So it did the substitution instead of understanding this as a single big identifier

glacial void
#

aah IC I recommend making variables only be inserted when the ~var~ syntax is used. This also makes it a lot easier for the user to figure out what's happening

median notch
#

Only two characters 🙏

median notch
#

Yeah makes sense

#

Except for json though right?

glacial void
#

hmm...

median notch
#

Like here

#

Or the bolt tutorial one

#

Also what about ~i ~ ~ do they do ~~i~ ~ ~

glacial void
# median notch

for this I think it's best to allow both and disable it inside strings

glacial void
#

can you do maybe $var instead?

median notch
#

?

median notch
median notch
glacial void
#

hmm looks a bit weird

#

like you can do execute positioned ~$offs_x ~ ~

#

looks great

#

and it's easy to type

median notch
#

{} and [] are same as before though right?

glacial void
median notch
#

Only i becomes $i

glacial void
# median notch

Ohh like that. Yea for the [] I would allow both so like both [infinite_invis]
and ```
[$infinite_invis]

are allowed
median notch
#

Hmm

#

I don't know if I like the duality in objects and arrays

#

I feel like $var should be a special feature specifically for commands and using {} is same as the already existing nbt{} syntax

glacial void
#

hmm yea maybe it's a bit weird

median notch
#
z = 10
x = nbt{x: 1b, y: z}

tellraw @a {x: 1b, y: z, k: $z}
#

Like I don't want two concepts for the user to learn and when to use which

#

Also I'll add ${} too

#

For expressions

glacial void
median notch
#

This will also speed up the preprocessor juust a bit

#

Probably not a necessary amount because preprocessor is already the fastest part of the Flare pipeline

#

But theoratically it will because I was checking literally every word against the variable list

#

Also this is a huge breaking change so get ready ChillBar_pray

glacial void
#

Ohh also quick suggestion. Can you add the output of all the syntax on your wiki? As a user that's just starting I'm still working myself from the output to flare's syntax so it's nice to know ow everything works

glacial void
glacial void
#

maybe bump the minor then

median notch
#

I had it in radon too like this

#

I'll try to add it to as many blocks as possible

median notch
glacial void
#

yea true. Maybe you can add like a <details> that you can expand to see the output but it isn't

glacial void
median notch
#

Yeah vitepress (the docs framework I'm using) has it built-in KeqingCelebrate_Frostfeuer

glacial void
#

ohh found another case where you can just use matches

#

hmm I'm also not sure what the elif score is for

glacial void
#

no math max?

median notch
glacial void
#

ohh

#

yea right

median notch
#

Math functions are all injected into Python's math and builtin functions because they're deterministic

#

Only random functions need to be ran from the flrand because I know when you write min(1, 2) you want to run the Python version but I don't know if you mean in Python or in Minecraft when you do randint(1, 5)

glacial void
#

OMG this is insanely cool

median notch
#

Glad you like it 😊

median notch
#

Currently working on the preprocessor $x update

median notch
median notch
glacial void
#

I don't think max is working correctly

median notch
#

I'll check it in a bit

median notch
#

I might make it so that you can tell it to invert the first condition instead

#

But it will get very messy if you have if-chains so it will probably be an explicit feature where you have to tell it to inline the inverted condition

glacial void
median notch
#

It should be setting it in the generated function

glacial void
#

ahh yes IC

median notch
#

Also renamed it from generated to if for if chains

median notch
#

Actually wait I can't really

#

I mean I guess I can in theory

#

Problem is

#
x = 10
if x > 5:
  x = 0
else:
  print("hi")
#

Here the safest option for the compiler is to use the elif temp variable

#

Because it will be

x = 10
if x > 5:
  x = 0
if x <= 5: # automatically generated
  print("hi") # this will always run because even if x was bigger than 5 it will be 0 which is smaller than 5
#

Logically the solution is to just change the order:

x = 10
if x <= 5:
  print("hi")
if x > 5:
  x = 0
#

But this also requires me to track which branches change which variables and if we need them in the condition

#

And then there's the case where both of the branches change the variable

#

I would just in general advise not using else if you want maximum optimized code without the little-costy elif temp variable

#

elif temp variable is just the safest option for the compiler though, unless I do this in-depth analysis

median notch
median notch
#

But in your case you probably shouldn't worry about a single score

#

Also I pushed the new version!

median notch
#

Also I just lazified both min and max functions

#

I'm going to cry because it's all linear

#

No temps

#

I just love how everything works perfectly with each other and everything's so independent of each other yet they resonate with each other so perfectly with just a few simple rules

median notch
glacial void
#

awesome

glacial void
#

@median notch
how do I do this

median notch
glacial void
#

aha

median notch
#

Also same thing goes with nbt{

glacial void
#

Hmm I expected this to output something like ```py
with schedule("1t", append=True).as(@n[type=text_display,tag=streak_counter]):
@s.transformation.scale = nbt[3.5f, 3.5f, 3.5f]
@s.start_interpolation = 0


**this function**

schedule function tg:with_0 1t append


**with_0**

execute as @n[type=text_display,tag=streak_counter] run function tg:with_1


**with_1**

@s.transformation.scale = nbt[3.5f, 3.5f, 3.5f]
@s.start_interpolation = 0

glacial void
#

sorry accidentally pressed enter to early

median notch
#

Oh you need to have two withs, schedule is a special one

#

If you're asking why it errored

glacial void
#

maybe you can add evaluation like this

median notch
#

I might connect them but the philosophy behind you being able to chain them was because they are all execute modifiers, but schedule isn't

glacial void
#

hmm IC

median notch
#

So if you do as...schedule...at it can make sense as in you first do as, then inside schedule do at

glacial void
#

well I'm not thinking of them as "execute modifiers" anymore

median notch
#

But it's hiding high-levelness

#

I might make schedule one of them though

median notch
glacial void
#

oh actually thats not bad syntax

median notch
#

Instead of dot

glacial void
#

did you already add @tag?

median notch
glacial void
#

ahh no problem :)

median notch
#

One second it should be easy

#

It will just call add_function_tag

#

Also should it just call add_function_tag or should it add it to the existing one if there is one

#

I think I'll make it have like tag_name.json by default and if it exists append to it

median notch
glacial void
median notch
#

Hmm

#

Did you update for sure?

glacial void
#

I'm on 0.10.2

median notch
glacial void
#

noice seems to work propperly now

median notch
glacial void
#

hmm ok I have a problem, I want to do execute unless #streak score_menu >= #record score_menu This is because scores can have a value of unset and thus > in this case won't work

median notch
#

If I didn't break it this should work, I had the same problem in the past

glacial void
#

Hmm macros don't seem to work for inline json

#

also tried without the $

median notch
#

Let me test it

glacial void
#

same thing, just writes it literally

median notch
#

Looking into it

#

Hmm

median notch
glacial void
# median notch Can you send the function as a text

here ```
@tag('dash_weapons/give')
@export('dash_weapons/give')
def give_item(id: macro, components: macro):
loot give @s loot {
"pools":[
{
"rolls":1,
"entries": [
{
"type": "minecraft:item",
"name": id,
"functions": [
{
"function": "set_components",
"components": {
"minecraft:consumable": {"consume_seconds":0.01,"consume_animation":"none","has_consume_particles":False,"sound":"minecraft:intentionally_empty"},
"minecraft:use_cooldown": {"seconds":5},
"minecraft:use_effects": {"can_sprint":True,"speed_multiplier":1},
"minecraft:custom_data": {"tg":{"dashable_weapon":True}},
"minecraft:custom_name": {"text": "SHIFT + RClick to dash","color":"green"}
}
},
{
"function": "set_components",
"components": components
}
]
}
]
}
]
}

median notch
median notch
#

Resource pack support is here 👀

glacial void
#

Ooooh

median notch
#

I also optimized the way it communicated with Beet so now it directly gives the output files to Beet through it's context api

glacial void
#

Nice. Did it first output a build and then link that to the pipeline?

median notch
#

You can also make resource packs without Beet, if you don't give any Minecraft function producing code it simply doesn't produce any

median notch
#

Now it's pretty ✨ professional ✨

glacial void
#

FaNcY

median notch
#

I will move it out of there though as it's not necessarily dependant on Beet

#

It's here now

glacial void
#

Awesome I like the syntax / simplicity a lot

#

Hmm what does .save(name) Do exactly?

median notch
glacial void
#

Ohh so I can use it for my textures that I use to generate the assets?

median notch
#

Yup

glacial void
#

Damn awesome

median notch
#

You can also just texture("namespace:item/something")

#

It will save to there automatically

#

You can modify the texture and it will save the last version of that texture

glacial void
#

Ooo

median notch
#

The docs should update in a sec to include every function with an example

glacial void
#

Damn my project is finished now I need time to start another project and actually use flare even more

median notch
#

Because I wrote very little in the documentation

#

You can see them all in here

glacial void
#

damn AI is getting good. I didn't notice any AI-ish language in the docs

median notch
#

Yeah I haven't written markdown in a long time 😔

#

This is probably the most I wrote like ever

#

Actually wait radon docs too

median notch
#

How many lines of mcfunction 👀

#

In the output

glacial void
median notch
#

Oooh where

glacial void
#

As testing data for my markdown parser husk

glacial void
median notch
glacial void
#

That would be really cool

median notch
glacial void
#

I'm going to sleep so have a nice evening I guess :)

median notch
median notch
#

Now it's next to the Compiled in ...ms text

glacial void
#

Nice

#

wait

#

why am I not asleep

#

holdon lemme fix that

median notch
#

I always say "It's not that I lied, it's because I failed"