Scripting - General Functions Available

(Go back to Scripting )

Most standard Visual Basic functions are available in addition to those listed below. Avoid the "With... End With" statement, as it is not available in VBScript 4.0

Msgbox "My Message"

Displays the message. Also, for long text, try func.InputBoxLong.

res = msgbox("Question?", 4)

Asks a yes/no question, returns in res 6 for yes and 7 for no.

s = Inputbox("Please Enter:", "Title String", "Default Value")

Ask the user to enter a string (defaulting to "Default Value"), which is then returned in s.

Execute "CodeString"

Uses the VBScript engine to execute the piece of code entered in the string. This allows you to run code that can be changed depending on some paramenters – for example, you could call func.ChooseString with a different list of parameters by using execute to build the call.

Formatting Rich Text Strings

You can format output to the combat log (in func.AddToCombatLog for example) by inserting the following RTF codes in this fashion:

\b1 Bold Text \b0

\u1 Underlined Text \u0

\i1 Italics Text \i0

\cf0 Black Text \cf0

\cf1 Red Text \cf0

\cf2 Blue Text \cf0

A new line will follow this text\par

Codes can be nested:

\cf2\b1\u1 Blue and Bold and Underlined Text \b0\u0\cf0

You must separate RTF codes from text, or it may cause the code to not work, or your following word to not display.

Common String Manipulation

It is beyond the scope of this document to describe in detail the functions for manipulating strings. However, here are the most common ones and links to detailed explanations from this site:

http://www.devguru.com/Technologies/vbscript/quickref/vbscript_list.html

Mid : Extract inner part of a string

UCase and LCase : Make a string upper and lower case, respectively

Replace : Replace a string within a string

InStr and InStrRev : Search for a string within another string

Len : Length of a string

RegExp : Regular-expression string searching.

Trim : Remove blank spaces around a string

Split : Splits a string according to a separator string (for instance, the comma)





Documentation for DM Genie and Player Genie, page Script_gen_funcs. Copyright © Mad Scientist Studios, 2006.
Help Contents   |   DM Genie home page
Click here if you cannot see the table of contents on the left