Right, I just finished up writing a simple set of triggers and functions to trigger when a line contains the town name and turn that one word into a hyperlink, not too bad, after reading through the problems other people had it wasn't too hard to adapt the concept for my own uses, however, I don't want this to trigger whenever it reads the town name in a line just anywhere, I'd prefer if it only sensed in room descriptions, which for my MUD come out in grey. If it were green I could sense on green, same for any other colour, but I want to sense on grey and I don't want to have to change my colour scheme over to help this one script.
So, my question is, is there any way to sense on 'grey'? since at the moment only standard colours such as black, white, green, cyan and red are listed.
Also, I'd rather not grab LineInfo and do IFs on each one.
Is that grey the normal text grey (ie, default color)? or the ascii grey?
I agree nick, it would make sense to match any ansi color on any ansi color. And also maybe a "no change" or "default" or something as well so you can match more descriminately than "any color".
Yes, well I'm incredibly sorry to report that due to my not paying attention to what the mud was putting out, sensing on white was more sufficent.
I do, however, have a different problem.
The MUD prefixes each room you enter with a 'compass' representing the directions available to you and whether or not they are open or close.
It looks like this:
Market Street - N -
(-------------------------------------------------) - <---(M)---> #
- S -
What I was trying to do was to read that in, ommit it, then re-create it, replacing available directions with hyperlinks. I simple made a trigger to operate on '* * * *' and the put those values into world variables which are then passed to the following script:
Sub compass (a,b,wildcard)
Dim roomvar1
Dim roomvar2
Dim roomvar3
Dim roomvar4
roomvar1 = world.getvariable ("roomvar1")
roomvar2 = world.getvariable ("roomvar2")
roomvar3 = world.getvariable ("roomvar3")
roomvar4 = world.getvariable ("roomvar4")
if roomvar2 = "NW" then
world.hyperlink "northwest", "NW", "Travel NorthWest", "yellow", "black", 0
elseif roomvar2 = "SW" then
world.hyperlink "southwest", "SW", "Travel SouthWest", "yellow", "black", 0
else
world.colourtell "#000080", "black", "-"
end if
world.tell " "
if roomvar3 = "N" then
world.hyperlink "north", "N", "Travel North", "yellow", "black", 0
elseif roomvar3 = "S" then
world.hyperlink "south", "S", "Travel South", "yellow", "black", 0
else
world.colourtell "#000080", "black", "-"
end if
world.tell " "
if roomvar4 = "NE" then
world.hyperlink "northeast", "NE", "Travel NorthEast", "yellow", "black", 0
elseif roomvar4 = "SE" then
world.hyperlink "southeast", "SE", "Travel SouthEast", "yellow", "black", 0
else
world.colourtell "#000080", "black", "-"
end if
end sub
I've posted an example of a room at:
http://heathen.1gb.se/exampleroom.html
If there's anything else you need to know to better understand my problem just ask and I'll post it.
Oh, and I'm aware that at present that trigger and script will only replace the upper and lower row of the compass, but if I can get this portion working the adaption will be simple.
You might try using regular expressions for your trigger, it'll let you structure your trigger better, rather than just matching on 'any four things'.
Also, there are at least two other posts in this forum (that I can remember) that have to do with this, you might be able to get some triggers/code off of them. Could probably search for compass, or something like that.
Are the two posts. Some of it is relevant, some of it is less so. But both of them might show you other ways of looking at the trigger and what to do with it.
Alright, I got it for the most part working, thanks to that advice about the use of Regex's, which now that I think about it was really quite obvious *doh*
My only problem is the sensitivity of the hyperlinks, it's very hard to click and since one of the major purposes I had in mind for this script was making it easier on people who find typing repetitively awkward (And yes, even on MUDs they do exist), so that really defies the point if they have to swing the pointer around in circles to get it to register.
Or, you could add some characters (space fillers, "x" or whatnot) to make the links themselves larger.
There really is no problem with the hyperlinks. Theyre as large as you want them to be. If youre just trying to click the N or whatnot, then yes, they would be a bit hard to click (especially if there is any scrolling), so you might try adding some extra characters.
But, if theyre moving, theyll have to move the mouse to move anyway right? Or were you just referencing trying to hover over the one character for the link?
Well, my original intention was to try and maintain as much of the original look of the game as possible, adding filler characters would work, and I did consider it, but I wanted to make sure there wasn't some other point I could look at before I went on to that.