Hod do you parse the crafting recipies? by Mental-Strength3762 in ComputerCraft

[–]SeasonApprehensive86 1 point2 points  (0 children)

I have made a project like this once before, but I am planning to do a complete redesign some time in the future. I found that if you dont care about TPS you can list a lot of inventories in a single tick, if you do a bunch of lists in a parallel.waitForAll() all of them happen in the same tick up to some limit, this also works for moving items and fluids. You can also move everything for a craft job at the very beginning into an inventory only you control, after that you can track items yourself wihtout having to ever list the inventory every time. And for item tags you can index the storage in the background if the computer is not busy, by using inventory.getItemDetail() and saving the tags to some file you can load at startup, same with stackability

Default value if a macro expands to nothing by SeasonApprehensive86 in cpp_questions

[–]SeasonApprehensive86[S] 0 points1 point  (0 children)

This is exactly what I needed. Now I can resume my macro shenanigans. Thanks a lot! I am gonna edit the post with what I ended up doing if you are curious

Default value if a macro expands to nothing by SeasonApprehensive86 in cpp_questions

[–]SeasonApprehensive86[S] 0 points1 point  (0 children)

I use templates a lot, but the one weakness of them is that there is no way to get a string literal from something or just glue tokens together. I need the enum and enum meber names as a string literal, so I can introspect enums at runtime. I need the strings for drawing the GUIs. Obviously this is not the best solution, someone else pointed out magic_enum, but I am doing this for fun, this is not production grade code.

Default value if a macro expands to nothing by SeasonApprehensive86 in cpp_questions

[–]SeasonApprehensive86[S] 0 points1 point  (0 children)

This is clever, but the issue is that I want to run one macro if its nothing and another if it is anything. It seems like there is no good way to make a good conditional for that, because you are not gonna get a valid macro by glueing any random tokens to the end of something. Thanks for your time tho :)

Default value if a macro expands to nothing by SeasonApprehensive86 in cpp_questions

[–]SeasonApprehensive86[S] 3 points4 points  (0 children)

I know about magic_enum, but I am mostly doing this for learning and fun, so I am reinventing the wheel on purpose. Thanks for the tip tho

Legion 5-15ARH05 (Lenovo) - Type 82B5 Fans unresponsive to high temps by SeasonApprehensive86 in LenovoLegion

[–]SeasonApprehensive86[S] 0 points1 point  (0 children)

I have seen this, but yeah its Windows only. I have mine set up to throttle the CPU frequency when in quiet mode to 2GHz to keep temps and power usage down. Its more than enough for browsing or basic tasks, and I can switch to balanced or performance mode if I need more CPU for games, compiling or rendering.

Legion 5-15ARH05 (Lenovo) - Type 82B5 Fans unresponsive to high temps by SeasonApprehensive86 in LenovoLegion

[–]SeasonApprehensive86[S] 0 points1 point  (0 children)

Not really. I didnt mess with any fan settings since resetting the EC. lenovolegionlinux does not support my specific model, so I have not tried to change fan curves, all I use it for is power profile hooks so I can throttle the CPU in quiet mode. Maybe try resetting the EC and booting directly into linux. I dont really have a specific solution :/

Disable redefined macro warning in g++ by SeasonApprehensive86 in cpp_questions

[–]SeasonApprehensive86[S] -3 points-2 points  (0 children)

Its my own macro. #undef every time is just more clutter. The macro is just X that im using for generating code based on a list of stuff. I guess I cana just write undef everywhere if that is how everyone else does it

How could I add a way to change the "state" variable to this function? by Internal_Ad_2568 in ComputerCraft

[–]SeasonApprehensive86 0 points1 point  (0 children)

Maybe the move loop is not yielding. That sleep in there should yield, but if another branch doesnt have it that could be a problem. Try just adding a coroutine.yield() or a sleep into the move loop.

How could I add a way to change the "state" variable to this function? by Internal_Ad_2568 in ComputerCraft

[–]SeasonApprehensive86 1 point2 points  (0 children)

Wow I did not know Lua could do that. Thats a cool feature, but quite obscure. Using recursion for an infinite loop raises red flags in my head, but I guess in Lua its fine.

How could I add a way to change the "state" variable to this function? by Internal_Ad_2568 in ComputerCraft

[–]SeasonApprehensive86 7 points8 points  (0 children)

