Synopsis: You can use new execs to set a new type of message: The dynamic message. It allows for:
*Additional scripting in the text of the message
Furthermore the following is now possible:
*3-part systemgraphic background for the message
*Ability to set message to a group number
This is the exec that when used makes sure the message will be treated as Dynamic Message and NOT a regular message. Otherwise its acts exactly the same and for example coding like [tempvar][/tempvar] will be executed in the same way. (you could also use ExecSetMessageStyle(style=3) before calling a regular ExecSetMessage. Internally the only difference for the engine is the style=0 or style=3, style 1+2 should not be used they are depreciated). Now the big difference a DynamicMessage style message brings is additional coding for layout and the ability to add options to messages. A DM (dynamic message) uses an XML-like coding like the regular message coding but will only display on screen stuff that is in between [element][/element] brackets.
For example:
[element]
[type]Picture[/type]
[eventpic]1[/eventpic]
[pos]40,40,200,200,1[/pos]
[color]200,100,0,128[/color]
[/element]
That example will show event picture slot #1 at x=40,y=40 with width 200 and height 200 at z-level 1. It will render it in RGBA 200,100,0,128 color.
text = will display a textarea. Must include: [font],[fontsize],[text],[pos],[lineheight] and optionally: [color],[fontstyle]
For example: [element][text]Herr General, We are pleased to see you have succeeded.[/text][type]Text[/type][fontname]FreeSans.ttf[/fontname][fontsize]32[/fontsize][lineheight]32[/lineheight][pos]40,80,400,200,1[/pos][color]0,100,0,255[/color][/element]
picture = will show a picture. Must include: [eventpic] or [portraitpic], [pos] and optionally: [color]
option = will add an option to the multiple choice list. Must include: [optiontitle][optionevent] and optionally: [optiontext],[optionpp] and one or multiple [optiontempvar]
This code allows you to put the name of a file inside the fonts/ directory. For example the already existing: 'FreeSans.ttf' This allows you do add fonts to the fonts/ directory and access them this way. There is a hardcoded limit of using 99 different combination of font,fontsize,fontstyle through DM's, but it should be more than enough. Keep in mind you have to specify the name of the file exactly and case-SenSiTive.
Give the fontsize in pixels.
Is optional. If ommited regular style will be used. Use 1 for bold and 2 for italic. Make sue the fontfile used actually has the defenitions for using these styles.
Number of pixels between lines
Consists of 5 variables seperated by comma's. For example: [pos]0,0,500,200,2[/pos] Its the x,y,width,height and z value.
The z value is used to sort all items and default is 0. The higher the z value the later it will be drawn. This way its possible to layer specific things over top of eachother.
Instead of using [pos][/pos] you could also use seperate [x][/x][y][/y][w][/w][h][/h][z][/z] tags to pass these values.
Here you can specifiy the slot# of the eventpic to be used.
Here you can specify the ID of the historical unit you want to use the officer portrait of. If now width and height are specified for this element it will be displayed 95×105 the same as in the normal unit view.
Specify r,g,b,a here or alternatively just r,g,b. Can be used by pictures and texts.
Here you can give a string for the title of the option
Here is the string for the small second line below the title
And here the cost in Political Points to play the option.
And here the event slot # that will be called when this option is played.
Here you can specify a limited number (at this moment) of tempvar values. For example [tempvar]0,125[/tempvar] will set tempvar0 to value 125 for the event that is being called.
You can only set the following tempvar numbers: 0,1,2,3,7,8,9,10. Well… 8 slots to be set should be enough.
The width used for Dynamic Messages is always 540. Keep this in mind when either overriding the systemgraphics parts for the dynamic background. The height is unlimited. The 3 systemgraphics part used are:
systemgraphics/cat1/paperBackground1.png
systemgraphics/cat1/paperBackground2.png
systemgraphics/cat1/paperBackground3.png
All 3 have width 540 and height 100. The first one is the top, the last one the bottom and the middle one is tiled between them to allow for unlimited height.
New exec that has to be called before an ExecSetDynamicMessage or ExecSetMessage.
It will set the name if you input a string bigger than ”” here. The name will be used in the various listboxes listing messages
It will set the group number. This is used to group attachment to DynamicMessages with options attached for the Decision Window.
It can set HideFromStart. When this is active it will never be shown on start turn.
It can set HideFromTab. When this is active it will not be shown in the messagetab. Usefull for example for a message you only want to make show up in the 'report bundle' of the Decision Window.
Its good to do a small recap here. Messages are displayed using 4 different windows at this moment. Yeah the engine has gotten a bit unwieldy in some places. Thats why i add this paragraph.
1) Small Message Popup.
Called when: During round due to trigger of new message created by Decision Window, by play of an actioncard, or by a rulevar(843) event call.
Limitations: Can only do regular messages. Only window that cannot show DynamicMessages. Is only 480×380 so keep ammount of text small.
2) Start turn Message
Called when: When rulevar(906) is inactive. All messages not put to HideFromStart are now shown.
Limitations: Can show all, but will never show options of a Dynamic Messages.
3) Reports in reports tab
Called when: Player acces the report-tab.
Limitations: Can show all, but will never show options of a Dynamic Message. Instead if there are options available it will show a button 'make decision' (or when already made 'review decision') to go to the Decision Window.
4)Decision Window
Called when: Player presses button in reports-tab
Limitations: None, will display all. This is the only window that will display the options of a dynamic message and allow the player to choose one and execute the event the option is set too.
It can be used to set a small note that will be displayed next to an officer portrait in the picture of a regular message that uses [portrait][/portrait]. Its extensively used in DC1 and DC2 upon feedback from officer after you have played one of their action cards.
[tempvar]nr[/tempvar]
[tempstring]nr[/tempstring]
[regimename]nr[/regimename]
[hexname]x,y[/hexname]
[unitname]nr[/unitname]
[gamevar]nr[/gamevar] ⇒game var value
[regimevar]regnr,nr[/regimevar] ⇒regime var value
[hisname]hisnr[/hisname]
[realhisname]hisID[/realhisname]
[commander]hisnr[/commander]
[realcommander]hisID[/realcommander]
[portrait]hisnr[/portrait]
[realportrait]hisID[/portrait]
[date]roundNr[/date]
Tempstring is always executed first. So you can put coding inside the tempstring.
Tempvar is executed second so you can use it to give input for another tag like [portrait][tempvar]1[/tempvar][/portrait]
Gamevar is executed third.
You can use the same formatting as for dynamic messages to pass text to ExecWritePDF. However there is a big difference here. Only text and picture type are implemented at moment.
For positioning of text you can only optionally specify x and y. [x][/x] and [y][/y] and position x,y is not the real position. position x is the offset from the left margin. position y is the offset from the previous element and is reset if new page is used.
For position of images you can also use width. To make sure a small image is sharp enough. If ommited it will be maximized to page width. Height is derived from your width specified. If an image is to wide or high to fit on a page it will be scaled automaticly.
The whole process is one of just rendering one element under another and creating new pages whenever necc.
The pixel system is also different as your pages (excluding margin) are 475 x 682. A good font size is between 10-12 for text. Images are as sharp as their original is.
One extra type of element is available when using ExecWritePDF and that is [type]pagebreak[/type]. Guess you know what it will do :)
Title and page number are rendered on each page automaticly as sort of watermarks.
You can use the [element][type]pagebreak[/type][/element] as already explained. You can specify a background image here… it will always be strectched to full page width & height which is: 595×842. You specify this image by adding [image]graphics/…jpg[/image] . These graphics will only temporary be loaded into memory. And you can change them for each page. Furthermore if your first element is a pagebreak it will not cause a blank page, but will use the image specified for the background of the first page.