[Mod] Scratch programmable robots [0.2.3][lwscratch]

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

[Mod] Scratch programmable robots [0.2.3][lwscratch]

by loosewheel » Post

This mod provides scratch programmable robots.

Image

Image

Version
0.2.3

Minetest Version
This mod was developed on version 5.4.0

Dependencies

Optional Dependencies
default
intllib

Licence
  • Code licence: LGPL 2.1
  • Media licence: CC-BY-SA 3.0
Features
  • Robots are programmed graphically.
  • Each robot can be persistent (remain loaded).
  • Robots can move, detect, dig, place, craft and work with inventories.
  • Program running continues across world restarts.
  • Cassettes for program copying and storing.
Image

Image Github
Download, extract to mods folder and rename to "lwscratch".
Last edited by loosewheel on Tue Mar 08, 2022 10:50, edited 22 times in total.

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [Mod]Scratch programmable robots[lwscratch][0.1.0]

by sirrobzeroone » Post

Just wanted to say this looks really good, I was looking for something like this about 6 months ago as my son was interested in learning a bit of simple programming.

I like that the robot UI and coding is done inside game, I did have him using the minecraft coding UI for a bit but he found the whole go out and back into the game to run program quiet distracting. This looks like a far better way to go, Ill see if I can get him interested in giving it a try.

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod]Scratch programmable robots[lwscratch][0.1.1]

by loosewheel » Post

Changed how the number values are set, to stop the scroll areas from jumping around. Now place the number item in the single slot. Also redesigned the form.

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod]Scratch programmable robots[lwscratch][0.1.2]

by loosewheel » Post

Example Program

Wheat Patch
Harvests and replants 6x6 wheat patch, placing the harvest in a chest. Wheat plant is only harvested if fully grown.

Layout
Image

Program
Image

mattruffoni
New member
Posts: 8
Joined: Wed Jun 09, 2021 13:23
In-game: mattruffoni

Re: [Mod] Scratch programmable robots [0.1.5][lwscratch]

by mattruffoni » Post

Hi, I'm Matteo an italian teacher. I installed a minetest server for my students and I'd like to translate the guide https://github.com/loosewheel/lwscratch ... cratch.pdf here https://it.wikibooks.org/wiki/Software_ ... a_blocchi). Could I take some screenshoot and upload it on wikimedia commons?

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.1.5][lwscratch]

by loosewheel » Post

@mattruffoni, yes. That's Ok.

c56
Member
Posts: 307
Joined: Wed Apr 21, 2021 03:05
GitHub: tigercoding56
In-game: bm5 or bemo5 also sell_her_on55

Re: [Mod] Scratch programmable robots [0.1.5][lwscratch]

by c56 » Post

finnaly i can write overcomplicated programs in minetest without triing to check for spelling errors wich hapen all the time when im triing to code and gramarly does not work for code ...
this is a signature not a place to post messages also if i could change my username i would change it to sell_her_on55

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.1.5][lwscratch]

by loosewheel » Post

c56 wrote:
Sun Aug 01, 2021 03:19
finnaly i can write overcomplicated programs in minetest without triing to check for spelling errors wich hapen all the time when im triing to code and gramarly does not work for code ...
Thanks. I'm glad it's working for you.

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.1.10][lwscratch]

by loosewheel » Post

Improved the item placement and added Use mod on_place setting, which is enabled by default. This attemps to use the mods on_place handler before doing a manual placement. Not all mods interpret the pointed_thing the same way. If nodes are not placing properly turn this off and use the place_substitute.lua file for substitutions.

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.1.10][lwscratch]

by loosewheel » Post

Example Program

Mine Shaft
Digs a mine shaft (glass is to see beneath). Place the robot in this position to start.
Image

The first number value (currently set to 8) can be changed to the desired depth. Each level is 4 blocks high. 2 default:ladder and 1 default:torch are required for each level.
Image
Two ladders on every level cannot be placed by the robot due to space confinement.
Remember to use persistence if the robot is going to go out of range.
Last edited by loosewheel on Fri Nov 12, 2021 15:34, edited 2 times in total.

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.1.10][lwscratch]

by loosewheel » Post

Example Program

Mine Level
Digs a level of the mine (glass is to see beneath). Place the robot in this position to start.
Image

The first number value (currently set to 3) can be changed to the desired rings to dig. If setting to greater than 3 you'll probably have to do a lot of picking up, as the robot's storage won't be able to hold the items dug.
Image

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] Scratch programmable robots [0.1.10][lwscratch]

by MisterE » Post

