| View previous topic :: View next topic |
| Author |
Message |
abedour
Joined: 29 Oct 2010 Posts: 33
|
Posted: Thu Sep 15, 2011 6:27 pm Post subject: Can't use functions inside of #sub? |
|
|
| Code: | #sub {^Spell:%1: modifies %2 by %3 for %4 hours$} {<g22>@fcolor{%4} Spell<g06>:<ccc>%1<g06>: <g22>modifies<ccc> %2<g22> by<ccc> %3<g22> for @fcolor{%4}%4 <ccc>hours<088>} {4}
#sub {^%1: modifies %2 by %3 for %4 hours$} {<ccc>@fcolor{%4} %1<g06>:<g22> modifies<ccc> %2 <g22>by<ccc> %3<g22> for @fcolor{%4}%4 <ccc>hours<088>} {5}
#sub {^%1: modifies %2 by %3 permanently$} {<ccc>%1<g06>:<g22> modifies<ccc> %2 <g22>by<ccc> %3<g22> for @afcol{-1} <ccc>hours<088>} {5}
#sub {^Spell:%1: for %2 hours$} {<g22>@fcolor{%2} Spell<g06>:<ccc>%1<g06>: <g22>for @fcolor{%2}%2 <ccc>hours<088>}
|
Now, @afcol works great, coloring it just fine. So we won't get into that. However, I have the function @fcolor doing this:
| Code: | #function {fcolor}
{
#switch {%1}
{
#case {0} {#return <faa>};
#case {1} {#return <fba>};
#case {2} {#return <fca>};
#case {3} {#return <ffa>};
#case {4} {#return <efa>};
#default {#return <fff>}
};
} |
Now, I would expect it to return the word "Spell:" to the color corresponding to how many hours are left on the timer for it to drop. But it doesn't, it returns like this:
| Code: | You are affected by the following:
Spell:18: for 18 hours
Spell:2: modifies hp by 50 for 2 hours
2: modifies ac by 40 for 2 hours
2: modifies hitroll by 3 for 2 hours
2: modifies damroll by 6 for 2 hours
Spell:29: modifies ac by -20 for 29 hours
Spell:29: modifies ac by -20 for 29 hours
Spell:15: for 15 hours
|
The "name" of the spell is replaced with how many hours are left, the colors are all RIGHT so to say, but everything is out of whack. It should read like this, (imagine it being colored correctly):
| Code: | You are affected by the following:
Spell: detect invis : for 17 hours
Spell: berserk : modifies hp by 50 for 1 hours
: modifies ac by 40 for 1 hours
: modifies hitroll by 3 for 1 hours
: modifies damroll by 6 for 1 hours
Spell: shield : modifies ac by -20 for 28 hours
Spell: armor : modifies ac by -20 for 28 hours
Spell: mounted : for 14 hours
|
Any ideas why this script could be messing with the output? |
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Thu Sep 15, 2011 10:52 pm Post subject: |
|
|
might need to be:
You can see if substitutions are triggering using: #debug sub on |
|
| Back to top |
|
 |
abedour
Joined: 29 Oct 2010 Posts: 33
|
Posted: Fri Sep 16, 2011 1:17 am Post subject: |
|
|
| Well, they definitely 'trigger', since if I remove the @functions the colors I've added show up just fine and look great. Maybe it's a bug? |
|
| Back to top |
|
 |
F-3000
Joined: 06 Dec 2010 Posts: 63 Location: Next to polarbear
|
Posted: Fri Sep 16, 2011 3:51 am Post subject: |
|
|
It's a bug.
For some odd reason, the #function replaces the #sub's %1 with #function's %1.
When line is...
| Code: | | Spell: berserk : modifies hp by 50 for 1 hours |
Output should be:
| Code: | | <g22><fba>Spell<g06>:<ccc> berserk <g06>: <g22>modifies<ccc> hp<g22> by<ccc> 50<g22> for <fba>1 <ccc>hours<088> |
While it actually is:
| Code: | | <g22><fba>Spell<g06>:<ccc>1<g06>: <g22>modifies<ccc> hp<g22> by<ccc> 50<g22> for <fba>1 <ccc>hours<088> |
(notice how the word "berserk" is replaced with number 1) |
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
|
| Back to top |
|
 |
abedour
Joined: 29 Oct 2010 Posts: 33
|
Posted: Fri Sep 16, 2011 8:46 am Post subject: |
|
|
| You're awesome. Thank you. |
|
| Back to top |
|
 |
|