GithubHelp home page GithubHelp logo

cyrusfirheir / cycy-wrote-custom-macros Goto Github PK

View Code? Open in Web Editor NEW
31.0 3.0 5.0 113 KB

Macros for SugarCube 2.

License: The Unlicense

CSS 2.25% JavaScript 97.75%
twine sugarcube-2 macros systems

cycy-wrote-custom-macros's Introduction

Cycy wrote custom macros


Installation

Download this repository (easiest way to grab everything, really) and cherry pick whatever you want in your project. Some might have CSS files, others won't, but everything you need is there. Along with a README.md for each macro which has further instructions on installation and usage.

Each macro set provides a <macro-name>.twee-config.yaml file which can also be added to workspace if using the Twee 3 Language Tools VSCode extension, for macro definitions of that set. It's recommended for error diagnostics.

Besides that, there's a cycy.twee-config.yaml in the root of the repo, and that has definitions for all the macro-sets in one file. This is the better way to go about it โ€” only one file to keep track of.


Macro sets

  1. Click to Proceed (CTP) v2

    • Clean way to reveal text block-by-block in the same passage without having to nest a million <<linkreplace>> macros.
    • Primarily made for sequential rendering, e.g. VN like interfaces.

    NOTE: CTP v1 can be found here.

  2. Crossfade

    • Crossfade between two images with simple macros.
    • Can be used to fade-in/out too.
  3. Live Update

    • Make the display of an expression 'live' and 'update' every such display to see the changes instantly.
    • Under the hood, it works similarly to how the <<replace>> and other DOM macros do, but on the surface, it's wayyy simpler to use.

JavaScript Libraries

  1. Rock paper scissors (RPS)
    • Makes RPS logic simpler.
    • Works for more than just three elements.

cycy-wrote-custom-macros's People

Contributors

bawdyinkslinger avatar cyrusfirheir avatar unexpected-dreams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cycy-wrote-custom-macros's Issues

Help please with liveupdate and listboxes

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 block form of <<live>>

Make syntax like the following possible:

<<live>>
  /* TwineScript */
<</live>>

So the entire section can be updated.

New <<ctp>> version bug: when nested, the last ctp block gets repeated

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

-->

Flash on listbox with liveupdate

test5

<<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

Specificity for live-update

Make the <<update>> macro take in an optional argument which specifies what variable has been updated to update the DOM accordingly.

<<type>> macro doest when callen Config.passages.onProcess

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.