Tinyfugue and Nested Macros

by Unknown

Back to Mechanic's Corner.

Unknown2010-02-24 02:05:38
Okay,

I'm trying to set up a macro that reads the contents of my inventory when I type ii, assigns variables based on whether or not certain items (ie weapons) are present and assign variable names to those items. So instead of typing broadsword34300 I would do things to the variable leftWeapon.

CODE
;######################
;# offences.tf                                  #
;#                                                     #
;######################

;**********************
;* variables                 *
;**********************

/set leftWeapon=
/set leftWeaponWielded=0

/set rightWeapon=
/set rightWeaponWielded=0

/def -mregexp -wlusternia -t'^You are wielding\\: $' invWield =\\
        /def -mregexp -n1 -t"^\\\\s+((\\\\w+)(\\\\d+)) : .* left hand" \\
                wieldLeft = /set leftWeapon %%{P1}%; \\
        /def -mregexp -n1 -t"^\\\\s+((\\\\w+)(\\\\d+)) : .* right hand." \\
                wieldRight = /set rightWeapon %%{P1}


I'm keeping it simple for now until I figure out why I keep getting the following error messages:

% macro not defined: "
% DEF -": invalid option
% DEF: options: -p -c -b -B -E
-t -w -h -a -f -P
-T -FiI -n -1 -m -q
% macro not defined: "
% DEF -": invalid option
% DEF: options: -p -c -b -B -E
-t -w -h -a -f -P
-T -FiI -n -1 -m -q

I'm pretty sure that there is some concept of nested macros I'm just not grasping. I've gotten, with help, a couple other nested macros to work. Is there some generalization that I should be aware of when it comes to nested macros, or is there something specific that portends to this macro specifically?

Any ideas/help would be great.
Zallafar2010-02-24 05:35:22
I copy/paste that code into a file and load it and I see no error messges. And when I trigger the first trigger I see no error messages. I using TF 5.0b8.
Unknown2010-02-24 08:26:10
QUOTE (Zallafar @ Feb 23 2010, 10:35 PM) <{POST_SNAPBACK}>
I copy/paste that code into a file and load it and I see no error messges. And when I trigger the first trigger I see no error messages. I using TF 5.0b8.


Same.

/ver
5.0 beta 8
Eldanien2010-02-24 08:34:12
Random detail picked out by a random person who knows very little about TF, but...

Does TF differentiate between single and double quote useage? I see you use single quotes around your first expression, but double quotes around the other two.
Unknown2010-02-24 08:51:43
QUOTE (Eldanien @ Feb 24 2010, 01:34 AM) <{POST_SNAPBACK}>
Random detail picked out by a random person who knows very little about TF, but...

Does TF differentiate between single and double quote useage? I see you use single quotes around your first expression, but double quotes around the other two.


no, I just use double quotes. Don't know why, but I don't think tf does differentiate., at least using single quotes didn't fix anything.
Zallafar2010-02-24 12:00:46
Suggests the syntax problem is in some code other than the portion you posted?
Unknown2010-02-24 15:12:33
QUOTE (Zallafar @ Feb 24 2010, 05:00 AM) <{POST_SNAPBACK}>
Suggests the syntax problem is in some code other than the portion you posted?


Yeah, but where? Gawd, I wonder....
Unknown2010-02-24 15:17:15
Search for -" in your script?
Unknown2010-02-24 16:04:46
QUOTE (Zarquan @ Feb 24 2010, 08:17 AM) <{POST_SNAPBACK}>
Search for -" in your script?

Really, didn't know that. j/k

Yeah, I'll be grepping my files here later today. Right now I've got to get some xp and gold. After that I have family duties for a while.
Unknown2010-03-09 13:43:07
Thread's getting a bit old, but I think I should post just for the archives.

1) Searched for the pattern -" in my scripts and the only place that that pattern shows up is in my prompt catching script.

2) Ran tf without my prompt catching script and connected to Lusty. Got same error when using the ii command.

3) The other day I cleaned up some of my affliction and curing code (none of those scripts had the pattern -" btw) and now the inventory script works!

In my code clean up I had found some entries that didn't have the appropriate %; or \\ (ie. nested ifs) at the end and even a couple that had them but shouldn't have had (ie. standalone triggers). I think that, based on the evidence, these were the sources of my error messages.

In conclusion: Audit your code. Sure, it's a no-brainer, but worth remembering.