Skip to content

JsMacros Functions

wagyourtail edited this page Sep 1, 2020 · 25 revisions

the JsMacros functions are:

getProfile()

Example: jsmacros.getProfile()

returns the main instance of the xyz.wagyourtail.jsmacros.profile.Profile class.

getConfig()

Example: jsmacros.getConfig()

returns the main instance of the xyz.wagyourtail.jsmacros.config.ConfigManager class.

getRunningThreads() 1.0.5+

Example: jsmacros.getRunningThreads()

returns a Map<RawMacro, ArrayList<RunScript$thread>>.

  • pre-1.1.2 Thread instead of RunScript$thread

RunScript$thread looks like

class thread {
    t, //Thread
    m, //RawMacro
    startTime, //Long
}

mcVersion() 1.1.2+

Example: jsmacros.mcVersion()

returns a string of the Minecraft Version.

runScript(String [, Consumer<String>]) 1.1.5+

Example: jsmacros.runScript("./test.js", (err) => {console.log(err);});

runs a script file completely independent of the current script. callback not neccecairy, but could be useful.

runScript(String, String [, Consumer<String>]) 1.2.4+

Example: jsmacros.runScript(extension, scriptstring, callback);

runs a script completely independent of the current script. callback not neccecairy, but could be useful.

getGameOptions() 1.1.7+

Example: jsmacros.getGameOptions()

returns an OptionsHelper

open(String) 1.1.8+

Example: jsmacros.open("http://github.com")

opens a URI externally. (file:// will have it open with default for filetype)

getFPS() 1.2.0+

Example: jsmacros.getFPS()

returns a string that includes the FPS (as well as some other related things).

on(String, BiConsumer<String, Map<String, Object>>) 1.2.3+

Example: jsmacros.on(eventName, callbackFn)

this will trigger the callback function on the event. returns an IEventListener (you should hold onto this to remove your event listener)

once(String, BiConsumer<String, Map<String, Object>>) 1.2.3+

Example: jsmacros.once(eventName, callbackFn)

this will trigger the callback function on the next call to the event. returns an IEventListener

off ([String,] IEventListener) 1.2.3+

Example: jsmacros.off(eventName, eventListener)

removes an active listener. returns true if listener was present.

connect(String [, Int]) 1.2.3+

Example: jsmacros.connect(ip, port)

connect to a server.

disconnect() 1.2.3+

Example: jsmacros.disconnect()

disconnects from a server.

waitTick([int]) 1.2.4+

Example: jsmacros.waitTick(ticks)

  • ticks is 1.2.6+

Waits for the next minecraft tick. For when you need to just wait to the next tick, not a fixed length of time.

Clone this wiki locally