- ComputerCraft | Programmable Computers for Minecraft
- → Mantas's Content
Mantas's Content
There have been 5 items by Mantas (Search limited from 10-February 22)
#257703 Chat Box
Posted by
Mantas
on 08 August 2016 - 12:09 PM
in
Ask a Pro
Well that was more obvious than I thought, I will definitely actually pay more attention to what I'm actually copying and what it means.
Also, this whole time I've indeed been typing
Thank you, it all works, and I completely understand what I'm doing now. I'll pay more attention to what variables are within the program next time.
Also, this whole time I've indeed been typing
string.char(167).."6"..string.char(167).."l".."The time is "Your minor-nit pick means a very big deal to me
Thank you, it all works, and I completely understand what I'm doing now. I'll pay more attention to what variables are within the program next time.
#257700 Chat Box
Posted by
Mantas
on 08 August 2016 - 11:40 AM
in
Ask a Pro
I'm very new to CC, Lua and the lot. That's exactly what I'm asking how to do. If player x sends message x, how do you get the Chat Box to reply to player x. I want it to be available to anyone in the server, so specifing a player = "player_name" isn't what I'm looking for. At least that's what I think you mean. If not, I'm a bit lost.
I originally thought if message == "message" and player ==... ? But I didn't know if that would work, and how it would work.
EDIT: I guess, what I'm looking for is something like (in actual code) if message == "message" and player == getPlayerName. or if message == "message" then cbox.tell(getPlayerName, "message")
I originally thought if message == "message" and player ==... ? But I didn't know if that would work, and how it would work.
EDIT: I guess, what I'm looking for is something like (in actual code) if message == "message" and player == getPlayerName. or if message == "message" then cbox.tell(getPlayerName, "message")
#257698 Tortoise API (better turtles)
Posted by
Mantas
on 08 August 2016 - 09:45 AM
in
Turtle Programs
Simple to use, and extremely useful. I don't think I'm ever using a turtle again without this API.
#257697 Chat Box
Posted by
Mantas
on 08 August 2016 - 08:52 AM
in
Ask a Pro
So I have been playing around with Chat Boxes recently and I have been seeing their capabilities. I played around a bit and made this.
(prepare to cringe at the layout)
So once I did that I figured I could do something like this, using surferpup's Real World Time API.
Now, whenever a lazy person wants to know the time in UTC, all they have to do is type it in chat mid-conversation, as opposed to having to tab out to google it like a normal person. However, it will get extremely annoying if every time someone asks the chatbox for the time, it will flood the chat with information that is only relevant to two people at most at any given moment. I am aware that chatboxes can tell(), but I just can not figure out how to get the Chat Box to detect who asked for the time and tell() them instead of perpetually annoying the rest of the server by riddling say()'ing to everyone what one person asked for.
I would appreciate if someone could point me in the right direction.
(prepare to cringe at the layout)
cbox = peripheral.wrap("right")
local T = os.time()
local D = os.day()
while true do
event, player, message,command = os.pullEvent("chat")
if message == "Time?" then
cbox.say(string.char(167).."6"..string.char(167).."l".."The time is "..textutils.formatTime( T, false ).." on Day "..D)
end
end
So once I did that I figured I could do something like this, using surferpup's Real World Time API.
os.loadAPI("timeAPI")
cbox = peripheral.wrap("right")
local T = os.time()
local D = os.day()
while true do
event, player, message,command = os.pullEvent("chat")
if message == "Time in-game?" then
cbox.say(string.char(167).."6"..string.char(167).."l".."The time is "..textutils.formatTime( T, false ).." on Day "..D)
end
local uTime = timeAPI.getTime("UTC",0,dateTimeFormat,0)
if message == "UTC Time?" then
cbox.say("The time is: "..uTime)
end
end
Now, whenever a lazy person wants to know the time in UTC, all they have to do is type it in chat mid-conversation, as opposed to having to tab out to google it like a normal person. However, it will get extremely annoying if every time someone asks the chatbox for the time, it will flood the chat with information that is only relevant to two people at most at any given moment. I am aware that chatboxes can tell(), but I just can not figure out how to get the Chat Box to detect who asked for the time and tell() them instead of perpetually annoying the rest of the server by riddling say()'ing to everyone what one person asked for.
I would appreciate if someone could point me in the right direction.
- ComputerCraft | Programmable Computers for Minecraft
- → Mantas's Content


