|
acaykath Wanderer
Joined: 03 Aug 2005 Posts: 84
|
Posted: Sun Apr 06, 2008 6:57 pm
%expand & %/$ Parameters |
"title=%expand(%item(@TitleVar,$num))" treats "%item(@TitleVar,$num)" as a literal string rather than a function that is to be executed to get the parameter to expand. The same problem occurs when using local variables. It seems that it will only take @variables or else will treat as a literal string, which means it takes 4 lines of code bouncing between variables to execute what should only take one.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Apr 06, 2008 7:12 pm |
While there may be a problem with %expand, in most cases you don't need to use it. If we could see the whole of your code, we could suggest a better way.
|
|
|
|
acaykath Wanderer
Joined: 03 Aug 2005 Posts: 84
|
Posted: Sun Apr 06, 2008 8:22 pm |
Timed trigger *180
Code: |
title=%item(@TitleVar,%random(1, %numitems(%expand(@TitleVar))))
title %expand(@title) |
@title is a placeholder variable, useless except to get around the bug.
@titlevar is a string list of titles, some of which contain references to other variables, thus the need for expansion.
Assuming everything worked right, this could be written as a single line of nested function calls, but this was the only way I found to get the functionality I wanted (though I can break it up furthur into more easily readable lines but it is now more compact than it was when I posted.). |
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Sun Apr 06, 2008 9:33 pm |
Code: |
%stripq(%item(@TitleVar,%random(1, %numitems(%expand(@TitleVar)))) ) |
|
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
|
|
|