Skip to content
NP Editor Docs

Tutorial: your first script — welcome message on join

Build a rule that greets players in chat when they join the server, in two ways with the Logic graph (Blueprints), and check the result in editor Play.

PartWhat you buildText in the chat (editor Play)
Part 1When a player joins → Chat message (replaces {player} in the text)“Welcome, player!”
Part 2When a player joins → Get player property (name) → Text operation (joins text with concat) → Chat message“Hello, player!”

In editor Play, the moment your body appears counts as “When a player joins”, and the body’s name is player. On a real server, the Minecraft name of the player who joined is used.

Preparation: open a world with ground to walk on in Play. The screenshots in this tutorial were taken with the sample world castle.npworld (in the samples folder of the install folder). To give the logic graph more room, the “Left area”, “Top right area” and “Bottom right area” checks in the Window menu are off, and the details area on the left is hidden with the ⚙ (details) button on the logic graph toolbar.

  1. Click Tools > Logic graph. The Logic graph tab opens in the bottom dock area.

    The Logic graph tab opened from the Tools menu

  2. Right-click an empty spot in the graph. When the Add node window opens, type join in the search box. When a player joins appears in the list.

    join typed in the search box of the Add node window

  3. Click When a player joins. A red event node (a new rule) appears. On its right are a white exec pin and the Player and First join value pins.

    The When a player joins event node

  4. Drag the white exec pin on the right of the event node and drop it on an empty spot. In the window that opens (“Connects after this” — shows only the nodes that can come after it), type chat in the search box and click Chat message. The node appears where you dropped the wire and connects to the event.

    Picking Chat message from the list opened by dropping the exec pin

  5. Type Welcome, {player}! in the Text field of the Chat message node. Leave To whom at its default (the triggering player). Check passed appears on the right of the toolbar.

    Welcome, {player}! typed in the Text field, with Check passed shown

  6. Click the ▶ (Play) button in the middle of the toolbar. The rule runs as the body appears, and “Welcome, player!” appears in the chat at the bottom left of the viewport.

    The chat line Welcome, player! at the bottom left of the Play view

  7. Press Esc to stop Play.

  1. Click the eye button in the header of the Part 1 event node to turn the rule off. A rule that is off is dimmed and does not run in Play or on the server (it is not deleted, so you can turn it back on).

    The rule turned off with the eye button in the event node header

  2. As in steps 2–3, right-click an empty spot in the graph and create another When a player joins event.

  3. Drag the Player pin (blue circle) of the new event node and drop it on an empty spot. In the window that shows only the nodes that take that value, type property and click Get player property.

    Picking Get player property from the list opened by dropping the Player pin

  4. Check that the Player field of the new node is wired to the event’s Player pin (← player) and that Properties is Display name (name). The name comes out of the Values pin on the right of the node (Result variable p1).

    The Player and Properties fields of the Get player property node

  5. Drag the Values pin and drop it on an empty spot, type text operation in the search box, then click Text operation. A node with Calculate set to concat (A + B + C) appears, and the value is first wired to field A (Result variable t1).

    Picking Text operation from the list opened by dropping the value pin

  6. Drag the Values pin to the pin of field B on the Text operation node. The name goes in the middle (B).

    The value pin wired to field B

  7. Click the World logic tab. This rule is selected in the list (“Sync with list” in the logic graph). Type Hello, (with one trailing space) in field A of the Text operation card.

    Hello, typed in field A of the Text operation card in the World logic tab

    In the 0.11.0 logic graph, too, you cannot turn a wired field back into a direct input field. Clicking the “Detach variable” button next to the field wires field A back to its default {player}. In the World logic tab, which shows the same rule, you can edit every field as text.

  8. Click the Logic graph tab and type ! in field C of the Text operation node. Field A shows the text you entered in step 14.

    Fields A, B and C of the Text operation node

  9. Drag the white exec pin of the Text operation node and drop it on an empty spot, type chat in the search box, then click Chat message.

    Picking Chat message by dropping the Text operation exec pin

    If you drop the Result pin on an empty spot and pick Chat message, 0.11.0 also wires the result to the hidden “Reference actor” field instead of the Text field (the text stays empty and the check fails). That is why you add the node from the exec pin and wire the result to the Text field yourself in the next step.

  10. Drag the Result pin of the Text operation to the pin of the Text field on the Chat message. The Text field becomes ← t1.

    The Result pin wired to the Text field of the Chat message

  11. Check that the chain runs When a player joins → Get player property → Text operation → Chat message and that Check passed appears on the toolbar.

    The finished Part 2 rule and Check passed

  12. Click the ▶ (Play) button. “Hello, player!” appears in the chat. The Part 1 rule is off, so “Welcome, …” does not appear.

    The chat line "Hello, player!" in the Play view

  13. Press Esc to stop Play. Everything changed during Play returns to its original state.

  • To insert only the name, drag the event’s Player pin straight to the pin of the Chat message Text field, without a break-out node. Pick “Player name → Text” in the “How should … go into …?” menu, and the Text field becomes {player|name} (one undo cancels it).
  • {name} in a text field is replaced with its value at run time. {player} = the triggering player’s name, {p1} · {t1} = the results of earlier nodes. That is why one text (Part 1) and a chain of nodes (Part 2) give the same result.
  • A rule turned off with the eye button, like the Part 1 rule, can stay in place without being deleted. Use this to alternate between two approaches while testing.
  • The log in the World logic tab keeps the rules fired during Play and the “Chat …” lines (bottom left of the step 14 screenshot).

These steps happen outside the editor (game server · Minecraft client), so there are no screenshots.

  1. Prepare a game server: Paper 1.21 or later, Java 21. Put the server plugin NPBridge 2.4.0 in the server’s plugins folder. The NPBridge jar is in the editor install folder (%LOCALAPPDATA%\Programs\NP Editor\server\NPBridge.jar). Detailed installation is in Installing NPBridge (server admins).
  2. Upload the rules to the server. Use one of the following.
    • Live connection: when you connect the editor to the server (NPBridge default port 25590), every rule edit goes to the server immediately — Server connection (live).
    • Scene export: build an .npbuild (including scene.json) that contains the rules and install it on the server — Export and import.
  3. Join the server in Minecraft. If “Welcome, <your name>!” (Part 1) or “Hello, <your name>!” (Part 2) appears in the chat, it worked.
  • The server plugin is the version bundled with the editor (NPBridge 2.4.0). Logic that uses 0.10.2’s new flow nodes (Do Once · Flip Flop …) is not uploaded to servers older than NPBridge 2.0.8 — see “NPBridge 2.0.8” in Logic graph.
  • On the server, “When a player joins” runs when a player joins the server (scene), and the triggering player = the player who joined.
NodeGroupFields and pins used in this tutorial
When a player joins (join)Event · FlowingOutputs Player · First join
Chat message (message)Actions · ViewText · To whom
Get player property (player_get)Actions · PlayerPlayer · Properties · Result variable · output Values
Text operation (text)Actions · TextCalculate (concat) · A · B · C · Result variable · output Result