RPTools.net

Discussion and Support

Skip to content

It is currently Sun Jan 21, 2018 5:47 pm 






Reply to topic  [ 40 posts ]  Go to page 1, 2, 3  Next

Previous topic | Next topic 

  Print view

Author Message
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 372
 Post subject: Using Handouts
PostPosted: Mon Oct 17, 2011 5:57 pm 
I've searched the forums but didn't notice anything like this.

I'm trying to come up with a good way to show handouts to my players on my VTT setup. It doesn't need to be anything real complicated. I just want to maybe click a macro, get a list of images that I previously setup with the macro, select an image, and then the image pops up on the screen for everyone to see exactly like it does when you right-click and select "Show Handout" on a token.

I've tried out Lindsay's Generic Tools Handout macro, and although the idea is a good one, it's not very user friendly and a bit clunky.

I also like how the Handout image is handled on tokens when you Show Handout. It's nice how it appears on screen and can be dragged around and resized.

So I'm wondering if anyone has already made something like this, or could do it for me if it isn't much trouble?

Ideally, I would like to be able to add/remove pictures to a list and have a macro show me that list, select from it, and the image appears just like when selecting "Show Handout" on a token. If that's too much trouble, I could even just create tokens and attach a picture as a Handout on each token. I could keep those tokens all on 1 map and when I'm on a different map, I could use a macro or macros that refer to those tokens and run the "Show Handout" option. I just don't know how to set something like that up and I'm terrible at trying to use the wiki and do it myself.


Top
 Profile  
 
User avatar  Offline
Demigod
 
Joined: Mon Jun 29, 2009 9:37 am
Posts: 3108
Location: Germany
 Post subject: Re: Using Handouts
PostPosted: Tue Oct 18, 2011 2:13 am 
The "show handout" option shows the image in a way that is not 100% reproducible by macro.

So first you have to decide to do this completly by macro but with less similarities to the show handout-method

or

use the show handout method and just have some macros help you organize that. BTW you dont have to keep them on a separate map, IIRC having them on the Hidden layer will work fine (or not?).

_________________
HELP: GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC.

most complete list of my maptool stuff


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 372
 Post subject: Re: Using Handouts
PostPosted: Tue Oct 18, 2011 3:37 pm 
My idea is to just put tokens on the Base map, add a handout image to each of them, and then make a campaign macro for each token that will activate the 'Show Handout' function for that token on the Base map. Or would the token have to be on the current map in order for the image to load?

If someone made me a macro like that, how different would the result be from the normal Show Handout option from the tokens pulldown menu? Maybe it is something I can live with.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9443
Location: Netherlands
 Post subject: Re: Using Handouts
PostPosted: Tue Oct 18, 2011 4:36 pm 
Oryan77 wrote:
My idea is to just put tokens on the Base map, add a handout image to each of them, and then make a campaign macro for each token that will activate the 'Show Handout' function for that token on the Base map. Or would the token have to be on the current map in order for the image to load?

If someone made me a macro like that, how different would the result be from the normal Show Handout option from the tokens pulldown menu? Maybe it is something I can live with.


it has to be on the same map, unless you add the prefix "image:" (similar to "lib:") to the token name. I know that that particular image is then available on all maps, I'm not sure however if that's also the case for handouts. I've got very limited intell on handouts as I don't use them (at least not for what they were originally intended).

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
 Offline
Giant
 
Joined: Fri Aug 01, 2008 8:18 am
Posts: 103
 Post subject: Re: Using Handouts
PostPosted: Wed Oct 19, 2011 2:11 pm 
I put together something almost exactly like you're describing a while ago. I just added the broadcast so it takes up less chat real-estate. You'll need an "ImageList" property and these four macros on a library token:

AddImages:
Code:
[H: Flag = json.isEmpty(getLibProperty("ImageList"))]
[H, IF(Flag):   setLibProperty("ImageList", getSelectedNames("json"));
   setLibProperty("ImageList", json.merge(getLibProperty("ImageList"), getSelectedNames("json")))]
Selected images added to image list.

RemoveImage:
Code:
[H: Images = getLibProperty("ImageList")]
[H: CheckString = listAppend("", "nulVar | Check to remove: |  | LABEL | SPAN=TRUE", "##")]
[H, FOREACH(Image, Images, ""): CheckString = listAppend(CheckString, "Image" + roll.count + " | 0 | " + Image + " | CHECK", "##")]
[H: abort(input(CheckString))]
[H, FOREACH(Image, Images, ""), IF(eval("Image" + roll.count)): Images = json.remove(Images, roll.count)]
[H: setLibProperty("ImageList", Images)]
Images removed.

