Set variable to a token selected at the request of the macro

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
Shadow Wizard
Giant
Posts: 182
Joined: Mon Apr 11, 2011 8:11 pm

Set variable to a token selected at the request of the macro

Post by Shadow Wizard »

So, I am trying to make an "attack" macro. But the macro needs something to attack. The idea is to start the macro (click the button to start it) and for it to ask me to click the token I wish to attack. But how do I bring up a box to tell me to select the token, and then to store the variable of the token ID.
Or is there a better way?

User avatar
aliasmask
RPTools Team
Posts: 9023
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Set variable to a token selected at the request of the macro

Post by aliasmask »

It can be done and probably has been done, but I can't point you to any examples. Typically, what I do is post my attack stats to a link that shows AC and damage and then whoever you're attacking can select their token to apply damage and or defenses.

Shadow Wizard
Giant
Posts: 182
Joined: Mon Apr 11, 2011 8:11 pm

Re: Set variable to a token selected at the request of the macro

Post by Shadow Wizard »

I'm the DM. And I use Maptool basically as a single screen VTT for my players during my tabletop sessions, and I control the DM stuff from my laptop. I am basically looking to speed up my end of it all. Click monster, click attack, click player, it applies damage if it hits, etc. Just trying to cut down a bit of what I have to do to speed things up on my end. So having it display the AC and Damage would cut my work down a bit, I was hoping to cut down my work load a bit more by getting it to do it automatically. But I do thank you for at least replying.

User avatar
aliasmask
RPTools Team
Posts: 9023
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Set variable to a token selected at the request of the macro

Post by aliasmask »

There are other ways to do it, like impersonate a token, that is your source token then you can select other tokens as the target and then do your math that way. As a GM, changing the impersonation could be a pain (lots of oopsies), otherwise... it takes a little more programming to create your own frame to be the source where you can then select targets and such. input() will not help.

Shadow Wizard
Giant
Posts: 182
Joined: Mon Apr 11, 2011 8:11 pm

Re: Set variable to a token selected at the request of the macro

Post by Shadow Wizard »

Yea, the thing is I don't know the language that well. That's why I was hoping for something to point me in the right direction.
Are there such things as "Global Macros" like for example, can I click on the Target macro, and initiate a "Set as target" macro that will just store the token value somewhere to be used by another macro on another token? Then I click on the "Attacker" token, and click the attack button and it will know which one is which?

User avatar
aliasmask
RPTools Team
Posts: 9023
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Set variable to a token selected at the request of the macro

Post by aliasmask »

What system are you playing. There may already be code out there.

Shadow Wizard
Giant
Posts: 182
Joined: Mon Apr 11, 2011 8:11 pm

Re: Set variable to a token selected at the request of the macro

Post by Shadow Wizard »

3.5
But I am a bit afraid of how that code may interfere with the macros and such I have already created.
In addition, using pre-existing code doesn't really teach me too much; one of the reasons I am looking to create my own.

User avatar
aliasmask
RPTools Team
Posts: 9023
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Set variable to a token selected at the request of the macro

Post by aliasmask »

Well, there are a couple of already good options out there for 3.5 and as for trying to learn the coding, having a base to work from is an advantage. Basically, learn by doing. My first experience with MapTool and coding was making a spell library for 3.5. Az already had a bunch of macros set up for the spells but I decided to try something different and do my own thing for that framework. No need to start from scratch.

Shadow Wizard
Giant
Posts: 182
Joined: Mon Apr 11, 2011 8:11 pm

Re: Set variable to a token selected at the request of the macro

Post by Shadow Wizard »

Well, I have noticed that things are not where they used to be.. I do agree that having something to look at may be advantageous, but I don't even know where one would look now to find the scripts. I have found posts pointing to tokens where the links don't work anymore, so some help where to look would be helpful.

Post Reply

Return to “Macros”