PHP code example of alvin0319 / libnpcdialogue
1. Go to this page and download the library: Download alvin0319/libnpcdialogue library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alvin0319 / libnpcdialogue example snippets
$npcDialogue = new NpcDialogue();
$npcDialogue->addButton(NpcDialogueButtonData::create()
->setName("Test")
->setText("Test123")
->setClickHandler(function(Player $player) : void{
$player->sendMessage("Hello world!");
})
->setForceCloseOnClick(true)
);
$npcDialogue->setNpcName("Test NPC");
$npcDialogue->setDialogueBody("Test Body");
$npcDialogue->setSceneName("TEST");
$npcDialogue->sendTo($sender);