Jump to content




Summoning Signal Help

computer command networking

19 replies to this topic

#1 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 24 March 2015 - 11:04 PM

I was making a main terminal for my base that controlled everything. I had a bug with my summoning...


How it works is it sends a signal to a command computer and it summons a mob. I cannot figure out why it isnt working and I do not get an error on other side.



Command Computer Code
rednet.open("top")
while true do

  local id, msg = rednet.receive()

  if id == 0 then

	commands.summon(msg, 1220, 6, 1720)

  end

end

Terminal Code
function clearS()
  term.setBackgroundColor(colors.white)
  term.clear()
  term.setTextColor(colors.blue)
  term.setCursorPos(1,1)
end
clearS()
print("TechedZombie:Command-OS")
while true do
  inp = read()
  if inp:lower() == "pig" then

	commands.summon("Pig", 1220, 8, 1720)
  
  elseif inp:lower() == "clear" then

	term.setBackgroundColor(colors.white)
	term.clear()
  
  else

	shell.run(inp)
  
  end
  sleep(1)
  clearS()
  print("TechedZombie:Command-OS  V - Alpha 0.1")
end


Thank you!

#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 24 March 2015 - 11:44 PM

I don't see any use of rednet.send() in this code...?

#3 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 25 March 2015 - 08:39 PM

Oops! I uploaded wrong Code!

#4 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 25 March 2015 - 08:45 PM

View PostBomb Bloke, on 24 March 2015 - 11:44 PM, said:

I don't see any use of rednet.send() in this code...?

Sorry Wrong Version Build! Here is the actual code!

function clearS()
  term.setBackgroundColor(colors.white)
  term.clear()
  term.setTextColor(colors.blue)
  term.setCursorPos(1,1)
end
clearS()
print("TechedZombie:Command-OS")
while true do
  inp = read()
  if inp:lower() == "pig" then
 
    commands.summon("Pig", 1220, 8, 1720) 
   
  elseif inp:lower() == "clear" then
 
    term.setBackgroundColor(colors.white)
    term.clear()
   
  elseif inp:match("summon") == "summon" then
 
    sum = inp:sub(8, -1)
    rednet.send(10, sub)
    print("Summoning")
   
  else
 
    shell.run(inp)
   
  end 
  sleep(1)
  clearS()
  print("TechedZombie:Command-OS  V - Alpha 0.1")
end


#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 26 March 2015 - 01:32 AM

Don't forget rednet.open().

#6 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 26 March 2015 - 08:46 PM

View PostBomb Bloke, on 26 March 2015 - 01:32 AM, said:

Don't forget rednet.open().
FacePalm

#7 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 27 March 2015 - 09:40 PM

Ok so I added rednet.open("back") and it still isn't working! HALP!

#8 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 28 March 2015 - 12:14 AM

Check that the ID numbers are correct.

Check that the systems aren't too far away from each other.

Rig the receiving system to print something every time it receives any message, and double-check that the sending system is printing "Summoning" when you use it.

Make sure you're typing the mob name using the correct capitalisation.

#9 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 28 March 2015 - 12:30 AM

Yes to all of those things its like 20 blocks away and the ids are correct the Mob name is case-correct and they both print the right things

View PostBomb Bloke, on 28 March 2015 - 12:14 AM, said:

Check that the ID numbers are correct.

Check that the systems aren't too far away from each other.

Rig the receiving system to print something every time it receives any message, and double-check that the sending system is printing "Summoning" when you use it.

Make sure you're typing the mob name using the correct capitalisation.


#10 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 28 March 2015 - 01:09 AM

Excellent! So if the receiver prints when the sender sends, we know the message is getting through.

Since the IDs are correct, that leaves only the summon command itself. Methinks you should check the co-ordinates - you've got one script targeting world layer 6, and one script targeting world layer 8. Is that as things should be?

#11 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 28 March 2015 - 01:43 AM

Yep

#12 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 28 March 2015 - 02:47 AM

In that case, if you STILL can't get it to work, have the receiving system output the command it's executing directly before attempting to perform it:

if id == 0 then
        print("summon "..msg.." 1220 6 1720")
        commands.summon(msg, 1220, 6, 1720)
end

If the result looks ok, go into the Lua prompt and test the command for yourself there. You'll get a success or a failure message - what's it say?

