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 ➜ General ➜ Two problems (variables I guess)

Two problems (variables I guess)

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


Posted by Noideas   (3 posts)  Bio
Date Tue 14 May 2013 11:40 PM (UTC)

Amended on Wed 15 May 2013 06:57 PM (UTC) by Noideas

Message
Hello,

I've been using MUSH for a bit and so far I enjoy it. I'm not a coder, I just love playing text-games.

I've tried to deal with this myself for quite a while now. The first problem I've almost managed to solve, but something is missing. The second one I have no idea how to even start and hope for some input and help.

1st problem:

Every room in the MUD I play, Imperian, has a number. You can view it by hitting ROOMNUM and then you get a display that looks like this:

Quote:
Room #13092 - 'Looking out over Imperial Stavenn.'


I am trying to capture that text to a variable and then send that to a certain channel. I.E

Quote:
(Citytells): You say, "I am at Room #13092 - 'Looking out over Imperial Stavenn.'"


The " lines (inluding .") in the above quote is automatically insterted by the MUD

I'm using this, with some result:

Quote:

<triggers>
<trigger
enabled="y"
expand_variables="y"
match="Room*"
send_to="9"
sequence="90"
variable="Roomnum"
>
<send>%1</send>
</trigger>
</triggers>

And then:

<aliases>
<alias
match="roomroom"
enabled="y"
expand_variables="y"
send_to="12"
sequence="100"
>
<send>world.execute ("roomnum");
world.setvariable ("Roomnum", "%1");
world.getvariable ("Roomnum");
world.doafter (1, "msg randomdude I'm at @Roomnum");</send>
</alias>
</aliases>



I used the 'getvariable' there because I've been trying to make it send the room I am in currently, instead of the last stored variable. I can capture the room in variable, but it is always the last room I checked, instead of the trigger capturing the text I get when moving a room and then running the alias. From what I understand, the script when run is sendind ghr last stored variable instead of waiting until I get a new one, but I don't know how I would write it up to make it update quick enough for me to be able to simply 'go east, check roomnum and make the trigger send that roomnum to 'randomperson''.

The 'doafter' I put in becuase I was hoping another second after getting the roomnum and hopefully storing that in the variable would send the actual room, not the room I last looked ROOMNUM in.

Problem two (maybe I should make a new post for this, since it seems more complicated, but I'll give it a go.

I have NO idea how to make this work, but basically I want to omit some text, send some text UNLESS I have that text 'saved' or 'stored' somewhere to not send it. The message from the MUD is:

Quote:

You bid your ouroboros to seek out life presences nearby.
Salish is at Skirting the Areish Mountains, at 425 health and 528 mana.
Septus is at Approaching wet plains, at 543 health and 538 mana.
Randomdude is at Approaching wet plains, at 543 health and 538 mana.
Masked man is at Approaching wet plains, at 543 health and 538 mana.
Masked woman is at Approaching wet plains, at 543 health and 538 mana.
Eathi is at Approaching wet plains, at 543 health and 538 mana.


Note, that the quotes tag put everyting on the same line here. In Imperian, after 80 characters there is a newline (perhaps not important when omitting, but I thought it would be important to mention).

What I want that to do is to just send who is in the area, while omitting some names I chose myself. With the example above, I'd like this to be sent to a channel:

clantell Septus, Randomdude, Masked man, Masked woman, Eathi is in the area.

I've omitted the name Salish and everything after the other persons names.

If someone could point me in the right direction for the 2nd issue, I'd be very glad.

Thank you for reading and hopefully replying.



Top

Posted by Noideas   (3 posts)  Bio
Date Reply #1 on Wed 15 May 2013 09:16 PM (UTC)
Message
Apparently I was able to solve my first problem doing this:

Quote:

<triggers>
<trigger
enabled="y"
expand_variables="y"
group="Roomnums"
match="^Room(?P&lt;Roomnum&gt;.*)"
regexp="y"
sequence="90"
variable="Roomnum"
>
<send>rt I am at %&lt;Roomnum&gt;</send>
</trigger>
</triggers>


Still no idea about the next one though and don't know why all my tries with using * and making me send %1 instead didn't work instead of having to name the wildcard.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 15 May 2013 10:30 PM (UTC)
Message
First problem:


world.setvariable ("Roomnum", "%1");
world.getvariable ("Roomnum");
world.doafter (1, "msg randomdude I'm at @Roomnum");</send>


The way MUSHclient expands out variables (in this case @Roomnum) is before handing this code over to the script engine. So @Roomnum is going to be what it was at the start of execution. Changing it half-way down won't affect the variable.

Plus:


world.getvariable ("Roomnum");


That doesn't do anything useful. You have to put the variable somewhere, eg.


roomnumber = world.getvariable ("Roomnum");


However my first remark still applies.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 15 May 2013 10:34 PM (UTC)
Message
It's better to use 'code' tags for code (eg. triggers and MUD output) rather than 'quote' tags because that preserves the spacing.

Your second problem sounds like you could get help from here:

Template:faq=37 Please read the MUSHclient FAQ - point 37.


Personally I prefer Lua these days as a script engine, but whatever, if you want to use VBscript.

Following the ideas in that FAQ you could capture each line of output, and then look at the first word (the player name) and see if it is in your list (there are various ways you could do that) and if not, build up another list for your clantell.

- Nick Gammon

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

Posted by Noideas   (3 posts)  Bio
Date Reply #4 on Thu 16 May 2013 06:32 AM (UTC)
Message
Many thanks, Nick!
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.


18,019 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.