User:Jack3

From EggWiki
Revision as of 18:15, 30 August 2022 by Jack3 (talk | contribs) (A super simple script for beginners. ( But actually useful :) ))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  1. August 30, 2022
  2. A very simple script. This is good for a 'first script'. Keep it simple - easier to get the hang of installing and using scripts.
  3. However, this script isn't a do-nothing script!  :) It is actually useful. I install it on every bot I create, first thing.
  4. This script creates a partyline command : .date
  5. It simply returns the current date and time, same as if you executed the date command on the linux command line in a shell.
  6. Usage:
  7. On the partyline, simply type: .date
  8. Bot will return the date and time.
  9. I find it very handy at times, when working in the partyline. Especially when editing/debugging a script that
  10. contains bind cron . I'll want to know when to expect it to trigger, and can quickly get that info.
  11. Feel free to install and use this script. If you do, I suggest you install it as-is, first. No edits.
  12. Reason: Get it installed and working correctly, first. THEN you can hack it up and do what you want with it.  :)
  13. Suggestion: Add to it. Make yet another command, so that it responds to a public command in a channel, and/or to a /msg to the bot.
  14. It's good practice!  :)
  15. References:
  16. https://docs.eggheads.org/using/tcl-commands.html
  17. text search tcl-commands.doc and find:
  18. bind dcc
  19. putdcc
  20. ctime
  21. unixtime
  22. Other helpful info:
  23. http://suninet.the-demon.de/
  24. http://suninet.the-demon.de/041.htm
  25. http://suninet.the-demon.de/042.htm
  26. http://suninet.the-demon.de/043.htm
  27. http://suninet.the-demon.de/044.htm
  28. Start small - like this.  :) Add to it. That's a great way to learn! But mostly - Have fun !  :)
  29. I hope this helps.
                                                                          1. Script starts here ###########################


bind dcc - "date" partyline_date_time

proc partyline_date_time {handle idx text} {

       putdcc $idx "[ctime [unixtime] ]"
}


                                                              1. end ####################################