• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Multiple User-Selected Images Help Needed

MagicSN

Well-known member
Hi!

I am using this code for displaying images (which should end up on the character sheet). I would like to change the code
in a way that either:

- I can display multiple images on the sheet ("the first three images") OR
- that always exactly 3 images can be chosen (instead of a list of images up to an unlimited number)

Any suggestions would be appreciated. Thanks in Advance!

(Basically I want to do one image per character sheet page, user-choosable ^^^)

Best regards,
MagicSN

<portal
id="peImages"
style="tblNormal">
<table_auto
component="UserImage"
showtemplate="peImage"
autothing="mscUserImg"
allowuserorder="yes"
showsortset="_CompSeq_">
<headertitle><![CDATA[
@text = "Gallery"
]]></headertitle>
<additem><![CDATA[
@text = "Add Another Image"
]]></additem>
</table_auto>
</portal>


<!-- peImage template
This template shows a user-added character image. The height is calculated
based on the width such that a relatively symmetric image space is provided.
-->
<template
id="peImage"
name="User Image"
compset="UserImage"
marginhorz="8"
marginvert="3">

<portal
id="image"
style="imgNormal">
<image_user
field="uimgImage">
</image_user>
</portal>

<portal
id="delete"
style="actDelete">
<action
action="delete"
buttontext="">
</action>
</portal>

<position><![CDATA[
~position the delete portal appropriately
perform portal[delete].alignedge[right,0]
portal[delete].top = 5

~use the remaining width for the image portal and use a symmetric height
portal[image].left = 0
portal[image].width = portal[delete].left - portal[image].left - 10
portal[image].height = portal[image].width

~set our height based on the extent of our contents
height = portal[image].bottom
]]></position>
</template>


I tried this:

field[acTacImage].value = hero.findchild[UserImage,"TRUE",_CompSeq_].field[uimgImage].value
field[acTacImag2].value = hero.findchild[UserImage,"TRUE",_CompSeq_].field[uimgImage].value+1
field[acTacImag3].value = hero.findchild[UserImage,"TRUE",_CompSeq_].field[uimgImage].value+2

But while (as the debug window revealed) the fields got the values 2, 3 and 4, when I tried to do the display code
only the first image was displayed, the other two got a "cannot load image" thing.

UserImage and acTacImage etc. are defined as such:

<field
id="acTacImage"
name="Image"
type="derived">
</field>

<field
id="acTacImag2"
name="Image"
type="derived">
</field>

<field
id="acTacImag3"
name="Image"
type="derived">
</field>

<component
id="UserImage"
name="User Image"
orderfield="uimgIndex">

<field
id="uimgImage"
name="Image"
type="user">
</field>

</component>

<thing
id="mscUserImg"
name="User Image"
compset="UserImage">
</thing>

and in the bootstrap.1st there is:

<autoadd thing="mscUserImg" portal="peImages"/>

Display Code on the sheet looks like this:

<template
id="oPortrait"
name="Output Image"
compset="Actor">

<portal
id="image"
style="outNormal">
<output_image
field="acTacImage">
</output_image>
</portal>

<portal
id="imgBorder"
style="outCharImg">
<output_label
text=" ">
</output_label>
</portal>

<position><![CDATA[
~if we don't have an image, set our height to 0, hide the image, and get out
if (portal[image].isimage = 0) then
height = 0
portal[image].visible = 0
portal[imgBorder].visible = 0
done
endif

~leave a margin of one pixel around all edges to draw our border
var margin as number
margin = 1
portal[image].left = margin
portal[image].width = width - margin * 2
portal[image].height = height - margin * 2

~optimally fit the image to the region available
perform portal[image].imagefit

~center the image if it's narrower than the available width
perform portal[image].centerhorz

~our full height is the bottom of the image plus our margin
height = portal[image].bottom + margin

~set the border to span our full dimensions
portal[imgBorder].width = width
portal[imgBorder].height = height
]]></position>

</template>
 
Additional indo: The code seems to work Sometimes.
If it works, I remove an image ans then add.the same
Image (!) again and it cannot load. Only
The image on p1 always works (and it is not related
To the image giles, if I swap those on p1 and p2 also
Always the one on p1 works the one on. P2 only
Sometimes.

A bug in Hero Lab maybe even?

Thanks in advance!

Best regards,
MagicSN
 
Please use the Code tags that this forum offers if you're going to throw walls of code at us. And please tell me what code you started with, and how this differs. I have a lot on my plate right now, and this is too much for me to wade through and figure out where your problem is coming from.
 
For a table portal that's displaying many items, itemcount is the number of items that could be shown there. itemsshown is the number that Hero Lab was actually able to fit into the space you gave the portal, and maxrows limits itemsshown to that value.
 
For a table portal that's displaying many items, itemcount is the number of items that could be shown there. itemsshown is the number that Hero Lab was actually able to fit into the space you gave the portal, and maxrows limits itemsshown to that value.

Hello, Mathias!

Thanks for your offer to help.

My code is basically the DnD 4e Code. Asides from that the 4e code only accessed the first chosen image and ignored the others my code did not change it (I only tried to modify it so that the 2nd and 3rd image can also be used).

Actually I do not care that much how the GUI for chosing the images looks (if it is as currently, or only 3 images choosable at max). What I want to achieve is accessing the first 3 images the user chose and displaying them on the charsheet. My problem is with what I have is:

- Image 1 always works (which is good ;-) )
- Image 2 and 3 only sometimes work. Sometimes even like this, that if I take a .por file where it works, remove
the image and then add the same image (!) again it no longer works.

I basically tried similar to the already existing code in the 4e codebase

field[acTacImage].value = hero.findchild[UserImage,"TRUE",_CompSeq_].field[uimgImage].value

to do something like this:

field[acTacImag2].value = hero.findchild[UserImage,"TRUE",_CompSeq_].field[uimgImage].value+1
field[acTacImag3].value = hero.findchild[UserImage,"TRUE",_CompSeq_].field[uimgImage].value+2

Any help appreciated. Thanks.

Best regards,
Steffen
 
Back
Top