| View previous topic :: View next topic |
| Author |
Message |
firefox32
Joined: 24 Apr 2008 Posts: 7
|
Posted: Thu Apr 24, 2008 2:49 am Post subject: Problem in parsing my prompt and make an action... |
|
|
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 |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Thu Apr 24, 2008 11:56 am Post subject: |
|
|
You'd probably want to use $porc_mp instead of $mp?
| Code: |
#if {$porc_mp < 50} {report}
|
|
|
| Back to top |
|
 |
firefox32
Joined: 24 Apr 2008 Posts: 7
|
Posted: Mon May 05, 2008 6:03 am Post subject: |
|
|
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 |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Sun May 11, 2008 8:18 pm Post subject: |
|
|
| No idea in that case. You can use: #debug action on, and make sure the action triggers. |
|
| Back to top |
|
 |
firefox32
Joined: 24 Apr 2008 Posts: 7
|
Posted: Tue May 20, 2008 2:38 am Post subject: |
|
|
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 |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Tue May 20, 2008 8:52 am Post subject: |
|
|
| 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 |
|
 |
firefox32
Joined: 24 Apr 2008 Posts: 7
|
Posted: Tue May 20, 2008 9:08 am Post subject: |
|
|
| 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 |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Tue May 20, 2008 10:57 am Post subject: |
|
|
| I don't see the #if in the debug report, possibly another/duplicate action is triggering? |
|
| Back to top |
|
 |
firefox32
Joined: 24 Apr 2008 Posts: 7
|
Posted: Wed May 21, 2008 3:13 am Post subject: |
|
|
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 |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Wed May 21, 2008 7:27 am Post subject: |
|
|
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 |
|
 |
firefox32
Joined: 24 Apr 2008 Posts: 7
|
Posted: Wed May 21, 2008 8:46 am Post subject: |
|
|
Tnx now it work!
So i must neast if clause only in action for check my variable? |
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Wed May 21, 2008 11:27 am Post subject: |
|
|
| The way you had it the variable was checked whenever you #read the file, instead of whenever the action triggers. |
|
| Back to top |
|
 |
|