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>
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>