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 ➜ VBscript ➜ Command Prompt with no Return

Command Prompt with no Return

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


Posted by Nemix   (12 posts)  Bio
Date Mon 16 Apr 2007 03:09 PM (UTC)
Message
Ok I'm trying to grab hp, sp, st changes and put them on the output, easier to show an example:

This is what normal looks like:

<1617hp 1727sp 2217st>

What I want to do..

<1717hp 1727sp 2117st> +100, 0, -100

Problem I'm having is that its not triggering off of the latest line and it doesn't show the +/-'s on the same line.
I recently made a damage script to show how hurt whatever I was fighting is and I had to omit from output and add in 0% for the whole line. Though even if I do that I still need help, since it won't replace it until the next line is recieved.

trigger on "^<(\d+)hp (\d+)sp (\d+)st>(.*?)$"

hpchange = (%1 - hpchange)
spchange = (%2 - spchange)
stchange = (%3 - stchange)
world.note hpchange & " " & spchange & " " & stchange & vbcrlf
hpchange = %1
spchange = %2
stchange = %3



Example of what happens:
<1717hp 1727sp 2117st>
+100, 0, -100

<1717hp 1727sp 2217st>

I believe it won't trigger off the latest line because there is nothing to indicate a new line yet, any idea how to trigger from it or fix this?
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #1 on Mon 16 Apr 2007 03:22 PM (UTC)
Message
Try using the IAC EOR/GA option in Configuration>Display. In most cases, that will terminate your prompt with a new line, in turn giving you the possibility to trigger on it. In the trigger of your prompt, you should omit the trigger from output and instead output it yourself. That way, it will be possible to output your entirely customized prompt.
Top

Posted by Nemix   (12 posts)  Bio
Date Reply #2 on Mon 16 Apr 2007 03:46 PM (UTC)
Message
Still no go, anything else to try?
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #3 on Mon 16 Apr 2007 05:51 PM (UTC)
Message
Some muds allow you to put a carriage return in your prompt. On the mud I play on, I have a "%c" at the end of my prompt to force a new line in order to make sure my prompt catcher works.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Vijay   (1 post)  Bio
Date Reply #4 on Sun 03 Jun 2007 02:55 AM (UTC)
Message
You'll have to set the trigger as "omit from output" = true. This is in your trigger properties window.

Otherwise you are already calculating the differences based on inputs you want to display. You merely need to keep the originals and re-display the originals beforehand.

Your output:
world.note hpchange & " " & spchange & " " & stchange & vbcrlf

should be:
(omit from output)
world.note "<" %1 & "hp " & %2 & "sp " & %3 & "st> " & hpchange & " " & spchange & " " & stchange & vbcrlf

This would give you the desired output you want without having to worry about changing other settings outside of the trigger.
Top

Posted by Nemix   (12 posts)  Bio
Date Reply #5 on Thu 29 Nov 2007 09:32 AM (UTC)
Message
That wasn't exactly my problem, I could do that easy enough but it doesn't show up until the next line is sent.

I tried the plugin's on this page here:
http://mushclient.com/forum/?id=7430

But for some reason all this did was hide the prompt until the next line was recieved.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Sat 01 Dec 2007 10:42 PM (UTC)
Message
The regexp in the plugin needs to match what you are getting as your prompt. You have shown what your prompt looks like, so can you post the regexp line from the plugin?

The original one read:


<!ENTITY prompt_regexp "^Alisha \- \((.*?)\/(.*?) (.*?)\/(.*?) (.*?)\/(.*?) (.*?) (.*?)\/(.*?)\) (.*?)$" >
]>


But that definitely won't work with your prompt, because it is different.

- Nick Gammon

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

Posted by Nemix   (12 posts)  Bio
Date Reply #7 on Sun 02 Dec 2007 03:51 PM (UTC)
Message
I think I tried a couple different phrases to match but this is what it is currently:

<!ENTITY prompt_regexp "^\\<(.*?)hp (.*?)sp (.*?)st\\>$" >

It seems to find the prompt but then it doesn't send the prompt until the next line & hides the newest one again.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #8 on Mon 03 Dec 2007 04:19 AM (UTC)
Message
Try this:


<!ENTITY prompt_regexp "^\<(\d+)hp (\d+)sp (\d+)st\>" >

- Nick Gammon

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

Posted by Nemix   (12 posts)  Bio
Date Reply #9 on Wed 05 Dec 2007 07:14 PM (UTC)
Message
I'm playing a mud called Materia Magica, once known as Moongate, www.materiamagica.com:4000.

Ok, I think its finding it, just not returning anything. Here's an example of while its on vs while the plugin is off,

On:
"

c 'cure light'
<2658hp 2680sp 2635st> You begin to speak the words of the spell...

<2658hp 2680sp 2635st>
You have completed your casting.
A warm, blue aura surrounds you for a moment, then softly fades.
You feel better!

"

It seems to be missing some prompts and stopping a newline from some of them.

Off:
"
<2658hp 2707sp 2636st>
c 'cure light'
You begin to speak the words of the spell...

<2658hp 2707sp 2636st>
You have completed your casting.
A warm, blue aura surrounds you for a moment, then softly fades.
You feel better!

<2658hp 2673sp 2636st>
"


Here's the whole plugin I got from the other post:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient[
<!ENTITY prompt_regexp "^\<(\d+)hp (\d+)sp (\d+)st\>" >
]>
<!-- MuClient version 3.59 -->

<!-- Plugin "Add_Newline_To_Prompt" generated by Plugin Wizard -->

<muclient>
<plugin
name="Add_Newline_To_Prompt"
author="Nick Gammon"
id="8316c19c35a9ebdb46055874"
language="Lua"
purpose="Adds a newline to prompt lines"
date_written="2004-12-13 12:08:00"
requires="3.59"
version="1.0"
>
<description trim="y">
Detects prompt lines without a newline, and if found, adds one.

Change ENTITY line on 3rd line of plugin to be a regular expression
that matches your prompt.

</description>

</plugin>

<!-- Script -->

<script>

re = rex.new ("&prompt_regexp;")

<![CDATA[

partial = "" -- partial line from last time through

function OnPluginPacketReceived (s)

-- add packet to what we already have (excluding carriage-returns)

partial = partial .. string.gsub (s, "\r", "")

t = {} -- table of lines to be returned

-- iterate over each line

partial = string.gsub (partial, "(.-)\n",
function (line)
table.insert (t, line)
return ""
end)


-- look for prompt

if (re:match (partial)) then
table.insert (t, partial)
partial = ""
end -- if found prompt

if table.getn (t) > 0 then
table.insert (t, "") -- to get final linefeed
end -- if

-- return table of lines, concatenated with newlines between each one
return table.concat (t, "\n")

end -- function OnPluginPacketReceived
]]>
</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.


39,544 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.