Register forum user name Search FAQ

Gammon Forum

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 ➜ Lua ➜ Obtaining information from the MUD.

Obtaining information from the MUD.

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by FishOnSpeed   USA  (31 posts)  Bio
Date Mon 19 Nov 2007 01:00 PM (UTC)

Amended on Mon 19 Nov 2007 01:01 PM (UTC) by FishOnSpeed

Message
to get information from the mud do i have to use triggers to pick up the variables or can i get them without having them show up on the screen.

i want to get level, stats, and such, store them in variables without having to open up the "score" and having
twenty different triggers to pick it all up.

~FishOnSpeed
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Mon 19 Nov 2007 02:09 PM (UTC)
Message
Unless your MUD has some kind of behind-the-scenes communication (which is very unlikely) you don't really have any choice but to make the MUD communicate the information to you one way or another and pick it up with triggers. Kind of unfortunate but the way it is.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by FishOnSpeed   USA  (31 posts)  Bio
Date Reply #2 on Mon 19 Nov 2007 02:52 PM (UTC)
Message
ah ok.

well what i want to do is have a trigger pick up the information given on an auction channel.

* is auctioning a * (Level *, Num *). Current bid is *.

so my trigger so far would be

* is auctioning a * (Level *, Num *). Current bid is *.
send
bidnum = %4
bid bidnum <<< my problem is here

what is the syntax for putting bidnum there
so it would output to the mud something like

bid 74 where bidnum is equal to 74

~FishOnSpeed
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 19 Nov 2007 10:27 PM (UTC)
Message
Have you read http://www.mushclient.com/faq - in particular, point 31? That deals with doing arithmetic in scripts.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by FishOnSpeed   USA  (31 posts)  Bio
Date Reply #4 on Tue 20 Nov 2007 03:25 PM (UTC)
Message
<send>
rats = (rats or 0) + 1
Note ("You have now killed ", rats, " rats")
</send>

is what is in point 31

* is auctioning * (Level *, Num *). Current bid is *.
<send>
bidnum = %4
note("bid ",bidnum)
</send>

trigger still doesnt work

Pappi is auctioning a black diamond earring (Level 17, Num 267). Current bid is 100.
bidnum = 267
note("bid ",bidnum)
[ 336/336hp 306/306mn 838/838mv 983tnl] > *[NOEXP]* Sorry Pappi, I don't understand you.
[ 336/336hp 306/306mn 838/838mv 983tnl] > *[NOEXP]* That is not a command. Type 'Commands' for a complete list.

is what gets put out when something is auctioned

its not showing an error but its also not doing what i want
i just want it to send the command

bid bidnum, where bidnum is equal to whatever auction number just popped up

~FishOnSpeed
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #5 on Tue 20 Nov 2007 10:15 PM (UTC)
Message
Can you paste here your whole trigger, not just selected bits of it?

http://www.mushclient.com/copying

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by FishOnSpeed   USA  (31 posts)  Bio
Date Reply #6 on Thu 22 Nov 2007 12:25 AM (UTC)
Message
<triggers>
<trigger
enabled="y"
expand_variables="y"
match="* is auctioning * (Level *, Num *). Current bid is *."
sequence="100"
>
<send>@bidnum = %4
bid @bidnum
</send>
</trigger>
</triggers>

this is my trigger

when it executes it prints out to the client

=54 or whatever the bid number was
then
bid it does not include the number after bid



~FishOnSpeed
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #7 on Thu 22 Nov 2007 04:20 AM (UTC)
Message
OK, I see what you are doing. When you expand variables, it only expands their current value, it doesn't let you replace it (the way you did it). The simple solution is this:


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   match="* is auctioning * (Level *, Num *). Current bid is *."
   sequence="100"
  >
  <send>bid %4
</send>
  </trigger>
</triggers>


That simply bids the auction number without changing any variables.

If you really want to set a variable, this will do it:


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   match="* is auctioning * (Level *, Num *). Current bid is *."
   send_to="12"
   sequence="100"
  >
  <send>
SetVariable ("bidnum", "%4")
Send ("bid " .. GetVariable ("bidnum"))
</send>
  </trigger>
</triggers>



Here I have changed it to "send to script", and in the script used SetVariable to set a variable, and GetVariable to get that variable's value back.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by FishOnSpeed   USA  (31 posts)  Bio
Date Reply #8 on Mon 26 Nov 2007 01:52 PM (UTC)
Message
ah ok thanks

~FishOnSpeed
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.


27,303 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.