home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / chat / ircii-2.8he / ircii-2 / help / ircII / programming < prev    next >
Encoding:
Text File  |  1993-05-04  |  3.9 KB  |  91 lines

  1. This is about programming in ircII, because ircII is not a client program,
  2. it's an operating system.. :)  And the language is just as simple as SMAIL
  3. (that is: it is horrendous) but if you want to get into it, here's a little
  4. note for you:
  5.  
  6. The command character (usually '/') is only necessary when you type commands
  7. interactively, when you program things it is no more needed, it used to be
  8. though. If you want to type to the channel from within an alias, on or
  9. binding, you have to use SAY or SEND.  There is a case where you 
  10. do need to use '/' and that is when you want to make absolutely sure you
  11. send the REAL command instead of an alias.  
  12. Here is a useful example:
  13. alias mode {
  14.     if (([$[1]0] == [#]) || ([$0] == [*]) || ([$0] == N))
  15.         { //mode $* }
  16.         { //mode $C $* }
  17. }
  18.  
  19. If the first arg is not a channel name or your nickname then the mode is 
  20. assumed to be to your current channel.. e.g. mode +i mode +ps etc..
  21. '//' is used to send a real MODE instead of the alias. This sort of thing
  22. is common.
  23.  
  24. The ';' has a special meaning in aliases, bindings and ons: It is treated
  25. as command separator, that means you can execute multiple commands in
  26. a row separated by semicolons. The semicolons are not considered separators
  27. when you use them interactively (to be able to type  ;-)) and within an
  28. ircII script file.
  29.  
  30. You can escape the meaning of ; in an alias with \;.  Try the following.
  31. alias testhook {
  32.     on hook * echo A hook has occured: $*;echo What are you going to do?
  33. }
  34. Then type /testhook followed by /hook blah blah blah
  35. and notice that the message "What are you going to do?" appeared when you
  36. typed the alias instead of when you activated the HOOK.  To avoid this
  37. problem, use the property mentioned above.
  38. alias testhook {
  39.     on hook * echo A hook has occured: $*\;echo What are you going to do?
  40. }
  41. Note that the \ take the special meaning away from the ; until the ON
  42. had been stored.  At which point it is parsed normally.
  43. See: USERHOST for some other notes about using \.
  44.  
  45. There are now several new forms for aliases and such.  The most common form 
  46. is to enclose multiple commands from an ALIAS, IF, FOREACH, or WHILE statement
  47. inside { }.  This also allows one command to be imbedded within another.
  48. (See IF, for an example of an imbedded IF statement).
  49.  
  50. For a full working example of imbedded FOREACH loops, see the FOREACH
  51. help.  For a prime example of this in action, take a look at the 'netsplit'
  52. script.
  53.  
  54. Many things have changed and continue to change.  Usually, the best way to 
  55. get some idea of how things work with any given release is to go take a 
  56. look at the files in the 'script' directory.  You can see where this is
  57. by looking at the contents of the LOAD_PATH variable or using the WHICH
  58. command. (ie. WHICH netsplit)   will show you where the netsplit script
  59. is located on your machine.  Use the help alot.  What you want to know is 
  60. in there and many people get tired of answering the same easy questions.
  61.  
  62. A couple notes about creating scripts.  It's best if you use a 
  63. consistent and useful naming scheme for the variables used within your
  64. scripts.  For example, if you have a script called 'blue' that
  65. has a bunch of internal variables and aliases then you might make
  66. those variables and aliases have names like.
  67. blue.tmp
  68. blue.cnt 
  69. or  bl.cnt  etc..  This does two things.  
  70. 1.  It lessens the chance that your variable names will collide with 
  71.     someone elses
  72. 2.  you can type  'assign blue.'   and see every variable associate
  73.     with that script and it's current value.  or 
  74.     'alias blue.' and see all the aliases.
  75.  
  76. When using ON's, if you have some ON that simple observes an action
  77. taking place and acts upon it, but does not try to suppress or change
  78. the output, then please use serial numbered ONs so that your ONs
  79. don't collide with those in other scripts.  See: HELP ON serial_numbers
  80.  
  81. Have fun.
  82.  
  83. See Also:
  84.   USERHOST
  85.   WHILE
  86.   ALIAS
  87.   IF
  88.   ON
  89.   ON serial_numbers
  90.   expressions
  91.