Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
hogarius
Adept


Joined: 29 Jan 2003
Posts: 221
Location: islands.genesismuds.org

PostPosted: Mon Mar 05, 2007 2:09 am   

Simutronics RoundTime gauge for CMUD [NOTE: long post]
 
I've seen several requests for a CMUD version of the DragonRealms and/or GemStone roundtime gauge (button) that's been previously posted for ZMUD. This is what I've come up with for Modus Operandi. Perhaps others can adapt it for the other Simu games. It seems to be accurate within about a second or so, but I make no guarantees.
I'm not going to try to list the information in command-line format, but will explain how I've entered the info into the GUI Package Editor, accessed by clicking the "Settings" button at the top of the main CMUD screen.


First, the button itself. Create a New Button, and fill in the fields as follows:

Script Text tab:
Enabled checkbox: [checked]
Name: R.T.: @roundtime
Type: Gauge
Script: (leave blank)

Options tab:
Variable: (leave blank)
Value: @roundtime
Tool tip: (leave blank)
ID: Roundtime
Priority: (see note below)
Size: Auto Size checkbox: [unchecked], Width: 200, Height: 24
Image on Left checkbox: [unchecked], Image Name: (leave blank), Image Margin: (leave blank)
Position: Auto Position checkbox: [checked] (see note below), Toolbar: 1
checkboxes: Show on session toolbar is only one checked
Button color: (select Dark Red)
Text color: (select Magenta)
NOTE: The Priority setting with the Auto Position checkbox checked determines the position on the toolbar, along with the Priority settings on other buttons. You can also uncheck the Auto Position checkbox and use the Left, Top and Toolbar fields to determine the position.

Gauge Tab:
Value: @roundtime
Max: @roundmax
Low: 0
Gauge color: (set to Dark Red)
Low warning color: (set to Black)
Gauge background color: (set to Black)

Save your changes, and your button should be set up.


Now, to set up some variables. Create a new variable for each of the following, and click the Save Changes button after you set up each one.

Name: roundmax; Value: (no need to set an initial value); Type: Integer; Default: (leave blank); Use Default checkbox: [unchecked]
Name: roundtime; Value: 0; Type: Integer; Default: 0; Use Default checkbox: [checked]
Name: InvestTime; Value: (no need to set an initial value); Type: Integer; Default: (leave blank); Use Default checkbox: [unchecked] (NOTE: This variable is used in Modus for sampling for lab tests. The sampling procedure does not use the typical GSL roundtime routines.)


Now for the triggers. First, here is the Alarm trigger that makes the gauge count down when a roundtime is incurred. When it gets to 0, it turns itself off. Begin by creating a New Trigger in the Package Editor.

Enabled checkbox: [unchecked]
Pattern: 1 (NOTE: this makes the trigger fire every second when it's activated.)
Script: roundtime=@roundtime-1;#if (@roundtime<0) {roundtime=0;#T- ClockTrigger}
Type: Alarm
ID: ClockTrigger
checkboxes: Trigger on Trigger [checked]; all others [unchecked]
Priority: (does not matter)
(click the Save Changes button when you have entered this information.)


This Expression Trigger is a backup to turn off ClockTrigger, in case it does not turn itself off at the end of the roundtime. Begin by creating a New Trigger in the Package Editor.

Enabled checkbox: [checked]
Pattern: @roundtime=0
Script: roundtime=0;#T- ClockTrigger
Type: Expression
checkboxes: Trigger on Trigger: [checked]; other checkboxes: [unchecked]
Priority: (does not matter)
(click the Save Changes button when you have entered this information.)


This trigger and subtrigger (2nd state for the first trigger) are what use GSL(Q) and GSL(q) to determine roundtimes in most cases. GSL(q) is a timer that increments by one each second. GSL(Q) indicates when the end of roundtime is reached. The trigger loads these values into @roundmax and @roundtime and activates the ClockTrigger alarm trigger. Begin by creating a New Trigger in the Package Editor.

Enabled checkbox: [checked]
Pattern: Q (NOTE: Be sure this is a capital Q)
Script: (leave blank)
Type: GSL
checkboxes: Case Sensitive: [checked]; Trigger on Trigger: [checked]; Trigger on New Line: [checked]; other checkboxes: [unchecked]
Priority: (does not matter, but see the GSL(q) trigger below)

Click the Save Changes button when you have entered this information. While the Q trigger in the left column is still highlighted, create a New Trigger State.

Enabled checkbox: [checked]
Pattern: q (NOTE: Be sure this is a lower-case q)
Script: roundmax=%gsl(Q)-%gsl(q);roundtime=@roundmax;#T+ ClockTrigger
Type: GSL
checkboxes: Case Sensitive: [checked]; Trigger on Trigger: [checked]; Trigger on Prompt: [checked]; other checkboxes: [unchecked]
Priority: (next number after GSL(Q) trigger. For example, I have the priority for the GSL(Q) trigger set to 967, and the priority for the GSL(q) trigger set to 968.)


Sometimes the GSL(Q)-GSL(q) equation does not figure the roundtime correctly. If Modus sends a message to the screen saying how much roundtime there is, the following trigger adjusts @roundmax accordingly. Begin by creating a New Trigger in the Package Editor.

Enabled checkbox: [checked]
Pattern: ^Roundtime: %d{roundmax} sec
Script: (leave blank)
Type: Pattern
checkboxes: Trigger on Trigger: [checked]; Trigger on Newline: [checked]; other checkboxes: [unchecked]
Priority: (does not matter)


Finally, if you try to send a command to the Modus server before the roundtime is up, Modus will respond by sending back a message telling you how much roundtime is left. The following trigger uses this message to update and self-correct the timer. Begin by creating a New Trigger in the Package Editor.

Enabled checkbox: [checked]
Pattern: ^...wait &%d{roundtime} sec
Script: (leave blank)
Type: Pattern
checkboxes: Trigger on Trigger: [checked]; Trigger on Newline: [checked]; other checkboxes: [unchecked]
Priority: (does not matter)


I'm pretty sure DR and GS4 players will need to make some adjustments to the above information, but this should be a good start for you.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net