Miscellaneous APIs
Functions
setclipboard
bool setclipboard(data: string | number | Instance | table)
Copies a string or Instance or table of Instances to the clipboard. Returns true on success.
setfflag
bool setfflag(fflag: string, value: string)
Sets FFlag fflag to value. Returns false if the flag doesn't exist or couldn't be set.
identifyexecutor
(string, string) identifyexecutor()
Returns "Synapse X" and version string.
unlockmodulescript
void unlockmodulescript(module: ModuleScript)
"Unlocks" module such that code running at different contexts (e.g. level 2 vs level 7) return the same values when required.
require
any require(module: ModuleScript)
This function replaces the game's require to allow for requiring game modules from higher contexts of script execution, like the one in which Synapse scripts run.
messagebox
int messagebox(text: string, caption?: string, type?: int) [yields]
A wrapper around Microsoft's MessageBoxA.
setwindowtitle
void setwindowtitle(text: string)
Sets the title of the game window. A wrapper around Microsoft's SetWindowTextA.
setwindowicon
void setwindowicon(data: string?)
Sets the icon of the game window.
gethui
Instance gethui()
Returns a protected container where GUIs can be hidden from detection by the game.
createuitab
void createuitab(title: string, contents: string, icon?: string)
Creates a tab in the external UI
newtable
table newtable(narray: number, nhash: number)
Creates a table with the specified array and hash sizes, then fills with random data.
Random data for hash part has random vector keys with X, Y, and Z values between 0 and 1 and false as a value. Random data for array part has false as a value.
This function is useful for creating tables with memory hidden to scripts. If you would like this feature, make sure narray is >= 33 and nhash is >= 17.
NOTE: To prevent table reallocation from exposing this memory, make sure you don't have fewer array/hash values!
cloneref
Instance cloneref(instance: Instance)
Clones a reference to an Instance. The Lua expression clone == instance will be false, but both values will point to the same Instance.
syn.queue_on_teleport
void syn.queue_on_teleport(script: string)
Queues script to be executed after the next teleport.
syn.clear_teleport_queue
void syn.clear_teleport_queue()
Removes all queued scripts from the teleport queue.
syn.get_thread_identity
int syn.get_thread_identity()
Returns the current thread's context level.
syn.set_thread_identity
void syn.set_thread_identity(identity: int)
Sets the current thread's context level.
syn.protect_gui
void syn.protect_gui(target: Instance)
protect_gui is deprecated. For backwards compatability, this function will cause target to be parented the return value of gethui() the next time it is parented.
syn.unprotect_gui
void syn.unprotect_gui(target: Instance)
unprotect_gui is deprecated. For backwards compatability, this function will disable the parent-redirection done by protect_gui.
syn.trampoline_call
(bool, ...any|string) syn.trampoline_call(target: function, call_stack: table, thread_options: table, ...any)
Proxy a call to a Lua function with the given call stack and thread options. call_stack is an array of tables, with each sub-table having fields described below.
The thread parameter allows you to preset the script, identity, and env fields with the values from that thread. This field is optional, and those fields can be overridden after the fact.
Note: These values do not need to correlate with actual information returned by debug.getinfo; they are fully customizable.
Note: The func parameter will override all other data you pass here aside from currentline!
| Call Stack Entry | Description |
|---|---|
| currentline | The currently executing line of code. |
| env | The function's environment. |
| source | The 'source' field returned by debug.getinfo. |
| name | The function's name. |
| numparams | The number of parameters in the function. |
| is_vararg | Whether this function takes variadic arguments. |
| func | A function to copy all information from. |
| Thread Option Entry | Description |
|---|---|
| script | The script attached to the thread. |
| identity | The identity of the new state. |
| env | The global environment of the new thread. |
| thread | A thread used as the parent. |
syn.toast_notification
void syn.toast_notification(options: table)
Displays a toast notification in the internal UI. The options table follows the following format:
| Option | Description | Default |
|---|---|---|
| Type | ToastType enum | Required |
| Duration | How long the notification should last, in seconds | 5 |
| Title | The notification's title | Required |
| Content | The notification's content | Required |
| IconColor | Overrides the icon color | Varies by Type |
syn.ipc_send
void syn.ipc_send(data: any)
Sends data to the UI.