@casual-simulation/aux-custom-portals
Advanced tools
Changelog
V2.0.15
miniMapPortal
.
mapPortal
that works kinda like the miniGridPortal
..getMoreRecords()
was called.Changelog
V2.0.14
local
space to delete the oldest inst when localStorage is full.pointerPixelX
and pointerPixelY
tags to the gridPortalBot to track the mouse pointer position on the screen.dataURL
instead of data
that points to where the record can be downloaded from.os.getFocusPoint()
) would always return null data..getMoreRecords()
function did not work.Changelog
V2.0.13
allowAsynchronousScripts
to true
in the options object that is passed to os.createDebugger()
.function.mask().returns()
instead of function()
.
web.get()
function sends an actual web request based on the options that you give it. When testing we don't want to send a real web request (since that takes time and can fail), so instead we can mask it with the following code:web.get.mask('https://example.com').returns({
status: 200,
data: 'hello world!',
});
Then, the next time we call web.get()
with https://example.com
it will return the value we have set:
console.log(web.get('https://example.com));
allowAsychronousScripts
set to false
.web.get()
web.post()
web.hook()
webhook()
webhook.post()
os.showInput()
os.getRecords()
os.publishRecord()
os.destroyRecord()
os.requestPermanentAuthToken()
globalThis
are now separated per-debugger.
globalThis.myVariable = 123;
and it won't affect debuggers.tempLocal
bots for built-in portals.
gridPortalBot
, mapPortalBot
, etc. are available in debuggers.configBot
.
configBot
property in the options object that is passed to os.createDebugger()
.Changelog
V2.0.12
os.createDebugger(options?)
function.
os.createDebugger()
can be used to create a separate sandbox area where bots can be tested without causing external effects.create()
and getBots()
) that can be used like normal.
For example:
const debug = os.createDebugger();
const debugBot = debug.create({ home: true, color: 'red' });
Creates a bot that is contained in the debugger. Therefore, scripts on the debugBot
will only affect bots that were created in the debugger.assert(condition, message?)
and assertEqual(received, expected)
functions.
meetPortalAnchorPoint
to left
or right
would not shift the gridPortal
to the remaining space.Changelog
V2.0.11
server
to inst
.
configBot.tags.inst
instead of configBot.tags.server
.https://casualos.com?inst=my-aux
instead of https://casualos.com?server=my-aux
.server
with inst
on the first load so old links will continue to work.pagePortal
to gridPortal
pagePortal
with gridPortal
on first load (so old links will continue to work) but any scripts that change pagePortal
will need to be updated to change gridPortal
.pagePortal
on the configBot
should now be gridPortal
.pagePortalBot
is now gridPortalBot
.os.getCameraPosition('page')
-> os.getCameraPosition('grid')
os.getCameraRotation('page')
-> os.getCameraRotation('grid')
os.getFocusPoint('page')
-> os.getFocusPoint('grid')
os.getPortalDimension('page')
-> os.getPortalDimension('grid')
@onPortalChanged
now uses gridPortal
for that.portal
.miniPortal
to miniGridPortal
miniPortal
on the configBot
should now be miniGridPortal
.miniPortalBot
should now be miniGridPortalBot
.os.getCameraPosition('mini')
-> os.getCameraPosition('miniGrid')
os.getCameraRotation('mini')
-> os.getCameraRotation('miniGrid')
os.getFocusPoint('mini')
-> os.getFocusPoint('miniGrid')
os.getPortalDimension('mini')
-> os.getPortalDimension('miniGrid')
@onPortalChanged
now uses miniGridPortal
for that.portal
.os.downloadServer()
-> os.downloadInst()
os.loadServer()
-> os.loadInst()
os.unloadServer()
-> os.unloadInst()
os.getCurrentServer()
-> os.getCurrentInst()
server.remotes()
-> os.remotes()
server.serverRemoteCount()
-> os.remoteCount()
server.servers()
-> os.instances()
server.serverStatuses()
-> os.instStatuses()
server.restoreHistoryMarkToServer()
-> server.restoreHistoryMarkToInst()
.os
namespace from the server
namespace. This is because most server
functions do not work on CasualOS.com and are only designed to work with a server-based system (which CasualOS.com is not). To clarify this, functions that work all the time are now in the os
namespace while the others are in the server
namespace.@onServerJoined
-> @onInstJoined
@onServerLeave
-> @onInstLeave
@onServerStreaming
-> @onInstStreaming
@onServerStreamLost
-> @onInstStreamLost
@onServerAction
-> @onAnyAction
os.enablePointOfView(center?)
to take an additional argument that determines whether to use the device IMU to control the camera rotation while in POV mode.
os.enablePointOfView(center?, imu?)
.os.enablePointOfView(undefined, true)
will enable using the IMU for controlling the camera rotation.Changelog
V2.0.10
os.getRecords(...filters)
to use authBot.id
if byAuthID()
is not specified.labelOpacity
tag.menuItemLabelStyle
tag.auto
value in the scaleY
tag for menu bots. This automatically scales the menu bot height based on the amount of text in the label.os.focusOn()
by setting normalized
to false
in the rotation
property.
os.focusOn()
are normalized to between 0 and 2π
.normalized
to false
will skip this process and allow rotations larger than 2π
which in turn means the camera will rotate past 2π
.