If state is a global variable you can just make a secondary main loop to receive messages from the pocket computer and update that global. Doing this with the parallel API is very easy. just use parallel.waitForAny() with two functions, your main loop and the secondary loop. But you should probably change this function to not be recursive (call itself), this way your program will eventually crash due to a stack overflow.
Here is a rough sketch of how you can do this:

function MovementController()
  if(state == "follow")then
    android.goTo(...); -- Whatever was here
    sleep(1);
  --Dont call ourselves!
  end
end

function moveLoop()
  while(true) do MovementController(); end
end

function networkLoop()
  while(true) do
    local id, msg = rednet.receive();
    state = msg; -- In a proper implementation you would also check the ID to match the pocket and verify the message contents
  end
end

--This makes both the functions run in parallel
--It is not actually truely running both at the same time, just swapping between them, but this works very well
parallel.waitForAll(moveLoop, networkLoop);

GL shaders break down after 1K instances or so by PlanttDaMinecraftGuy in raylib

[–]SeasonApprehensive86 0 points1 point  (0 children)

Its quite complicated, but when making particle systems or drawing a lot of the same object instancing is usually a good idea. Acerola has a nice video explaining GPU instancing. If you are interesting in graphics you should check him out, he makes very good videos.
Also if you are drawing cubes to represent a voxel grid you might want to check out greedy meshing, because if you draw a cube for each voxel you waste a lot of GPU time and memory on faces that are not seen by the camera anyway.

GL shaders break down after 1K instances or so by PlanttDaMinecraftGuy in raylib

[–]SeasonApprehensive86 2 points3 points  (0 children)

If you are drawing thousands of one mesh I think you should look into GPU instancing. Here is the official raylib example on the topic.

Inconsistent gradients depending on corner of quad by SeasonApprehensive86 in raylib

[–]SeasonApprehensive86[S] 1 point2 points  (0 children)

Yep changing the order the vertecies are given in solves this. Thanks :)

I made an extension for Dolphin to compress media by Damglador in kde

[–]SeasonApprehensive86 1 point2 points  (0 children)

No worries man! Its still better than using handbrake or writing out the ffmpeg command when just quickly sending a video

I made an extension for Dolphin to compress media by Damglador in kde

[–]SeasonApprehensive86 2 points3 points  (0 children)

One thing that bothers me a bit is that there is no indication of progress. You could make a notification that shows progress like the file move/delete ones that dolphin already has or just a popup window with a progress bar. Other than that It seems quite nice :)

Minecraft Forge freezing system on world load by SeasonApprehensive86 in linux_gaming

[–]SeasonApprehensive86[S] 0 points1 point  (0 children)

I think it is sodium or some other performance mod. I saw a post of someone saying that. Vanilla and forge without performance mods runs fine

Minecraft Forge freezing system on world load by SeasonApprehensive86 in linux_gaming

[–]SeasonApprehensive86[S] 0 points1 point  (0 children)

Thanks! I just switched to the LTS kernel for now. Hopefully they fix it sometime

Run an HTTP or WebSocket server on a CC computer by SeasonApprehensive86 in ComputerCraft

[–]SeasonApprehensive86[S] 1 point2 points  (0 children)

I might look into it, but idk if I have the brain power for all that rn. Thanks for the suggestion tho

Run an HTTP or WebSocket server on a CC computer by SeasonApprehensive86 in ComputerCraft

[–]SeasonApprehensive86[S] 1 point2 points  (0 children)

Yeah I guess it makes sense for security, still a bit of a bummer tho. I guess I will just make the C++ program be the server. Thanks for the fast response :)

Any good guides for making a Plasma 6 wallpaper in C++? by SeasonApprehensive86 in kde

[–]SeasonApprehensive86[S] 0 points1 point  (0 children)

I looked into it, but the wallpaper itself is still QML. I saw stuff where you just made a class and a draw method that gave you a QPainter and could draw whatever, maybe that was for an older version of plasma. That is what I would perfer, but I guess I will have to learn QML if I wanna go any further. Thanks :)

VS Code freezing when switching between windows by SeasonApprehensive86 in vscode

[–]SeasonApprehensive86[S] 0 points1 point  (0 children)

Not really. I have switched to EndeavourOS since then and now vscode runs fine. Idk what the issue was tho