Hi, I'm trying to create an escape room gm/hint system and one feature I'd like to have is to send through an image (preferably selected from a dropdown menu) to display on the UIBuilder page along with the timer. I've managed to get text hints to work but can't for the life of me figure out how to do it with images. I thought it work work the same sort of way, by passing the url of the image in the message, but whatever I try either doesn't seem to read the message and convert it to an image url, or it just kills the rest of the page completely.
What I have already is using vue and I've tried reading through a lot of their tutorials but can't find anything relevant to this. Am I just missing something somewhere, or is this actually a lot more difficult than I'm imagining?
Here is the flow (just for the text and image hints) I've got currently:
[
{
"id": "2a872390.448ac4",
"type": "ui_dropdown",
"z": "2ad15a22.7b6726",
"name": "",
"label": "Image Hints",
"tooltip": "",
"place": "Select option",
"group": "afbc44fd.ff57c8",
"order": 5,
"width": 0,
"height": 0,
"passthru": true,
"multiple": false,
"options": [
{
"label": "clocks",
"value": "http://localhost:1880/clocks1.jpg",
"type": "str"
},
{
"label": "table",
"value": "<img src=http://localhost:1880/hint_screen_back.jpg>",
"type": "str"
}
],
"payload": "",
"topic": "",
"x": 90,
"y": 360,
"wires": [
[
"acaa2182.89e168"
]
]
},
{
"id": "acaa2182.89e168",
"type": "change",
"z": "2ad15a22.7b6726",
"name": "",
"rules": [
{
"t": "set",
"p": "imageSrc",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 510,
"y": 400,
"wires": [
[
"68d5ae2d.f92c6"
]
]
},
{
"id": "68d5ae2d.f92c6",
"type": "join",
"z": "2ad15a22.7b6726",
"name": "",
"mode": "custom",
"build": "merged",
"property": "",
"propertyType": "full",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": true,
"timeout": "",
"count": "1",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "num",
"reduceFixup": "",
"x": 950,
"y": 460,
"wires": [
[
"90030e4c.fe9ed"
]
]
},
{
"id": "90030e4c.fe9ed",
"type": "uibuilder",
"z": "2ad15a22.7b6726",
"name": "Game Timer and Clue Display",
"topic": "",
"url": "lab",
"fwdInMessages": false,
"allowScripts": false,
"allowStyles": false,
"copyIndex": true,
"showfolder": false,
"x": 1130,
"y": 460,
"wires": [
[],
[]
]
},
{
"id": "3c3317af.5f16b8",
"type": "change",
"z": "2ad15a22.7b6726",
"name": "",
"rules": [
{
"t": "set",
"p": "clueText",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 500,
"wires": [
[
"68d5ae2d.f92c6",
"aeccdd77.be2a9"
]
]
},
{
"id": "888f472c.94d1c8",
"type": "ui_text_input",
"z": "2ad15a22.7b6726",
"name": "",
"label": "Hint",
"tooltip": "",
"group": "afbc44fd.ff57c8",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"mode": "text",
"delay": "0",
"topic": "",
"x": 70,
"y": 480,
"wires": [
[
"1a77f5dd.9db63a",
"3c3317af.5f16b8"
]
]
},
{
"id": "afbc44fd.ff57c8",
"type": "ui_group",
"z": "",
"name": "Hints",
"tab": "1c294719.eeb109",
"order": 2,
"disp": false,
"width": "10",
"collapse": false
},
{
"id": "1c294719.eeb109",
"type": "ui_tab",
"z": "",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
The HTML:
<!doctype html>
<html lang="en">
<head>
<!-- Put your own custom styles in here -->
<link rel="stylesheet" href="./index.css" media="all">
<!-- Include Webfont to style text in custom font -->
<link href="https://fonts.googleapis.com/css?family=Staatliches&display=swap" rel="stylesheet">
</head>
<body>
<!-- The "app" element contains any content that receives dynamic updates -->
<div id="app">
<div style="height:30px"></div>
<div style="width:50%;padding-left:25%;padding-right:25%;">
<div class="timerText">{{msg.formattedTimeRemaining}}</div>
</div>
<div style="height:30px"></div>
<div class="clueText">{{msg.clueText}}</div>
<div class="imageHint"><img src="{{msg.imageSrc}}"></div>
</div>
<!-- uibuilder script libraries -->
<script src="../uibuilder/vendor/socket.io/socket.io.js"></script>
<script src="../uibuilder/vendor/vue/dist/vue.min.js"></script>
<script src="./uibuilderfe.min.js"></script>
<!-- Put any additional custom code in here -->
<script src="./index.js"></script>
</body>
</html>
And the JS:
var app = new Vue({
// The HTML element to attach to
el: '#app',
// Variables defined here will be avalable and updated within the HTML
data: {
msg: '[No Message Received Yet]',
},
// Callback function when Vue library is fully loaded
mounted: function() {
// Start up uibuilder
uibuilder.start();
// Keep a reference to the Vue app
var vueApp = this;
// Callback triggered when node receives a (non-control) msg
uibuilder.onChange('msg', function(msg) {
vueApp.msg = msg;
});
},
});