Private Roll Request macro help

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

User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Private Roll Request macro help

Post by kristof65 »

Right now I have a few simple macros set up that send whispers to each of my players asking for specific types of rolls. So when i need Bobby to make a Perception test, I press the "Bobby-Perception" test button, and it whispers a request to him to make a perception test.

This works great - except for now I'm to the point I'd like to have buttons for a couple of other oft-repeated requests as well. With six players and 3-4 tests, that's a lot of seperate buttons.

What I'd like to do is replace all of those with a single button that pops up a window where I can select the test I want to ask for, and check off the players I'd like it sent to. I know that some form of this should be possible, but for the life of me I can't figure out where to start. Everytime I read the macro info on the wiki, I get a headache (not so much the wiki's fault, it's that I often don't get a chance to work on this stuff until late at night and I'm too worn out to think)

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Private Roll Request macro help

Post by plothos »

I'm assuming the input menu isn't what's confusing you, but rather how you get the outputs to the players you want.

What I'd try first would be [w("name1", "name2"):]

The content of the whisper would be defined by your choice of check, and the list in the w(): would be set by your name selection mechanic.

If you're confused about how to set up the input, we can go there too, but I hope that was clear. :)

Edit: I've not used w(): much, but there is one limitation I've found with these roll options (added in 1.3.58), namely, they can be overridden if the macro is called via a macrolink or similar call that specifies an output. If you link to a macro with "self" as the output, even if you use [g:] the gm won't see it. But it sounds like you just want this to be a panel-button click situation, so you should be good.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Re: Private Roll Request macro help

Post by kristof65 »

actually, my problem is more the input side.

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Private Roll Request macro help

Post by Raoden »

Here is a good website to explain how to write Forms in HTML.

Programming macros to whisper messages in Chat to just particular players is kind of complicated, and you'll probably be best off copying/pasting a fair amount of code from Lindsay's Whisper Utility.
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Private Roll Request macro help

Post by plothos »

Ah, okay, well, I wouldn't mess with an HTML form, if you don't know how to do it, as an input() should suffice.

First thing is you'll want the window to let you pick which checks to run. This will require you to have a list you can put into a pull-down. If it's not going to be changing and dynamic, simplest thing is just type it in. So that line of the input() would be something like.

Code: Select all

"checkpick|Acrobatics, Perception, Stealth|What check do you want to request?|list|value=string"

or, if you're doing 3.5 and not 4E

"checkpick|Balance, Hide, Listen, Move Silent, Spot, COMBO - Hide and Move Silent, COMBO - Listen and Spot|What check do you want to request?|list|value=string"
Now, what you could do to really easily, is get a list of the player names with getAllPlayerNames(), which will return a list of the players connected (not their token names, which is good as this is what you want to use with [w():] ). Easiest thing to do now is just have another pull-down like this.

Code: Select all

"playerpick|"+getAllPlayerNames()+"|Who do you want to request this from?|list|value=string"
Make sure you put the comma after the first but not the second line, and then have the whisper code something like:
[r,w(playerpick): "GM requests that you make a "+checkpick+" check."] and you're all set.

Limitations of this is you'd have to run it for each player for each check and it wouldn't indicate which character they should use, if they have multiple. But hey, we're off and running.

One way to jazz it up is to instead of having a pull-down with the player names, have a separate line in the input with a checkbox for each player. This way you could quickly send a check request to multiple guys. Still wouldn't be requesting by character, and you'd have to have the input add or subtract lines depending on the number of players, which can be tricky. You'd probably have to use the "##" trick, and I don't trust myself to explain that well enough off the top of my head from work. :) But you could probably search for "##" and find info.

A final thought I have is maybe instead of checkboxes for each player, instead have checkboxes for each PC, using getPCNames() to get the list. Then expand your follow-up code to detect who is the owner of each checked PC using getOwners() to send the owner of the token a request for that token to make the indicated check.

This would run into problems (play-wise if not necessarily code-wise) if multiple people own a token, and it would also require you to use something like the "##" trick to handle varying numbers of PC tokens.

That's the way I'd approach it anyway. Hope that gives ya something to chew on.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Re: Private Roll Request macro help

Post by kristof65 »

thanks plothos - that was the kick in the butt I needed

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Private Roll Request macro help

Post by plothos »

Yay!
Happy coding. :D
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Re: Private Roll Request macro help

Post by kristof65 »

Ok, I'm not getting the "##" trick. I've read everything I can find on the wiki that reference ##, but it's been a slow process, and it doesn't seem to apply. Trying to search for ## here or the wiki yields no results.

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Private Roll Request macro help

Post by plothos »

Okay, I have it in at least on place in my FW. I'll see if I can dig up an example.

Basic idea is you want to save a string to a variable that can be loaded into the input(), but the input() needs each line surrounded by quotes and separated by commas. Not sure if that makes this impossible or just hard to do... until you find out that you can also use ## to indicate a line break that input() will recognize.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Private Roll Request macro help

Post by plothos »

Okay, found an example in the code for my spell manager.

Code: Select all

[h:inptext=""]
[h:num=1]

[h,foreach(entry,"SPD1,SPD2,SPD3,SPD4,SPD5,SPD6,SPD7,SPD8,SPD9"),code:{
  [if(num<=AMSL),code:{
    [inptext=listAppend(inptext,entry+"|"+eval(entry)+"|Level "+num,"##")]
  }]
  [num=num+1]
}]

[h:screen0=input(
  "junkvar|Include any bonus spells from high Intelligence|Enter your Assassin spells per day|LABEL",
  inptext
)]
[h:abort(screen0)]
Hopefully that'll at least give you an idea of where to begin fiddling. :)
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Private Roll Request macro help

Post by CoveredInFish »

Another example, how that technique is named and how to find more of it in the forum can be found in this post.

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Private Roll Request macro help

Post by Raoden »

The ## really needs to be put on the wiki somewhere.
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Private Roll Request macro help

Post by plothos »

Well, it kinda is in the entry for input().
inputField - A string containing various 'sub-parameters' that set the type and options of each inputField; requires at least one inputField but will accept a reasonably large amount. The inputFields can be set using a series of individual parameters, or as one or more String Lists. If a String List is used, the delimiter must be "##".
But that could be a lot clearer. I'll try to think of a better way to put it, and maybe throw in an example at the bottom.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
plothos
Great Wyrm
Posts: 1890
Joined: Sat Jun 21, 2008 1:07 am

Re: Private Roll Request macro help

Post by plothos »

Okay, I've added an example and some further explanatory text to the wiki's input() entry.
Drop-In Utilities:
My Spell Manager for D&D3.5 and PFRPG
My Inventory Manager for D&D and PFRPG, but more generally useable than that.
My Message Manager -- My Top-Down D&D Token Images
and my Custom Initiative & Status/Spell-Effect Tracker (work in progress, but functional).

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Private Roll Request macro help

Post by Raoden »

Huh ... I still feel lame for having missed it. :oops: Thanks, though!
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

Post Reply

Return to “Macros”