Input drop down with images?

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
xavram
Dragon
Posts: 891
Joined: Tue Apr 20, 2010 8:22 pm

Input drop down with images?

Post by xavram »

I have a macro that display the input box and I would like to have a drop down list with some images that the player can select from. Basically, they're choosing which image to represent their character.

Is this possible? I have all the images on a map, as seperate tokens. Would this be better off in a table? Haven't done this before in Maptool and not sure where to begin, even though I'm pretty sure I've seen it in some screenshots.

Thanks!

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Input drop down with images?

Post by Full Bleed »

xavram wrote:I have a macro that display the input box and I would like to have a drop down list with some images that the player can select from. Basically, they're choosing which image to represent their character.

Is this possible? I have all the images on a map, as seperate tokens. Would this be better off in a table? Haven't done this before in Maptool and not sure where to begin, even though I'm pretty sure I've seen it in some screenshots.

Thanks!
Something like this:

Code: Select all

[h: charImageList = getImage("Token Name")]

[h:status=input(
        "charImage|"+charImageList+"|Select Target|LIST|SELECT=0 ICON=TRUE ICONSIZE=30"
)]
You'll need to make sure that charImageList is an actual string list of the tokens you want in the input. The above example is just getting 1 token image.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

xavram
Dragon
Posts: 891
Joined: Tue Apr 20, 2010 8:22 pm

Re: Input drop down with images?

Post by xavram »

Is there any way to make the drop down itself bigger? The images I have are 150x75, native size, so they get compressed quite a bit on the input form, to the point that its actually hard to distinguish one from the other.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Input drop down with images?

Post by Full Bleed »

xavram wrote:Is there any way to make the drop down itself bigger? The images I have are 150x75, native size, so they get compressed quite a bit on the input form, to the point that its actually hard to distinguish one from the other.
I assume that's what the ICONSIZE subparameter is for. My example was set to 30 because I basically pulled the base code from the example on the input wiki:

Wiki: input()
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

xavram
Dragon
Posts: 891
Joined: Tue Apr 20, 2010 8:22 pm

Re: Input drop down with images?

Post by xavram »

Oh sweet, I just didn't see that in your sample! Excellent, that did the trick!

xavram
Dragon
Posts: 891
Joined: Tue Apr 20, 2010 8:22 pm

Re: Input drop down with images?

Post by xavram »

So I used this and it works...

Code: Select all

[h : x = 0]
[h : imageList = ""]
[h, while(x<20), code : {
	[h : x = x + 1]
	[h : imageList = listAppend(imageList, tableImage("Small", x))]	
}]

[h:status=input(
        "charImage|"+imageList+"|Select Target|LIST|SELECT=0 ICON=TRUE ICONSIZE=75|VALUE=STRING|SPAN=TRUE"
)]

[r : tableImage("Small", charimage)]

[h : setTokenImage(tableImage("Small", charimage+1))]
However, I've got like 20 images in this table, which causes the dropdown list to be so big that it goes off the top and bottom of the screen, so you don't see all the options.

Is there any way to only show, say, half a dozen of the options at any given time? Most drop down controls in other languages have a "show max items" kind of setting to limit this but I don't see an option like this in the "Input" document for maptool.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Input drop down with images?

Post by Full Bleed »

xavram wrote: However, I've got like 20 images in this table, which causes the dropdown list to be so big that it goes off the top and bottom of the screen, so you don't see all the options.

Is there any way to only show, say, half a dozen of the options at any given time?
And do what with the other options? You mean be able to sort of page through options like 6 at a time? I don't think there is a way to do that...
Most drop down controls in other languages have a "show max items" kind of setting to limit this but I don't see an option like this in the "Input" document for maptool.
You could count the number of items in the list, and if it's larger than 6, add the extras to successive lists and dynamically create inputs based on the number of lists that you have.

That would, however, make multiple drop-down selections, so you'd have to create some kind of mechanic where the default was something like "No Selection" and then check that only one input is used to select something before going through with the operation.

That's pretty clunky though and will likely be more work than it's worth. If your list is going to be that big, it would be better to just use a text list or make the images display smaller.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

Post Reply

Return to “Macros”