put %bulionvar%c
is all of a sudden parsing as
%bulionvar1
%bulionvar2
....
instead of
(first action)
(second action)
example
put forage %forage%c(=1) (=stick)
forage %forage1(not stick)
put forage %forage%c(=2) (=pine stick)
forage %forage2
?
is it my syntax or something wrong with the parser?
SHNURUI
SHNURUI
Re: script parsing error
02/04/2007 09:28 AM CST
Ok, found a work around that works.
%forage =%forage
setvariable %foragex=%forage%%c
%forage =%forage
setvariable %foragex=%forage%%c
THREEPHI
Re: script parsing error
02/04/2007 11:41 AM CST
Stormfront parses compound variables a little differently than Wizard. When in doubt, always use % on both sides of your variables and there should be no problems.
You want to concatenate the value of the variable "bulion" (%bulion%) with the value of the counter "c" (%c%).
%bulion% + %c%
put %bulionvar%%c%
should do what you want.
You want to concatenate the value of the variable "bulion" (%bulion%) with the value of the counter "c" (%c%).
%bulion% + %c%
put %bulionvar%%c%
should do what you want.
WEILM
Re: script parsing error
02/04/2007 06:29 PM CST
>>put %bulionvar%c
Depending on which FE you use is how to resolve this.
For Avalon/YASSE, I think it would work as $bulion%c$.
~Kyn (Kynevon)
Info Page http://kynevon.info
Grimoire of Echoes: http://tinyurl.com/2ac987
Hunting Info: http://tinyurl.com/44jlt
Armor Info: http://tinyurl.com/2h5jcp
Depending on which FE you use is how to resolve this.
For Avalon/YASSE, I think it would work as $bulion%c$.
~Kyn (Kynevon)
Info Page http://kynevon.info
Grimoire of Echoes: http://tinyurl.com/2ac987
Hunting Info: http://tinyurl.com/44jlt
Armor Info: http://tinyurl.com/2h5jcp
THREEPHI
Re: script parsing error
02/04/2007 10:41 PM CST
>>put %bulionvar%c
>You want to concatenate the value of the variable "bulion" (%bulion%) with the value of the counter "c" (%c%).
>%bulion% + %c%
>put %bulionvar%%c%
Eh, of course where I said 'bulion' above I meant 'bulionvar'... the point is, in Stormfront you should always put the % on both sides of every variable, even when you join them together.
>You want to concatenate the value of the variable "bulion" (%bulion%) with the value of the counter "c" (%c%).
>%bulion% + %c%
>put %bulionvar%%c%
Eh, of course where I said 'bulion' above I meant 'bulionvar'... the point is, in Stormfront you should always put the % on both sides of every variable, even when you join them together.
SHNURUI
Re: script parsing error
02/05/2007 07:47 PM CST
Actually tried all four ways.
%forage%c%
%Forage%%c%
%forage%c
%%forage%%c%%
Only doing it the aforementioned way did it actually work.
%forage%c%
%Forage%%c%
%forage%c
%%forage%%c%%
Only doing it the aforementioned way did it actually work.
WEILM
Re: script parsing error
02/06/2007 04:33 AM CST
Did you try %forage%c%%?
And my eyes hurt. ;)
~Kyn (Kynevon)
Info Page http://kynevon.info
Grimoire of Echoes: http://tinyurl.com/2ac987
Hunting Info: http://tinyurl.com/44jlt
Armor Info: http://tinyurl.com/2h5jcp
And my eyes hurt. ;)
~Kyn (Kynevon)
Info Page http://kynevon.info
Grimoire of Echoes: http://tinyurl.com/2ac987
Hunting Info: http://tinyurl.com/44jlt
Armor Info: http://tinyurl.com/2h5jcp
THREEPHI
Re: script parsing error
02/06/2007 07:41 PM CST
You're talking about Stormfront, right?
%Forage%%c%
is different from
%forage%%c%
Caps matter in variable names, looks like you made the typo in the one that actually works ;)
Here's a test script that illustrates it working correctly:
[Script test is running, Esc to cancel, Shift-Esc to pause]
setVariable: forage=yelith
### forage = yelith
### counter is 5
### forage+c = yelith5
[script done]
%Forage%%c%
is different from
%forage%%c%
Caps matter in variable names, looks like you made the typo in the one that actually works ;)
Here's a test script that illustrates it working correctly:
setvariable forage yelith |
counter set 5 |
echo ### forage = %forage% |
echo ### counter is %c% |
echo ### forage+c = %forage%%c% |
exit |
[Script test is running, Esc to cancel, Shift-Esc to pause]
setVariable: forage=yelith
### forage = yelith
### counter is 5
### forage+c = yelith5
[script done]
SHNURUI
Re: script parsing error
02/07/2007 05:44 PM CST
Your way.
[Script countertest is running, Esc to cancel, Shift-Esc to pause]
stick
%forage%c%
%forage1
my way
counter set 1
echo %forage1
echo %forage%%c%
echo %forage%c
echo %forage%c%
echo %%forage%%c%%
counter add 1
echo %forage2
echo %forage%%c%
echo %forage%c
echo %forage%c%
echo %%forage%%c%%
result=failure
stick
%forage%c%
%forage1
%forage1
%forage%c%
pine stick
%forage%c%
%forage2
%forage2
%forage%c%
with %forage set as %forage(recursive error pop up)
result=failure
Adding setvariable forageX %forage%c%
RESULT Success
[Script countertest is running, Esc to cancel, Shift-Esc to pause]
stick
%forage%c%
%forage1
my way
counter set 1
echo %forage1
echo %forage%%c%
echo %forage%c
echo %forage%c%
echo %%forage%%c%%
counter add 1
echo %forage2
echo %forage%%c%
echo %forage%c
echo %forage%c%
echo %%forage%%c%%
result=failure
stick
%forage%c%
%forage1
%forage1
%forage%c%
pine stick
%forage%c%
%forage2
%forage2
%forage%c%
with %forage set as %forage(recursive error pop up)
result=failure
Adding setvariable forageX %forage%c%
RESULT Success
THREEPHI
Re: script parsing error
02/08/2007 01:27 PM CST
Mmmm I think we're talking about two slightly different things. FWIW I can't really agree that you're depicting 'my way' accurately without seeing the code of the 'countertest' script, the pre-existing values of all the variables in use in that example, and without knowing precisely what you're trying to achieve ;)
I think there are two overlapping peculiarities in how SF handles variables at play here.
1) If a variable is undefined in SF, then it will echo back the raw text with percent signs instead of the variable value (Wizard would return null text as I recall).
example:
>[Script test is running, Esc to cancel, Shift-Esc to pause]
>setVariable: forage=yelith
>yelith
>yelith
>DeleteVariable: forage sucessfully deleted.
>%forage%
>%forage
>[script done]
Do you actually have a variable named 'forage' you want to use, or only numbered ones eg 'forage1', 'forage2', etc.?
2) Recursive variable names, where the value of one variable is intended to call the value of another variable, doesn't work directly in SF, and I think this is another issue at play.
I think there are two overlapping peculiarities in how SF handles variables at play here.
1) If a variable is undefined in SF, then it will echo back the raw text with percent signs instead of the variable value (Wizard would return null text as I recall).
example:
setvariable forage yelith |
echo %forage% |
echo %forage |
deletevariable forage |
echo %forage% |
echo %forage |
>[Script test is running, Esc to cancel, Shift-Esc to pause]
>setVariable: forage=yelith
>yelith
>yelith
>DeleteVariable: forage sucessfully deleted.
>%forage%
>%forage
>[script done]
Do you actually have a variable named 'forage' you want to use, or only numbered ones eg 'forage1', 'forage2', etc.?
2) Recursive variable names, where the value of one variable is intended to call the value of another variable, doesn't work directly in SF, and I think this is another issue at play.
WOODY
Re: script parsing error
02/09/2007 08:43 PM CST
It is important to note that "does not work directly" is definately still "works"
setvariable temp %%forage%c%%%
setvariable foragenow %temp%
deletevariable %temp%
echo %foragenow%
setvariable temp %%forage%c%%%
setvariable foragenow %temp%
deletevariable %temp%
echo %foragenow%
THREEPHI
Re: script parsing error
02/09/2007 09:44 PM CST
>It is important to note that "does not work directly" is definately still "works"
Thanks for the assist, Woody, that is absolutely correct. I wrote that post at work and had to log off and leave before I could put in a nice example of that issue ;)
I spent a while tearing my hair out trying to get recursive variables to work properly before I came upon the correct workaround, as you illustrate.
Thanks for the assist, Woody, that is absolutely correct. I wrote that post at work and had to log off and leave before I could put in a nice example of that issue ;)
I spent a while tearing my hair out trying to get recursive variables to work properly before I came upon the correct workaround, as you illustrate.
SHNURUI
Re: script parsing error
02/10/2007 11:23 AM CST
so as long as it's defined, I don't have to place %forage inside it?
No, I'm not using %forage%%null%
No, I'm not using %forage%%null%
THREEPHI
Re: script parsing error
02/10/2007 02:36 PM CST
>so as long as it's defined, I don't have to place %forage inside it?
>No, I'm not using %forage%%null%
I'm still having trouble understanding exactly what you want to do.
I was asking if you use %forage% all by itself, without any other numbers or text after it. I think that's what you were saying, but %forage%%null% will be interpreted as "the value of the variable named 'forage' concatenated to the value of the variable named 'null'. Which is different than %forage% by itself so those two are not identical. Gotta be extremely precise and literal when dealing with syntax, you know ;)
Put another way... Do you have a variable named 'forage' or only variables named 'forage1', 'forage2', 'forage3' etc etc?
If there is no variable named 'forage' then I think this is where the problem is/was. In SF it is very important when dealing with compound variable names to always use % on both sides of your variables. It helps the parser precisely identify which part of a text string is a variable call, and which is not. Additionally, the bug that Woody and I were talking about has to do with some weirdness when you have two or more % signs in a row. In those cases, the SF script parser can get easily confused about what part of your string is intended to represent a variable value, and what part is plain text. Basically in those cases you can't call nested variables directly and have to use temp variables to get the parser to do what you intend.
When assembling the correct text for nested variable calls, I find it helpful to work from the inside out.
If I understand what you intend correctly, you have a series of variables forage1 forage2 forage3 etc. whose values you wish to call. So starting from the inside, you have %c%, the value of the counter. Adding 'forage' to that you get forage%c%. Then you want the value of the variable named forage%c%, so put % marks around the whole thing and you get %forage%c%%.
As I mentioned however this gets you into the parser bug that Woody and I referenced so you need to use a temp variable to work around it. And as if it weren't already confusing enough, the results will be different depending on whether you have 'forage' defined as a variable or not. The following script illustrates these bugs and the workarounds, and hopefully will be helpful for what you wanted to do with your script:
[Script test is running, Esc to cancel, Shift-Esc to pause]
setVariable: forage1=yelith
setVariable: forage2=nemoih
Case 1: 'forage' variable undefined:
DeleteVariable: forage sucessfully deleted.
setVariable: temp=%forage1%
item is %forage1%
item is yelith
setVariable: temp=%forage2%
item is %forage2%
item is nemoih
Case 2: 'forage' variable defined:
setVariable: forage=root
setVariable: temp=rootc%
item is rootc%
item is rootc%
setVariable: temp=rootc%
item is rootc%
item is rootc%
Extra workaround for Case 2:
setVariable: temp=forage2
setVariable: temp2=%forage2%
item is nemoih
[script done]
>No, I'm not using %forage%%null%
I'm still having trouble understanding exactly what you want to do.
I was asking if you use %forage% all by itself, without any other numbers or text after it. I think that's what you were saying, but %forage%%null% will be interpreted as "the value of the variable named 'forage' concatenated to the value of the variable named 'null'. Which is different than %forage% by itself so those two are not identical. Gotta be extremely precise and literal when dealing with syntax, you know ;)
Put another way... Do you have a variable named 'forage' or only variables named 'forage1', 'forage2', 'forage3' etc etc?
If there is no variable named 'forage' then I think this is where the problem is/was. In SF it is very important when dealing with compound variable names to always use % on both sides of your variables. It helps the parser precisely identify which part of a text string is a variable call, and which is not. Additionally, the bug that Woody and I were talking about has to do with some weirdness when you have two or more % signs in a row. In those cases, the SF script parser can get easily confused about what part of your string is intended to represent a variable value, and what part is plain text. Basically in those cases you can't call nested variables directly and have to use temp variables to get the parser to do what you intend.
When assembling the correct text for nested variable calls, I find it helpful to work from the inside out.
If I understand what you intend correctly, you have a series of variables forage1 forage2 forage3 etc. whose values you wish to call. So starting from the inside, you have %c%, the value of the counter. Adding 'forage' to that you get forage%c%. Then you want the value of the variable named forage%c%, so put % marks around the whole thing and you get %forage%c%%.
As I mentioned however this gets you into the parser bug that Woody and I referenced so you need to use a temp variable to work around it. And as if it weren't already confusing enough, the results will be different depending on whether you have 'forage' defined as a variable or not. The following script illustrates these bugs and the workarounds, and hopefully will be helpful for what you wanted to do with your script:
setvariable forage1 yelith |
setvariable forage2 nemoih |
echo |
echo Case 1: 'forage' variable undefined: |
deletevariable forage |
counter set 1 |
setvariable temp %forage%c%% |
echo item is %forage%c%% |
echo item is %temp% |
counter add 1 |
setvariable temp %forage%c%% |
echo item is %forage%c%% |
echo item is %temp% |
echo |
echo Case 2: 'forage' variable defined: |
setvariable forage root |
counter set 1 |
setvariable temp %forage%c%% |
echo item is %forage%c%% |
echo item is %temp% |
counter add 1 |
setvariable temp %forage%c%% |
echo item is %forage%c%% |
echo item is %temp% |
echo |
echo Extra workaround for Case 2: |
setvariable temp forage%c% |
setvariable temp2 %%%temp%%% |
# yes, %%%temp%%% is weird but that's what works |
echo item is %temp2% |
[Script test is running, Esc to cancel, Shift-Esc to pause]
setVariable: forage1=yelith
setVariable: forage2=nemoih
Case 1: 'forage' variable undefined:
DeleteVariable: forage sucessfully deleted.
setVariable: temp=%forage1%
item is %forage1%
item is yelith
setVariable: temp=%forage2%
item is %forage2%
item is nemoih
Case 2: 'forage' variable defined:
setVariable: forage=root
setVariable: temp=rootc%
item is rootc%
item is rootc%
setVariable: temp=rootc%
item is rootc%
item is rootc%
Extra workaround for Case 2:
setVariable: temp=forage2
setVariable: temp2=%forage2%
item is nemoih
[script done]
SHNURUI
Re: script parsing error
02/10/2007 06:14 PM CST
no, nothing in %forage%
but
a bit of syntax seepage from Zmud has occured.
if you want to use %forage% as a compound in a bulion(list) (ie (forage1, forage2, forage3..etc.)) you have to set it as itself, which will give you a recursive error popup(just hit no and it'll do it's thing)
However, the error is, you should be able to do as WE(You and I) have both been saying, even if we have to sidestep it through a secondary variable(ie %foragenow) in the above examples.
in zmud, if you want to use a comand veriable litterally, such as put, you have to set put as put, as it would be in the command.
Thus the complaint is, the bulion format(list handling) of SF leaves a lot to be desired, but is still 5x better than wizard.
but
a bit of syntax seepage from Zmud has occured.
if you want to use %forage% as a compound in a bulion(list) (ie (forage1, forage2, forage3..etc.)) you have to set it as itself, which will give you a recursive error popup(just hit no and it'll do it's thing)
However, the error is, you should be able to do as WE(You and I) have both been saying, even if we have to sidestep it through a secondary variable(ie %foragenow) in the above examples.
in zmud, if you want to use a comand veriable litterally, such as put, you have to set put as put, as it would be in the command.
Thus the complaint is, the bulion format(list handling) of SF leaves a lot to be desired, but is still 5x better than wizard.
WOODY
Re: script parsing error
02/10/2007 10:17 PM CST
Correction Three...
Should really be |
%%forage%c%%% |
double the % signs, remember; as it will concatenate them down to one when setting, and then expand it when expanding %temp% |
Basically as your output shows, its echoing as "foragec%" because of how that "bug"/"feature" (whatever) works. |
THREEPHI
Re: script parsing error
02/11/2007 11:09 AM CST
I don't have any experience with Zmud so I guess that explains my confusion with what you were talking about ;)
Anyway, that whole bug makes my brain hurt and I always have to re-learn the workarounds whenever it comes up in a scripting project. I haven't had much time in game lately so I haven't been doing much scripting as it is.
Anyway, that whole bug makes my brain hurt and I always have to re-learn the workarounds whenever it comes up in a scripting project. I haven't had much time in game lately so I haven't been doing much scripting as it is.