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
Thoras
Newbie


Joined: 08 Mar 2002
Posts: 8

PostPosted: Fri Mar 08, 2002 8:26 pm   

How to set up
 
High, just got zmud because I've heard so much about it and everything. Must say I'm pretty amazed, awesome piece of work 8)

Was wondering if anyone could help me with how to do something though, here it is.

I wanted to take something I get from my status the mud sends me, hp armor etc, divide one of the numbers and then use it to do something, but only by typing one command and without having to bother changing it myself each time.

prompt goes like this:
<Experience (xxxxxxx/xxxxxxx)>

the numbers change constantly

I wanted to take the first set of numbers on the left, divide it by 10,000 and then use that number to do another command. Wanted to know if I this was possible :p
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Mar 08, 2002 9:27 pm   
 
Two concepts:
1) You want a trigger to capture the changing numbers for you.
2) You want to make a variable to store that number value / 10000 so you can refer to it
elsewhere.

1)
#TRIGGER {^~<Experience ~((%d)~/(%d)~)~>} {#VARIABLE promptxp [%1/10000];#VARIABLE secondcapture %2}

Any special characters (view->settings->special characters) in the trigger line needs
to have a ~ in front of it so zMud doesn't think it has to do something else with it.
So you'll see that I replaced:
< with ~<
( with ~(
) with ~)

As your experience is shown to you as a number we'll match it and capture with (%d)
see help "Pattern Matching" for other kinds of matching. Capturing the value is done by
putting the () around what you want to capture.

The first thing captured can be refered to as %1 in the script, the second as %2, etc

I captured the information %1 and %2 into two variables called promptxp and secondcapture.
These you can use to refer to the numbers it captured form your prompt later.

2)
You can test that you captured the value for your experience an divided it by 10000 with
#ECHO @promptxp

Else where you can refer to that value as @promptxp such as here
with this alias that will check the variable promptxp for the value we capture and echo
to the screen if it is larger or smaller than 10:

#ALIAS xpcheck {#IF (@promptxp > 10) {#ECHO @promptxp is larger than 10!} {#ECHO @promptxp is less than or equal to 10!}}

As you play around with it, the concepts all gel fast. Anything unclear in the above,
I'll be happy to explain.


TonDiening
Beta Upgrading to 6.26

Modified 7:58
#ALIAS xpcheck {#IF (@promptxp > 10) {#ECHO @promptxp is larger than 10!} {{#ECHO @promptxp is less than or equal to 10!}}
Reply with quote
Thoras
Newbie


Joined: 08 Mar 2002
Posts: 8

PostPosted: Fri Mar 08, 2002 10:06 pm   
 
Thanks for the quick reply. I've gotten some basic easy nothing triggers to work, but you pretty much completely lost me on that one ;)

I can follow what your doing and everything, but I don't know how to put it into zmud, maybe just a bit of clarification on where to stick the commands?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Mar 08, 2002 10:23 pm   
 
There are 2 ways to present things that seem to be adhered to in these forums.
1) something you can cut and paste into your command line
2) something you can cut and paste into your settings editor

I used things that you can cut and paste into your command line.

Here are the equivalents:
Command line:
#TRIGGER {^~<Experience ~((%d)~/(%d)~)~>} {#VARIABLE promptxp [%1/10000];#VARIABLE secondcapture %2}

Settings Editor
Trigger: ^~<Experience ~((%d)~/(%d)~)~>
Script: #VARIABLE promptxp [%1/10000];#VARIABLE secondcapture %2

and

Command Line:
#ALIAS xpcheck {#IF (@promptxp > 10) {#ECHO @promptxp is larger than 10!} {#ECHO @promptxp is less than or equal to 10!}}

Settings Editor:
Alias: xpcheck
Script: #IF (@promptxp > 10) {#ECHO @promptxp is larger than 10!} {{#ECHO @promptxp is less than or equal to 10!



TonDiening
Beta Upgrading to 6.26
Reply with quote
Thoras
Newbie


Joined: 08 Mar 2002
Posts: 8

PostPosted: Fri Mar 08, 2002 11:57 pm   
 
thanks a bunch for the quick replies and the help. Tinkering a bit I got it to work some, but I messed something up and now
nothing works :D

Couldn't make anything work again even after deleting it all and putting it back in, so oh well, thanks anyways 8)
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat Mar 09, 2002 1:13 am   
 
My bad on the alias:
#ALIAS xpcheck {#IF (@promptxp > 10) {#ECHO @promptxp is larger than 10!} {{#ECHO @promptxp is less than or equal to 10!}

should be

#ALIAS xpcheck {#IF (@promptxp > 10) {#ECHO @promptxp is larger than 10!} {#ECHO @promptxp is less than or equal to 10!}}

The trigger should be ok though.

What isn't working?


TonDiening
Beta Upgrading to 6.26
Reply with quote
Thoras
Newbie


Joined: 08 Mar 2002
Posts: 8

PostPosted: Sat Mar 09, 2002 1:50 am   
 
It doesn't seem to be making the variables anymore.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat Mar 09, 2002 2:09 am   
 
The variables are created and updated with the trigger:

#TRIGGER {^~<Experience ~((%d)~/(%d)~)~>} {#VARIABLE promptxp [%1/10000];#VARIABLE secondcapture %2}


You can test the value of the variables with the following
once you've see the mud output:
<Experience (xxxx/xxxx)>

#ECHO @promptxp @secondcapture

What does that give you?

TonDiening
Beta Upgrading to 6.26
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat Mar 09, 2002 2:09 am   
 
The variables are created and updated with the trigger:

#TRIGGER {^~<Experience ~((%d)~/(%d)~)~>} {#VARIABLE promptxp [%1/10000];#VARIABLE secondcapture %2}


You can test the value of the variables with the following
once you've see the mud output:
<Experience (xxxx/xxxx)>

#ECHO @promptxp @secondcapture

What does that give you?

TonDiening
Beta Upgrading to 6.26
Reply with quote
Thoras
Newbie


Joined: 08 Mar 2002
Posts: 8

PostPosted: Sat Mar 09, 2002 5:01 am   
 
Gives me back nothing at all :p
I just realised it may not be working because the prompt isn't exactly what I said, sorry, exact prompt i get is

<Lifeforce (100) Armor (831) Energy (3,806)>
<Powerlevel (39,691,491/39,691,491)>
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Mar 09, 2002 7:57 am   
 
Next time please just give a copy of the mud's output first.

Replace Ton's:
#TRIGGER {^~<Experience ~((%d)~/(%d)~)~>} {#VARIABLE promptxp [%1/10000];#VARIABLE secondcapture %2}
With:
#TRIGGER {^~<Powerlevel ~((*)~/(*)~)~>} {#VARIABLE promptxp %eval(%replace(%1,",","")/10000);#VARIABLE secondcapture %replace(%2,",","")}
Reply with quote
Thoras
Newbie


Joined: 08 Mar 2002
Posts: 8

PostPosted: Sat Mar 09, 2002 4:28 pm   
 
Sorry for the intial bad posting guys, but with all the help I was able to tinker a bit and it works perfectly now! 8)
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