|
Drylar Wanderer
Joined: 04 Nov 2001 Posts: 53 Location: USA
|
Posted: Mon Feb 10, 2003 3:39 pm
Help with Prompt/Newline scripting. |
I'm getting to the point where Vodka and hairpulling are all I have left. I'm trying to get it so that I always add a newline after my prompt. Here's a quick sample of mud output:
439/735hp 497/592mn 506/506mv{3610G 18S 84a 5268xp}{} / / >==========k toy
save
You do the best you can!
--------> Disarm attempted.
<439/735hp 497/592mn 506/506mv{3610G 18S 84a 5268xp}{} / / >==========Saving. Remember that Prophecy has automatic saving.
:end sample
See how the message that it's saving is tacked on the to prompt string? I created a trigger that fires on my prompt...
~<(%d)/(%d)hp (%d)/(%d)mn (%d)/(%d)mv~{(%d)G (%d)S (%d)a (%d)xp~}~{(%*)~}(%*)/(%*)/(%*)~>==========
triggers...
#SAY %null
This works whenever commands are not stacked. When I stack commands so that they are entered before it can output the last, it tacks on to my prompt. I want all output to be on new lines. Can anyone show me a way to make sure it always adds a newline after the prompt string, before it adds anything else? I'd prefer something that can tell if it ends in a newline and WONT add a newline if one is already present, and WILL add one if something gets tacked on. Something that would kludge it and ALWAYS add a newline would suffice. Hopefully someone else has figured this one out and can point me in the right direction.
Before I post, here's a sample minus the trigger mentioned above:
<371/735hp 523/592mn 506/506mv{3610G 18S 84a 5248xp}{} / / >==========k toy
k toy
You do the best you can!
<371/735hp 523/592mn 506/506mv{3610G 18S 84a 5248xp}{} / / >==========You do the best you can!
<371/735hp 523/592mn 506/506mv{3610G 18S 84a 5248xp}{} / / >==========
:end sample
and here's a quick sample (using an editor) of what my prefered outcome would be:
<371/735hp 523/592mn 506/506mv{3610G 18S 84a 5248xp}{} / / >==========
k toy
k toy
You do the best you can!
<371/735hp 523/592mn 506/506mv{3610G 18S 84a 5248xp}{} / / >==========
You do the best you can!
<371/735hp 523/592mn 506/506mv{3610G 18S 84a 5248xp}{} / / >==========
:end sample
Hopefully enough info is here that someone can help me solve my hair-pulling-and-alcohol-consuming problem. As per that trigger, I also use it to read my prompt into variables (since some are text and not handled by zMUD's built in prompt stuff) as well as tag my prompt line. And lastly, if you couldn't notice, all unrelated lines in the samples are gagged. (That's how I keep them anyway, as they do not affect my character.)
Thanks for any help you can offer. Pointers would be most appreciated, as I'd like to learn the proper way to handle this for any future issues I might come into similar to this.
-Drylar |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Mon Feb 10, 2003 3:51 pm |
maybe try the command:
#if (%ends(%trigger, %char(13)) OR %ends(%trigger, %char(10)) ) {#NOOP} {#say %cr}}
--------
moon.icebound.net:9000 |
|
|
|
Evangelist Adept
Joined: 10 Oct 2000 Posts: 224 Location: USA
|
Posted: Mon Feb 10, 2003 5:21 pm |
For a lot of muds, when you enter your prompt, add %d at the end for a carriage return to save yourself the trouble of having to do it through zmud :)
Evangelist/Pernius
telnet://phidar.com:9000 |
|
|
|
Drylar Wanderer
Joined: 04 Nov 2001 Posts: 53 Location: USA
|
Posted: Mon Feb 10, 2003 5:30 pm |
Emit, nice try but it didn't work. It works basically the same as my trigger, except that it added the line after prompt+added text.
Evangelist, if it can be added any other way, I'd prefer that since as it stands, the way I keep my prompt I have no more room left in the allowed space for a prompt. The mud keeps it short to help relieve some of the bandwidth usage, and I keep the information in the prompt that I need to keep my scripting going. If zmud were fast enough, if i could get away with nothing but spaces between stuff, i'd just put it something like this:
10 100 20 100 20 100 3000 3000 NESW I H S
and have zmud read it, and substitue it with the prettier version such as:
10/100h 20/100m 20/100v 3000g 3000s {NESW}I/H/S
but alas, it starts to behave oddly when it is required to handle that fast of execution on that intense a trigger. If I must, I'll resort to dropping stuff to allow a cr through the mud, but again, I'd prefer to figured out how to accomplish this as I've been trying for days to do this.
-Drylar |
|
|
|
Evangelist Adept
Joined: 10 Oct 2000 Posts: 224 Location: USA
|
Posted: Mon Feb 10, 2003 7:09 pm |
Nah, i mean the %d goes in your prompt but it does not show up, it's just a carriage return (in some muds, the %d doesnt work in all)
But just add it to your prompt such as.
prompt %hhp %HMhp %mm %MMm %vmv %VMmv $:%g TNL:%X align:%a %d
It doesn't take up any more room on your prompt, and I don't think that is gonna cause too much bandwidth problems.
Or could you catch the line and use #SUB {%line %cr} or something like that, just substitute the line and add a carriage return?
Evangelist/Pernius
telnet://phidar.com:9000 |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Feb 10, 2003 7:09 pm |
You can easily shorten your prompt by 16 characters, with no loss of information, by removing the blue characters and the spaces between them. There may be reason to keep some of them, but I doubt that they are all needed. That should leave plenty of room to include a carriage-return token.
<439/735hp 497/592mn 506/506mv{3610G 18S 84a 5268xp}{} / / >==========
LightBulb
Advanced Member |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Mon Feb 10, 2003 7:11 pm |
for my second attempt then, i'll suggest #subs, like so:
#if (%ends(%trigger, %char(13)) OR %ends(%trigger, %char(10)) ) {#NOOP} {#sub {%concat(%trigger,%cr)}}
--untested--
--------
moon.icebound.net:9000 |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Mon Feb 10, 2003 7:17 pm |
quote:
Nah, i mean the %d goes in your prompt but it does not show up, it's just a carriage return (in some muds, the %d doesnt work in all)
But just add it to your prompt such as.
prompt %hhp %HMhp %mm %MMm %vmv %VMmv $:%g TNL:%X align:%a %d
It doesn't take up any more room on your prompt, and I don't think that is gonna cause too much bandwidth problems.
I think he means that he reached the internal server defined limit of characters. It doesn't show up on your screen but it still takes up spaces
--------
moon.icebound.net:9000 |
|
|
|
Drylar Wanderer
Joined: 04 Nov 2001 Posts: 53 Location: USA
|
Posted: Wed Feb 12, 2003 6:15 pm |
As per the extra < at the begining, something is required for zmud to catch the line correctly. As per the {} / / >========== at the end, it's actually the exits of the room, a delimiter, the spaces are an indicator of whether i am invisible, the next is hide, the next is sneak. I put the /'s between them, when a space will do. I used /'s for my own sake, but either a space or a / take 1 space on the prompt line. The real prompt string is like thus:
<%h/%Hhp %m/%Mmn %v/%Vmv{%gG %sS %Qa %Xxp}{%e}%i/%q/%n>%G
As it stands, it's working, although already longer than the supposed 55 char limit. (And no, decreasing it to well under doesn't solve the issue I have.) As per a carriage return in the prompt, it's been removed from the game. (To my understanding, it was a crash bug, where one cold create a prompt with all cr's and then just hit enter a few times to crash it.)
As per the idea of catching and using a concat, it didn't work, it still tacked on. I'm wondering whether or not this is possible.
Thanks so far for all the help, and I hope you are beginning to understand why I am almost to the point of giving up, not to mention drinking and ripping out fistfuls of hair over this.
If anyone figures this out where I seem to be stumped, I'd be forever in your debt.
-Drylar
-Drylar |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Feb 12, 2003 7:16 pm |
#TR {~<(%n)/(%d)hp (%n)/(%d)mn (%n)/(%d)mv} {#SHOW {}} {} {nocr|prompt}
I didn't bother to include your entire prompt, the pattern above should be more than sufficient. I used parentheses around the wildcards mostly to separate them from the hp, mn, mv. I can't guarantee you'll never get a prompt in the middle of other text though, especially if you have a habit of spamming commands.
If you are doing this in the belief that your triggers won't fire unless they are on a separate line from the prompt, test your assumption. If it turns out you assumed wrong, then we're just wasting a lot of time. If your assumption is correct, it's because you've used the ^ anchor. In that case, give serious consideration to removing the anchor. I know most of the Gurus swear by it but I've seldom had any need of it.
LightBulb
Advanced Member |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Wed Feb 12, 2003 10:52 pm |
ah ok, i see the problem. The line coming in has this pattern
~<(%d)/(%d)hp (%d)/(%d)mn (%d)/(%d)mv~{(%d)G (%d)S (%d)a (%d)xp~}~{(%*)~}(%*)/(%*)/(%*)~>==========*
notice the trailing *. That might be why our attempts to #say or #show don't work, the offending text is already on the screen. I think a solution would be to %insert a %crlf at the appropriate position
#tr {~<(%d)/(%d)hp (%d)/(%d)mn (%d)/(%d)mv~{(%d)G (%d)S (%d)a (%d)xp~}~{(%*)~}(%*)/(%*)/(%*)~>==========(*)} {
pos = %len(%triger) - %len(%15)
..define all other variables..
#sub {%insert(%crlf, %trigger, @pos)}
}
A second (a maybe preferable) solution would be to just gag the whole line, and make your own prompt out of #show or #say commands. This would have the advantage of being able to span multiple lines (so you can read all that information better), use mxp colors and links/menus if you desire, and finally put all trailing text on its own line.
--------
moon.icebound.net:9000 |
|
|
|
Drylar Wanderer
Joined: 04 Nov 2001 Posts: 53 Location: USA
|
Posted: Thu Feb 13, 2003 4:24 am |
Emit, you're a genius. That worked. I did toy around a bit with your idea, and I finally have a colorized prompt, thanks to mxptags. I'm going to experiment more later when I don't have to leave for work. (Btw, I need 2 triggers to accomplish it that way, since the bar of ='s which is colorized green/yellow/red to show target's hp only shows up in combat.) If I could ever figure out how to capture the little bar with it's color I'd gag the whole line in a heartbeat, but I've only found ways to trigger on color, not capture it through triggers.
As per lightbulb, the reason I need to anchor things to the begining is that I play in pk battles on a mud where scripting is allowed. Since many of the lines that sometimes get tagged on directly affect my (and everyone else's scripts) alot of people use 'say blah blah blah' to attempt to fire off triggers, like quaffing potions of cure blind or sanctuary which is a very very bad thing in combat.
-Drylar |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Feb 13, 2003 6:11 am |
Very good. Answer one point and ignore the rest. I believe I actually gave you a perfectly good trigger to achieve what you said you wanted (a carriage-return after every prompt).
I've never tested whether prompts affect the start-of-line anchor. But, I have noticed there are very few requests for this type of trigger and also that it's never suggested by the many accomplished scripters who recommend using that anchor (at least some of whom must have experience at PK scripting). I've also noticed that nobody had a ready-to-use script for what should be a very common problem. From all that, I'd guess that prompts probably don't affect the start-of-line anchor. I really do recommend testing your assumption (using something that won't be a "very very bad thing").
However, there's no need to answer me if you disagree with my suggestions. I only made them in an attempt to be helpful. If they don't help, just ignore them.
LightBulb
Advanced Member |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Feb 13, 2003 1:27 pm |
Let's just test this and find out, no? I logged onto my MUD and verified that when I entered "l;l" into zMUD it sent look twice to the MUD. However, since they are sent at once, the room name from the second look appears just after the prompt instead of in its own line.
I then created a trigger to fire with the current room's name, anchored it at the start of the line with ^ and made it display a message when it fired. When I did a "l;l" to send the two looks, the message from the first look's room name was displayed but the one from the second one (which appears right after the prompt) did not.
So, in summary, it seems like the prompt at the start does affect triggers anchored at the beginning of a line.
Kjata |
|
|
|
Drylar Wanderer
Joined: 04 Nov 2001 Posts: 53 Location: USA
|
Posted: Thu Feb 13, 2003 3:04 pm |
Lightbulb, let me expand a bit more upon your posts, hopefully to clear things up for those who might search and find this in the future.
The trigger you offered in that last example did not work correctly. It still seemed to assume that the tacked on portion of whatever is being sent was also part of the prompt and created a carriage return immediately after the full line including the room description, battle message, etc was tacked on.
As per whether or not the prompt being before the string affects the beginning of line, yes it does. Zmud doesn't care if it's a prompt or a description or whatever else, but seems to require that a new line be fed before triggering on a start-of-line anchor. That's also why I use the anchor, and it has yet to fail in that. I'll ask if you can possibly show some instance where zMUD fires a start-of-line anchor in the middle of the line, be it after a prompt, description, etc.. so that I may submit it as a bug.
As per the carriage return tacked on using a %whatever, it's offered in most muds that I have seen, yet the one on which I play has found it to be a crash bug vulnerability, so have removed it to prevent bug abuse. On 90% of the muds I have tried, it is offered as an option, and is stock in most Diku derivatives. If it were offered, I could have avoided this whole fiasco in the first place.
As per the 'most Gurus' that you mention, that swear by the ^ anchor that you said yourself you've seldom had any need of, please explore the uses of it. I've found that alot of times, if you just trigger on something to the degree of 'Your aura fades', people might attempt to do this in battle: Erath says 'Your aura fades.', which would force my charcter to take a valuable potion of sanctuary out of my bag and quaff it, which has a waitstate by the mud, offering him a slight advantage. If he were to spam that line at me several times, I would quickly run out of the potions, while being temporarily frozen from all the commands my trigger would have fired off before i could counter act by turning off triggers, leaving me quite vulnerable, which could lead to my death and the looting of belongings I have spent a great many hours collecting. There are many many many messages that I trigger upon that cause things that could be as devestating as this if the possibility for abuse existed. Instead I trigger it as such: #trigger {^Your aura fades.$} {} which can only be set off if one of the administrators were to use a global echo, which they wouldn't do. This removes all possiblity of other characters abusing my scripting, which has happened in the past, which can easily lead to my character's death. Hopefully you are a bit more enlightened into why these tags are so neccisary for those of us that use scripting in battle with other characters. In the past, on the lines that get tacked on, I've always had to manually set off the triggers using hotkeys, which in the heat of battle on a mud that allows full scripting in pk, can easily lead to death.
As per my 'assumptions' I said I was having a problem with, which usually indicates that this has happened more than once. I've been an avid zMUD user for well over 6 years and seldom have had this much difficulty in accomplishing a task I set out to seek the answer for.
Hopefully this makes you a bit more aware of some of the usage of the anchors, and that every mud doesn't support every option, and that untested triggers don't always work. Sorry to come across harsh, I was going to flame a bit but realized after that fact you had nothing but good intentions, so decided to try and help the Guru out a bit in their overall understanding.
-Drylar |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Feb 13, 2003 5:21 pm |
Thanks, Kjata. Facts are always preferable to assumptions and it looks like I was wrong.
Sorry for wasting any of your time Drylar.
LightBulb
Advanced Member |
|
|
|
PHLN Adept
Joined: 30 Dec 2001 Posts: 220 Location: Canada
|
Posted: Thu Feb 13, 2003 8:59 pm |
Anyone know how to use the same thing for my prompt?
* HP:Healthy MV:Strong >
All I see is texts that I have no clue about.. but I know that you guys trying to make the line after the prompt a new line right? ... |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Thu Feb 13, 2003 9:14 pm |
sure, just like this:
#tr {* HP:%w MV:%w >(*)} {
pos = %len(%trigger) - %len(%1)
#sub {%insert(%crlf, %trigger, @pos)}
}
this is assuming that you don't have other captured pieces in your prompt trigger already, if you do, change %1 to the correct number for the last parameter.
--------
moon.icebound.net:9000 |
|
|
|
PHLN Adept
Joined: 30 Dec 2001 Posts: 220 Location: Canada
|
Posted: Thu Feb 13, 2003 9:16 pm |
oh, thanks, but one more question, do you know why my prompt now move the right more now? Instead of before where it stick to the left side of the screen
|
|
|
|
PHLN Adept
Joined: 30 Dec 2001 Posts: 220 Location: Canada
|
Posted: Thu Feb 13, 2003 9:17 pm |
oh, and it doesn't seem to work, heh,
Ryshad has suddenly arrived.
* HP:Healthy MV:Tiring > Caemlyn Central Square
You are in a large stone square, right in the middle of Caemlyn's outer
city. You see a wide boulevard to the north, and the path to the inner
city. There are a number of shops around you. The density of the population
is really quite incredible. It's almost impossible to relax as you are
being constantly bumped and jostled. From here you can really get a good
view of the outer city, and this just makes you appreciate the older inner
city all the more.
A large banner hangs nearby, depicting a map of Caemlyn's outer city.
[ obvious exits: N E S W ]
A cloak of thick wool lies on the ground.
A fountain is here, offering water to all.
An oil lamp, set in a steel cage, hangs from a high wooden pole.
Ryshad the warrior of Two Rivers is standing here.
Rico Suave is resting here.
Kalou the hunter of Shienar is standing here, riding a bloodstock stallion.
A draft horse is here.
Dracon Din'Nerrosh {Swordbrother Veteran} is standing here, riding a warhorse.
A small dog is here, barking furiously.
A stout looking guard is here, walking the streets of Caemlyn.
A stout looking guard is here, walking the streets of Caemlyn. |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Thu Feb 13, 2003 9:22 pm |
oic, i thought the * in your first post on this topic indicated there was more to the prompt on that side. if we escape the * it should turn out alright:
#tr {~* HP:%w MV:%w >(*)} {
pos = %len(%trigger) - %len(%1)
#sub {%insert(%crlf, %trigger, @pos)}
}
note if it still isn't working, please let me know if it is because the trigger doesn't fire, or for some other reason. remember the trigger isn't supposed to be activated on a normal prompt, only on one where you have a roomname or some other text on the same line.
--------
moon.icebound.net:9000 |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Feb 13, 2003 9:59 pm |
You're going to have to use #GAG and #SH instead of #SUB because triggers are not parsed for a match agaisnt text produced by a #SUB.
Kjata |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|