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
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Mon Mar 30, 2009 1:41 pm   

[3.05] %mud vs package
 
I am having a problem.
Recently i packaged up a class i made for distribution and discovered a flaw in my logic.

It seems that %mud.xp when used in a package is 0 instead of the mxp value.

How do i get it to see the value sent by the mud in this instance??

Code:
<module name="Discworld - XP Tracker" global="true">
  <uid>{0AE36500-E094-4034-8705-B0D6C3BA6350}</uid>
  <class name="Exp" id="1">
    <trigger priority="270" id="2">
      <pattern>You gain (%d)xp from teaching (%w)*.$</pattern>
      <value>$student=%2
$earned=%eval(%1+@teaching.$student)
#ADDKEY teaching {$student=$earned}</value>
    </trigger>
    <trigger name="expTracker" type="Alarm" priority="730" id="3">
      <pattern>*1:00</pattern>
      <value>$xp=%eval(%mud.xp - @xpStart + @xpSpent)
#VAR xpTrack {%additem($xp, @xpTrack)}</value>
    </trigger>
    <var name="xpStart" usedef="true" id="4">
      <value>83592</value>
      <default>0</default>
    </var>
    <var name="xpTrack" type="StringList" usedef="true" id="5">
      <value>0|-83592|-83592|-83592|-83592|-83592|84|-83592|-83592|-83592|-83592|-83592|84|-83592|-83592|-83592|-83592|-83592|282|-83592|-83592|-83592|-83592|-83592|282|-83592|-83592|-83592|-83592|-83592|282|-83592|-83592|-83592|-83592|-83592|282|-83592|-83592|-83592|-83592|-83592|282|-83592|-83592|-83592|-83592|-83592|282|-83592|-83592|-83592|-83592|-83592|282|-83592|-83592|-83592|-83592|-83592</value>
      <default>0</default>
    </var>
    <stat name="xpDisplay" showinbar="false" showinwindow="true" priority="790" id="6">
      <value>Total XP: %mud.xp
This Run: %eval(%mud.xp - @xpStart + @xpSpent)
Last 05 min: %eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 5)))
Last 10 min: %eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 10)))
Last 15 min: %eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 15)))
Last 30 min: %eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 30)))
Last 45 min: %eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 45)))
Last 60 min: %eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 60)))
Type 'reset' to initiate, or reset the tracker.</value>
    </stat>
    <trigger priority="800" id="7">
      <pattern>You start to teach yourself (*) for (%d) xp.$</pattern>
      <value>$learning=%1
#WAITFOR {You finish teaching yourself $learning} 180000
#ADD xpSpent %2</value>
      <trigger>
        <pattern>You finish teaching yourself (*).$</pattern>
        <value>#ADD xpSpent %t2</value>
      </trigger>
    </trigger>
    <alias name="xptotals" id="9">
      <value>$TotalXP=%eval(%mud.xp - @xpStart + @xpSpent)
$m5=%eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 5)))
$m10=%eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 10)))
$m15=%eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 15)))
$m30=%eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 30)))
$m45=%eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 45)))
$m60=%eval(%item(@xpTrack, %numitems(@xpTrack)) - %item(@xpTrack, %eval(%numitems(@xpTrack) - 60)))

#SAY Last 5: $m5, 10: $m10, 15: $m15, 30: $m30, 45: $m45, 60: $m60, TOT: $TotalXP</value>
    </alias>
    <trigger priority="1" id="10">
      <pattern>^(*) starts to teach you (*) for (%d) xp.$</pattern>
      <trigger>
        <pattern>You finish learning (*) from (*).$</pattern>
        <value>#IF (%t1=%t5) {#ADD xpSpent %t3} {#SAY failed}</value>
      </trigger>
    </trigger>
    <var name="xpSpent" usedef="true" id="12">
      <value>0</value>
      <default>0</default>
    </var>
    <trigger priority="1010" id="13">
      <pattern>{Xp:|Your current experience is} (%d)</pattern>
      <value>#IF (@xpstart) {} {xpstart=%mud.xp}</value>
    </trigger>
    <alias name="reset" id="14">
      <value>#RESET exp
score</value>
    </alias>
  </class>
</module>
_________________
Discord: Shalimarwildcat
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Mon Mar 30, 2009 2:09 pm   
 
Very odd, the problem turned out to be the alarm and not %mud at all.

For some reason as *1:00 it would enter about 4-6 entries to the xptrack variable, only one of which was correct
changing it to -1:00 fixed it however
_________________
Discord: Shalimarwildcat
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Mon Mar 30, 2009 2:53 pm   
 
On a side note, how can i be sure that i have synced my new version with the one stored online?

Some sort of confirmation/failure message would be nice.

Also, it doesn't seem to like float version numbers, the person who i was sharingit with didn't see a change on thier end till i used a new integer version number.
_________________
Discord: Shalimarwildcat
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Mar 30, 2009 6:07 pm   
 
Btw, please keep posts about Beta versions (3.05) in the Beta forum. Thanks.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Mon Mar 30, 2009 11:00 pm   
 
Oh, right, my bad. It might not be just 3.05 though.
_________________
Discord: Shalimarwildcat
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