This is an old revision of the document!

The Scripting Language

Limitations and features

The Nettalk-language script uses the same syntax as other Visual Basic dialects. However there are some limitations to note:

  • You can not have multiple commands with a colon in a separate line.
  • There is only the Do / Loop construct for iterating around a piece of script (ie the For / Next statements are not available).
  • There is no Else If (or ElseIf) statement, only Else.
  • There is no static declaration of variables.
  • As with VB Script, there is only one universal variable type (known as a variant). After the declaring a variable using Dim it will be an empty string.
  • There are no line numbers.
  • Arrays are only one-dimensional, they are not declared and are valid throughout the script part (a section marked by #NewScriptBegin). Instead of a numeric index a string key can also be used.

Nettalks scripting language is closely related to VBScript (and therefore Visual Basic 6) rather than VB.Net and has the limitations noted above. If you are new to VB then some tutorials may be found here. Microsoft's reference for VBScript is available here, and in particular the functions reference is a useful resource.


Procedures and variables

#NewScriptBegin Script1
'Variable Testvar1 available in Script1
Dim Testvar1
'Variable Testvar2 available in all scripts
Public Testvar2
Sub StartTest()
  Testvar2="More Test-Text"
  MsgBox "Test2 in Script1"
  'Call Test1 in Script1
  'Call Test1 in Script2
End Sub
Sub Test1()
  MsgBox "Test1 in Script1 (" + Testvar1 + ")"
End Sub
#NewScriptBegin Script2
Sub Test1()
  MsgBox "Test1 in Script2 (" + Testvar2 + ")"
End Sub

Functions and variables

#NewScriptBegin Script1
Sub StartTest()
  MsgBox "Test2 in Script1"
  'Call Test1 in Script1
  Test1 "Burt", "Fred"
  'Call Test1 in Script2
  TempText = Script2.Test1("Test...")
  MsgBox TempText
End Sub
Sub Test1(Text1, Text2)
  MsgBox "Test1 in Script1 (" + Text1+ " and " + Text2 + ")"
End Sub
#NewScriptBegin Script2
Function Test1(Text)
  Test1 = "Text from Test1 in Script2 (" + UCase(Text) + ")"
End Sub

Nettalk commands calling script

Subroutines and functions within your script (or built into the scripting language itself) may be called via teh Nettalk command interface (the same place where you type your chat). This may be done using any of the commands /call, /calc, or simply ?. The following three calls therefore all have the same effect:

/call Test1 Burt Fred 

/calc Test1("Burt", "Fred")

?Test1("Burt", "Fred")

You can see how the single ? is a shorthand for the /calc command. The ? command also has to special modified forms of ?# and ?@. Whilst the single ? just displays the return of the function to just you, the ?# sends it to the IRC server for all to see as if you had typed the return as chat. The ?@ command goes further still and sends details of the function call as well to the IRC server for all to see:

?@Test1("John", Str(32*1024))
/calc 7*7+5

Since the command / call the arguments without quotation marks are given, can have a maximum of a string with blanks over the result of a “marked. Zudem zeigt /call keine Rückgabewerte an. Moreover / call no return values. Beispiel für einen String mit Leerzeichen: Example of a string with blanks:

Since the /call command takes its arguments without quotation marks, with each argument separated by one or more spaces. However you can specify the last argument with spaces by prefixing it with a : (a single colon) like so:

/call Test3 Harry England :and Saint George

Original German content : Die Scriptsprache

Personal Tools