Simple Basic Robots Tutorials

User avatar
ManElevation
Member
 
Posts: 896
Joined: Tue Aug 02, 2016 22:04
Location: Madrid,Spain
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation

Simple Basic Robots Tutorials

by ManElevation » Thu Aug 24, 2017 11:26

Place this codes inside robot to make it work, then press save, start
Most codes by rnd (creator of mod)
Mod:https://forum.minetest.net/viewtopic.php?f=9&t=15850
Advance Basic Robots Tutorials coming soon!
i made this post because no one would

Move Robots foward
Code: Select all
move.forward()

Move Robot foward and up (need blocks to go up)
Code: Select all
move.forward()
move.up()

Move Robot Forward and when hit obstacle than remove robot
Code: Select all
self.spam(1)
if move.forward() then
  say("walking ..")
else
  say("I hit obstacle. removing robot"); self.remove()
end

Move Robot Forward and when hit obstacle than turn left
Code: Select all
if not move.forward() then
  turn.left()
end

Make sound! (doorbell)
the sound goes at "dingdong", need to have the sound on your minetest (.ogg)
Code: Select all
if not s then s = 0 end
if s%5 == 0 then self.sound("dingdong",1) end
s=s+1
self.remove()

Dig Foward certain block, used for stone generators and so
Code: Select all
dig.forward('default:stone')

Say "Hello" and automatically remove robot
Code: Select all
text = "Say and remove!";
say(text)
self.remove()

Place Blocks, need to store the blocks in "storage" inside the robot
Code: Select all
place.right("default:diamondblock")

Place apples inside chest to the right side
Code: Select all
insert.right("default:apple")
self.remove()

Take apples inside chest to the right side
Code: Select all
take.left("default:apple")
self.remove()

Tells you time and date when start robot
Code: Select all
self.label("TimeDate") 

td = os.date("%Y-%m-%d  %H:%M:%S")
msg = "Time and date"
say(msg..": "..td)

ok=write_text.up(msg)  -- label the button above the robot
ok=write_text.down("This robot was last run: "..td)

self.remove()

Takes from chest at right coal and cobble stone and places into top furnace and activates it
and says "1 coal inserted in furnace, 1 cobble taken from chest, 1 cobble inserted in furnace"
Code: Select all
take.right("default:coal_lump","fuel")
insert.up("default:coal_lump","fuel")
  take.right("default:cobble")
  insert.up("default:cobble","src")
  activate.up(1)
say("1 coal inserted in furnace, 1 cobble taken from chest, 1 cobble inserted in furnace")
self.remove()

Robots says "Hello! im stupid!"
Code: Select all
say("Hello! im stupid!")
self.remove()

Tells you players near you
Code: Select all
players =  find_player(5);
if players then
msg = table.concat(players," and ")
msg = "Around me i see " .. msg
say(msg)
self.remove()
end

Kill players near you (admin only)
change this to you name "if not ok then ok = {NAME =1} end"
Code: Select all
if not ok then ok = {ManElevation =1} end

players =  find_player(5) or {}; msg = ""; atk = 0;
for _,name in pairs(players) do
  if ok[name]==1 then
   msg = msg .. name .. " is good,"
   else
      msg = msg .. name .. " is bad, "
      grab(name)
      if atk == 0 then attack(name); atk = 1 end
   end
end
if msg == "" then self.label("nobody is here") else self.label(msg) end
--self.remove()

Change you name tag to saying "ADMIN ManElevation" (admin only)
Code: Select all
local name = "ManElevation"; local player = _G.minetest.get_player_by_name(name)
player:set_nametag_attributes({text = colorize("red","ADMIN") .. "[" .. name .. "]"});
self.remove()

Make you look like a giant nyan cat cube
change ManElevation to ur name (local name = "ManElevation")
Code: Select all
local name = "ManElevation"; local player = _G.minetest.get_player_by_name(name); player:set_properties({visual = "cube"});player:set_properties({textures = {"nyancat_side.png", "nyancat_side.png", "nyancat_side.png","nyancat_side.png", "nyancat_front.png", "nyancat_back.png"}});player:set_properties({collisionbox={-0.5,-0.5,-0.5,0.5,0.5,0.5}})
player:set_nametag_attributes({text = colorize("red","NYAN") .. "[" .. name .. "]"});

Take fuel from left and place in right
change basic_machines:power_cell to the itemstring of what u want to move
Code: Select all
take.left('basic_machines:power_cell', 'fuel')
insert.right('basic_machines:power_cell', 'fuel')
self.label("")

Make people get teleport when they get near to this robot (use to prevent people to go into ur room)(admin only)
change ManElevation to ur name "ok = {ManElevation=1}"
Code: Select all
if not ok then
   ok = {ManElevation=1}
   timeout = 6; t = 0; self.label("")
  spawn_spawnpos = {x = 10.168999671936, y = 19.5, z = 2.2809998989105}
end

players =  find_player(5) or {}; msg = ""; atk = 0;
for _,name in pairs(players) do
  if ok[name]==1 then
   else
      t = t + 1;
      if spawn_spawnpos then
         local player = _G.minetest.get_player_by_name(name)
         player:setpos(spawn_spawnpos)
       --return true, "Teleporting to Spawn..."
      end
   end
end

if msg == "" then
   self.label("")
else
   self.label(msg)
end
Last edited by ManElevation on Sun Aug 27, 2017 16:14, edited 4 times in total.
My Public Mods! Discord: Rottweiler Games#3368
 

User avatar
ManElevation
Member
 
