Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Sat Sep 11, 2004 8:20 am   

I need a simple script please
 
I'm needing a simple script that will tell me when my align is about to change from netural/evil/good.

my prompt looks like this:

HIT:12722/18722 MVS:1367/1367 A:340 EXLVL:6202335

When the A:??? approaches 350 i want some type of visual or alarm to let me know before it reaches 350. Likewise i need to also know when it's going to hit -350 as well and all my eq zappes off of me.

Simple? eh not for me lol but for you guru's i'm certain it's a snap!
Thanks in advance.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Sep 11, 2004 1:55 pm   
 
Since both positive and negative values are bad and the cut-off is the same for both, I pulled that out of the capture and used just the number. This is designed to give you warnings every time your alignment changes when it is over 300 and moving towards 350.

#TR "AlignmentWarn" {^HIT:%d/%d MVS:%d/%d A:{-|}(%d) EXLVL:%d} {#IF (%1>300) {#IF (%1>@LastAlign) {#ECHO Warning! You are losing neutrality!}};LastAlign=%1} {} {prompt|nocr}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Sat Sep 11, 2004 5:04 pm   
 
I get the following when using this.


{#IF (%1>) {#ECHO Warning! You are losing neutrality!}};LastAlign=%1
^ syntax error
Reply with quote
Backu
Novice


Joined: 24 Feb 2003
Posts: 36
Location: USA

PostPosted: Sat Sep 11, 2004 5:08 pm   
 
Eghm... no {} around the actuall #IF..

#IF (%1>300) {#ECHO Warning! You are losing neutrality!};LastAlign=%1
_________________
-Backu Zethara
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Sep 11, 2004 7:15 pm   
 
I just tested it, and it works perfectly. Simply copy the entire thing, paste it into the command line and hit enter.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Sun Sep 12, 2004 1:20 am   
 
#TR "AlignmentWarn" {^HIT:%d/%d MVS:%d/%d A:{-|}(%d) EXLVL:%d} {#IF (%1>300) {#IF (%1>@LastAlign) {#ECHO Warning! You are losing neutrality!}};LastAlign=%1} {} {prompt|nocr}


Patter: ^HIT:%d/%d MVS:%d/%d A:{-|}(%d) EXLVL:%d

Value: {#IF (%1>) {#ECHO Warning! You are losing neutrality!}};LastAlign=%1
^ syntax error


I copied the entire line into the command line and pressed enter. It created the trigger just fine however it gives the error indicated above.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Sep 12, 2004 3:58 am   
 
I can't do anything other then reformat it and hope you can understand this way. Use the Settings Editor to correct the existing trigger to match below.

Pattern: ^HIT:%d/%d MVS:%d/%d A:{-|}(%d) EXLVL:%d

Value: #IF (%1>300) {#IF (%1>@LastAlign) {#ECHO Warning! You are losing neutrality!}};LastAlign=%1

Options: Prompt=checked, NewLine=unchecked
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Sep 12, 2004 6:16 am   
 
You apparently have selected 'Expand Vars' in your Script Parser Preferences. Uncheck the preference while entering scripts at the command line.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Wed Sep 15, 2004 6:24 pm   
 
I've tried to find "expand vars" in the script parser preferences however i have been unable to find the "Script Parser Preferences"

I still have not been able to get this script to work :( and I know you all are trying so hard to help me and i appriciate it too i really do.
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Sep 15, 2004 7:18 pm   
 
On zMud's menu bar, select View,Preferences,General.
In the left pane, find 'General Parsing' and click it.
On the right pane in the second column, uncheck 'Expand Vars'

I believe this is what LightBulb was referring to.
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Wed Sep 15, 2004 7:44 pm   
 
Okay! that removed the error! Now it just doesn't seem like the trigger is firing. :(

the var @lastalign is never created.
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Sep 15, 2004 8:03 pm   
 
In the settings editor with the trigger selected, click the test tab. Copy and paste your prompt into the text entry box and determine if the trigger is correct.
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Wed Sep 15, 2004 8:36 pm   
 
Okay i think this is what the problem is however I have no clue how to fix this.

the code for my prompt is as follows:

prompt %0Hit:%1%h/%H%0 MVS:%3%v/%V%0 A:%8%2%a%0 EXPLVL:%3%X%0%r%t%f%r%0

Now if i remove the %r%t%f%r%0 from the prompt code the trigger works. Below is an explanation of what these are for and why I need them.

%h - current hitpoints %i - Current hp with color
%m - current mana %n - Current mana with color
%v - current moves %w - Current moves with color
%k - current ki %l - Current ki with color
%g - current gold

%H - Max hitpoints %x - Experience
%M - Max mana %X - Experience to next level
%V - Max moves %a - Alignment
%K - Max ki %A - Alignment with color
%s - Sector type of room you are in

These codes also work, but they will only be displayed when you are
fighting:

%c - Your condition %C - Your condition with color
%f - Opponent's condition %F - Opponent's condition with color
%t - Tank's condition %T - Tank's condition with color

These codes allow you to set the colors used in your prompt:

%0 - Go back to normal text %5 - Purple
%1 - Red %6 - Cyan
%2 - Green %7 - Grey
%3 - Yellow %8 - Bold
%4 - Blue %9 - Flashing
%r - Carriage Return

So how do i account for the %r (carriage return) %t (Tank's Condition) %f (Opponet's Condition)
and the final %r (Carriage Return) in the prompt patten below?

Pattern: ^HIT:%d/%d MVS:%d/%d A:{-|}(%d) EXLVL:%d

Thanks!
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Wed Sep 15, 2004 8:57 pm   
 
As long as you're not anchoring the end of the prompt with the end of line pattern-matching character ($ by default), those things at the end of the prompt shouldn't matter.

As a guess, you could try adding %y to the end of your pattern. If that doesn't work, you'll have to wait for someone else's ideas.

Pattern: ^HIT:%d/%d MVS:%d/%d A:{-|}(%d) EXLVL:%d%y
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Wed Sep 15, 2004 9:24 pm   
 
unfortunally for me lol this did not work. The trigger stopps working as soon as i add the %r for the carriage return. As for the rest of the variables well i don't know until i get past the %r
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Sep 16, 2004 12:16 am   
 
If your prompt has a newline after the end then its no longer a "prompt" line uncheck the option for prompt and check the option for newline
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Sep 16, 2004 1:36 am   
 
That is funny. The trigger options set it to fire on prompts and not newlines. So since it always has a newline from the mud it never fires. The concept of a prompt is that it doesn't have a newline (I tend to do the same thing with my "prompt" though), wish you mentioned it in the first place. Simply check the Newline option and uncheck the Prompt option. The %y is not needed in the pattern, but you could add the end of line anchor $ if you want.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Thu Sep 16, 2004 3:30 am   
 
Okay we finally got this thing working!!!! Good job everyone!

Now, to add some spice to it lol...

What i'd like to do now is

1) add color to the echo xxxx
2) I have a list of equipment that I wear as follows.

You are using:
<right finger> an ivory ring [Excellent]
<left finger> an ivory ring [Excellent]
<around neck> a sparkling necklace [Excellent]
<around neck> a pale blue collar [Decent]
<on body> the Master Captain's scale mail [Good]
<on head> the Master Captain's coif [Excellent]
<on legs> the Master Captain's embossed greaves [Excellent]
<on feet> the Master Captain's leather boots [Excellent]
<on hands> the Master Captain's leather gloves [Excellent]
<on arms> the Master Captain's embossed bracers [Excellent]
<about body> a monkey's body [Excellent]
<about waist> a tattered loincloth [Excellent]
<around wrist> a red bandana [Excellent]
<around wrist> a red bandana [Decent]
<wielded> a crude, jagged spear [Excellent]
<second wield> a crude, jagged spear [Excellent]
<on face> a pair of vicious wolf fangs [Excellent]
<in left ear> a bronze giant earring (Glowing) [Excellent]
<in right ear> a bronze giant earring [Excellent]

Now, what i need to do is when my align reaches +-340 I want to automatically remove equipment and store it in a container.

And i thought just making this script was going to be a piece of cake lol.
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Thu Sep 16, 2004 5:30 am   
 
Okay posted below is the original reply to my script here but i've just discovered that this only works when the numbers are going in a positive direction.

if my align is say -299 and it goes to -308 the trigger does not fire however if it's in a positive state it does trigger ie. 299 hitting 308 it triggers.



Since both positive and negative values are bad and the cut-off is the same for both, I pulled that out of the capture and used just the number. This is designed to give you warnings every time your alignment changes when it is over 300 and moving towards 350.

#TR "AlignmentWarn" {^HIT:%d/%d MVS:%d/%d A:{-|}(%d) EXLVL:%d} {#IF (%1>300) {#IF (%1>@LastAlign) {#ECHO Warning! You are losing neutrality!}};LastAlign=%1} {} {prompt|nocr}
Reply with quote
Falan
Wanderer


Joined: 17 Aug 2004
Posts: 98
Location: OK, USA

PostPosted: Thu Sep 16, 2004 5:54 am   
 
You showed the + display as A:340. What's the - display look like?

Add an %ansi() function to the #ECHO.
Add an #IF (%1>340) {text to remove eq; text to put eq in container}

{#IF (%1>300) {#IF (%1>@LastAlign) {#ECHO {Warning! You are losing neutrality!;%ansi(color of choice)}}};#IF (%1>340) {text to remove eq; text to put eq in container};LastAlign=%1}
_________________
zMUD 7.05a
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Sep 16, 2004 12:16 pm   
 
REPLACE in the pattern A:{-|}(%d) WITH A:(%n)
REPLACE all occurances of %1 in the value WITH %abs(%1)
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Thu Sep 16, 2004 2:00 pm   
 
okay got the +- thing figured out.

As for the removal of eq. There is a list of eq i need to remove not just one piece.
So how do i work in a list of eq to be removed and to be put into a container?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Sep 16, 2004 3:03 pm   
 
text to remove eq; text to put eq in container;more text to remove other eq;more text to put eq in container
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Thu Sep 16, 2004 4:24 pm   
 
Okay all that works, now i have another issue.

once my align hits the specified value, the trigger stays in a loop and floods the mud with the same commands.

So what i need now is if the align reaches 340 or -340 i need to remove items. if align is below 340 or -340 i need to wear items.

And the %ansi command does not work as listed above.
Reply with quote
Falan
Wanderer


Joined: 17 Aug 2004
Posts: 98
Location: OK, USA

PostPosted: Thu Sep 16, 2004 6:44 pm   
 
The %abs(%1) method worked fine for all positive values.

For negative values, when %1 < -300 , each lesser %1 (e.g. -301, -302, etc) triggered the #ECHO {Warning! You are losing neutrality!}. That's expected.

HOWEVER, when %1 increased to a more positive number < -300, it still triggered the #ECHO. E.g. %1 changed from -302 to -301.
AND, the #ECHO also fired when %1 was unchanged and < -300.

I ran it with Vijilante's A:{-|} and had no problems.

Change the #IF statement to
Code:

{#IF ((%1<340) and (@RemEq)) {#ECHO {%ansi( high, green)You have regained neutrality. Wearing EQ};#FORALL @RemEqList {get %i from container;wear %i};#VAR RemEq 0};#IF (( %1>300) and ( %1<340)) {#IF (%abs( %1)>@LastAlign) {#ECHO {%ansi( yellow)Warning! You are losing neutrality!}}};#IF (%1>339) {#IF !(@RemEq) {#ECHO {%ansi( high, red, blink)You have lost neutrality! Removing EQ!};#VAR RemEQ 1;#FORALL @RemEqList {remove %i;put %i in container}}};LastAlign=%1}

and create 2 more variables
Code:

#VAR RemEQ {0}
#VAR RemEqList {item1|item2|item3}
_________________
zMUD 7.05a
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net