Author Topic: Value of time help [SOLVED]  (Read 1126 times)

I am trying to make a "Clockbot" that tells time whenever I need it to, I don't know why.. I just feel like making it.
I need to find the value of time for Central USA, if anyone could help that would be great!  :cookieMonster: :cookie:
Code: [Select]
package Clockbot

{

    function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)

{

        if (%name $= ("D Trix")

{

    if (%msg $= !DBOTIME")

{    

    commandtoserver('messagesent',"DBot: The time is currently:
« Last Edit: July 24, 2012, 11:44:01 PM by TrollBoat »

I am trying to make a "Clockbot" that tells time whenever I need it to, I don't know why.. I just feel like making it.
I need to find the value of time for Central USA, if anyone could help that would be great!  :cookieMonster: :cookie:
Code: [Select]
package Clockbot

{

    function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)

{

        if (%name $= ("D Trix")

{

    if (%msg $= !DBOTIME")

{    

    commandtoserver('messagesent',"DBot: The time is currently:

You need to learn proper syntax first.

package Clockbot
{
   function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
   {
       parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg); //do not forget to parent this otherwise you'd overwrite the whole function and it'd work incorrectly and will not work as it normally should.

       if(%name $= "D Trix")
      {
          if(%msg $= "!DBOTIME")
         {   
            commandtoserver('messagesent',"DBot: The time is currently: " @ getWord(getDateTime(),1));
         }
      }
   }
};
ActivatePackage("Clockbot");


clientCmdChatMessage is a terrible way of making a bot as there is many flaws.

  • Some other person can use the console and talk as you, and when "!DBOTIME" is typed, it'll still tell the time.
  • You still need to learn the proper syntax for TorqueScript. Iban Explains it All.
  • You forgot to put a parent in your original code. This would ruin the original function of clientCmdChatMessage if you didn't parent the code.
  • Your original code didn't have the closing brackets, this is important. Again, Iban Explains it All.

Before you carry on scripting this, first revise the Iban Explains it All documents as that would be the best help for you at this time.

What is the point of making it announce it to everyone? If you want to see the time, just look at your system clock or make an add-on which places it on your screen somewhere (e.g. GUI, bottomprint, centerprint or chat message). Don't annoy everybody else with it.

What is the point of making it announce it to everyone? If you want to see the time, just look at your system clock or make an add-on which places it on your screen somewhere (e.g. GUI, bottomprint, centerprint or chat message). Don't annoy everybody else with it.
this, as well as the fact that this will only work when you're named D Trix, and it's more effective to just check the netname.

this, as well as the fact that this will only work when you're named D Trix, and it's more effective to just check the netname.
if(%name == $pref::Player::NetName) i think

if(%name == $pref::Player::NetName) i think

use $=

== is only for comparing numbers

nerraD stole Darren's avatar!

I am Darren, silly.

use $=

== is only for comparing numbers

I wasn't sure about that. Thanks for clarifying it.

I am Darren, silly.

I wasn't sure about that. Thanks for clarifying it.
Umm. Why? Were you banned?

No, I hate the name "Wordy".

So you changed it to an even dumber name
gj

In your opinion, sure.

if(%name == $pref::Player::NetName) i think
Lol about the   ==
== is for comparing numbers, silly, (as Nexus said before)

Lol about the   ==
== is for comparing numbers, silly, (as Nexus said before)
Are you autistic?

Nexus has cleared this up before, you don't need to repeat everything everyone says.