This is an old revision of the document!
Scripting - Misc data and function
Here can find some infomation about Enhanced Scripting function and data misc!
Message
| Player Sysmessage |
| Syntax |
Misc.SendMessage(string or int or bool) |
| Description: |
| Send a sysmessage. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
string Message, int Value, bool Status
|
| Player Sysmessage colored |
| Syntax |
Misc.SendMessage(string or int or bool, color) |
| Description: |
| Send a sysmessage whit specific color |
| Returns |
none |
| In Object: |
Misc |
| Parameters: |
string Message or int Value or bool Status, int color
|
| Player SendToClient |
| Syntax |
Misc.SendToClient(string) |
| Description: |
| Send a string to the UO client window. Can contain control characters by prefixing the character with ^ (e.g. ctrl-u is “^u”) |
| Returns |
none |
| In Object: |
Misc |
| Parameters: |
string to send to client window
|
File
| Append a line to a file |
| Syntax |
Misc.AppendToFile(string FileName, string LineToAppend) |
| Description: |
| Appends a single line to a file. |
| Returns |
bool True - success False - Fail |
| In Object: |
Misc |
| Parameters: |
string FileName, string LineToInsert
|
| Append a line to a file IF it doesn't already exist |
| Syntax |
Misc.AppendNotDupToFile(string FileName, string LineToAppend) |
| Description: |
Appends a single line to a file if that line does not already exist in the file.
use in your code like:
#
result = Misc.AppendNotDupToFile("C:/CUO/Data/Client/TreasureMaps.csv", "1111, 2222, map,desc,I forget")
#
|
| Returns |
bool |
| In Object: |
Misc |
| Parameters: |
string FileName |
string LineToInsert
|
| Remove a line from a file |
| Syntax |
Misc.RemoveLineInFile(string FileName, string LineToAppend) |
| Description: |
| Removes a single line from a file if it exists |
| Returns |
bool True - success False - Fail |
| In Object: |
Misc |
| Parameters: |
string FileName, string LineToInsert
|
System
| Resync Game Data |
| Syntax |
Misc.Resync( ) |
| Description: |
| Resync game data. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
none
|
| Pause on Script |
| Syntax |
Misc.Pause(int) |
| Description: |
| Pause script for X millisecond. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
MSpause
|
| Focus on UoClient window |
| Syntax |
Misc.FocusUOWindow() |
| Description: |
| Set UoClient window in focus or restore if minimized. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
none
|
| Screen Capture the UoClient window |
| Syntax |
Misc.CaptureNow() |
| Description: |
| Creates a snapshot of the current UO window |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
none
|
Misc
| Beep |
| Syntax |
Misc.Beep( ) |
| Description: |
| Play beep system sound. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
none
|
| Shard Name |
| Syntax |
Misc.ShardName( ) |
| Description: |
| Get string with shard name you play. |
| Returns |
string |
| In Object: |
Misc |
| Parameters: |
none
|
| Inspect Items |
| Syntax |
Misc.Inspect( ) |
| Description: |
| Prompts for a target, then displays info for that item |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
none
|
| NextContPosition |
| Syntax |
Misc.NextContPosition(x, y) |
| Description: |
| Sets the x,y co-ordinates of where the next gump will be openned. You must have cascading containers enabled |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
int x, int y window position
|
| GetContPosition |
| Syntax |
Misc.GetContPosition() |
| Description: |
| Returns the x,y co-ordinates of where the current gumpis positioned. |
| Returns |
point(x, y) |
| In Object: |
Misc |
| Parameters: |
|
Mouse
| Get Current Mouse Location |
| Syntax |
Misc.MouseLocation() |
| Description: |
| Returns a point with the X and Y coordinates of the mouse relative to the UO Window |
| Returns |
point |
| In Object: |
Misc |
| Parameters: |
none |
Example:
p = Misc.MouseLocation()
|
| Set Mouse Location |
| Syntax |
Misc.MouseMove() |
| Description: |
| Moves the mouse pointer to the position X,Y relative to the UO window |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
int X, int Y |
Example:
Misc.MouseMove(p.X+10, p.Y+20)
|
Disconnect
| Disconnect |
| Syntax |
Misc.Disconnect( ) |
| Description: Immediate logout |
| Force client to disconnect. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
none
|
| Wait Context Menu |
| Syntax |
Misc.WaitForContext(int or mobile or item, int) |
| Description: |
| Wait server response a context menu request. |
| Returns |
List < Context > - Context { int reply, string text in menu } |
| In Object: |
Misc |
| Parameters: |
timeout
|
| Context Menu Reply |
| Syntax |
Misc.ContextReply(int or mobile or item, int or string) |
| Description: |
| Respond to a context menu on mobile or item. Menu ID is base zero, or can use string of menu text |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
Menuname
|
Share Data for Script
| Read Shared Value |
| Syntax |
Misc.ReadSharedValue(string) |
| Description: |
| Read a shared value, if value not exist return null. |
| Returns |
obj |
| In Object: |
Misc |
| Parameters: |
nameofvalue
|
| Remove Shared Value |
| Syntax |
Misc.RemoveSharedValue(string) |
| Description: |
| Remove a shared value, |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
nameofvalue
|
| Check Shared Value |
| Syntax |
Misc.CheckSharedValue(string) |
| Description: |
| Get a true o flase if value exist. |
| Returns |
bool |
| In Object: |
Misc |
| Parameters: |
nameofvalue
|
| Set Shared Value |
| Syntax |
Misc.SetSharedValue(string, obj) |
| Description: |
| Set a value by specific name, if value exist he repalce value. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
value
|
| Has Menu |
| Syntax |
Misc.HasMenu() |
| Description: |
| Return bool if have or not a menu opened. |
| Returns |
bool |
| In Object: |
Misc |
| Parameters: |
none
|
| Close Menu |
| Syntax |
Misc.CloseMenu() |
| Description: |
| Close opened menu. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
none
|
| Menu Contain |
| Syntax |
Misc.MenuContain(string) |
| Description: |
| Search in opened menu if contains a specific string, return true or false. |
| Returns |
bool |
| In Object: |
Misc |
| Parameters: |
texttosearch
|
| Menu Title |
| Syntax |
Misc.GetMenuTitile() |
| Description: |
| Return a string of title for opene menu. |
| Returns |
string |
| In Object: |
Misc |
| Parameters: |
none
|
| Wait For Menu |
| Syntax |
Misc.WaitForMenu(int) |
| Description: |
| Pause script until server send menu, delay is in ms. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
delayinms
|
| Menu Response |
| Syntax |
Misc.MenuResponse(string) |
| Description: |
| Perform a menu response by subitem name. If item not exist close menu |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
subitemname
|
Query String
| Has Has QueryString |
| Syntax |
Misc.HasQueryString( ) |
| Description: |
| Check if a have a query string menu opened, return true or false. |
| Returns |
bool |
| In Object: |
Misc |
| Parameters: |
none
|
| Wait For Query String |
| Syntax |
Misc.WaitForQueryString(int) |
| Description: |
| Pause script until server send query string request, delay is in ms. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
delayinms
|
| Query String Response |
| Syntax |
Misc.QueryStringResponse(bool, string) |
| Description: |
| Perform a query string response by ok or cancel button and specific response string. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
stringtoresponse
|
Script Function
| Run a Script |
| Syntax |
Misc.ScriptRun(string) |
| Description: |
| Run a script by file name, Script must be present in script grid. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
scriptfilename
|
| Stop a Script |
| Syntax |
Misc.ScriptStop(string) |
| Description: |
| Stop a script by file name, Script must be present in script grid. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
scriptfilename
|
| Stop all Script |
| Syntax |
Misc.ScriptStopAll( ) |
| Description: |
| Stop all script running. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
none
|
| Script Status |
| Syntax |
Misc.ScriptStatus(string) |
| Description: |
| Get status of script if running or not, Script must be present in script grid. |
| Returns |
bool |
| In Object: |
Misc |
| Parameters: |
scriptfilename
|
Pets
| Rename Pet |
| Syntax |
Misc.PetRename(int or mobile, string ) |
| Description: |
| Rename a specific pet. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
newname
|
String Prompt Response
| Reset Prompt response |
| Syntax |
Misc.ResetPrompt() |
| Description: |
| Reset a prompt response. |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
none
|
| Reset Prompt response |
| Syntax |
Misc.HasPrompt() |
| Description: |
| Check if have a prompt request. |
| Returns |
bool |
| In Object: |
Misc |
| Parameters: |
none
|
| Wait Prompt |
| Syntax |
Misc.WaitForPrompt(int) |
| Description: |
| Wait a prompt response. |
| Returns |
bool |
| In Object: |
Misc |
| Parameters: |
delaytowait
|
| Cancel Prompt |
| Syntax |
Misc.CancelPrompt() |
| Description: |
| Cancel a prompt request. |
| Returns |
bool |
| In Object: |
Misc |
| Parameters: |
none
|
| Prompt Response |
| Syntax |
Misc.ResponsePrompt( string ) |
| Description: |
| Response a prompt request. |
| Returns |
bool |
| In Object: |
Misc |
| Parameters: |
reponsetosend
|
Ignore List
| Add object to Ignore List |
| Syntax |
Misc.IgnoreObject( ) |
| Description: |
| Add an object to ignore list. Can add serial, items or mobiles |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
mobtoignore
|
| Remove object from Ignore List |
| Syntax |
Misc.UnIgnoreObject( ) |
| Description: |
| Remove object from ignore list. Can remove serial, items or mobiles |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
mobtounignore
|
| Check object if present in Ignore List |
| Syntax |
Misc.CheckIgnoreObject( ) |
| Description: |
| Check object from ignore list, return true if present. Can check serial, items or mobiles |
| Returns |
bool |
| In Object: |
Misc |
| Parameters: |
mobtocheck
|
| Clear ignore list |
| Syntax |
Misc.ClearIgnore( ) |
| Description: |
| Clear ignore list from all object |
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
none
|
| Change the current active profile |
| Syntax |
Misc.ChangeProfile(profileName ) |
| Description: |
CHanges the current active profile
use in your code like:
#
Misc.ChangeProfile("profileName")
#
|
| Returns |
void |
| In Object: |
Misc |
| Parameters: |
newProfileName
|
| Distance between 2 places using UO algorithm |
| Syntax |
Misc.Distance(X1, Y1, X2, Y2) |
| Description: |
Compute the distance between 2 places using UO algorithm for distance
use in your code like:
#
d = Misc.Distance(10, 10, 20, 20)
#
|
| Returns |
int |
| In Object: |
Misc |
| Parameters: |
X1 - x origin |
Y1 - y origin |
X2 - x dest |
Y2 - y dest
|