Posts: 896
Joined: Tue Aug 02, 2016 22:04
Location: Madrid,Spain
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
 

hajo
Member
 
Posts: 597
Joined: Thu Oct 13, 2016 10:45
Location: DE

Re: Simple Basic Robots Tutorials

by hajo » Thu Aug 24, 2017 12:06

ManElevation wrote:i made this post because no one would

See my signature.

Also, see Tutorial at the wiki and 'live' at the ROBOTS_SKYBLOCK - server.
 

User avatar
ManElevation
Member
 
Posts: 896
Joined: Tue Aug 02, 2016 22:04
Location: Madrid,Spain
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation

Re: Simple Basic Robots Tutorials

by ManElevation » Thu Aug 24, 2017 12:21

hajo wrote:
ManElevation wrote:i made this post because no one would

See my signature.

Also, see Tutorial at the wiki and 'live' at the ROBOTS_SKYBLOCK - server.

crap :I
My Public Mods! Discord: Rottweiler Games#3368
 

hajo
Member
 
Posts: 597
Joined: Thu Oct 13, 2016 10:45
Location: DE

Re: Simple Basic Robots Tutorials

by hajo » Thu Aug 24, 2017 15:30

ManElevation wrote:crap :I

No problem :)

I'm always looking for nice / interesting / useful non-admin programs.
(Because admin can always do everything, so he doesn't really need robots & programs.
And those admin-only programs are useless for every other player.)
 

User avatar
azekill_DIABLO
Member
 
Posts: 7489
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
ManElevation
Member
 
Posts: 896
Joined: Tue Aug 02, 2016 22:04
Location: Madrid,Spain
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation

Re: Simple Basic Robots Tutorials

by ManElevation » Sun Aug 27, 2017 16:15

Make sound! (doorbell)
the sound goes at "dingdong", need to have the sound on your minetest (.ogg)
Code: Select all
if not s then s = 0 end
if s%5 == 0 then self.sound("dingdong",1) end
s=s+1
self.remove()
My Public Mods! Discord: Rottweiler Games#3368
 

User avatar
azekill_DIABLO
Member
 
Posts: 7489
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
ManElevation
Member
 
Posts: 896
Joined: Tue Aug 02, 2016 22:04
Location: Madrid,Spain
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation

Re: Simple Basic Robots Tutorials

by ManElevation » Sun Aug 27, 2017 17:52

azekill_DIABLO wrote:+1

+2?
My Public Mods! Discord: Rottweiler Games#3368
 

User avatar
azekill_DIABLO
Member
 
Posts: 7489
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
ManElevation
Member
 
Posts: 896
Joined: Tue Aug 02, 2016 22:04
Location: Madrid,Spain
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation

Re: Simple Basic Robots Tutorials

by ManElevation » Tue Sep 05, 2017 09:14

azekill_DIABLO wrote:+3

+4?
My Public Mods! Discord: Rottweiler Games#3368
 

User avatar
christoferlevich
Member
 
Posts: 323
Joined: Thu Dec 01, 2016 23:44
Location: Athol, Massachusetts
GitHub: ChristoferL

Re: Simple Basic Robots Tutorials

by christoferlevich » Sat Dec 09, 2017 15:38

ManElevation wrote:Make sound! (doorbell)
the sound goes at "dingdong", need to have the sound on your minetest (.ogg)
Code: Select all
if not s then s = 0 end
if s%5 == 0 then self.sound("dingdong",1) end
s=s+1
self.remove()


I can't seem to get this one to work. I am on a Win 10 machine, but all 'sound' seems 'on' in game or otherwise. any thoughts?

UPDATE EDIT It seems whenever I ask a question in public, I have a better chance of solving it. I realized 'dingdong' wasn't actually in the basic robots sound directory. I replaced 'dingdong' with one of the files in the sound folder and all make noise! Woo hoo!
everything can be a learning experience...
 

User avatar
ManElevation
Member
 
Posts: 896
Joined: Tue Aug 02, 2016 22:04
Location: Madrid,Spain
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation

Re: Simple Basic Robots Tutorials

by ManElevation » Mon Dec 11, 2017 20:48

christoferlevich wrote:
ManElevation wrote:Make sound! (doorbell)
the sound goes at "dingdong", need to have the sound on your minetest (.ogg)
Code: Select all
if not s then s = 0 end
if s%5 == 0 then self.sound("dingdong",1) end
s=s+1
self.remove()


I can't seem to get this one to work. I am on a Win 10 machine, but all 'sound' seems 'on' in game or otherwise. any thoughts?

UPDATE EDIT It seems whenever I ask a question in public, I have a better chance of solving it. I realized 'dingdong' wasn't actually in the basic robots sound directory. I replaced 'dingdong' with one of the files in the sound folder and all make noise! Woo hoo!

yep, was about to say that, but im glad you figure it out your self :P
My Public Mods! Discord: Rottweiler Games#3368
 

User avatar
LemonFox
Member
 
Posts: 25
Joined: Tue Jan 09, 2018 16:27
IRC: LemonFox
In-game: LemonFox

Re: Simple Basic Robots Tutorials

by LemonFox » Thu Feb 22, 2018 13:57

What privs are needed to use _G commands?
 

hajo
Member
 
Posts: 597
Joined: Thu Oct 13, 2016 10:45
Location: DE

Re: Simple Basic Robots Tutorials

by hajo » Fri Feb 23, 2018 12:05

LemonFox wrote:What privs are needed to use _G commands?

admin - because _G is 'global-everything' for that game.
 


Return to General Discussion



Who is online

Users browsing this forum: MSN [Bot] and 20 guests