-
Notifications
You must be signed in to change notification settings - Fork 11
Server settings
Server settings is a panel in Mappet's dashboard that allows to configure global per-world Mappet options. At the moment, you can edit trigger hotkeys, global triggers and global and player states. The panel looks like this:
Global triggers allow map makers to attach triggers to specific events that will happen in the world (or on the server). Some global triggers may pass additional data to events, dialogues or scripts. Here is the list of global triggers that is available in Mappet:
- Block: broken by player
- Block: clicked by player
- Block: interacted by player
- Block: placed by player
- Entity: death
- Entity: hurt
- Player: chat
- Player: closed container
- Player: death
- Player: left click (air)
- Player: logged in
- Player: opened journal
- Player: picked up an item
- Player: respawn
- Player: right click (air)
- Server: loaded
- Server: ticking
For more information about the available variables, cancelability, and tips, check the documentation included within global triggers panel.
Some of these global triggers can be canceled, as you can figure out from the description of the global trigger. To cancel a global trigger, you need to either add a Cancel node to the event, and that node must be executed, or call IScriptEvent.cancel()
from a script:
function main(e)
{
e.cancel();
}
Trigger hotkeys are kind like global triggers, but they are designed to triggered when player presses a key. For example, if you want to make spells, you can create a couple of scripts/events and bind them to Y
, U
, I
, and O
keys.
To edit hotkeys, simply press on the icon button (that looks like ⬆), and the Trigger hotkey editor will show up. To add a trigger hotkey, right click on the left part of the screen and Add a trigger hotkey. An editor like this will show up:
Everything there should be straight forward:
- Click under Keybind label (on None label), and you'd be able to set a single key that will trigger the triggers
- Edit triggers... allows you to setup trigger blocks that will be executed when a player will press a key
- Toggle mode toggles ability to receive additional trigger that determines whether hotkey was pressed or released
- Checker under Enabled label allows you to setup an expression or condition under which triggers will be triggered
When toggle mode is enabled, it allows for trigger hotkeys to be triggered twice: once the hotkey was pressed, and another time when it was released. This feature allows map makers to implement features like charging something, grabbing some objects and then letting it go afterwards, etc.
When toggle mode was enabled, you can detect whether the key was pressed or released using down
variable. When it's 1
, it was pressed. When it's 0
, it was released. Here is an example of detecting it with a script:
function main(e)
{
var down = e.getValue("down");
if (down)
{
e.send("The key was pressed down.");
}
else
{
e.send("The key was released.");
}
}
Hotkey triggers also include key
variable into the trigger context, which is the LWJGL keycode of the pressed/released key by a client. For full list, see this page. Using this trigger context variable, you can use it in scripts/events to handle multiple keycodes into a single place. Consider following script:
function main(e)
{
var key = e.getValue("key");
var player = e.getPlayer();
if (key === 32) // D
{
e.send(player.getName() + " pressed D");
}
else if (key === 45) // X
{
e.send(player.getName() + " pressed X");
}
}
It would work only if you attached two hotkey triggers to D
and X
keys to the same script.
The states editor on the left allows you to edit server (global) and player states. Here is how it looks like:
Here is a break down of GUI elements that are shown above. 🔎 icon allows to open an overlay that will let you choose whose states can be edited. ~
is server's states, and separate player usernames are, obviously, player states. Once you pick whose states you'll be editing, you can add new states using ➕ icon button.
After a new row will be added, there will be 4 different fields:
- State's key, it can't be duplicate of another state's key. If you input a duplicate, then it will ignore the key change and will light up red.
- Upon clicking, it changes state's value type between a number and a string type.
- State's value.
- Upon clicking, it removes this state from the states list.
When editing state's key, make sure you don't leave it empty or have a same name as another state. It will turn red if the state's key you inputted is invalid.
If parts of the wiki don't make sense with Mappet's latest version, or you weren't able to recreate examples (i.e. outdated information), feel free to report the page and section that is out of date on community's Discord server (make sure to mention which Mappet’s version did you use).