TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Problem in parsing my prompt and make an action...

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help
View previous topic :: View next topic  
Author Message
firefox32



Joined: 24 Apr 2008
Posts: 7

PostPosted: Thu Apr 24, 2008 2:49 am    Post subject: Problem in parsing my prompt and make an action... Reply with quote

Hi at all,
i'll try to make a script that parse my prompt bar and make some action for report my status to other pg.

This is my prompt:
Code:

H: 421/421 M: 240/244 V: 183/183 X: 148519700 [SPELL: ST] TANK: * MOB: *>


And i parse that prompt with that action:
Code:

#action {H: %1/%2 M: %3/%4 V: %5/%6 X: %7}
{
   #var hp %1;
   #var max_hp %2;
   #math {porc_hp} {100*$hp/$max_hp} ;
   #var mp %3;
   #var max_mp %4;
   #math {porc_mp} {100*$mp/$max_mp} ;
   #var vp %5;
   #var max_vp %6;

}


My goal is that if some of that variable assume a specific value my trigger must make some action, for example if my mana point will be under 50 i report my status with report command:
Code:

#if {$mp<50} {report;}

but that do not work.
Where is my mistake?
Tnx in advance for ani tips.
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3274

PostPosted: Thu Apr 24, 2008 11:56 am    Post subject: Reply with quote

You'd probably want to use $porc_mp instead of $mp? Wink

Code:

#if {$porc_mp < 50} {report}
Back to top
View user's profile Send private message Send e-mail
firefox32



Joined: 24 Apr 2008
Posts: 7

PostPosted: Mon May 05, 2008 6:03 am    Post subject: Reply with quote

No the example in my post is for $mp not for $porc_mp infact that report show my mana status to other member of my group for say to other that i cuold not make some efficent cure.
$porc_mp is for another kind of script but for future implementation first of all i wuold like to do work that part of script.
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3274

PostPosted: Sun May 11, 2008 8:18 pm    Post subject: Reply with quote

No idea in that case. You can use: #debug action on, and make sure the action triggers.
Back to top
View user's profile Send private message Send e-mail
firefox32



Joined: 24 Apr 2008
Posts: 7

PostPosted: Tue May 20, 2008 2:38 am    Post subject: Reply with quote

And this is the result of debug on:

Code:

#ACTION DEBUG: #var hp 468;#var max_hp 497;#math {porc_hp} {100*$hp/$max_hp} ;#var mp 191;#var max_mp 244;#math {porc_mp}
{100*$mp/$max_mp} ;#var vp 148;#var max_vp 183;
H: 468/497 M: 191/244 V: 148/183 X: 43056399 [SPELL: sT] *:* *:* >
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3274

PostPosted: Tue May 20, 2008 8:52 am    Post subject: Reply with quote

I don't see why it shouldn't work, but you could add the if check, use #debug all on, and use #showme {H: 468/497 M: 33/244 V: 148/183 X: 43056399 [SPELL: sT] *:* *:* >} to see if it works.
Back to top
View user's profile Send private message Send e-mail
firefox32



Joined: 24 Apr 2008
Posts: 7

PostPosted: Tue May 20, 2008 9:08 am    Post subject: Reply with quote

Code:

#showme {H: 468/497 M: 33/244 V: 148/183 X: 43056399 [SPELL: sT] *:* *:* >}
#ACTION DEBUG: #var hp 468;#var max_hp 497;#math {porc_hp} {100*$hp/$max_hp} ;#var mp 33;#var max_mp 244;#math {porc_mp}
{100*$mp/$max_mp} ;#var vp 148;#var max_vp 183;
#OK. VARIABLE {hp} HAS BEEN SET TO {468}.
#OK. VARIABLE {max_hp} HAS BEEN SET TO {497}.
#OK. VARIABLE {porc_hp} HAS BEEN SET TO {94}.
#OK. VARIABLE {mp} HAS BEEN SET TO {33}.
#OK. VARIABLE {max_mp} HAS BEEN SET TO {244}.
#OK. VARIABLE {porc_mp} HAS BEEN SET TO {13}.
#OK. VARIABLE {vp} HAS BEEN SET TO {148}.
#OK. VARIABLE {max_vp} HAS BEEN SET TO {183}.
H: 468/497 M: 33/244 V: 148/183 X: 43056399 [SPELL: sT] *:* *:* >

The variabile mp is correct but the if cicle do not make a report...
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3274

PostPosted: Tue May 20, 2008 10:57 am    Post subject: Reply with quote

I don't see the #if in the debug report, possibly another/duplicate action is triggering?
Back to top
View user's profile Send private message Send e-mail
firefox32



Joined: 24 Apr 2008
Posts: 7

PostPosted: Wed May 21, 2008 3:13 am    Post subject: Reply with quote

ill try to load a tintin file with only that line:
Code:

#action {H: %1/%2 M: %3/%4 V: %5/%6 X: %7}
{
   #var hp %1;
   #var max_hp %2;
   #math {porc_hp} {100*$hp/$max_hp} ;
   #var mp %3;
   #var max_mp %4;
   #math {porc_mp} {100*$mp/$max_mp} ;
   #var vp %5;
   #var max_vp %6;

}
#alias {avvisa} {report}
#if {$mp<50} {avvisa}

and after that with debug all on

Code:

H: 493/497 M: 234/274 V: 183/183 X: 28666011 [SPELL: sT] *:* *:* >
#showme {H: 468/497 M: 33/244 V: 148/183 X: 43056399 [SPELL: sT] *:* *:* >}
#OK. VARIABLE {hp} HAS BEEN SET TO {468}.
#OK. VARIABLE {max_hp} HAS BEEN SET TO {497}.
#OK. VARIABLE {porc_hp} HAS BEEN SET TO {94}.
#OK. VARIABLE {mp} HAS BEEN SET TO {33}.
#OK. VARIABLE {max_mp} HAS BEEN SET TO {244}.
#OK. VARIABLE {porc_mp} HAS BEEN SET TO {13}.
#OK. VARIABLE {vp} HAS BEEN SET TO {148}.
#OK. VARIABLE {max_vp} HAS BEEN SET TO {183}.
H: 468/497 M: 33/244 V: 148/183 X: 43056399 [SPELL: sT] *:* *:* >
#showme $mp
33


I don'see the if report...
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3274

PostPosted: Wed May 21, 2008 7:27 am    Post subject: Reply with quote

Ah, you'd want to nest it into the prompt trigger:

Code:

#action {H: %1/%2 M: %3/%4 V: %5/%6 X: %7}
{
   #var hp %1;
   #var max_hp %2;
   #math {porc_hp} {100*$hp/$max_hp} ;
   #var mp %3;
   #var max_mp %4;
   #math {porc_mp} {100*$mp/$max_mp} ;
   #var vp %5;
   #var max_vp %6;
   #if {$mp<50} {report}
}
Back to top
View user's profile Send private message Send e-mail
firefox32



Joined: 24 Apr 2008
Posts: 7

PostPosted: Wed May 21, 2008 8:46 am    Post subject: Reply with quote

Tnx now it work!
So i must neast if clause only in action for check my variable?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3274

PostPosted: Wed May 21, 2008 11:27 am    Post subject: Reply with quote

The way you had it the variable was checked whenever you #read the file, instead of whenever the action triggers.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help All times are GMT - 5 Hours
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
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group