seems simple - passing vars
Hello,
Was hoping to get a tiny bump in the right direction.
I am trying to write a simple.. well in theory, macro. The idea is I want to be able to pick up an item and have it search for said item on my other toons that are logged in.
I get the item name and ID just find and can echo it .. no problems there.
Here is where I seem to just be getting my butt kicked.
Passing that ${itemName} to the others via BCAA command always comes back NULL for all the others. It would seem it is looking for that variable name locally rather then parsing it out to what its value is before sending the command.
Does that makes sense? How do you pass vars to other chars?
/varset ItemName ${Cursor}
/noparse /bcaa //bc ${ItemName}
in the Cmd window
Toon 0 "correct name
Rest toons
NULL
Any tips?
Thank you very much.
Macro
Sun Oct 25, 2015 1:47 pm
done
Because I hate when some noob asks a question .. figures it out and never comes back to share the answer here you go
Macro
Sun Oct 25, 2015 3:31 pm
First, some background about variables...
Every instance of EQ - every character - is separated from every other character. CharacterA cannot look into the address space of CharacterB. CharacterA can see CharacterA's ${Me.Name} but cannot see CharacterB's ${Me.Name}.
Any workaround which we'll get to is just that: a workaround. Workarounds allow values to be shared between clients, but the original variable in memory is still hidden. Luckily, several workarounds exist. In no particular order: plugins, events and Ini files.
You have the Ini file route covered.
Plugins are the best solution if one exists for a particular piece of information. NetBots is a great example but NetBots doesn't share the name/id of held items.
That leaves events.
/bcaa //echo CheckForItem ${Cursor.Name}
Run the macro on all characters then type in the above line. Upon seeing that line, the macro event will trigger and execute. The macro sits patiently until the trigger phrase is seen. The trigger phrase contains the necessary information.
This macro isn't exactly like the original. It's written as is to show the concept of macro events and also of passing variable values between clients.
Second, global variable scope...
Global scope means a variable exists "outside of any macro." It may help to think of variables such as ${Me.Name} and ${Cursor.ID} as global scope variables. They exist even when a macro isn't running.
Outer scope variables have macro scope. Macro scope variables will only exist while that macro is running on that character. Bye bye macro means bye bye variable.
Local scope variables only exist within a specific subroutine on a specific character. Leave that subroutine and you can no longer view or edit the local variable.
Neither global, outer, nor local can be used to pass variables between characters.
Every instance of EQ - every character - is separated from every other character. CharacterA cannot look into the address space of CharacterB. CharacterA can see CharacterA's ${Me.Name} but cannot see CharacterB's ${Me.Name}.
Any workaround which we'll get to is just that: a workaround. Workarounds allow values to be shared between clients, but the original variable in memory is still hidden. Luckily, several workarounds exist. In no particular order: plugins, events and Ini files.
You have the Ini file route covered.
Plugins are the best solution if one exists for a particular piece of information. NetBots is a great example but NetBots doesn't share the name/id of held items.
That leaves events.
Macro
/bcaa //echo CheckForItem ${Cursor.Name}
Run the macro on all characters then type in the above line. Upon seeing that line, the macro event will trigger and execute. The macro sits patiently until the trigger phrase is seen. The trigger phrase contains the necessary information.
This macro isn't exactly like the original. It's written as is to show the concept of macro events and also of passing variable values between clients.
Second, global variable scope...
Global scope means a variable exists "outside of any macro." It may help to think of variables such as ${Me.Name} and ${Cursor.ID} as global scope variables. They exist even when a macro isn't running.
Outer scope variables have macro scope. Macro scope variables will only exist while that macro is running on that character. Bye bye macro means bye bye variable.
Local scope variables only exist within a specific subroutine on a specific character. Leave that subroutine and you can no longer view or edit the local variable.
Neither global, outer, nor local can be used to pass variables between characters.
Sun Oct 25, 2015 6:16 pm
Senior Project Member