This seems to be the way to do it in SugarCube...
<div id="red-bar" class="rpgui-progress red"></div>
<<script>>
// set the red bar into 50% full
var progress = document.getElementById("red-bar");
RPGUI.set_value(progress, 0.5);
<</script>>
But I don't know about harlowe. I tried it and got this error:
"Sorry to interrupt, but this page's code has got itself in a mess.
@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:3:3
n@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:58:3344
E@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:58:8517
.append@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:59:27483
u@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:75:5380
d.goToPassage@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:75:5736
@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:76:9175
o/</f@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:59:12434
o/</p<@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:59:12790
(This is probably due to a bug in the Harlowe game engine.)"
No idea what all of that means, but somebody might know. I got this far by doing this:
<div id="red-bar" class="rpgui-progress red"></div>
<body>
<script type="text/javascript">
var progress = document.getElementById("red-bar");
RPGUI.set_value(progress, 0.5);
</script>
</body>