Files

68 lines
1.9 KiB
Markdown

# IScriptPlayer.stopSound
[← IScriptPlayer](index.md) · [← Master](../../wiki.md)
Parça 10/11 · [önceki](stopSound-9.md) · [sonraki](stopSound-11.md)
Get entity's quests (if it has some, only players have quests).
// Assuming that c.getSubject() is a player
var quests = c.getSubject().getQuests();
if (!quests.has("important_quest"))
{
c.getSubject().send("I think you should complete the main quest chain before attempting side quests...");
}
openUI
default void openUI(IMappetUIBuilder builder)
Open UI for this player.
function main(c)
{
var ui = mappet.createUI().background();
var button = ui.button("Push me").id("button");
// Place a button in the middle of the screen
button.rxy(0.5, 0.5).wh(80, 20).anchor(0.5);
c.getSubject().openUI(ui);
}
openUI
boolean openUI(IMappetUIBuilder builder,
boolean defaultData)
Open UI for this player with default data populated.
By default, default data population is disabled, meaning that once the UI was opened, UI context's data
will be empty. By enabling default data population, UI context's data gets filled with all component's
default data.
This is useful when you need to data to be present in the handler at start, so you wouldn't need to do extra
checks.
function main(c)
{
var ui = mappet.createUI(c, "handler").background();
var button = ui.button("Push me").id("button");
var name = ui.textbox("John").id("name");
var lastname = ui.textbox("Smith").id("lastname");
// Place a button in the middle of the screen
button.rxy(0.5, 0.5).wh(80, 20).anchor(0.5);
name.rx(0.5).ry(0.5, 25).wh(80, 20).anchor(0.5);
lastname.rx(0.5).ry(0.5, 50).wh(80, 20).anchor(0.5);
// Open the UI with default data populated
c.getSubject().openUI(ui, true);
}
function handler(c)
{
var uiContext = c.getSubject().getUIContext();