cyrusfirheir / cycy-wrote-custom-macros Goto Github PK
View Code? Open in Web Editor NEWMacros for SugarCube 2.
License: The Unlicense
Macros for SugarCube 2.
License: The Unlicense
Make syntax like the following possible:
<<live>>
/* TwineScript */
<</live>>
So the entire section can be updated.
^ title
Config.passages.onProcess = function (p) {
if (p.tags.includes('typed') && settings.type_dissabled) {
var $speed_setting = '<<type ' + settings.typed_speed + 'ms>>'
return $speed_setting + p.text + '<</type>>'; /* adjust this however you see fit */
} else {
return p.text;
}
}
Returns empty output. Type macro is not triggered. Thanks!
I admit I am nesting them despite you telling me not to some time ago with v1, though you did say it would work then, just that it would be messy.
:: test2
<<link 'advance'>><<ctpAdvance $thread>><</link>>
<<set $thread to 'test1'>>
<<ctp 'test1'>>
1
<<ctpNext>>
2
<<ctpNext>>
3
<<ctpNext>>
4
<<set $thread to 'test2'>>
<<ctp 'test2'>>
5
<<ctpNext>>
6
<<ctpNext>>
7
<<ctpNext>>
8
<</ctp>>
<</ctp>>
<!--
Expected output:
advance 1 2 3 4 5 6 7 8
Actual output:
advance 1 2 3 4 5 5 4 4 4 4 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
It gets recursively bigger, this was result after what would've been 6. By 8, it's flowing off screen with extra 4's
-->
Make cycy.twee-config.yaml
with defs for all macros.
<<liveblock>>
<<run setup.GameTime($City.long, $City.lat)>>
<p id="city-button" class="passage-text default-button city-continue-button hidden">
<<link "Start the game!">>
/* stuff */
<</link>>
</p>
<</liveblock>>
<<script>>
$(document).on("click", "#listbox-city", function () {
$(document).trigger(":liveupdate");
$("#city-button").removeClass("hidden");
});
<</script>>
Expected behavior, no flashing.
Removing the $(document).trigger(":liveupdate");
fixes everything.
See GIF for the problem. See code for what I've done.
Possible fix, unsure.
Yours sincerely,
Sjoerd Hekking Redsea
Make the <<update>>
macro take in an optional argument which specifies what variable has been updated to update the DOM accordingly.
I have two listboxes on the passage and I want to change content of the second listbox when option of the first listbox chosen. How to do this with your macros without page reloading?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.