em.tin 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #ALIAS {^mod{kill|load|reload} %S$}
  2. {
  3. CSAVE;
  4. #nop {reload all modules};
  5. #if {"%0" == "modreload all"}
  6. {
  7. #script {for module in modules/*.tin ; do if [ "$module" != "modules/msdp.tin" ];then echo "#class {$(basename "$module" .tin)} {kill};#class {$(basename "$module" .tin)} {read} {$module}";fi;done};
  8. #showme {All modules except msdp reloaded.};
  9. #showme {To reload msdp you must close tintin and relaunch it.}
  10. };
  11. #else
  12. {
  13. #nop {Kill, load, or reload a specified module.};
  14. #if {"%2" != "msdp"}
  15. {
  16. #if {"%1" == "{kill|reload}"}
  17. {
  18. #class {%2} {kill};
  19. #showme {Class %2 has been killed.}
  20. };
  21. #if {"%1" == "{load|reload}"}
  22. {
  23. #showme {Loading modules/%2.tin};
  24. #class {%2} {read} {modules/%2.tin}
  25. }
  26. };
  27. #else
  28. {
  29. #showme {Refusing to touch msdp. To reload msdp you must close and reopen tintin.}
  30. }
  31. };
  32. #if {"$MSDP_CHARACTER_NAME" != ""}
  33. {
  34. #class {$MSDP_CHARACTER_NAME} {open}
  35. }
  36. }
  37. {9}
  38. #ALIAS {^{em|login}$}
  39. {
  40. #if {"$connected" == "false"}
  41. {
  42. #session {$mudSessionName} {$mudAddress} {$mudPort}
  43. };
  44. #else
  45. {
  46. #showme {Huh?}
  47. }
  48. }
  49. {9}
  50. #EVENT {PROGRAM START}
  51. {
  52. #nop {Set the home directory variable.};
  53. #script {HOME} {if [ -z "$XDG_CONFIG_HOME" ] ; then if ! [ -d "$HOME/.config/tintin-empiremud/" ] ; then mkdir -p "$HOME/.config/tintin-empiremud";fi;echo -n "$HOME/.config/tintin-empiremud";else if ! [ -d "$XDG_CONFIG_HOME/tintin-empiremud/" ] ; then mkdir -p "$XDG_CONFIG_HOME/tintin-empiremud/";fi;echo -n "$XDG_CONFIG_HOME/tintin-empiremud";fi};
  54. #variable {HOME} {${HOME[1]}};
  55. #replace {HOME} {-n } {};
  56. #nop {Load all the .tin files in the modules directory in classes named after the module name.};
  57. #script {for i in modules/*.tin ; do echo "#class {$(basename "$i" .tin)} {read} {$i}";done};
  58. #nop {Get the date as a number, e.g. 1225 is Christmas day. Then PLAY intros based on the date.};
  59. #script {introDate} {date '+%m%d'};
  60. #if {${introDate[1]} == 1031}
  61. {
  62. PLAY halloween-intro
  63. };
  64. #elseif {${introDate[1]} > 1124 && ${introDate[1]} < 1200}
  65. {
  66. PLAY thanksgiving-intro
  67. };
  68. #elseif {${introDate[1]} >= 1213 && ${introDate[1]} <= 1225}
  69. {
  70. PLAY christmas-intro${introDate[1]}
  71. };
  72. #else
  73. {
  74. PLAY intro
  75. };
  76. #nop {This is the only time we need the date number, so may as well clear it.};
  77. #unvariable {introDate};
  78. #nop {Get the last modified date of the news file.};
  79. #script {motd} {curl --connect-timeout 10 -sI "$MOTDURL"};
  80. #regexp {${motd[1]}} {HTTP/1.1 {.*} {.*}} {#variable {motdStatus} {&1}};
  81. #regexp {${motd[4]}} {Last-Modified: {.*}} {#variable {motdTime} {News updated &1}};
  82. #nop {DisPLAY intro message.};
  83. #echo {$mudIntroMessage};
  84. #nop {This is the only time we need the intro message, so may as well clear it.};
  85. #unvariable {mudIntroMessage};
  86. #echo {To get started type login};
  87. #nop {If everything went ok with the news file above, disPLAY the last time news was updated.};
  88. #if {$motdStatus == 200}
  89. {
  90. #echo {${motdTime}};
  91. #echo {To listen to it type news.};
  92. Add_Channel_Event all ${motdTime}
  93. }
  94. }
  95. #EVENT {SESSION CONNECTED}
  96. {
  97. SYNTH_PLAY connectedSound;
  98. #nop {Set connected to true so if you accidently type login it won't try to login twice.};
  99. #variable {connected} {true};
  100. #nop {Create the log directory if it doesn't exist. Log files are based on date and time.};
  101. #script {logFilePath} {date +'log/%Y/%B/%d/'};
  102. #variable {logFilePath} {${HOME}/${logFilePath[1]}};
  103. #script {logFileName} {date +'%I_%M%p.log'};
  104. #system {mkdir -p $logFilePath};
  105. #log {overwrite} {${logFilePath}${logFileName[1]}}
  106. }
  107. #VARIABLE {connected} {false}
  108. #VARIABLE {enteredPassword} {false}
  109. #VARIABLE {motd} {}