*Scripting features in J-LAN Communicator* Since jlanc 1.4, SFI (http://www.usebox.net/jjm/sfi) it's included in the application: The Simple Forth Interpreter (SFI in short) is a Java implementation of a little subset of the ANS Forth language. The goal of SFI is to develop a small interpreter to be embedded in any application and provide scripting functionality with low resources. jlanc will try to load and execute $HOME/.jlanc.fth in each start. *Words called on events* ON.INIT ( -- ) ON.QUIT ( -- ) ON.AKA ( a -- ; a points to the new ALIAS ) ON.NICK ( a -- ; a points to the caller's nick ) ON.USER.NEW ( a -- ; a points to the new user's name ) example: : ON.USER.NEW ( a -- ; a points to the new user's name ) 1 JLANC.BUFFER ! ( enable buffering ) ."Hello " COUNT TYPE 0 JLANC.BUFFER ! ( disable buffering ) MSG ."!" ; ON.USER.CHANGE ( a -- ; a points to the user's new name ) ON.USER.LEFT ( a -- ; a points to the user's name that left the net ) ON.SEND ( a -- ; a points to the string with the raw text ) ON.RECEIVE ( a b -- ; a points to the string with the raw text b points to the username) *Jlanc Words* ADD.USER.COMMAND ( a b -- ; WORD description ) example: C"HELLO.WORLD" C"Say hello" ADD.USER.COMMAND : HELLO.WORLD C"Hello world!" ; MSG ( -- ; next output will be sent to net ) RAW ( -- ; next output will be sent as raw to net ) LOG ( -- ; next output will be sent to system ) example: LOG "This message will be logged!" CLEAR ( -- ; clear the output buffer ) COMPARE.STRING ( a b -- c ; c is 0 if a equals to b c is >0 if a is greather than b c is <0 if a is lower than b ) example: C"john" JLANC.USERNAME @ COMPARE.STRING 0 = IF ."You're john!" CR THEN READ.NUMBER ( a -- b ; will prompt a to the user and read a number, b ) READ.STRING ( a -- b ; will prompt a to the user and read a string, b ) FREE.STRING ( a -- ; free the string pointed by a ) example: C"what's your name?" READ.STRING 1 JLANC.BUFFER ! ."Hello " DUP COUNT TYPE 0 JLANC.BUFFER ! MSG ."!" FREE.STRING *Jlanc Variables* JLANC.USERNAME ( string address for the username ) JLANC.ALIAS ( string address for current alias ) JLANC.BUFFER ( buffering, 0 disabled 1 enabled ) *About output buffering* If you do: MSG ."Hello " ." world!" Only first string will be sent to the network. If you want to build a complex message and send it in one MSG you must enable "output buffering". example: 1 JLANC.BUFFER ! ( enable buffering ) ."Hello " ( send first string to the buffer ) ." world!" ( send second string ) 0 JLANC.BUFFER ! ( disable buffering ) MSG ."!" (send to the net the buffer plus "!" ) *EOF*