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
jrwr
Beginner


Joined: 19 Jan 2006
Posts: 10

PostPosted: Fri Jan 20, 2006 3:49 am   

newbie question
 
how do i get stuff of the output of the mud into a var
i whant to make a status bar,

i am a PHP scripter so i know how to work with vars, and i know how to display the vars in the bar i guess (i would like a percent bar) this is the line its blue bold i think
it does popup about ever 5 secs on the output

<58hp 97m 320mv 100br>

this is for the Medievia MUD
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Jan 20, 2006 4:36 am   
 
Triggers are used to capture scrolling text.
(see help TRIGGER Syntax: #TR [id] pattern command [classname] [options])

<58hp 97m 320mv 100br>

The trigger pattern we need to capture the output into variables:
(see help Pattern Matching <Variables>)

#TRIGGER {^~<(%d)hp (%d)m (%d)mv (%d)br~>} {#VAR V_hp %1;#VAR V_m %2;#VAR V_mv %3;#VAR V_br %4}

Now we have saved your status prompt into variables.

To make a status bar with percents you could do:

Capture these from somewhere else or set them manually. I'll guess 100 is the max for the example.
#VAR V_hp_max 100
#VAR V_m_max 100
#VAR V_mv_max 100
#VAR V_br_max 100

#ST %eval(100*@V_Hp/@V_Hp_Max)~%hp %eval(100*@V_m/@V_m_Max)~%hp %eval(100*@V_mv/@V_mv_Max)~%mv %eval(100*@V_br/@V_br_Max)~%br
Reply with quote
jrwr
Beginner


Joined: 19 Jan 2006
Posts: 10

PostPosted: Fri Jan 20, 2006 4:43 am   
 
also howto auto login to this mud would help too
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Jan 20, 2006 4:49 am   
 
The second time you log into the mud it will try and guess the line for character and for password.

Modify that wizard to fit your needs. If you are past that, in the folder autolog contains the triggers for the autologin.

What does Medievia look like these days when you log in? Specifically the character & password lines.
Do you type on that line or the following line?
Reply with quote
jrwr
Beginner


Joined: 19 Jan 2006
Posts: 10

PostPosted: Fri Jan 20, 2006 4:51 am   
 
i was able to config the prompt to <151/151hp 82/82m 370/370mv 100br -r>
as you migth know the last num is max
Reply with quote
jrwr
Beginner


Joined: 19 Jan 2006
Posts: 10

PostPosted: Fri Jan 20, 2006 4:55 am   
 
nvm got it to work, the autologin
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Jan 20, 2006 4:58 am   
 
TRIGGER {^~<(%d)~/(%d)hp (%d)~/(%d)m (%d)~/(%d)mv (%d)~/(%d)br (%x)~>} {#VAR V_hp %1;#VAR V_m %3;#VAR V_mv %5;#VAR V_br %7;#VAR V_hp_max %2;#VAR V_m_max %4 ;#VAR V_mv_max %6 ;#VAR V_br_max %8;#VAR V_other {%9}}

As you can see the %<number> is linked to the pattern matched () in the trigger. Ie the first number captured (%d) is %1 the second (%d) is %2 etc.
Reply with quote
jrwr
Beginner


Joined: 19 Jan 2006
Posts: 10

PostPosted: Fri Jan 20, 2006 5:18 am   
 
ok i changed it to
^\<(\d+)\/(\d+)hp (\d+)\/(\d+)m (\d+)\/(\d+)mv (\d+)\/(\d+)br (\S+)\>
and changed

#VAR V_hp %1
#VAR V_m %3
#VAR V_mv %5
#VAR V_br %7
#VAR V_hp_max %2
#VAR V_m_max %4
#VAR V_mv_max %6
#VAR V_br_max %8


Last edited by jrwr on Fri Jan 20, 2006 5:39 am; edited 1 time in total
Reply with quote
jrwr
Beginner


Joined: 19 Jan 2006
Posts: 10

PostPosted: Fri Jan 20, 2006 5:20 am   
 
but all it shoes is 0%hp 0%m 0%mv etc
Reply with quote
jrwr
Beginner


Joined: 19 Jan 2006
Posts: 10

PostPosted: Fri Jan 20, 2006 5:48 am   
 
i got it to work just fine, im all good now
Reply with quote
jrwr
Beginner


Joined: 19 Jan 2006
Posts: 10

PostPosted: Fri Jan 20, 2006 5:48 am   
 
hay are there any way to add some color to it, and also can i remove the prompts from veing displayed
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Jan 20, 2006 6:09 am   
 
Use the ansi command.

#FUNC Color {%if(%1>7,black,%if(%1>5,green,%if(%1>3,yellow,red)))}

#ST %ansi(bold,@Color(%eval(10*@V_Hp/@V_Hp_Max)))%eval(100*@V_Hp/@V_Hp_Max)%ansi(default)~%hp %ansi(bold,@Color(%eval(10*@V_m/@V_m_Max)))%eval(100*@V_m/@V_m_Max)%ansi(default)~%hp %ansi(bold,@Color(%eval(10*@V_mv/@V_mvMax)))%eval(100*@V_mv/@V_mv_Max)%ansi(default)~%mv %ansi(bold,@Color(%eval(10*@V_br/@V_br_Max)))%eval(100*@V_br/@V_br_Max)%ansi(default)~%br
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