SendLink:
Code:
[H: abort(input("Image | " + json.toList(getLibProperty("ImageList")) + " | Select image | LIST | VALUE=STRING"))]
[R: broadcast(macroLink("Click to view " + Image + "...", "ViewImage@" + getMacroLocation(), "none", Image))]

ViewImage:
Code:
[dialog("ImageViewer"): {   <html><image src="[R: getImage(macro.args)]">   }]

The images you'll want to send will need the "image:" prefix on their token name and can be on any map, as was mentioned. I'd set a shortcut key to AddImages so you can select tokens and call it easily.


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 372
 Post subject: Re: Using Handouts
PostPosted: Wed Oct 19, 2011 3:46 pm 
the_meek wrote:
I put together something almost exactly like you're describing a while ago.


Cool! I tried setting this up but I'm having some problems. I barely know anything about creating code. I hope I followed your instructions correctly, but I may be missing something.

I think I have the add and remove macros working since it says an image was added and the remove macro lets me choose that token name and remove it from the list.

But when I hit the SendLink macro, it says "You do not have permission to call the "broadcast" function."

When I hit the ViewImage macro, it says "Error executing "getImage": the token name or id "" is unknown."

When I create the ImageList property in my campaign property, is that what I name the property? If so, what do I add in the actual property box?

I named the lib: token "lib:Handouts" and the image: token "image:testpic". Is that ok, or was I supposed to use a specific name?

Sorry, I just can't figure this out on my own. I even looked at the wiki link. I'm terrible at this kind of stuff.


Top
 Profile  
 
 Offline
Giant
 
Joined: Fri Aug 01, 2008 8:18 am
Posts: 103
 Post subject: Re: Using Handouts
PostPosted: Wed Oct 19, 2011 4:06 pm 
If you're running the SendLink macro directly from the token, you'll have to get rid of the broadcast function, because it can only be run from a Trusted_Macro. You can either call the macro from some other macro (like a campaign macro) like this:
Code:
[MACRO("SendLink@lib:Handouts"): ""]


or get rid of the broadcast function, making the SendLink macro this:
Code:
[H: abort(input("Image | " + json.toList(getLibProperty("ImageList")) + " | Select image | LIST | VALUE=STRING"))]
[R: macroLink("Click to view " + Image + "...", "ViewImage@" + getMacroLocation(), "none", Image)]


The property name for the library is ImageList, yes. You can leave it blank. The add/remove macros store the names of the images in this property when you run those macros. Your token names should be fine.

ViewImage is the macro that the link that SendLink sends to chat calls. It will give an error if you click on it because it needs the argument from SendLink (the "Image" variable).

Let me know how that works out for you.


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 372
 Post subject: Re: Using Handouts
PostPosted: Wed Oct 19, 2011 4:35 pm 
Ah, I read the Trusted Macro link you gave and figured out that I needed to uncheck the 'allow players to edit macros' box in order to get the broadcast code to work.

the_meek wrote:
ViewImage is the macro that the link that SendLink sends to chat calls. It will give an error if you click on it because it needs the argument from SendLink (the "Image" variable).


So I got the SendLink macro to work, I can click the link in the chat and view the image. But I'm not sure what you mean about getting the ViewImage macro to work. It still gives the same error. Am I supposed to manually add the token name in the ViewImage macro or something?

Also, this isn't a big deal or anything, but I was wondering if there was code I could add so that when the image window appears, it will be sized to fit the image rather than requiring me to resize it? If so, is there also a way to get the image to load without the window frame surrounding it? Sort of like how the Show Handout feature does? I assume these might be the limitations that Wolph was talking about, but I wanted to ask.


Top
 Profile  
 
 Offline
Giant
 
Joined: Fri Aug 01, 2008 8:18 am
Posts: 103
 Post subject: Re: Using Handouts
PostPosted: Wed Oct 19, 2011 5:16 pm 
You don't actually do anything with the ViewImage macro. That gets called by the link in chat. It's what brings up the dialog with the image in it when you click the link in chat. It sounds like you have it working as intended.

As far as I know, there's no way to get the size of an image in MapTool, so there's really no way to automatically set the size of the dialog to that of the image. With more complicated macros, you could set the size of each image you want to pull up later, but you'd have to add the images one at a time, and I was just looking for a quick and dirty way of doing this.

I guess you could only use images that are the same aspect ratio and hard code the sizes of the dialog and image, but that's not a great solution. Plus, if you want something that's not the same aspect ratio, it's going to be distorted.

The dialog article says you can remove the frame of the dialog with "noframe=1". That would look like this:
Code:
[dialog("ImageViewer", "noframe=1;"): {   <html><image src="[R: getImage(macro.args)]">   }]

The problem is that you don't seem to be able to resize the dialog without the frame, so you're back to having to deal with the size. The spot I added "noframe=1" is also where you'd set the width and height (separated by semicolons), in case you feel like messing with it.

As an aside, if you want to get rid of the close button at the bottom (can still use Escape or the X to close the dialog), use "input=1" in that same section, like this:
Code:
[dialog("ImageViewer", "input=1;"): {   <html><image src="[R: getImage(macro.args)]">   }]


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 372
 Post subject: Re: Using Handouts
PostPosted: Wed Oct 19, 2011 5:22 pm 
Interesting. I'm going to try that out and play with it.

I thought the ViewImage macro was actually going to allow me to pull up the image by clicking on that macro. So if that is not what it does, is there another macro I can use that will load the image rather than me being required to click the link in the chat. So basically, a macro that thinks I clicked the link in the chat. :P


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 12107
Location: Tampa, FL
 Post subject: Re: Using Handouts
PostPosted: Wed Oct 19, 2011 5:27 pm 
the_meek wrote:
I guess you could only use images that are the same aspect ratio and hard code the sizes of the dialog and image, but that's not a great solution. Plus, if you want something that's not the same aspect ratio, it's going to be distorted.

Or specify only one of width or height and the other will default to be whatever is correct in order for the aspect ratio to be maintained. :)


Top
 Profile  
 
 Offline
Giant
 
Joined: Fri Aug 01, 2008 8:18 am
Posts: 103
 Post subject: Re: Using Handouts
PostPosted: Wed Oct 19, 2011 5:32 pm 
Smashing a couple of those macros together gets you:
Code:
[H: abort(input("Image | " + json.toList(getLibProperty("ImageList")) + " | Select image | LIST | VALUE=STRING"))]
[dialog("ImageViewer"): {   <html><image src="[R: Image]">   }]

That should give you the input to choose the image, then the dialog with the image in it.

If you don't want the input at the beginning, and only want to show one image with the macro, you don't even need all of these macros. You'd just need one with the image name hardcoded:
Code:
[dialog("ImageViewer"): {   <html><image src="[R: getImage('image:something')]">   }]
Where "image:something" is the name of the image token.


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 372
 Post subject: Re: Using Handouts
PostPosted: Wed Oct 19, 2011 5:52 pm 
When I used the first code (smashed code), it pops up the window with a red x. I'm not sure what I'm doing wrong. Any idea?

I did get the 2nd code to work, which is a nice option to have just in case. But I like your original setup of being able to add lots of images and select one of them to view. :D

Azhrei wrote:
Or specify only one of width or height and the other will default to be whatever is correct in order for the aspect ratio to be maintained. :)


Good to know. I think that will allow me to do exactly what I've been trying to do once I get this setup working.


Top
 Profile  
 
 Offline
Giant
 
Joined: Fri Aug 01, 2008 8:18 am
Posts: 103
 Post subject: Re: Using Handouts
PostPosted: Wed Oct 19, 2011 6:01 pm 
My mistake. I took the getImage call out.
Code:
[H: abort(input("Image | " + json.toList(getLibProperty("ImageList")) + " | Select image | LIST | VALUE=STRING"))]
[dialog("ImageViewer"): {   <html><image src="[R: getImage(Image)]">   }]


Azhrei, I actually never knew you could do that. I've always specified both, and assumed not specifying one would use the image's actual dimension. Neat.


Top
 Profile  
 
 Offline
Dragon
 
Joined: Sun Feb 20, 2011 3:14 pm
Posts: 372
 Post subject: Re: Using Handouts
PostPosted: Wed Oct 19, 2011 6:31 pm 
Ok, that worked!

The only thing now is that I still see a frame around the image. I can get the close button to go away, but not the entire frame.

Is this all the code that should be in the ViewImage macro? Or have I done something wrong?

Code:
[dialog("ImageViewer", "noframe=1;"): {   <html><image src="[R: getImage(macro.args)]">   }]

[dialog("ImageViewer", "input=1;"): {   <html><image src="[R: getImage(macro.args)]">   }]


Also, say I wanted to set the image height to always be 800 pixels (and default the width as mentioned). How do I implement that into the code?


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 40 posts ]  Go to page 1, 2, 3  Next

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 2 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman