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
martym
Newbie


Joined: 10 Mar 2008
Posts: 7

PostPosted: Sun May 22, 2011 3:19 am   

Status window showing code not required data
 
Using CMUD 3.34. So I found a script in XML that closely matches what I was starting to work on. I thought great, now I can get back to doing something else (I am ok at coding, and fixing errors but writing from scratch is not my forte). Anyway I import the XML file and open the status window and I get the following:


Code:

Quota%if((%alarm(Quota)/1000)<1800 AND @QuotaStatus!=Complete OR @QuotaStatus=Unchecked, , )(@QuotaStatus): [$@CurrentQuota/$@MaxQuota]~(%if(@CurrentQuota<((@MaxQuota-100)/%float(4)),,
)%round(@CurrentQuota/%float(@MaxQuota)*100)~%~) {$%format(2,%eval(@MaxQuota-@CurrentQuota))} ~[%mod( %alarm(Quota)/1000/3600, 24)h:%mod( %alarm(Quota)/1000/60, 60)m:%mod( %alarm(Quota)/1000, 60)s~]


all in pretty colours. I would really like to get this thing to work but I can find nothing obviously wrong and all the checks come back OK, all the settings suggested for CMUD and the mud suggested by the author, MXP Menus and MXP status window, default characters in Cmud are set correctly, the status just does not display right.

Here is the XML I imported. Note that you really need to be in Discworld mud (and a thief) to read the license information.

Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <class name="Quota">
    <trigger priority="62292">
      <pattern>^You still have (%d) hour{s|}, (%d) minute{s|}, (%d) second{s|} left this quota period.$</pattern>
      <value>#VAR QuotaTime (%1*3600)+(%2*60)+(%3)
#ALARM "Quota" {+@QuotaTime} {
#ECHO Quota is ready to reset!
} Quota</value>
    </trigger>
    <var name="QuotaTime">36254</var>
    <stat name="Quota" showinbar="false" showinwindow="true" priority="62110">
      <value><![CDATA[
<color orange>Quota</color>%if((%alarm(Quota)/1000)<1800 AND @QuotaStatus!=Complete OR @QuotaStatus=Unchecked, <color red>, <color orange>)(@QuotaStatus)</color><color orange>:</color> <color lime>[</color><color yellow>$@CurrentQuota</color><color lime>/<color><color orange>$@MaxQuota</color><color lime>]</color><color lime>~(</color>%if(@CurrentQuota<((@MaxQuota-100)/%float(4)),<color red>,<color orange>)%round(@CurrentQuota/%float(@MaxQuota)*100)~%</color><color lime>~)</color> <color darkred>{$%format(2,%eval(@MaxQuota-@CurrentQuota))}</color> <color white>~[</color><color yellow>%mod( %alarm(Quota)/1000/3600, 24)h</color><color white>:</color><color yellow>%mod( %alarm(Quota)/1000/60, 60)m</color><color white>:</color><color yellow>%mod( %alarm(Quota)/1000, 60)s</color><color white>~]</color>]]></value>
    </stat>
    <var name="QuotaStatus">Complete</var>
    <trigger priority="62130">
      <pattern>^You haven't stolen enough to reach your quota yet.$</pattern>
      <value>#VAR QuotaStatus Incomplete</value>
    </trigger>
    <trigger priority="62140">
      <pattern>^You still have to pay the guild to reach your quota.$</pattern>
      <value>#VAR QuotaStatus Partial</value>
    </trigger>
    <trigger priority="62141">
      <pattern>^You have reached and paid your quota this period.$</pattern>
      <value>#VAR QuotaStatus Complete</value>
    </trigger>
    <trigger priority="62293">
      <pattern>^You still have (%d) hour{s|} left this quota period.$</pattern>
      <value>#VAR QuotaTime (%1*3600)
#ALARM "Quota" {+@QuotaTime} {
#ECHO Quota is ready to reset!
} Quota</value>
    </trigger>
    <event event="onConnect" priority="63060">
      <value>#VAR QuotaStatus Unchecked</value>
    </event>
    <trigger priority="63390">
      <pattern>^You still have (%d) minute{s|}, (%d) second{s|} left this quota period.$</pattern>
      <value>#VAR QuotaTime (%1*60)+(%1)
#ALARM "Quota" {+@QuotaTime} {
#ECHO Quota is ready to reset!
} Quota</value>
    </trigger>
    <trigger priority="64890">
      <pattern>^You still have (%d) hour{s|}, (%d) second{s|} left this quota period.$</pattern>
      <value>#VAR QuotaTime (%1*3600)+(%2)
#ALARM "Quota" {+@QuotaTime} {
#ECHO Quota is ready to reset!
} Quota</value>
    </trigger>
    <trigger priority="67410">
      <pattern>^A shadowy character sneaks up beside you, makes some marks in a leatherbound ledger, and slips silently away.$</pattern>
      <value>#VAR QuotaTime (12*3600)
#ALARM "Quota" {+@QuotaTime} {
#ECHO Quota is ready to reset!
} Quota
#VAR QuotaStatus Incomplete
#VAR CurrentQuota 0</value>
    </trigger>
    <trigger priority="64890">
      <pattern>^You still have (%d) hour{s|}, (%d) minutes{s|} left this quota period.$</pattern>
      <value>#VAR QuotaTime (%1*3600)+(%2*60)
#ALARM "Quota" {+@QuotaTime} {
#ECHO Quota is ready to reset!
} Quota</value>
    </trigger>
    <trigger priority="84590">
      <pattern>^People have brought receipts to the guild, with the following value:</pattern>
      <trigger>
        <pattern>A~$%1.</pattern>
        <value>#VAR CurrentQuota %1</value>
      </trigger>
    </trigger>
    <var name="CurrentQuota">124.15</var>
    <var name="MaxQuota">320</var>
    <trigger priority="86560">
      <pattern>^Maximum Quota: A~$%1.</pattern>
      <value>#VAR MaxQuota %1</value>
    </trigger>
    <trigger priority="62291">
      <pattern>^You have reached and paid your minimum quota this period but still have some outstanding debt to settle.$</pattern>
      <value>#VAR QuotaStatus Partial</value>
    </trigger>
    <trigger name="Quota" type="Alarm" priority="91970">
      <pattern>+@QuotaTime</pattern>
      <value>#ECHO Quota is ready to reset!</value>
    </trigger>
  </class>
</cmud>
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Sun May 22, 2011 9:04 pm   
 
Could you tell us exactly how you imported this code?
Reply with quote
martym
Newbie


Joined: 10 Mar 2008
Posts: 7

PostPosted: Sun May 22, 2011 10:37 pm   
 
File import xml from the trigger screen. I had downloaded the file from another site.
Reply with quote
martym
Newbie


Joined: 10 Mar 2008
Posts: 7

PostPosted: Mon May 23, 2011 1:25 am   
 
These are the notes on the site from which the script was downloaded:

The .xml files on each page can be imported by opening the Package Editor, then File > Import XML.
If it is a Status Window Script, you will need to open the status window to view it, which can be done from your main cmud session in the menu Window > Status Window.
A lot of my scripts use MXP. You'll want to check your options under the MXP section to make sure it is enabled. This includes the 'Allow commands in MXP menus' and 'Allow MXP in Status Window'.
Also many of my scripts require the mud prompt (options output prompt=on) to work correctly.
Most of my scripts will need your special characters set to defaults. Go to Options > General > Scripting > Special Characters. You can click to reset button to set them back to normal.

I verified each of the above and then imported the script as the first line indicates.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon May 23, 2011 2:21 am   
 
Got any examples of what it's supposed to look like? Code is hard enough to read when it works correctly, and obviously this isn't correctly-working code.

Quote:

%if(@CurrentQuota<((@MaxQuota-100)/%float(4)),,)


This part doesn't make sense, it's not doing anything at all for either the true condition or the false condition.
_________________
EDIT: I didn't like my old signature
Reply with quote
martym
Newbie


Joined: 10 Mar 2008
Posts: 7

PostPosted: Mon May 23, 2011 2:29 am   
 
From the page I got it from, I sent a message to him but have not heard back. I have not seen it in action but I believe that the bold section is close to what it should look like. This is from the page where I downloaded the script:

========================================================================================================================
This is a Status Window script.

Quota(Complete): [$200/$500](40%) {$300} [7h:20m:1s]

I have updated this with more information goodness.
Quota(Complete/Incomplete status): [$Current amount on quota/$Max quota](Percent of max quota stolen) {Amount left you can steal} [hours:minutes:seconds remaining on quota]

It'll keep track of whether or not you have reached and paid your quota, as well as the time remaining until the current quota period ends.
All you have to do is 'read quota' and it will get the data it needs.
It displays Incomplete if you have not reached your quota, Partial if you have reached but not paid your quota, and Complete if you have reached and paid your quota.
It will display the (Status) in bright red if your remaining quota time is under 30 minutes AND you have not reached and paid your quota, otherwise it will be in orange.
It will also send an #ECHO when it expires for those of you that like to try to roll yourself over to the next period as soon as possible.

Just as the Complete/Incomplete part changes color based on status and time left, the (Percent%) part will be red if you are still under your minimum quota.
Please note that it will not go from red to orange at 25%. It shows your percent of MAX quota.
So in the example above with guild level 400 the percent would go from red to orange at $100 stolen, or 20% of your maximum quota.
Basically you hit minimum quota at (GuildLevel/(GuildLevel+100)*25) percent of your maximum quota!
For anyone who cares, this number actually would go from red at 24% to orange at 25% at guild level 4900 (your minimum would be 24.5% of the maximum and it would round)!

One thing to keep in mind. This uses an #ALARM, which ticks anytime you're online. If you disconnect, next time you connect it will reset to it's original time.
You can fix this by simply reading your quota again.

Added an onConnect event to change the status to Unchecked, which will appear in red, to remind you to check your quota to correct the timer.
========================================================================================================

Other portions work as expected, I get notifications an hour before and a minute or two before my quota expires
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