High Score Tracking

Posted by Xyborg on Thu 09 Oct 2003 09:08 AM — 3 posts, 15,829 views.

Canada #0
Ok. I want to track the highest score from playing the slots in a mud. The triggers is "You have won # dollars!"

Now. I think I know how to write this, but I'm not entirely sure, hence the reason I'm posting here.


<triggers>
  <trigger
   enabled="y"
   match="You have won * dollars!"
   script="OnWin"
   sequence="100"
   other_text_colour="black"
   other_back_colour="black"
  >
  </trigger>
</triggers>

<script>
<![CDATA[
sub OnWin (sName, sLine, wildcards)
dim new
dim last
dim highest

<!-- Little foggy around this area.  Don't know how to get %1 from the trigger. -->

 if (new > last) then
  SetVariable "highest", "new"
 end if
End Sub
]]>
</script>


Other than the part I don't know how to do, I think I have it right. Any help would be great help.
Amended on Thu 09 Oct 2003 09:09 AM by Xyborg
Greece #1
%1 in the script is wildcards(1)
Canada #2
Personally, I would just do:

Sub OnWin (sName, sLine, wildcards)
  if CInt(Wildcards(1)) > CInt(World.GetVariable("HighScore")) Then World.SetVariable "HighScore", Wildcards(1)
End Sub

CInt converts the value to an integer. If your numbers can be very large, you might want to switch to a Long Integer. [CLng]