Edited by Bomb Bloke, 28 March 2015 - 02:51 AM.


#13 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 29 March 2015 - 08:30 PM

View PostBomb Bloke, on 28 March 2015 - 02:47 AM, said:

In that case, if you STILL can't get it to work, have the receiving system output the command it's executing directly before attempting to perform it:

if id == 0 then
		print("summon "..msg.." 1220 6 1720")
		commands.summon(msg, 1220, 6, 1720)
end

If the result looks ok, go into the Lua prompt and test the command for yourself there. You'll get a success or a failure message - what's it say?

It says false summon (<entityname> [x] [y] [z] [DataTag])

#14 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 30 March 2015 - 05:08 AM

In response to... what? I'd really only expect you to get that output if you didn't pass any parameters at all. What command did you use?

#15 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 30 March 2015 - 10:53 PM

I typed in first :
rednet.open("top")
id, message = rednet.receive()
commands.summon(msg, MyCoordsHere)

#16 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 31 March 2015 - 06:12 AM

So what's "msg" supposed to be, given that your stored your incoming rednet signal in "message"...?

What I asking you to do was report on what happens when you enter the command your actual script printed when it encountered this line I asked you to add to it earlier:

print("summon "..msg.." 1220 6 1720")

Let's say that printed out "summon Cow 1220 6 1720". You then go to the Lua console and enter commands.exec("summon Cow 1220 6 1720"), character for character. Don't use variables, use the exact syntax that print statement gave you.

What I want to know is what command do you end up entering, and what response do you get to it?

#17 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 31 March 2015 - 05:08 PM

View PostBomb Bloke, on 31 March 2015 - 06:12 AM, said:

So what's "msg" supposed to be, given that your stored your incoming rednet signal in "message"...?

What I asking you to do was report on what happens when you enter the command your actual script printed when it encountered this line I asked you to add to it earlier:

print("summon "..msg.." 1220 6 1720")

Let's say that printed out "summon Cow 1220 6 1720". You then go to the Lua console and enter commands.exec("summon Cow 1220 6 1720"), character for character. Don't use variables, use the exact syntax that print statement gave you.

What I want to know is what command do you end up entering, and what response do you get to it?

Oh I see I will try that and then tell you it will be a little while though because I am not presently at home

#18 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 31 March 2015 - 10:13 PM

I get Attempt to concatenate nil

View PostTechedZombie, on 31 March 2015 - 05:08 PM, said:

View PostBomb Bloke, on 31 March 2015 - 06:12 AM, said:

So what's "msg" supposed to be, given that your stored your incoming rednet signal in "message"...?

What I asking you to do was report on what happens when you enter the command your actual script printed when it encountered this line I asked you to add to it earlier:

print("summon "..msg.." 1220 6 1720")

Let's say that printed out "summon Cow 1220 6 1720". You then go to the Lua console and enter commands.exec("summon Cow 1220 6 1720"), character for character. Don't use variables, use the exact syntax that print statement gave you.

What I want to know is what command do you end up entering, and what response do you get to it?

Oh I see I will try that and then tell you it will be a little while though because I am not presently at home

Edited by TechedZombie, 31 March 2015 - 10:15 PM.


#19 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

Posted 01 April 2015 - 01:09 AM

View PostTechedZombie, on 31 March 2015 - 10:13 PM, said:

I get Attempt to concatenate nil

Make sure you use the same variables:
rednet.open("top")
id, message = rednet.receive()
commands.summon(message, MyCoordsHere)  --# You had 'msg' instead of 'message' originally

print("summon "..message.." 1 2 3") --# And here as well


#20 TechedZombie

  • Members
  • 43 posts
  • LocationIA, USA

Posted 05 April 2015 - 07:18 PM

View PostHPWebcamAble, on 01 April 2015 - 01:09 AM, said:

View PostTechedZombie, on 31 March 2015 - 10:13 PM, said:

I get Attempt to concatenate nil

Make sure you use the same variables:
rednet.open("top")
id, message = rednet.receive()
commands.summon(message, MyCoordsHere)  --# You had 'msg' instead of 'message' originally

print("summon "..message.." 1 2 3") --# And here as well


Thanks but it still won't work but luckily dan announced a change it says : The “exec” program, commands.exec() and all related Command Computer functions now return the console output of the command. : So I think I can better bug fix now!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users