Misc
The Misc class contains general purpose functions of common use.
Table of Contents
Methods
AppendNotDupToFile
Misc.AppendNotDupToFile(fileName, lineOfData)Allows creation and append of a file within RE ValidLocations. For OSI/RE this is only the RE directory / sub-directories For CUO/RE this is only CUO or RE directory / sub-directories The filename MUST end in a limited file suffix list Checks to see if an identical line is already in the file, and does not add if it exists
fileName(String)lineOfData(String)
BooleanAppendToFile
Misc.AppendToFile(fileName, lineOfData)Allows creation and append of a file within RE ValidLocations. For OSI/RE this is only the RE directory / sub-directories For CUO/RE this is only CUO or RE directory / sub-directories The filename MUST end in a limited file suffix list
fileName(String)lineOfData(String)
BooleanBeep
Misc.Beep()Play Beep system sound.
VoidCancelPrompt
Misc.CancelPrompt()Cancel a prompt request.
VoidCaptureNow
Misc.CaptureNow()Creates a snapshot of the current UO window.
StringChangeProfile
Misc.ChangeProfile(profileName)Allow the scripted loading of a profile
profileName(String): Name of profile to load
VoidCheckIgnoreObject
Misc.CheckIgnoreObject(serial)Check object from ignore list, return true if present. Can check Serial, Items or Mobiles
serial(Int32): Serial to check.
BooleanClearIgnore
Misc.ClearIgnore()Clear ignore list from all object
VoidCloseBackpack
Misc.CloseBackpack()Close the backpack. (OSI client only, no ClassicUO)
VoidCloseMenu
Misc.CloseMenu()Close opened Old Menu.
VoidConfigDirectory
Misc.ConfigDirectory()Get the full path to the Persistence Directory.
StringContextReply
Misc.ContextReply(serial, response_num)Respond to a context menu on mobile or item. Menu ID is base zero, or can use string of menu text.
serial(Int32): Serial of the Entityresponse_num(Int32): Position of the option in the menu. Starts from 0.
VoidDataDirectory
Misc.DataDirectory()Get the full path to the Persistence Directory.
StringDeleteFile
Misc.DeleteFile(fileName)Allows deletion of a file within RE ValidLocations. For OSI/RE this is only the RE directory / sub-directories For CUO/RE this is only CUO or RE directory / sub-directories The filename MUST end in a limited file suffix list
fileName(String)
BooleanDisconnect
Misc.Disconnect()Force client to disconnect.
VoidDistance
Misc.Distance(X1, Y1, X2, Y2)Returns the UO distance between the 2 sets of co-ordinates.
X1(Int32): X co-ordinate of first place.Y1(Int32): Y co-ordinate of first place.X2(Int32): X co-ordinate of second place.Y2(Int32): Y co-ordinate of second place.
Int32DistanceSqrt
Misc.DistanceSqrt(point_a, point_b)Compute the distance between 2 Point3D using Pythagorean.
point_a(Point3D): First coordinates.point_b(Point3D): Second coordinates.
DoubleExportPythonAPI
Misc.ExportPythonAPI(path, pretty)Return a string containing list RE Python API list in JSON format.
path(String): Name of the output file. (default: Persistence/AutoComplete.json )pretty(Boolean): Print a readable JSON. (default: True )
VoidFilterSeason
Misc.FilterSeason(enable, seasonFlag)Enable or disable the Seasons filter forcing a specific season Season filter state will be saved on logout but not the season flag that will be recovered.
enable(Boolean): True: enable seasons filterseasonFlag(UInt32): 0: Spring (default fallback) 1: Summer 2: Fall 3: Winter 4: Desolation
VoidFocusUOWindow
Misc.FocusUOWindow()Set UoClient window in focus or restore if minimized.
VoidGetContPosition
Misc.GetContPosition()Get the position of the currently active Gump/Container. (OSI client only, no ClassicUO)
PointGetMapInfo
Misc.GetMapInfo(serial)Get MapInfo about a Mobile or Item using the serial
serial(UInt32): Serial of the object.
Misc.MapInfoGetMenuTitle
Misc.GetMenuTitle()Get the title of title for open Old Menu.
StringGetWindowSize
Misc.GetWindowSize()Get a Rectangle representing the window size. See also: https://docs.microsoft.com/dotnet/api/system.drawing.rectangle
RectangleHasMenu
Misc.HasMenu()Check if an Old Menu is open.
BooleanHasPrompt
Misc.HasPrompt()Check if have a prompt request.
BooleanHasQueryString
Misc.HasQueryString()Check if a have a query string menu opened, return true or false.
BooleanIgnoreObject
Misc.IgnoreObject(serial)Add an entity to the ignore list. Can ignore Serial, Items or Mobiles.
serial(Int32): Serial to ignore.
VoidInspect
Misc.Inspect()Prompt the user with a Target. Open the inspector for the selected target.
VoidIsItem
Misc.IsItem(serial)Determine if the serial is an item
serial(UInt32): Serial number of object to test is Item
BooleanIsMobile
Misc.IsMobile(serial)Determine if the serial is a mobile
serial(UInt32): Serial number of object to test is Mobile
BooleanLastHotKey
Misc.LastHotKey()Returns the latest HotKey recorded by razor as HotKeyEvent object.
HotKeyEventLeftMouseClick
Misc.LeftMouseClick(xpos, ypos, clientCoords)Perform a physical left click on the window using Windows API. Is possible to use absolute Screen Coordinates by setting clientCoords=False.
xpos(Int32): X click coordinate.ypos(Int32): Y click coordinate.clientCoords(Boolean): True: Client coordinates.- False:Screen coordinates (default: True, client).
VoidMenuContain
Misc.MenuContain(text)Search in open Old Menu if contains a specific text.
text(String): Text to search.
BooleanMenuResponse
Misc.MenuResponse(text)Perform a menu response by subitem name. If item not exist close menu.
text(String): Name of subitem to respond.
VoidMouseLocation
Misc.MouseLocation()Returns a point with the X and Y coordinates of the mouse relative to the UO Window
PointMouseMove
Misc.MouseMove(posX, posY)Moves the mouse pointer to the position X,Y relative to the UO window
posX(Int32): X screen coordinate.posY(Int32): Y screen coordinate.
VoidNextContPosition
Misc.NextContPosition(x, y)Return the X,Y of the next container, relative to the game window. (OSI client only, no ClassicUO)
x(Int32): X coordinate.y(Int32): Y coordinate.
VoidNoOperation
Misc.NoOperation()Just do nothing and enjoy the present moment.
VoidOpenPaperdoll
Misc.OpenPaperdoll()Open the backpack. (OSI client only, no ClassicUO)
VoidPause
Misc.Pause(millisec)Pause the script for a given amount of time.
millisec(Int32): Pause duration, in milliseconds.
VoidPetRename
Misc.PetRename(serial, name)Rename a specific pet.
serial(Int32): Serial of the pet.name(String): New name to set.
VoidPlaySound
Misc.PlaySound(sound, x, y, z)Send a sound to the client.
sound(Int32): The sound to play.x(Int32): The x point to send sound to.y(Int32): The y point to send sound to.z(Int32): The z point to send sound to.
VoidQueryStringResponse
Misc.QueryStringResponse(okcancel, response)Perform a query string response by ok or cancel button and specific response string.
okcancel(Boolean): OK Buttonresponse(String): Cancel Button
VoidRazorDirectory
Misc.RazorDirectory()Get the full path to the main Razor Enhanced folder. This path maybe be different from the Python starting folder when RE is loaded as plugin (ex: ClassicUO)
StringRemoveLineInFile
Misc.RemoveLineInFile(fileName, lineOfData)Allows removal of a line in a file within RE ValidLocations. For OSI/RE this is only the RE directory / sub-directories For CUO/RE this is only CUO or RE directory / sub-directories The filename MUST end in a limited file suffix list Checks to see if an identical line is in the file, and if it exists, it is removed and file written
fileName(String)lineOfData(String)
BooleanResetPrompt
Misc.ResetPrompt()Reset a prompt response.
VoidResponsePrompt
Misc.ResponsePrompt(text)Response a prompt request. Often used to rename runes and similar.
text(String): Text of the response.
VoidResync
Misc.Resync()Trigger a client ReSync.
VoidRightMouseClick
Misc.RightMouseClick(xpos, ypos, clientCoords)Perform a physical Right click on the window.
xpos(Int32): X click coordinate.ypos(Int32): Y click coordinate.clientCoords(Boolean): True: Client coordinates - False: Screen coordinates (default: True, client).
VoidScriptCurrent
Misc.ScriptCurrent(fullpath)Returns the path of the current script.
fullpath(Boolean): True:Returns the full path. False: Returns the filename. (Default: true)
StringScriptDirectory
Misc.ScriptDirectory()Get the full path to the Scripts Directory.
StringScriptIsSuspended
Misc.ScriptIsSuspended(scriptfile)Get status of script if is suspended or not, Script must be present in script grid.
scriptfile(String)
BooleanScriptResume
Misc.ScriptResume(scriptfile)Resume a script by file name, Script must be present in script grid.
scriptfile(String): Name of the script.
VoidScriptRun
Misc.ScriptRun(scriptfile)Run a script by file name, Script must be present in script grid.
scriptfile(String): Name of the script.
VoidScriptStatus
Misc.ScriptStatus(scriptfile)Get status of script if running or not, Script must be present in script grid.
scriptfile(String)
BooleanScriptStop
Misc.ScriptStop(scriptfile)Stop a script by file name, Script must be present in script grid.
scriptfile(String): Name of the script.
VoidScriptStopAll
Misc.ScriptStopAll(skipCurrent)Stop all script running.
skipCurrent(Boolean): True: Stop all scripts, but the current one - False: stop all scripts. (Default: false)
VoidScriptSuspend
Misc.ScriptSuspend(scriptfile)Suspend a script by file name, Script must be present in script grid.
scriptfile(String): Name of the script.
VoidSendMessage
Misc.SendMessage(msg, color, wait)Send a message to the client.
msg(String): The object to print.color(Int32): Color of the message.wait(Boolean): True: Wait for confirmation. - False: Returns instantly.
VoidSendToClient
Misc.SendToClient(keys)Send to the client a list of keystrokes. Can contain control characters: - Send Control+Key: ctrl+u: ^u - Send ENTER: {Enter} Note: some keys don't work with ClassicUO (es: {Enter} )
keys(String): List of keys.
VoidShardName
Misc.ShardName()Get the name of the shard.
StringUnIgnoreObject
Misc.UnIgnoreObject(serial)Remove object from ignore list. Can remove serial, items or mobiles
serial(Int32): Serial to unignore.
VoidUseContextMenu
Misc.UseContextMenu(serial, choice, delay)Open and click the option of Context menu, given the serial of Mobile or Item, via packets.
serial(Int32): Serial of the Item or Mobile.choice(String): Option as Text or integer.delay(Int32): Maximum wait for the action to complete.
BooleanWaitForContext
Misc.WaitForContext(serial, delay, showContext)Return the List entry of a Context menu, of Mobile or Item objects. The function will ask the server for the List and wait for a maximum amount of time.
serial(Int32): Serial of the entity.delay(Int32): Maximum wait.showContext(Boolean): Show context menu in-game. (default: True)
List[Misc.Context]WaitForMenu
Misc.WaitForMenu(delay)Pause script until server send an Old Menu, for a maximum amount of time.
delay(Int32): Maximum wait, in milliseconds.
BooleanWaitForPrompt
Misc.WaitForPrompt(delay)Wait for a prompt for a maximum amount of time.
delay(Int32): Maximum wait time.
BooleanWaitForQueryString
Misc.WaitForQueryString(delay)Pause script until server send query string request, for a maximum amount of time.
delay(Int32): Maximum wait, in milliseconds.
Boolean