| |
LANGUAGE
REFERENCE (FULL EDITION ONLY,
WINDOWS ONLY)
This page contains a description of most
of the VBScript functions and keywords. The common statements (if..then, do...loop,
etc.) are
not listed. Please visit the
VBScript
Language Reference website for a list of all the common functions and
statements (except those that belong to Adventure Maker).
|
Note: although it is not required, it is recommended that
you use the keyword "Action." when you call a function (for example, use
"Action.GoToFrame" instead of just "GoToFrame").
ACTION |
Description |
AddComponent |
Advanced function for
loading ActiveX components. Click here
for more information. |
AddItem |
Adds an item to the player's inventory.
The syntax is:
Action.AddItem "ITEM_NAME"
where ITEM_NAME is the name of the item
(as it appears in the "Manage Inventory" list in
Adventure Maker) that you
want to be added to the player's inventory. If you don't want the inventory to
automatically pop up when the item is added, use the following syntax:
Action.AddItem "ITEM_NAME", True |
CaptureFrame |
Draws the
contents of a frame (including all the hotspots, text objects, and custom controls) into a
PictureBox. The syntax is:
Action.CaptureFrame
PICTUREBOXNAMEwhere PICTUREBOXNAME is the name of the picturebox that will contain the captured
frame. |
ChangeDefaultCursor |
Dynamically changes the
default cursor (the one that you can also change from the "Options" tab of the
"Project Properties" window). The syntax is: Action.ChangeDefaultCursor "FILENAME"
where FILENAME is the name of an icon or a cursor
(without the path) that is located inside the "icons" sub-folder of the
"Project Resources", which corresponds to the directory
"c:\...\PROJECTNAME\icons". The supported file types are ICO and CUR.
To restore the default cursor, replace FILENAME with
an empty string, as shown below:
Action.ChangeDefaultCursor ""
Note: you may need to reload the frame in order to
restore the default cursors. |
ChangeDisplayResolution |
Changes the screen size
(display resolution) on the fly. The screen size is automatically restored when the player
quits the game. The syntax is:
Action.ChangeDisplayResolution MODE_NUMBER
where MODE_NUMBER is the number that identifies the
screen mode. The available modes are:
0 no changes
1 for 640 x 480
2 for 800 x 600
3 for 1024 x 768 (not
recommended)
For example, to change the screen size to 640x480,
use the following code:
Action.ChangeDisplayResolution 1
This function is particularly useful if you want to
replace the Initial Screen (the start-up window) with a custom "Main Menu" frame
that contains a "Start New Game" button, and that allows to change the display
resolution when the player starts a new game. To implement this function, go to the
properties of the "Start New Game" button, and type it in the VBScript text
field. If your "Main Menu" frame also contains a "Load Game" button,
you should type "Action.ChangeDisplayResolutionOnLoadGame" instead of
"Action.ChangeDisplayResolution" (read below for details) in the properties of
the "Load Game" button. Use these functions in conjunction with the "Bypass
Initial Screen" option that is under the "Advanced" tab of the
"Project Properties" window. |
ChangeDisplayResolutionOnLoadGame |
Allows you to have the
screen size (display resolution) be automatically changed the next time that the player
loads a saved game. You will NOT see any changes until the player loads a saved game. The
screen size is automatically restored when the player quits the game. The syntax is: Action.ChangeDisplayResolutionOnLoadGame MODE_NUMBER
where MODE_NUMBER is the number that identifies the
screen mode. The available modes are:
0 no changes
1 for 640 x 480
2 for 800 x 600
3 for 1024 x 768 (not
recommended)
Use this function if you want to replace the Initial
Screen (the start-up window) with a custom "Main Menu" frame that contains a
"Load game" button, and that allows to change the display resolution when the
player loads a saved game. To implement this function, go to the properties of the
"Load game" button, and type it in the VBScript text field. Use this function in
conjunction with the "Action.PopupLoadGame" command, and the "Bypass
Initial Screen" option that is under the "Advanced" tab of the
"Project Properties" window. |
ConvertQuotesIntoDoubleQuotes |
Converts a string into
another string, in which the quotes are replaced with double-quotes. It is particularly useful when used in conjunction with the
CreateTimedEvent function: see the source code of the Flash Plugin for an example. |
ConvertToNumber |
Converts strings and other
data types into numeric values (integers, longs, singles, doubles...). For example, ConvertToNumber("Hello") will return 0, whereas
ConvertToNumber("1357") will return 1357. |
CreateTimedEvent |
Dynamically creates a
timed event, which is an event that must occur either after a time has elapsed, or every X
seconds. The syntax is:
Action.CreateTimedEvent X, "CODE", REPEAT
where CODE is the VBScript code that must be executed after X seconds (or every X
seconds), X is the number of seconds after which the specified code must be executed (it
must be smaller than 60 seconds), and REPEAT is a boolean (the value of which is either
True or False) specifying whether the code must be executed only once, or every X seconds
(until the player goes to another frame). For example, if you want to quit the game after
4.5 seconds, you should type:
Action.CreateTimedEvent 4.5 , "Action.Quit" ,
False
Important note: If you want to include quotes in your CODE, you must use the double quotes
("") instead of the single quotes ("). For example, if you want to display
the message "Hello World" after 19 seconds, you should type (notice that there
are 3 quotes after the exclamation mark):
Action.CreateTimedEvent 19, "MsgBox ""Hello
World!""", True
If you want the CODE to contain more than one
command, simply separate the commands with the colon. For example, if you want to set VAR1
to 1 and also to set VAR2 to 0, you should type:
Action.CreateTimedEvent 4.5 , "VAR1=1 : VAR2=0" , False
Note: the timed events are automatically removed when the end-user goes to another frame.
To manually remove a timed event, use the "Action.RemoveTimedEvent" command. |
DDir |
Identical to the "Dir" command of VB6. |
DoComponentsEvents |
Similar to
the "DoEvents" command of VB6, except that it applies only to the events of the
ActiveX components. Note that while those events are executed, the form is disabled. Click
here for more information on the use
of ActiveX components with Adventure Maker. |
DoesComponentExist |
Advanced
functions to know whether a given string has already been used to identify an ActiveX
component. Click here for more information. |
GetAMVersion |
Returns the version number
of the Adventure Maker engine. This function is particularly useful if you want to
distribute the source code of a project and prevent people from using it under old
versions of Adventure Maker. |
GetClickPositionX
and
GetClickPositionY |
They return the exact
position where the player has clicked, or where the player has dragged an item from the
inventory. "Action.GetClickPositionX" will return the horizontal coordinate,
while "Action.GetClickPositionY" will return the vertical coordinate (in
pixels). Use them in
conjunction with the if/then statements to reduce the number of hotspots used in your
game.
For example:
If Action.GetClickPositionX < 50 Then Action.GoToFrame "FRAME1"
else Action.GoToFrame "FRAME2" |
GetCurrentFrameName |
Returns the name of the frame that is
currently visible. Note: this
command is particularly useful if your project contains hotspots that are shared by
several frames (with the "Runtime Frames Merging" function for example), or
procedures that are called by several frames. |
GetDisplayResolutionX
and GetDisplayResolutionY |
They return the screen size (display
resolution) in pixels. "Action.GetDisplayResolutionX" will return the screen
width, while "Action.GetDisplayResolutionY" will return the screen height (both
are read-only). Use the
"Action.ChangeDisplayResolution" and
"Action.ChangeDisplayResolutionOnLoadGame" commands to change the screen size
(read above for details). |
GetEncryptedFileName |
Returns the encrypted
version of a given filename. For example, GetEncryptedFileName("MyFile.wav")
will return "MyFile.209". It allows to work with the project files during
runtime when the project is in its compiled form. Note:
for security reasons, the encrypted filename is returned ONLY if
the corresponding file is found. Otherwise the original filename is returned. For example,
if the file "MyFile.209" does not exist, GetEncryptedFileName("MyFile.wav") will return "MyFile.wav". |
GetHotspotNumber |
Returns the number that
identifies the hotspot that has been clicked or on which the user has dragged an item. Example:
msgbox "The hotspot number is: "+CStr(Action.GetHotspotNumber) |
GetMergedHotspotIndex |
Returns the number that
identifies the first hotspot that belongs to the merged frame. It is useful only when the
"Runtime Frames Merging" function is being used. |
GetMergedTextIndex |
Returns the number that identifies the
first Text object that belongs to the merged frame. It is useful only when the
"Runtime Frames Merging" function is being used. |
GetNumberOfFrames |
Returns the number of frames of the project. |
GetPath |
Returns the path that corresponds to
the "External" sub-folder of the project folder. To return the path of a different folder, call the GetPath function with
one of the following arguments:
0 : location of the project folder
1: location of the "Root" sub-folder (in the compiled version of
the project, it corresponds to the project folder)
2: location of the "External" sub-folder (default)
3: location of the "Config" sub-folder
4: location of the "Areas" sub-folder
5: location of the "Frames" sub-folder
6: location of the "FramesData" sub-folder
7: location of the "Icons" sub-folder
For example, GetPath(7) will return the path of the
"Icons" sub-folder that is inside the project folder. |
GetProjectHeight |
Returns the
frame height (in pixels) of the project (it can be modified from the
"Options" tab of the Project Properties window). |
GetProjectName |
Returns the
name of the project. (Note: unlike the project title, the name cannot be
modified from the Project Properties). |
GetProjectTitle |
Returns the
title of the project (it can be modified from the "General" tab of the
Project Properties window). |
GetProjectWidth |
Returns the
frame width (in pixels) of the project (it can be modified from the
"Options" tab of the Project Properties window). |
GetTransitionsStatus
and
GetEffectsStatus |
They return TRUE or FALSE
depending on whether the "Disable Transitions" and "Disable Effects"
options are checked or not. Use
them in conjunction with the "Action.InvertTransitionsStatus" and
"Action.InvertEffectsStatus" commands to create a custom "Options"
frame, to replace the default "Options" menu that is located at the top of the
runtime window.
If you want for example to create a led that is ON
only when the transitions are enabled, create a new "integer" variable named
"Var1", create a hotspot with the appearance of the led ON, set it to be visible
only if "Var1=1" (by using the options that are under the "Variables"
tab in the "Hotspot Properties"); then go to the properties of the frame that
contains your custom "Options" menu, and enter the following code in the
VBScript field under the "Advanced" tab:
if Action.GetTransitionsStatus=True then Var1=1 Else Var1=0 |
GetVariableReferenceFromName |
Returns the reference to a
global variable from a string that contains the name of the global variable. The syntax
is: Set VAR2 =
GetVariableReferenceFromName("VAR1")
where "VAR1" is the name of the global
variable and VAR2 is the variable that will point to VAR1.
For example, if you wish to change the value of the
global variable named "X" to 1357, you have two ways:
1. First way (very simple): X = 1357
2. Second way (more complicate):
Dim Y
Set Y = GetVariableReferenceFromName("X")
Y = 1357
That function is particularly useful for creating
plugins in which the end-user can specify a global variable by entering its name (as a
string). |
GoToFrame |
Goes to another frame. If you don't want any transition, use the following syntax:
Action.GoToFrame "FRAME_NAME"
If you want a transition, use the following syntax:
Action.GoToFrame "FRAME_NAME", DURATION,
NUMBER
where DURATION is the transition duration in seconds
and NUMBER is the number that identifies the transition. The possibilities for NUMBER are:
1 |
Alphablending |
2 |
Slide Left |
3 |
Slide Right |
4 |
Slide up |
5 |
Slide Down |
Note(1): The new frame is not loaded
immediately. Adventure Maker waits until the end of the script execution before going to
the other frame. If the "Action.GoToFrame" command is called several times
during the execution of the script, only the last call is considered (all the other calls
are ignored).
Note(2): The Action.GoToFrame command also allows to
go to the last visited frame. To do so, use the following code:
Action.GoToFrame "Last Visited Frame" |
HideInventoryButton |
Causes the inventory button
and the drop-down inventory to disappear (works only when the "Drop-Down Inventory
System" is enabled in the "Project Properties" window). To make them
reappear, use the "Action.ShowInventoryButton" command. If you have put a "magnifier" item in the player's inventory, and
you want to display an "Item Description" frame each time that the player drags
the magnifier onto an inventory item, it is recommended that you hide the inventory to
prevent the player from dragging the magnifier onto another inventory item while the
"Item Description" frame is still open (which would result in the "Go back
to the last visited frame" command not working properly). |
HideMenu |
Hides the menu at the top of the screen. |
InvertTransitionsStatus
and
InvertEffectsStatus |
They allow you to
check/uncheck the "Disable Transitions" and "Disable Effects" options.
They work also when those options are hidden (to hide them, go to the "Options"
tab of the "Project Properties"). The changes immediately take effect. Use them in conjunction with the "Action.GetTransitionsStatus"
and "Action.GetEffectsStatus" commands to create a custom "Options"
frame, to replace the default "Options" menu that is located at the top of the
runtime window. |
IsComponentInstalled |
Advanced function to
know whether a given ActiveX ProgID exists. Click here
for more information. |
IsRunningFromEditor |
Returns TRUE if the project is being run from the
Adventure Maker editor, and FALSE if it being run from the compiled binaries. |
LoadAPicture |
Dynamically loads a
graphic file into a hotspot. The syntax is: Action.LoadAPicture Hotspot(HOTSPOT_NUMBER),
"FILENAME"
where HOTSPOT_NUMBER is the number that identifies
the hotspot into which you want to load the graphic file and FILENAME is the name of the
graphic file. The graphic file must be located inside the "Hotspot Graphic
Files" sub-folder of the "Project Resources", which corresponds to the
directory "c:\...\PROJECTNAME\Areas". The supported graphic types are: BMP, JPG,
GIF (not animated), WMF, EMF, ICO and CUR.
If you want to remove the hotspot picture (i.e. to
make the hotspot become transparent), replace FILENAME with an empty string, as shown
below:
Action.LoadAPicture Hotspot(HOTSPOT_NUMBER),
"" |
LoadControl |
Dynamically loads a
control into memory. Returns TRUE if the control was successfully loaded and FALSE if the
control could not be loaded or was already loaded before.
You can load any of the following controls: CheckBoxObject, LineObject, ShapeObject,
TextBoxObject, PictureBoxObject, ListBoxObject, ImageBoxObject, FileBoxObject,
DirBoxObject, DriveBoxObject, MediaPlayerObject. The syntax is:
Action.LoadControl CONTROLNAME(INDEX)
where you must replace CONTROLNAME with any of the names listed above, and INDEX with any
integer number greater than 1. For example, to display a TextBox in your frame, execute
the following code when the project starts:
Action.LoadControl TextBoxObject(1)
TextBoxObject(1).Move 0,0,300*15, 20*15
TextBoxObject(1).Visible = True
Note: to remove a control, use the Action.UnloadControl function. |
LoadGraphicFile |
Similar to the Action.LoadAPicture
command, but for more advanced users. It loads a graphic file from the "Areas"
sub-folder of the project folder into a property. For example, to change the cursor that
is associated with the hotspot number 5, you should type: Hotspot(5).MouseIcon =
LoadGraphicFile("FILENAME")
Hotspot(5).MousePointer = 99
where FILENAME is the name of the graphic file,
located inside the "Hotspot Graphic Files" sub-folder of the "Project
Resources", which corresponds to the directory "c:\...\PROJECTNAME\Areas".
The supported graphic types are: BMP, JPG, GIF (not animated), WMF, EMF, ICO and CUR.
Replace FILENAME with an empty string to unload the picture. |
LoadParameter |
Loads a saved parameter from the
Windows registry (use this command in conjunction with the Action.SaveParameter command).
The syntax is: x=Action.LoadParameter("PARAMETER_NAME",
DEFAULTVALUE)
where x is the name of the variable in which you
want to store the loaded parameter value, PARAMETER_NAME is the name of the parameter (for
example "NumberOfTrialDaysLeft"), and DEFAULT_VALUE is the value that must be
returned if the parameter is not found in the Registry.
Note: The function will always return a string. To
convert it into another type (such as Integer), use the conversion functions CInt(),
CLng(), etc. |
Message |
Displays a text message at
the bottom of the frame. The syntax is: Action.Message "MESSAGE_TEXT"
where MESSAGE_TEXT is the body of your text message. |
OpenFile |
Launches an executable or
opens a file with the associated program. The syntax is: Action.OpenFile "FILENAME"
where FILENAME is the name of the file you want to
launch. If FILENAME does not contain the full path of the file, Adventure Maker will
assume that the file is located in the "External" subfolder that is inside the
project folder. |
OpenExeFileAndWait |
Same as above, but it waits
for the user to close the file before continuing. Works only with executables. |
OpenURL |
Opens an URL with the
default Internet browser. The syntax is: Action.OpenURL "ENTER_URL_HERE" |
PopupLoadGame |
Causes the "Load
Game" window to pop up. Note:
the "Load Game" window does not appear immediately: Adventure Maker waits until
the end of script execution before showing it. |
PopupSaveGame |
Causes the "Save
Game" window to pop up. Note:
the "Save Game" window does not appear immediately: Adventure Maker waits until
the end of script execution before showing it. |
Quit |
Quits to the main menu (or
to the desktop, if the "bypass the Initial Screen" is checked). |
QuitDialogue |
Quits the dialogues
(conversations) created with the Dialogue Wizard. |
ReadINI |
Retrieves a value (string)
from a INI file. The syntax is:
return_value = Action.ReadINI(FILENAME, SECTION, KEY)
where FILENAME is the name of the file (which can
have any extension), and SECTION and KEY are two strings indicating the exact position
(inside the file) of the value to retrieve. If FILENAME does not contain the full path of
the file, Adventure Maker will assume that the file is located in the "External"
subfolder that is inside the project folder. If the file (or the key) is not found, the
function will return an empty string: "". Since the function will always return
a string, you may need to also use a conversion function such as Clng() to convert it to a
number. To write data to a INI file, use the Action.WriteINI command. |
RefreshWindow |
Forces screen refresh. Use
this function ONLY if you are experiencing a bug related to the screen not being refreshed
properly. You may also want to use the function named "UpdateHotspotsState"
(read below). |
RemoveAllItems |
Removes all the items from
the player's inventory. |
RemoveComponent |
Advanced function for
removing ActiveX components. Click here for
more information. |
RemoveItem |
Removes an item from the player's
inventory. The syntax is:
Action.RemoveItem "ITEM_NAME"
where ITEM_NAME is the name of the item
(as it appears in the "Manage Inventory" list in
Adventure Maker) that you
want to be removed from the player's inventory. If the item is not found, nothing occurs.
If the inventory contains several copies of the same item (duplicates), only one of them
will be removed. If you want all of them to be removed at the same time, use the following
syntax:
Action.RemoveItem "ITEM_NAME", True |
RemoveTimedEvent |
Removes a Timed Event (see the
description of the command "Action.CreatedTimedEvent" for details on what timed
events are). The syntax is:
Action.RemoveTimedEvent NUMBER
where NUMBER is the number that identifies the Timed Event that you want to remove (the
first one that you have created is number 1, the second one is number 2, etc.).
Note: If you want, when you create a new Timed
Event, you can retrieve the number that identifies it, by using the following code:
NUMBER = Action.CreateTimedEvent(X,
"CODE", REPEAT)
Instead of the following one:
Action.CreateTimedEvent X, "CODE", REPEAT |
ResetRemovedHotspots |
Restores the visibility of all the hotspots that were
hidden using the "Hide and disable this hotspot (permanently)" option from
the "Action" tab of the Hotspot Properties window.
Note: This command is particularly useful to create a
custom "Start New Game" button (in this case, it should be used in
conjunction with "RemoveAllItems" and the other commands to reset everything). |
SaveAPicture |
Saves a graphic from
the "Picture" or "Image" property of an object or control (such as a
PictureBox) into a BMP file. The syntax is:
Action.SaveAPicture
CONTROLNAME,"FILENAME"where
CONTROLNAME is the name of the object or control that contains the picture
to save and FILENAME is the name of the output BMP file. |
SaveParameter |
Saves the value of a parameter to the
Windows registry (use this command in conjunction with the Action.LoadParameter command).
The syntax is:
Action.SaveParameter "PARAMETER_NAME", VALUE
where PARAMETER_NAME is the name of the parameter
(for example, "NumberOfTrialDaysLeft"), and VALUE is the value of the parameter
(for example 30 to indicate that there are 30 trial days left) |
SendEmail |
Opens the default mail
client and creates a blank email ready to be sent to the specified address. The syntax is: Action.SendEmail
"ENTER_EMAIL_ADDRESS_HERE" |
ShowInventoryButton |
Causes the inventory button
to appear (works only when the "Drop-Down Inventory System" is enabled in the
"Project Properties" window). To make it disappear, use the
"Action.HideInventoryButton" command. |
ShowMenu |
Displays the menu at the top of the screen. |
SimulateHotspotClick |
Executes the actions that are associated with the
specified hotspot. The syntax is:
Action.SimulateHotspotClick INDEX
where
INDEX is the hotspot number. Tip: to know the number of a hotspot, hold the
pointer over the hotspot in the Adventure Maker editor, and wait for the
tooltip text to appear. Alternatively, you can open the Hotspot Properties
and read the number in the titlebar of the Hotspot Properties window. |
StopEverything |
Causes the execution to
stop, the Exit, Load Game and Save Game commands to appear, and the main screen to
disappear. Use this function ONLY for error handling or debug purposes. If you simply want
to quit, use the "Action.Quit" command instead. |
UnloadControl |
Removes a
specified control from memory. Returns TRUE is the control was successfully unloaded and
FALSE if the control could not be unloaded or does not exist. The syntax is:
Action.UnloadControl CONTROLNAME(INDEX)
Read the description of the "Action.LoadControl" function for details. |
UpdateHotspotsState |
Allows to force update of
the hotspots that are set to be visible (enabled) depending on the value of a variable. Since the hotspots are automatically updated when the player clicks on a
hotspot or when a Timed Event is executed, the function is useful ONLY when trapping
events raised by custom ActiveX components (ocx). |
WriteINI |
Writes a value (string) to a INI file.
If the file does not already exist, it is automatically created. The syntax is: Action.WriteINI FILENAME, SECTION,
KEY, VALUE
where FILENAME is the name of the file (which can
have any extension), SECTION and KEY are two strings indicating the exact position (inside
the file) where to write the value, and VALUE is the string that you want to write to the
INI file. If FILENAME does not contain the full path of the file, Adventure Maker will
assume that the file is located in the "External" subfolder that is inside the
project folder. To retrieve a value from a INI file, use the Action.ReadINI command. |
MESSAGE BOXES
A message box displays a message in a dialog box, waits for
the user to click a button, and returns an integer indicating which button the user
clicked.
The syntax is:
return_value = msgbox ( PROMPT,
BUTTONS, TITLE )
where PROMPT is the text you want to be displayed in the
dialog box, TITLE is the dialog box title and BUTTONS is an integer indicating the number
and type of buttons to display, the icon style to use and the identity of
the default button. Instead of specifying an integer for the BUTTONS argument, you can use
the following VBScript constants:
NUMBER AND TYPE OF BUTTONS:
vbOKOnly = 0
Display OK button only.
vbOKCancel = 1 Display OK and Cancel buttons.
vbAbortRetryIgnore = 2 Display Abort, Retry,
and Ignore buttons.
vbYesNoCancel = 3 Display Yes, No, and Cancel
buttons.
vbYesNo = 4 Display Yes and No buttons.
vbRetryCancel = 5 Display Retry and Cancel
buttons.
ICON STYLE TO USE:
vbCritical = 16
Display Critical Message icon.
vbQuestion = 32 Display Warning Query icon.
vbExclamation = 48 Display Warning Message
icon.
vbInformation = 64 Display Information Message
icon.
IDENTITY OF THE DEFAULT BUTTON:
vbDefaultButton1 = 0
First button is default.
vbDefaultButton2 = 256 Second button is
default.
vbDefaultButton3 = 512 Third button is default.
vbDefaultButton4 = 768 Fourth button is
default.
You can combine the constants above by using the
"+" operator.
The following example shows how to ask the player if he
wants a hint:
return_value = msgbox ( "Do you
want a hint?", vbYesNo + vbQuestion, "HINT?")
The return value depends on the button that the player has
clicked. Here is the list of all the possible values:
vbOK = 1
vbCancel = 2
vbAbort = 3
vbRetry = 4
vbIgnore = 5
vbYes = 6
vbNo = 7
The following example shows how to ask the player if he
wants a hint and then give it to him he clicked "OK":
return_value = msgbox ( "Do you
want a hint?", vbYesNo + vbQuestion, "HINT?")
if return_value = vbOK then msgbox "You have clicked OK. Here is the
hint..."
INPUT BOXES
An Input Box displays a prompt in a dialog box, waits for
the user to input text or click a button, and returns a string containing the contents of
the text box.
The syntax is:
return_value = inputbox ( PROMPT,
TITLE, DEFAULT )
where PROMPT is the text you want to be displayed in the
dialog box, TITLE is the dialog box title and DEFAULT is the expression displayed in the
text box as the default response if no other input is provided.
The following example shows how to ask the player to enter
a password. Then it asks him to enter the password again in order to proceed.
password = InputBox( "Please
choose a password.", "Password" )
if password = "" then exit sub
MsgBox "You have chosen the following password: " & password ,
vbInformation
do until returnvalue = password
returnvalue = inputbox("Now enter the password again in order to
proceed.")
If returnvalue = "" then exit sub
If returnvalue = password then MsgBox "The password is correct."
else MsgBox "Wrong password.",vbExclamation
loop
Function |
Description |
CDate |
Converts a valid date and time
expression to the variant of subtype Date |
Date |
Returns the current system date |
DateAdd |
Returns a date to which a specified
time interval has been added |
DateDiff |
Returns the number of intervals
between two dates |
DatePart |
Returns the specified part of a given
date |
DateSerial |
Returns the date for a specified year,
month, and day |
DateValue |
Returns a date |
Day |
Returns a number that represents the
day of the month (between 1 and 31, inclusive) |
FormatDateTime |
Returns an expression formatted as a
date or time |
Hour |
Returns a number that represents the
hour of the day (between 0 and 23, inclusive) |
IsDate |
Returns a Boolean value that indicates
if the evaluated expression can be converted to a date |
Minute |
Returns a number that represents the
minute of the hour (between 0 and 59, inclusive) |
Month |
Returns a number that represents the
month of the year (between 1 and 12, inclusive) |
MonthName |
Returns the name of a specified month |
Now |
Returns the current system date and
time |
Second |
Returns a number that represents the
second of the minute (between 0 and 59, inclusive) |
Time |
Returns the current system time |
Timer |
Returns the number of seconds since
12:00 AM |
TimeSerial |
Returns the time for a specific hour,
minute, and second |
TimeValue |
Returns a time |
Weekday |
Returns a number that represents the
day of the week (between 1 and 7, inclusive) |
WeekdayName |
Returns the weekday name of a
specified day of the week |
Year |
Returns a number that represents the
year |
Function |
Description |
Asc |
Converts the first letter in a string
to ANSI code |
CBool |
Converts an expression to a variant of
subtype Boolean |
CByte |
Converts an expression to a variant of
subtype Byte |
CCur |
Converts an expression to a variant of
subtype Currency |
CDate |
Converts a valid date and time
expression to the variant of subtype Date |
CDbl |
Converts an expression to a variant of
subtype Double |
Chr |
Converts the specified ANSI code to a
character |
CInt |
Converts an expression to a variant of
subtype Integer |
CLng |
Converts an expression to a variant of
subtype Long |
CSng |
Converts an expression to a variant of
subtype Single |
CStr |
Converts an expression to a variant of
subtype String |
Hex |
Returns the hexadecimal value of a
specified number |
Oct |
Returns the octal value of a specified
number |
Function |
Description |
FormatCurrency |
Returns an expression formatted as a
currency value |
FormatDateTime |
Returns an expression formatted as a
date or time |
FormatNumber |
Returns an expression formatted as a
number |
FormatPercent |
Returns an expression formatted as a
percentage |
Function |
Description |
Abs |
Returns the absolute value of a
specified number |
Atn |
Returns the arctangent of a specified
number |
Cos |
Returns the cosine of a specified
number (angle) |
Exp |
Returns e raised to a power |
Hex |
Returns the hexadecimal value of a
specified number |
Int |
Returns the integer part of a
specified number |
Fix |
Returns the integer part of a
specified number |
Log |
Returns the natural logarithm of a
specified number |
Oct |
Returns the octal value of a specified
number |
Rnd |
Returns a random number less than 1
but greater or equal to 0 |
Sgn |
Returns an integer that indicates the
sign of a specified number |
Sin |
Returns the sine of a specified number
(angle) |
Sqr |
Returns the square root of a specified
number |
Tan |
Returns the tangent of a specified
number (angle) |
Function |
Description |
Array |
Returns a variant containing an array |
Filter |
Returns a zero-based array that
contains a subset of a string array based on a filter criteria |
IsArray |
Returns a Boolean value that indicates
whether a specified variable is an array |
Join |
Returns a string that consists of a
number of substrings in an array |
LBound |
Returns the smallest subscript for the
indicated dimension of an array |
Split |
Returns a zero-based, one-dimensional
array that contains a specified number of substrings |
UBound |
Returns the largest subscript for the
indicated dimension of an array |
Function |
Description |
InStr |
Returns the position of the first
occurrence of one string within another. The search begins at the first character of the
string |
InStrRev |
Returns the position of the first
occurrence of one string within another. The search begins at the last character of the
string |
LCase |
Converts a specified string to
lowercase |
Left |
Returns a specified number of
characters from the left side of a string |
Len |
Returns the number of characters in a
string |
LTrim |
Removes spaces on the left side of a
string |
RTrim |
Removes spaces on the right side of a
string |
Trim |
Removes spaces on both the left and
the right side of a string |
Mid |
Returns a specified number of
characters from a string |
Replace |
Replaces a specified part of a string
with another string a specified number of times |
Right |
Returns a specified number of
characters from the right side of a string |
Space |
Returns a string that consists of a
specified number of spaces |
StrComp |
Compares two strings and returns a
value that represents the result of the comparison |
String |
Returns a string that contains a
repeating character of a specified length |
StrReverse |
Reverses a string |
UCase |
Converts a specified string to
uppercase |
Function |
Description |
CreateObject |
Creates an object of a specified type |
Eval |
Evaluates an expression and returns
the result |
GetLocale |
Returns the current locale ID |
GetObject |
Returns a reference to an automation
object from a file |
GetRef |
Allows you to connect a VBScript
procedure to a DHTML event on your pages |
InputBox |
Displays a dialog box, where the user
can write some input and/or click on a button, and returns the contents |
IsEmpty |
Returns a Boolean value that indicates
whether a specified variable has been initialized or not |
IsNull |
Returns a Boolean value that indicates
whether a specified expression contains no valid data (Null) |
IsNumeric |
Returns a Boolean value that indicates
whether a specified expression can be evaluated as a number |
IsObject |
Returns a Boolean value that indicates
whether the specified expression is an automation object |
LoadPicture |
Returns a picture object. Available
only on 32-bit platforms |
MsgBox |
Displays a message box, waits for the
user to click a button, and returns a value that indicates which button the user clicked |
RGB |
Returns a number that represents an
RGB color value |
Round |
Rounds a number |
ScriptEngine |
Returns the scripting language in use |
ScriptEngineBuildVersion |
Returns the build version number of
the scripting engine in use |
ScriptEngineMajorVersion |
Returns the major version number of
the scripting engine in use |
ScriptEngineMinorVersion |
Returns the minor version number of
the scripting engine in use |
SetLocale |
Sets the locale ID and returns the
previous locale ID |
TypeName |
Returns the subtype of a specified
variable |
VarType |
Returns a value that indicates the
subtype of a specified variable |
Keyword |
Description |
Empty |
Used to indicate an uninitialized
variable value. A variable value is uninitialized when it is first created and no value is
assigned to it, or when a variable value is explicitly set to empty. dim x 'the variable x is uninitialized!
x="ff" 'the variable x is NOT uninitialized anymore
x=empty 'the variable x is uninitialized!
Note: This is not the same as Null!! |
False |
Has a value equal to 0 |
Nothing |
Used to disassociate an object
variable from an object to release system resources. Example: set myObject=Nothing |
Null |
Used to indicate that a variable
contains no valid data. Note:
This is not the same as Empty!! |
True |
Has a value equal to -1 |
Please visit the
VBScript
Language Reference website for a list of all the common functions and
statements (except those that belong to Adventure Maker). |