User Tools

Site Tools


dynamicmessages

This is an old revision of the document!


New Message options for DC3

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

ExecSetDynamicMessage

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.

Type of elements

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]

[font][/font]

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.

[fontsize][/fontsize]

Give the fontsize in pixels.

==[fontstyle][/fontstyle] 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.

==[lineheight][/lineheight] Number of pixels between lines

[pos][/pos]

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.

[eventpic][/eventpic]

Here you can specifiy the slot# of the eventpic to be used.

[portraitpic][/portraitpic]

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.

[color][/color]

Specify r,g,b,a here or alternatively just r,g,b. Can be used by pictures and texts.

[optiontitle][/optiontitle]

Here you can give a string for the title of the option

[optiontext][/optiontext]

Here is the string for the small second line below the title

[optionpp][/optionpp]

And here the cost in Political Points to play the option.

[optionevent][/optionevent]

And here the event slot # that will be called when this option is played.

[optiontempvar][/optiontempvar]

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.

Stuff to keep in mind with layout

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.

ExecSetMessageNameAndGroup

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.

Where are messages displayed?

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.

dynamicmessages.1383036526.txt.gz · Last modified: 2026/06/22 12:13 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki