|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Jan 23, 2009 8:18 pm
Odd Issue with formatting [Solved] |
Here's the working trigger:
Code: |
<trigger priority="460" regex="true" id="46">
<pattern>^Spell: permanency : modifies none by \d+ for (\d+) cycles, \(\d+ (?:1/2 )?hours\)$</pattern>
<value>$Time_LeftC=%1
$Time_LeftS=$Time_LeftC*41
$Time_LeftM=%float($Time_LeftS)/60
$Time_LeftH=%float($Time_LeftM)/60
$Time_LeftH=%format(2,$Time_LeftH)
$Time_Hours=%round($Time_LeftH*100)/100
$Time_Minutes=%mod(%round($Time_LeftH*100),100)*60/100
#SWITCH ($Time_Hours>1)
{
#sub "Permanency Cooldown : "$Time_Hours" hours and "$Time_Minutes" minutes remaining."} ($Time_Hours=1) {#sub "Permanency Cooldown : "$Time_Hours" hour and "$Time_Minutes" minutes remaining."
} ($Time_Hours<1) {#sub "Permanency Cooldown : "$Time_Minutes" minutes remaining. (or "%1" cycles)"}
</value>
</trigger>
|
However, I don't like how that reads, I wanted it to look like this:
Code: |
...
#SWITCH ($Time_Hours>1)
{
#sub "Permanency Cooldown : "$Time_Hours" hours and "$Time_Minutes" minutes remaining."
}
($Time_Hours=1)
{
#sub "Permanency Cooldown : "$Time_Hours" hour and "$Time_Minutes" minutes remaining."
}
($Time_Hours<1)
{
#sub "Permanency Cooldown : "$Time_Minutes" minutes remaining. (or "%1" cycles)"
}
|
But it started erroring like that. What rules of formatting am I breaking by doing that? |
|
_________________ Listen to my Guitar - If you like it, listen to more
Last edited by chamenas on Mon Jan 26, 2009 12:59 am; edited 1 time in total |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Fri Jan 23, 2009 8:37 pm |
Try to play with an indent. General rule is: your curly braces {} must be 1 level deeper than parentheses. If it'll not help, try to make an indent for the parentheses as well
Code: |
#SWITCH ($Time_Hours>1) {
#sub "Permanency Cooldown : "$Time_Hours" hours and "$Time_Minutes" minutes remaining."
}
($Time_Hours=1)
{
#sub "Permanency Cooldown : "$Time_Hours" hour and "$Time_Minutes" minutes remaining."
}
($Time_Hours<1)
{
#sub "Permanency Cooldown : "$Time_Minutes" minutes remaining. (or "%1" cycles)"
} |
Sorry, I can't run CMUD right now and look how I did in my scripts. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Jan 23, 2009 9:30 pm |
That worked, thanks. Now I have an odd issue though.
Code: |
<trigger priority="460" regex="true" id="46">
<pattern>^Spell: permanency : modifies none by \d+ for (\d+) cycles, \(\d+ (?:1/2 )?hours\)$</pattern>
<value><![CDATA[$Time_LeftC=%1
$Time_LeftS=$Time_LeftC*41
$Time_LeftM=%float($Time_LeftS)/60
$Time_LeftH=%float($Time_LeftM)/60
$Time_LeftH=%format(2,$Time_LeftH)
$Time_Hours=%round($Time_LeftH*100)/100
$Time_Minutes=%mod(%round($Time_LeftH*100),100)*60/100
#SWITCH (($Time_Hours>1) AND ($Time_Minutes>1) OR ($Time_Minutes<1)) {
#sub "Permanency Cooldown : "$Time_Hours" hours and "$Time_Minutes" minutes remaining."
}
(($Time_Hours=1) AND ($Time_Minutes=1))
{
#sub "Permanency Cooldown : "$Time_Hours" hour and "$Time_Minutes" minute remaining."
}
(($Time_Hours<1) AND ($Time_Minutes>1))
{
#sub "Permanency Cooldown : "$Time_Minutes" minutes remaining. (or "%1" cycles)"
}
(($Time_Hours>1) AND ($Time_Minutes=1))
{
#sub "Permanency Cooldown : "$Time_Hours" hours and "$Time_Minutes" minute remaining."
}
(($Time_Hours=1) AND ($Time_Minutes>1))
{
#sub "Permanency Cooldown : "$Time_Hours" hour and "$Time_Minutes" minutes remaining."
}
(%1<4)
{
#sub "Permanency Cooldown : cycles remaining!
} ]]></value>
</trigger>
|
Is the new code, and it works fine for the instances I have tested, except then %1 gets below 4. The pattern matches below 4, but the trigger doesn't replace the text, it lets it goes through and tries to create a new trigger based off of information from the pattern.
Example trigger made by #show "Spell: Permanency : modifies none by 0 for 3 cycles, (123 1/2 hours)"
Code: |
<trigger priority="870" id="87">
<pattern>"Permanency</pattern>
<value>#sub {Cooldown}</value>
</trigger>
|
|
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Jan 23, 2009 10:55 pm |
Probably because all your subs need to be in brackets, not quotes.
#SUB {Permanency Cooldown : cycles remaining!}
should work.
Charneus |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sat Jan 24, 2009 12:58 am |
Should I do brackets and quotes? Or leave the quotes out. I have a mix of strings and variables.
|
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Jan 24, 2009 1:12 am |
Try doing brackets and quotes. Normally, I don't quote anything in #SUB, but it couldn't hurt, I don't think. By the way, instead of doing that large space, try using the %repeat(" ",15) or however many spaces you want so you don't have to type them out. ;)
Charneus |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sat Jan 24, 2009 1:42 am |
Thanks, that worked. Oddly though, the color shorts out about halfway through. Even though there are no errors.
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sat Jan 24, 2009 4:43 pm |
Here's the trigger, btw:
Code: |
<trigger priority="460" regex="true" id="46">
<pattern>^Spell: permanency : modifies none by \d+ for (\d+) cycles, \(\d+ (?:1/2 )?hours\)$</pattern>
<value><![CDATA[$Time_LeftC=%1
$Time_LeftS=$Time_LeftC*41
$Time_LeftM=%float($Time_LeftS)/60
$Time_LeftH=%float($Time_LeftM)/60
$Time_LeftH=%format(2,$Time_LeftH)
$Time_Hours=%round($Time_LeftH*100)/100
$Time_Minutes=%mod(%round($Time_LeftH*100),100)*60/100
#SWITCH (($Time_Hours>1) AND ($Time_Minutes>1) OR ($Time_Minutes<1)) {
#sub {"Permanency Cooldown : "$Time_Hours" hours and "$Time_Minutes" minutes remaining."}
}
(($Time_Hours=1) AND ($Time_Minutes=1))
{
#sub {"Permanency Cooldown : "$Time_Hours" hour and "$Time_Minutes" minute remaining."}
}
(($Time_Hours<1) AND ($Time_Minutes>1))
{
#sub {"Permanency Cooldown : "$Time_Minutes" minutes remaining. (or "%1" cycles)"}
}
(($Time_Hours>1) AND ($Time_Minutes=1))
{
#sub {"Permanency Cooldown : "$Time_Hours" hours and "$Time_Minutes" minute remaining."}
}
(($Time_Hours=1) AND ($Time_Minutes>1))
{
#sub {"Permanency Cooldown : "$Time_Hours" hour and "$Time_Minutes" minutes remaining."}
}
(%1<4)
{
#sub {"Permanency Cooldown : "%1" cycles remaining!"}
} ]]></value>
</trigger>
|
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Jan 25, 2009 10:39 pm |
bump
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Jan 26, 2009 12:17 am |
What exactly are you bumping? This the last thing you posted before the trigger? Is the trigger not working? Not compiling?
chamenas wrote: |
Thanks, that worked. Oddly though, the color shorts out about halfway through. Even though there are no errors. |
I just tried pasting into CMUD and it seems fine. |
|
_________________ Asati di tempari! |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Mon Jan 26, 2009 12:59 am |
Odd, it is working now. Thanks.
|
|
|
|
|
|