[Mod] basic_robot [basic_robot]

User avatar
rnd
Member
 
Posts: 136
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

Re: [Mod] basic_robot [basic_robot]

by rnd » Wed Jan 18, 2017 20:05

UPDATE:
-prevention of infinite loops/recursion:
replaced "expensive" function call to check that steps weren't exceeded with cheap conditional "if" checking sandbox local variable. This should give considerable speed increase
- builtin book browser/editor/code loader
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: [Mod] basic_robot [basic_robot]

by hajo » Wed Jan 18, 2017 22:16

rnd wrote:UPDATE: ..

Nice !
- builtin book browser/editor/code loader

I need to look at that part some more,
see also debug-screenshot
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

Brummi
Member
 
Posts: 16
Joined: Fri Mar 25, 2016 07:21

Re: [Mod] basic_robot [basic_robot]

by Brummi » Thu Jan 19, 2017 08:41

Ein Mesesignal lässt den Server crashen.


Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
ERROR[Main]: stack traceback:
ERROR[Main]: ...Minetest-Survival\bin\..\mods\_test\basic_robot\init.lua:779: in function 'action_on'
ERROR[Main]: ...test-Survival\bin\..\mods\mesecons\mesecons/internal.lua:190: in function <...test-Survival\bin\..\mods\mesecons\mesecons/internal.lua:183>
ERROR[Main]: ...t-Survival\bin\..\mods\mesecons\mesecons/actionqueue.lua:93: in function 'execute'
ERROR[Main]: ...t-Survival\bin\..\mods\mesecons\mesecons/actionqueue.lua:84: in function <...t-Survival\bin\..\mods\mesecons\mesecons/actionqueue.lua:61>
ERROR[Main]: ...rdner\Minetest-Survival\bin\..\builtin\game\register.lua:369: in function <...rdner\Minetest-Survival\bin\..\builtin\game\register.lua:349>
 

User avatar
rnd
Member
 
Posts: 136
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

Re: [Mod] basic_robot [basic_robot]

by rnd » Thu Jan 19, 2017 11:07

update: mesecons compatibility: can be activated by mesecons signal and can activate mesecons blocks. to turn on wires use delayer first

1. Here a switch activates wire which turns robot on and makes it work continuously. If wire turns off robot disappears.
Image

2. Here robot activates (on/off) delayer, which activates wire which makes piston work
Image

see also debug-screenshot

Inside library left side there is a list of books from specified library ( coordinates ). On right side it shows "inventory list" in current block. So 2 totally different things ( if coordinates same then same ).

This makes it possible to edit books in other ppl library ( you need building rights at their spawner )
Attachments
robot_mesecons_2.jpg
robot_mesecons_2.jpg (64.17 KiB) Viewed 5246 times
robot_mesecons_1.jpg
robot_mesecons_1.jpg (59.56 KiB) Viewed 5246 times
 

Brummi
Member
 
Posts: 16
Joined: Fri Mar 25, 2016 07:21

Re: [Mod] basic_robot [basic_robot]

by Brummi » Thu Jan 19, 2017 11:50

Mesecons is updated, the server crashes.

blinkyplant & robot spwnwer - Evil guys on the multiplayer server are happy.


Bild 1.png
Bild 1.png (157.75 KiB) Viewed 5246 times
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: [Mod] basic_robot [basic_robot]

by hajo » Mon Jan 23, 2017 11:30

Now on the minetest-wiki:
* Mods/basic_robot - User-docu, with introduction to programming
* Basic_robot/Tutorial - Programs from the tutorial-area at the ROBOTS-server
* ROBOTS-server - Server-portrait

Also:
* Mods/basic_machines - documentation about the mod basic_machines,
** with some examples.

Suggestions/additions/corrections/more details welcome...
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: [Mod] basic_robot [basic_robot]

by hajo » Wed Jan 25, 2017 08:21

hajo wrote:* ROBOTS-server - Server-portrait .. Suggestions/additions/

* A map at the top of that page would look nice (like that from Cash's World).

Ideas for some more buildings:
* Bar (perhaps with juice/drinks), e.g. at the area behind the Casino and shop
* Public library, with some bookshelves
* Stairs at the 'tower' by the divingpool
* Minecart-Rollercoaster (with an elevated start-rail)

* Armory - weapons on display (with signs like "steel sword, X damage")
* Zoo - mobs on display (with signs like "common dirtmonster, 20 HP" :)

* some public teleporter-booths on the streets, about 250 nodes away from center
The teleporter to the counterstrike-arena uses the movers from basic_machines ?

Also, is that server based on rnd's lab server (without magic, spells etc.) ?
Last edited by hajo on Sat Feb 04, 2017 13:07, edited 1 time in total.
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: [Mod] basic_robot [basic_robot]

by hajo » Tue Jan 31, 2017 19:16

hajo wrote:* ROBOTS-server - Server-portrait .. Suggestions/additions
* A map at the top of that page ..
Ideas for some more buildings ...

More Ideas:

Bank
* with deposit-boxes, using combination-locks
Could be done with a set of 'box'-chests, a second set of 'safe'-chests in the basement,
a keypad for entering the number, and a mover to swap the contents of safe and box.

* Board listing the nearest unclaimed spots of land
** maybe as a bot that scans the landscape around the town,
** and announces the nearest places in north/east/south/west direction

Info-point
* with greeter-bot / tour-guide
That guide would follow a player,
leads him around "follow me to our next attraction, X",
and when arriving there, tell some info-text.

Could be done mostly with the code of follower-bot,
plus a set of attractions/Points-Of-Interests (coordinates and text to speak),
and maybe commands "+", "-", "thanks"/"bye" for going to next/prev, and dismiss.

While leading a player, the bot would switch the target between player and
the next POI every few seconds, to not lose him.
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: [Mod] basic_robot [basic_robot]

by hajo » Sun Feb 05, 2017 20:23

Bugs found so far in v01/18:

* robot keeps running after self.remove():
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
say("done.")  self.remove()  say("Bye") say("bye")

should stop after saying "done.",
but it keeps running, and also outputs "Bye" and "bye".

* self.display_text("",0.0) -- crashes minetest
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

User avatar
rnd
Member
 
Posts: 136
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

Re: [Mod] basic_robot [basic_robot]

by rnd » Mon Feb 06, 2017 10:19

UPDATE:

-bug fixes
-robot now has "energy", each round of execute gives 1 energy up to max 1. to dig stuff, 1 energy is expended
-find_player, pickup, player.connected now all return list or nil
-check_inventory can look at i-th item in inventory and return its name
-robot can turn on furnaces with "activate.direction(1)"
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: [Mod] basic_robot [basic_robot]

by hajo » Wed Feb 08, 2017 19:29

rnd wrote:UPDATE: .. -bug fixes

statements after self.remove() are still executed
-robot now has "energy", .. to dig stuff, 1 energy is expended

is there a way to query the current energylevel, and/or a wait/sleep-statement ?

E.g. making a 1x3 tunnel
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
 dig.forward()
 move.forward()
 dig.up()
 dig.down()

currently doesn't work right, because only the first dig is excuted.

Also, I get the impression that digging only works correctly
upto a certain distance between spawner and robot.
Beyond that, the item/ore that was dug
doesn't get into the inventory, and is lost.

For simple stone etc. I wouldn't mind too much,
but it might be valuable ore, and there is no message/warning/error.

About that new farming/fertilizer mod - is that an existing mod,
or do you plan to publish it as a new mod ?
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

User avatar
rnd
Member
 
Posts: 136
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

Re: [Mod] basic_robot [basic_robot]

by rnd » Thu Feb 09, 2017 09:01

statements after self.remove() are still executed

yes it just removes the robot entity, but running program step completes. Just use goto like:

self.remove(); goto end
PROGRAM CODE
::end::

is there a way to query the current energylevel, and/or a wait/sleep-statement ?

Each new running step robot has 1 energy. that is all. If you want to pause robot thats trivial:

if not pause then ... PROGRAM CODE .. end

Also, I get the impression that digging only works correctly upto a certain distance between spawner and robot.


This is not because of robot mod but because minetest shuts down all activity thats far from player location ( depends on settings in minetest.conf, on my server around 3 chunks = 3*16=48 nodes)

About that new farming/fertilizer mod - is that an existing mod,
or do you plan to publish it as a new mod ?


This is very simple modification of farming redo mod. It adds fertilizer and nutrients in dirt and makes farming much more realistic. Now its just super boring "put seed in dirt and forget about it" - this is not how it works in "real life". I can publish it if there is interest
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: [Mod] basic_robot [basic_robot]

by hajo » Thu Feb 09, 2017 09:43

rnd wrote:
is there a way to query the current energylevel, and/or a wait/sleep-statement ?

Each new running step robot has 1 energy. that is all. If you want to pause robot thats trivial:
if not pause then ... PROGRAM CODE .. end


With 'pause' I meant 'sleep/wait before each dig, until there is enough energy available,
then continue with dig', preferably with sleep=do-nothing, instead of busy waiting like
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
while self.energy() < 1.0 do wait(500) end; dig.up()

(or wait/sleep until the next 'running step' starts).

After all, how does the bot know the settings of maxdig, energy-allowance / -requirements, etc. ?
Last edited by hajo on Thu Feb 09, 2017 14:18, edited 1 time in total.
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: [Mod] basic_robot [basic_robot]

by hajo » Thu Feb 09, 2017 11:21

rnd wrote:
digging only works correctly upto a certain distance between spawner and robot.

minetest shuts down all activity thats far from player location ( depends on
settings in minetest.conf, on my server around 3 chunks = 3*16=48 nodes)

When mining with a remote (and no program running on the spawner),
I'm near the robot, so the only thing the spawner needs to 'do' is receiving the drops.

So, to detect the condition where a dig fails to add something to the inventory,
do we need to do an inventory-check after each dig ?
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: [Mod] basic_robot [basic_robot]

by Byakuren » Thu Feb 09, 2017 20:24

hajo wrote:
rnd wrote:
is there a way to query the current energylevel, and/or a wait/sleep-statement ?

Each new running step robot has 1 energy. that is all. If you want to pause robot thats trivial:
if not pause then ... PROGRAM CODE .. end


With 'pause' I meant 'sleep/wait before each dig, until there is enough energy available,
then continue with dig', preferably with sleep=do-nothing, instead of busy waiting like
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
while self.energy() < 1.0 do wait(500) end; dig.up()

(or wait/sleep until the next 'running step' starts).

After all, how does the bot know the settings of maxdig, energy-allowance / -requirements, etc. ?


It would require using coroutines and I think rnd has said that he didn't want to use them for basic_robot.
Every time a mod API is left undocumented, a koala dies.
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: [Mod] basic_robot [basic_robot]

by hajo » Tue Feb 14, 2017 04:03

rnd wrote:
hajo wrote:is there a way to query the current energylevel,

Each new running step robot has 1 energy. that is all.

So, when exactly does that happen, and how does the robot know/check ?
Does it matter if several statements are on the same line,
if they are inside a loop, or in a function ?

Looking at the result, as in
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
ok=dig.up()

also doesn't help, because dig can fail for other reasons too,
e.g. protection.

BTW, I already suggested to make returncodes more detailed, e.g.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
return false,"not enough energy"


I also tried to get the bots to do some simple crafting,
e.g. with some wood in robots's inventory:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
say("Crafting101")
s="default:wood"
--pickup(8); place.forward(s); dig.forward(s)

ok=check_inventory.self(s)
if ok then  say(s.." ok") else say("no "..s) end

s="default:stick"
s="doors:door_wood"
ok=craft(s)
if ok then say(s.." ok") else say(s.." fail") end
self.remove()

So far, only very few recipes worked (e.g. "darkage:chalk", "default:snowblock").
Is there a list of working recipes ?

If there is a problem when an item can be crafted from different indigrents,
how about starting the search with the item in slot#1 of the inventory ?
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: [Mod] basic_robot [basic_robot]

by hajo » Sat Mar 04, 2017 10:30

hajo wrote:* ROBOTS-server - Server-portrait .. Suggestions/additions
* A map at the top of that page ..
Ideas .. Bank ... Info-Point ...

Map now updated to 2017-03, along with some other info.

Some suggestions:
* mod for HUD - displays text for current tool when scrolling thru hotbar with mousewheel
That would be useful when there are several similar-looking items on the hotbar,
less checking, and less do/undo/change tool/redo with the wrong tree/stone etc.

Also, the last update for robots at github is now 3 weeks old,
and doesn't have the numbered keypads yet.
And a working housebuilder, like the one shown at spawn,
would be quite useful if it worked on the robot of a player.

For testing that farming/fertilizer-stuff on singleplayer,
it would be nice if that was published as a mod.
Maybe even other servers might be interested in such a mod...

Bug:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
say("Hello")
self.label("working")
say("I'm "..self.name() )
self.remove()

gives error when run with id=0.

Also, the sandbox-check complains about "_G" in comments
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

Previous

Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 11 guests

cron