Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - Event Handler/Queue Line

Author
Message
Mr909
11
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 11th Nov 2012 21:20
Yay!
So, with the help of nonZero, Phaelax, and Virtual Nomad here at the forums, I've managed to blend my prompt problem ("Command Prompt Only Working Sometimes?") with my array problem ("Array Compression Function?") To come up with this neat little event handler, the Queue line (I usually just call it the Q Line since the spelling of the full word makes my head hurt )

Essentially, each "trigger" in the queue system is one little event. So far they are:

2-Write a string to the "Prompter"
Attached String(att$)-Text to write to prompter
(This one works a little differently so that other commands later can write special, data-based strings to the prompter)
3- Wait
Parm1-Time in 30-tic increments
Latch 1- Allows ENTER to terminate prematurely
Latch 2- Only accepts ENTER to terminate it
16-Prompter Reset
(No parameters/latches)
Resets the prompter to it's default state, clearing the message and turning the prompter color white
77-Prompter Color Change
Parm1-Red Color
Parm2-Green Color
Parm3-Blue Color
Changes the color that the prompter prints to.

So, DEBUG shows the time ticker and the length count for the strings. At the moment, commands are limited to 20 characters by an arbitrary cap, remove it if you don't like it. TEST runs my test q, just a short little display of all the commands it can run so far. CLEAR PROMPT is a manual prompt clear, and I shouldn't have to tell you what EXIT does.

I'm going to use this as part of my message system as well as for triggers and other systems. It's going to write to three different prompts (Overhead prompt that prints character at a time for system events, character message "name-badge", and character message), play sounds, deal damage, and give items to players, among many other things. That's just a bit of inspiration for ya.

So go, play with it, tell me what you think. If you have a cool custom command that you find useful, put it here.

When writing custom queues, you don't have to just write to qline(20) and compress each time, but that's the way I've found convenient for the TEST. It would also be perfectly logical for the 6 part test to just write to 14-20 and then compress once.

Attachments

Login to view attachments
Mr909
11
Years of Service
User Offline
Joined: 2nd Jun 2012
Location:
Posted: 11th Nov 2012 22:04 Edited at: 11th Nov 2012 22:10
Okay, the "Print String" command was at 2 instead of 1 for a reason. Here's the code modifications necessary to use "Combo String", the main function for most RPG prompts. Essentially, it starts as an Event 2 "Print String" then turns into an Event 3 "Wait" when it's done.

Change the prompt updater/printer like so:


Place right above the Event 2 code:



EDIT: Here's the demo code. Just put this at the bottom and put "load_triggers(1)" before the main loop. Notice how much quicker it is than the original test.

Why divide events 1,2,and 3? Well, because 2 is going to be used for return prompts, where I don't WANT an appended wait, and 3 is going to be used for other functions that include waiting and that have all their own parameters/latches used up.

Login to post a reply

Server time is: 2024-02-26 02:00:46
Your offset time is: 2024-02-26 02:00:46