2021-11-14 11:16:29: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'lwscratch' in callback node_on_timer(): ...Craft/games/mesecraft/mods/ITEMS/lwscratch/robot_ops.lua:746: attempt to index local 'item' (a nil value)
2021-11-14 11:16:29: ERROR[Main]: stack traceback:
2021-11-14 11:16:29: ERROR[Main]: ...Craft/games/mesecraft/mods/ITEMS/lwscratch/robot_ops.lua:746: in function 'substitute_group'
2021-11-14 11:16:29: ERROR[Main]: ...Craft/games/mesecraft/mods/ITEMS/lwscratch/robot_ops.lua:801: in function 'robot_craft'
2021-11-14 11:16:29: ERROR[Main]: ...seCraft/games/mesecraft/mods/ITEMS/lwscratch/program.lua:1072: in function <...seCraft/games/mesecraft/mods/ITEMS/lwscratch/program.lua:1063>
2021-11-14 11:16:29: ERROR[Main]: ...seCraft/games/mesecraft/mods/ITEMS/lwscratch/program.lua:1737: in function 'run'
2021-11-14 11:16:29: ERROR[Main]: ...MeseCraft/games/mesecraft/mods/ITEMS/lwscratch/robot.lua:259: in function <...MeseCraft/games/mesecraft/mods/ITEMS/lwscratch/robot.lua:245>

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.1.10][lwscratch]

by loosewheel » Post

MisterE wrote:
Wed Nov 17, 2021 03:11
2021-11-14 11:16:29: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'lwscratch' in callback node_on_timer(): ...Craft/games/mesecraft/mods/ITEMS/lwscratch/robot_ops.lua:746: attempt to index local 'item' (a nil value)
2021-11-14 11:16:29: ERROR[Main]: stack traceback:
2021-11-14 11:16:29: ERROR[Main]: ...Craft/games/mesecraft/mods/ITEMS/lwscratch/robot_ops.lua:746: in function 'substitute_group'
2021-11-14 11:16:29: ERROR[Main]: ...Craft/games/mesecraft/mods/ITEMS/lwscratch/robot_ops.lua:801: in function 'robot_craft'
2021-11-14 11:16:29: ERROR[Main]: ...seCraft/games/mesecraft/mods/ITEMS/lwscratch/program.lua:1072: in function <...seCraft/games/mesecraft/mods/ITEMS/lwscratch/program.lua:1063>
2021-11-14 11:16:29: ERROR[Main]: ...seCraft/games/mesecraft/mods/ITEMS/lwscratch/program.lua:1737: in function 'run'
2021-11-14 11:16:29: ERROR[Main]: ...MeseCraft/games/mesecraft/mods/ITEMS/lwscratch/robot.lua:259: in function <...MeseCraft/games/mesecraft/mods/ITEMS/lwscratch/robot.lua:245>
This should be fixed, but I don't know which item was being crafted when the error occurred to test it.

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] Scratch programmable robots [0.1.11][lwscratch]

by MisterE » Post

ill update the mod and if it happens again let you know

mattruffoni
New member
Posts: 8
Joined: Wed Jun 09, 2021 13:23
In-game: mattruffoni

Re: [Mod] Scratch programmable robots [0.1.12][lwscratch]

by mattruffoni » Post

I'm writing guidelines for my pupils to learn coding inside minetest
https://it.wikibooks.org/wiki/Software_ ... _Lwscratch
and upload a videotutorial
https://www.youtube.com/watch?v=wtPLY5GoZgQ
I'm working to uploading another videotutorial
See you soon online

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.1.14][lwscratch]

by loosewheel » Post

Improved support of param2 for placed nodes (pallet index is used as well). Nodes that use a color pallet will be removed from the robot's storage of any color, but the node placed will be the color of the node in the program sheet.

Added cassettes.
If a robot is left clicked with a cassette the robot's program is copied to the cassette. Then the cassette can be right clicked in the air and it's label can be changed, and it can be toggled read only. If read only left clicking a robot will not overwrite the cassette. Right click + sneak a robot to copy the program from the cassette to the robot. If a robot is owned by another player it cannot be copied from or to.

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.2.0][lwscratch]

by loosewheel » Post

With update to version 0.2.0 some internal changes were made which may affect existing worlds. If you have robots and cassettes in existing worlds and want to keep them, you can do the following:

Before updating the mod, place new robots for every cassette you want to keep and copy the program from the cassette onto the robot. Leave these robots placed. Any robots in an inventory that you want keep, place them. Leave the world and update the mod. Go back into the world and copy the programs back onto the cassettes from the robots. Don't try and use or drop the cassette before this. Then the robots used to copy the program can be removed. Any robots placed out of inventories can just be dug and put back in.

If a robot's program is too large (this is in data, not commands) the program will not be remembered when its dug, and cannot be copied to a cassette. This is only likely to occur if the program sheet has inventory items that hold a lot of data. Most don't (for example, a robot with a program holds data).

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] Scratch programmable robots [0.2.1][lwscratch]

by MisterE » Post

crash from latest version:

Code: Select all

                        │·······································
2022-01-06 22:13:44: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from│·······································
 mod 'lwscratch' in callback item_OnPlace(): ...seCraft/games/mesecraft/mods/ITE│·······································
