Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Waiting for input

$
0
0
Hey everyone.

I'm developing a game server for a game client and I needed a scripting interface to use for NPCs, so I tried using ClearScript, however I came into an issue.

First, here's an example of a NPC script:
character.SendNext("Welcome, press next to proceed.");
character.SendNext("Good! Now, press next again.");
bool yes = character.SendYesNo("Do you like it?");

if (yes) {
      character.SendOk("Good!");
} else {
     character.SendOk("Okay!");
}
When you click on a NPC in the game, the client sends a packet with the NPC id, and then the server knows which script to execute. Once it executes the script, I want the script to be able to wait for the user input. So, after it executes "character.SendNext", I want to script to halt and wait until an input has been given.

Once the user clicks the next button, the client sends another packet. Once that packet is received, I want to resume the script depending on the packet's value.

How can that be achieved?

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>