Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Rat Counter - Info Bar
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Morgoth
Israel (38 posts) Bio
|
Date
| Thu 31 Jul 2003 10:15 AM (UTC) |
Message
| Alright, here's my problem. Here's what I want to achieve,
I want to make a rat counter, so it triggers "You pick up a black rat" (there's a couple of rats btw) so each time I pick it up, it changes the amount of money I have and the number of rats, on the info bar. so like I trigger "You pick up a black rat", and the info bar changes to
Rats: 1 Gold: 15. I've done this before on zmud...not sure how to do it on mush. Please Help. | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #1 on Thu 31 Jul 2003 11:44 AM (UTC) |
Message
| Could you paste the exact text, and tell us how your gold changes each time you pick up a rat? |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| Morgoth
Israel (38 posts) Bio
|
Date
| Reply #2 on Thu 31 Jul 2003 11:50 AM (UTC) |
Message
| No.....I mean like the info bar changes. I want it to have text like this Gold: 0 Rats: 0, each rat is worth a differant amount, so I know how much golds worth of rats I'm holding. so each time I Pick it up, the info bar changes, so if I have 50 rats, it will say Rats: 50, and how many the rats are worth. I think it would need variables.....so like everytime I pick up the rats the variables change. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Thu 31 Jul 2003 09:57 PM (UTC) |
Message
| It isn't clear what your question is exactly? How to match on the rat message? How to store variables? How to write to the info bar?
The info bar is documented at:
http://www.gammon.com.au/scripts/doc.php?general=infobar
If you want someone to actually write the trigger that counts rats you will have to do what Poremenos says, and post some example MUD output, we can't do it blind. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Morgoth
Israel (38 posts) Bio
|
Date
| Reply #4 on Sun 03 Aug 2003 10:59 AM (UTC) |
Message
| I want something to count how many rats I have and how many they are worth on an info bar. The thing I would need to trigger are when I pick up the rats:
You pick up the corpse of a rat.
-----------------------------------------------------------
So now I have 1 rat which is worth 15 gold, so the info bar would change from Gold: 0 Rat: 0 to Gold: 15 Rat: 1, lets say I pick up another rat so now I have two rats which are worth 30 gold all together so the counter changes to
Gold: 30 Rat: 2. I hope this is clearer. | Top |
|
Posted by
| Morgoth
Israel (38 posts) Bio
|
Date
| Reply #5 on Sun 03 Aug 2003 11:02 AM (UTC) |
Message
| Err...forgot to add this on. What I don't know how to do is how to write the sub so it does the mathematical action and how I would I put it on the info bar (e.g Would I have to use variables?) | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #6 on Mon 04 Aug 2003 07:32 AM (UTC) |
Message
| Try something like this:
Dim intGold
Dim intRats
Sub OnRat(strName, strLine, strWildcards)
intGold = Int(intGold + 15)
intRats = Int(intRats + 1)
Info "Rats: " & intRats & ". Gold: " & intGold & "."
End Sub
I would think that should work. |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| Morgoth
Israel (38 posts) Bio
|
Date
| Reply #7 on Mon 04 Aug 2003 11:20 AM (UTC) |
Message
| Its terrific! works great. (just as a side note, I forgot to mention there are a couple types of rats, so each time I picked it up it added it instead of changing, so I just info cleared it each time and it works great). :P. thanks | Top |
|
Posted by
| Matthias
(28 posts) Bio
|
Date
| Reply #8 on Wed 06 Aug 2003 11:59 PM (UTC) |
Message
| Morgoth, by some chance do you play Achaea?
Anyways, how would I make a variable appear on the info bar? I mean, saw the command, but what do I do with it? And for that matter, how do I put text at all there? Can imagges be placed there? |
Give a man a fire and you warm him for a day.
Set a man on fire and you warm him for the rest of his life. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #9 on Thu 07 Aug 2003 04:56 AM (UTC) |
Message
| |
Posted by
| Hathcock
(49 posts) Bio
|
Date
| Reply #10 on Thu 22 Apr 2004 03:04 PM (UTC) |
Message
| ok, I tried this,
Dim intPinchers
Sub OnPincher(strName, strLine, strWildcards)
intPinchers = Int(intPinchers + 1)
Info "Pinchers: " & intPinchers & "."
End Sub
and I put it in a trigger
^You pick up the corpse (.*?) pincher.$
but I get nothing in my infobar, I'm sure I'm doing something wrong here....here are the lines I see that I need the counter to work off:
You pick up the corpse of a tiny pincher.
You pick up the corpse of an ugly pincher.
You pick up the corpse of a giant ugly pincher. | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #11 on Thu 22 Apr 2004 07:59 PM (UTC) |
Message
| This line looks wrong:
intPinchers = Int(intPinchers + 1)
It should be instead:
intPinchers = cstr(intPinchers + 1)
And since this topic is about a rat counter, I've made one a while back that never got to be posted and I was too lazy to go and post it someplace myself. It's for Achaea (autopickup) but can serve as an example too:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE muclient >
<muclient>
<plugin name="Ratter" author="Keldar" language="vbscript" purpose="Display ratting info"
save_state="y" date_written="2003-11-15" date_modified="2003-11-16" requires="3.32" version="1.0"
id="152d7cdff704e856e0c00d58">
<description trim="y">
<![CDATA[
This simple plugin will display the basic statistics of your ratting. It
uses the Info bar for display, and can show either counts for each type
of rat you have slain so far, or their gold worths. The commands to use it
are:
ratter on|off - turn the Ratter on or off, turning it off resets the current count
ratter nums|gold - defines whether the plugin will display amounts or gold values
of rats
rats * - * stands for a ratman's name, sends 'sell rats to *'
]]>
</description>
</plugin>
<include name="constants.vbs" />
<triggers>
<trigger
name="RatPickup"
enabled="n"
regexp="y"
match="^You have slain (?:a|an) (baby rat|young rat|rat|old rat|black rat), retrieving the corpse\.$"
script="CountRats"
keep_evaluating="y"
sequence="10"
></trigger>
</triggers>
<aliases>
<alias
name="ratter_switch"
enabled="y"
regexp="y"
match="^ratter (on|off|nums|gold)$"
sequence="100"
script="Ratter"
/>
<alias
name="sellrats"
enabled="y"
match="rats *"
sequence="100"
><send>sell rats to %1</send></alias>
</aliases>
<script>
<![CDATA[
dim displayMode
displayMode = 1 '1 displays amounts, 2 - gold values
dim ratPrice(5) 'This array holds prices for different rats
ratPrice(0) = 7 'baby rat
ratPrice(1) = 14 'young rat
ratPrice(2) = 21 'rat
ratPrice(3) = 28 'old rat
ratPrice(4) = 35 'black rat
dim ratNums(5) 'This array holds the number of different rats you've killed
ratNums(0) = 0 'baby rats
ratNums(1) = 0 'young rats
ratNums(2) = 0 'rats
ratNums(3) = 0 'old rats
ratNums(4) = 0 'black rats
sub Ratter(name, output, wildcs)
select case wildcs(1)
case "on"
world.EnableTrigger "RatPickup", 1
DisplayInfo
world.Note "Ratter plugin is ON"
case "off"
world.EnableTrigger "RatPickup", 0
world.InfoClear
world.InfoBackground "lightgrey"
dim i
for i = 0 to ubound(ratNums)
ratNums(i) = 0
next
displayMode = 1
world.Note "Ratter plugin is OFF"
case "nums"
displayMode = 1
DisplayInfo
case "gold"
displayMode = 2
DisplayInfo
end select
end sub
sub CountRats(name, output, wildcs)
select case wildcs(1)
case "baby rat"
ratNums(0) = ratNums(0) + 1
case "young rat"
ratNums(1) = ratNums(1) + 1
case "rat"
ratNums(2) = ratNums(2) + 1
case "old rat"
ratNums(3) = ratNums(3) + 1
case "black rat"
ratNums(4) = ratNums(4) + 1
end select
DisplayInfo
end sub
sub DisplayInfo
world.InfoClear
world.InfoFont "FixedSys", 12, 0
world.InfoColour "white"
world.InfoBackground "black"
dim totalNums, totalGold, i
totalNums = 0
totalGold = 0
for i = 0 to ubound(ratNums)
totalNums = totalNums + ratNums(i)
next
if (displayMode = 1) then
world.Info "Total: " & cstr(totalNums) & " | "
world.Info "Baby rats: " & cstr(ratNums(0)) & " | "
world.Info "Young Rats: " & cstr(ratNums(1)) & " | "
world.Info "Rats: " & cstr(ratNums(2)) & " | "
world.Info "Old rats: " & cstr(ratNums(3)) & " | "
world.Info "Black rats " & cstr(ratNums(4))
elseif (displayMode = 2) then
for i = 0 to ubound(ratNums)
totalGold = totalGold + ratNums(i)*ratPrice(i)
next
world.Info "Total: " & cstr(totalGold) & "gp | "
world.Info "Baby rats: " & cstr(ratNums(0)*ratPrice(0)) & "gp | "
world.Info "Young Rats: " & cstr(ratNums(1)*ratPrice(1)) & "gp | "
world.Info "Rats: " & cstr(ratNums(2)*ratPrice(2)) & "gp | "
world.Info "Old rats: " & cstr(ratNums(3)*ratPrice(3)) & "gp | "
world.Info "Black rats " & cstr(ratNums(4)*ratPrice(4)) & "gp"
end if
end sub
]]>
</script>
</muclient>
| Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
35,202 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top