MS/lwscratch/encoder.lua:214: attempt to index local 'code' (a nil value)       │·······································
2022-01-06 22:13:44: ERROR[Main]: stack traceback:                              │·······································
2022-01-06 22:13:44: ERROR[Main]:       ...seCraft/games/mesecraft/mods/ITEMS/lw│·······································
scratch/encoder.lua:214: in function 'dencode_program'                          │·······································
2022-01-06 22:13:44: ERROR[Main]:       ...MeseCraft/games/mesecraft/mods/ITEMS/│·······································
lwscratch/robot.lua:217: in function 'after_place_node'                         │·······································
2022-01-06 22:13:44: ERROR[Main]:       /home/minetest/MeseCraft/builtin/game/it│·······································
em.lua:414: in function </home/minetest/MeseCraft/builtin/game/item.lua:293>

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.2.1][lwscratch]

by loosewheel » Post

MisterE wrote:
Thu Jan 06, 2022 23:17
crash from latest version:

Code: Select all

                        │·······································
2022-01-06 22:13:44: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from│·······································
 mod 'lwscratch' in callback item_OnPlace(): ...seCraft/games/mesecraft/mods/ITE│·······································
MS/lwscratch/encoder.lua:214: attempt to index local 'code' (a nil value)       │·······································
2022-01-06 22:13:44: ERROR[Main]: stack traceback:                              │·······································
2022-01-06 22:13:44: ERROR[Main]:       ...seCraft/games/mesecraft/mods/ITEMS/lw│·······································
scratch/encoder.lua:214: in function 'dencode_program'                          │·······································
2022-01-06 22:13:44: ERROR[Main]:       ...MeseCraft/games/mesecraft/mods/ITEMS/│·······································
lwscratch/robot.lua:217: in function 'after_place_node'                         │·······································
2022-01-06 22:13:44: ERROR[Main]:       /home/minetest/MeseCraft/builtin/game/it│·······································
em.lua:414: in function </home/minetest/MeseCraft/builtin/game/item.lua:293>
This error appears to have occurred because the robot was in an inventory when the mod was updated to version 0.2.0. If this is not the case, if you know more about when it occurred would be a help. By the code flow 'code' shouldn't be nil, it should be a string of the encoded program. If for some reason the program wasn't stored, this should be picked up before trying to access this key. If its nil a program was detected, but its probably the old format and this key doesn't exist. If this is the case and you want to salvage the robot you would have to wind back to the mod version prior to 0.2.0 and follow the above procedure.

bigolbug
New member
Posts: 7
Joined: Fri Sep 04, 2020 20:52
GitHub: bigolbug

Re: [Mod] Scratch programmable robots [0.2.1][lwscratch]

by bigolbug » Post

Can you include some kind of config file in which you are able to specify nodes that can not be dug by the robot? For instance if you are familiar with the maptools mod. There are blocks that can block the players movement called maptools:playerclip. The robot is able to dig through these. I would like to prevent this.
cdb_184073c1b234

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.2.1][lwscratch]

by loosewheel » Post

bigolbug wrote:
Wed Feb 09, 2022 18:05
Can you include some kind of config file in which you are able to specify nodes that can not be dug by the robot? For instance if you are familiar with the maptools mod. There are blocks that can block the players movement called maptools:playerclip. The robot is able to dig through these. I would like to prevent this.
Are you only concerned with the nodes in the maptools mod, or an arbitrary list of nodes. A list would probably be implemented as a mod setting, comma separated list. The maptools mods uses a group 'unbreakable'. The robot can check for this group and not dig these nodes.

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.2.2][lwscratch]

by loosewheel » Post

Updated, robots will not dig nodes with 'unbreakable' group.

bigolbug
New member
Posts: 7
Joined: Fri Sep 04, 2020 20:52
GitHub: bigolbug

Re: [Mod] Scratch programmable robots [0.2.2][lwscratch]

by bigolbug » Post

loosewheel wrote:
Wed Feb 09, 2022 23:58
Updated, robots will not dig nodes with 'unbreakable' group.
Thanks! That is a way better solution then what I was thinking.
cdb_184073c1b234

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [Mod] Scratch programmable robots [0.2.3][lwscratch]

by loosewheel » Post

Due to actions by some members of the maintenance team of Minetest it appears obvious that this is not a FOSS project. ContentDB stopped updating from Github weeks ago. Continuing with the mod appears pointless as they are primarily inaccessible, and I have no interest contributing to an exclusive interest project. This mod was released under an open license so it can obviously be forked, if there is any interest to do so.

viewtopic.php?p=415477#p415477

User avatar
Neuromancer
Member
Posts: 958
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

Re: [Mod] Scratch programmable robots [0.2.3][lwscratch]

by Neuromancer » Post

You picked a fine time to leave me loosewheel. https://www.youtube.com/watch?v=mJIn6gMlo6A j/k. This mod is brilliant. I wish that somehow these cassettes could be converted to text and shared on this forum between users and then put back on a cassette and used in game. We could come up with some really cool robot apps.

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests