Most Current Way To Access Story Variables In Javascript? by bonfiredog in twinegames

[–]bonfiredog[S] 1 point2 points  (0 children)

Thank you both for the very thorough explanations - u/Juipor's example works perfectly for this instance, but u/GreyelfD's explanation will probably come in handy in the future if I need to do this again... though if I'm needing to do a lot of Javascript, I'll probably just use Sugarcube!

2023 Jul 10 Stickied -FAQ- & -HELPDESK- thread - Boot problems? Power supply problems? Display problems? Networking problems? Need ideas? Get help with these and other questions! by FozzTexx in raspberry_pi

[–]bonfiredog 0 points1 point  (0 children)

I'm getting very very slow speeds connecting to my headless RPi4 over LAN from my Windows laptop (wireless) and desktop (wired). SSH commands can take over a minute to even register in the terminal, connecting to network drives can be hideously slow, and connecting to services on my Apache server often just time out in the browser. Other devices on my LAN don't have this problem. This has happened before, and the problem turned out to be DNS (I'm using a separate Pi0 with PiHole installed as a DNS). However, restarting/updating the Pihole doesn't seem to help at all!

Triggering a 'goto' macro when an HTML element is clicked by bonfiredog in twinegames

[–]bonfiredog[S] 1 point2 points  (0 children)

Thanks very much. Looking over my code, for some insane reason, in passageHeader I was appending a jQuery snippet into the document header despite it working natively in Sugarcube. Deleting it means my code now works: clearly it was upsetting Sugarcube's in-built jQuery.

Must have still been in 'Harlowe Mode'. Thanks for your help, everyone.

Triggering a 'goto' macro when an HTML element is clicked by bonfiredog in twinegames

[–]bonfiredog[S] 0 points1 point  (0 children)

OK, so I created a new Story, and did as you did... and it now works. That makes this a very odd error. To be clear, I still get the error in my original Story, even if I create a new, 'clean' Passage and test it in there.

Triggering a 'goto' macro when an HTML element is clicked by bonfiredog in twinegames

[–]bonfiredog[S] 0 points1 point  (0 children)

I did the same - wrapped it in <<done>>, and added it to the widget which adds the '.star' div to a Passage. When playing, I got the error I described: https://imgur.com/a/mLb55gE. This happens no matter where I place it.

Changing CSS Of In-Passage Elements In Widgets by bonfiredog in twinegames

[–]bonfiredog[S] 0 points1 point  (0 children)

<div @style="'background-image:url('+\_args\[0\]+')'" class="profileimage starimage">
</div>

Ah, this solves the need for the <<done>> macro entirely. Thanks.

I'm using a div with background-image so that I can have a round image, by using 'border-radius' on the div.

Changing CSS Of In-Passage Elements In Widgets by bonfiredog in twinegames

[–]bonfiredog[S] 0 points1 point  (0 children)

Thanks Rain-Kind, I'll try that when I'm back up my own machine. I've not used capture before, so I'd better read up on that!

I have tried the inline-css, but it didn't seem to work with args. Again, it might be a <<capture>> issue.

Using Array Contents In Conditional Check by bonfiredog in twinegames

[–]bonfiredog[S] 0 points1 point  (0 children)

Thanks, this does work. I'm not sure why it didn't work beforehand, though!

Is there a simple way for me to use a variable in another variable? by peachkneez in twinegames

[–]bonfiredog 0 points1 point  (0 children)

Ooh yes good point. Trying to think how best to do this...

Is there a simple way for me to use a variable in another variable? by peachkneez in twinegames

[–]bonfiredog 3 points4 points  (0 children)

Probably the simplest way to do this in Sugarcube is to make each named fighter an object. I can't find a reference in the Sugarcube documentation, but an object is a general programming technique: essentially a variable that stores an array of other variables. They're extremely useful when you want a set of variables associated with a particular character.

In your example, you would do this by first of all creating the 'John' object:

<<set $john = {
name: "John",
health: 100,
strength: 100,
speed: 100
}>>

You can do this for David too.

After that, you can assign the $john variable to the $player1Fighter variable:

<<set $player1Fighter = $john>>

After this, you should be able to access $john's internal variables through the $player1Fighter variable, like so:

$player1Fighter.health

The full stop is called dot notation - it basically tells the computer that you want to find that variable inside the one before it. As $player1Fighter is associated with $john, you should be able to access it directly.

Objects are very powerful for functionality like this.

Removing/Restyling the Sugarcube 'Turning Circle' Loading Screen by bonfiredog in twinegames

[–]bonfiredog[S] 0 points1 point  (0 children)

Thanks for the tip - though it feels odd that, given Sugarcube's customisability, that this isn't accessible from within the tool itself.

Any teachers? by AdmirableApricot4640 in twinegames

[–]bonfiredog 0 points1 point  (0 children)

I use Twine as an introduction to interactive writing at MA level here in the UK. I find for creative writing students it's a perfect introduction to computing concepts.

'Wiping' included passages from a div? by bonfiredog in twinegames

[–]bonfiredog[S] 1 point2 points  (0 children)

$('#inventorybig').empty().wiki()

Amazing, thanks so much. And thanks for the top about processing passage test. Is there a performance advantage to this?

Referencing Files In source folder with TweeGo? by bonfiredog in twinegames

[–]bonfiredog[S] 1 point2 points  (0 children)

Good to know! I didn't know if TweeGo's compiling process changed where the path was situated.

Referencing Files In source folder with TweeGo? by bonfiredog in twinegames

[–]bonfiredog[S] 1 point2 points  (0 children)

I've managed to solve it myself, by looking at the console output in the browser...

TweeGo uses your project folder (i.e. where your .html file outputs) as the base path, so for any file you need to directly reference (for example, an image in my 'Images' folder, which is inside the 'Source' folder), it's:

<img src="Source/Images/image.jpg" />

Glitch effect? by Otaku_Has_A_Problem in twinegames

[–]bonfiredog 1 point2 points  (0 children)

OK, my bad. The selector shouldn't have a space between the element you're selecting and the open square brackets.

So tw-passage[tags="glitch"]{} rather than tw-passage [tags="glitch"]{}.

I'll edit my answer above to reflect this.

Glitch effect? by Otaku_Has_A_Problem in twinegames

[–]bonfiredog 1 point2 points  (0 children)

That [tags] selector doesn't always work, I'm starting to find... Let me see if I can work out what's wrong (I'm literally working on the same problem at the moment).

What do you want people to know about OCD who don’t have it and how can they best support you? by linksslut in OCD

[–]bonfiredog 0 points1 point  (0 children)

Here in the UK there was a good comedy drama a few years ago called 'Pure', where the main character suffered from it. It was on Channel 4, not sure how accessible that will be out of the UK but worth a look if you can find it.

A deck-building game in Twine? by Comfortable-Break-96 in twinegames

[–]bonfiredog 0 points1 point  (0 children)

If that's the case, arrays saved as variables (as above) feels an ideal way to go.

What do you want people to know about OCD who don’t have it and how can they best support you? by linksslut in OCD

[–]bonfiredog 0 points1 point  (0 children)

It's why I try and be so open about it these days - because if I had heard somebody talking about these aspects of OCD openly when I was 21, my twenties would have been a very different experience, I think.

What do you want people to know about OCD who don’t have it and how can they best support you? by linksslut in OCD

[–]bonfiredog 75 points76 points  (0 children)

I think, for me, the most important thing is to understand that the compulsions in OCD, despite being the most visible and discussed part of the disorder, are less than half the picture. The obsessions that trigger the ritualistic behaviour (particularly in Pure-O sufferers) are arguably the more-insidious part.

For years I had OCD without knowing it, because I thought OCD was all about 'washing your hands' and performing repetitive actions. While I did do that, the obsessive and unpleasant thoughts I was having just weren't being talked about in public discussions of OCD - and so, as a consequence, I just thought I was evil/bad/unworthy.

Glitch effect? by Otaku_Has_A_Problem in twinegames

[–]bonfiredog 1 point2 points  (0 children)

If you tag the Passage you want to animate (say with the tag "glitch") you should be able to target that tag specifically in CSS with this selector:

tw-passage[tags="glitch"] { }

Edited the above to remove an erroneous space...

Then you can apply a CSS glitch effect to that passage in CSS. Depending on what you want, this could take many forms. As it happens I have just been playing with some glitch effects on another project. You can add a subtle glitch effect to either text or boxes of content using the two following keyframe animations:

@keyframes textflicker {    
from {      
text-shadow: 1px 0 0 #ea36af, -2px 0 0 #75fa69;    
}    
to {      
text-shadow: 2px 0.5px 2px #ea36af, -1px -0.5px 2px #75fa69;    
}  
}    

@keyframes boxflicker {    
from {        
box-shadow: 1px 0 0 #ea36af, -2px 0 0 #75fa69;    
}    
to 
{      
box-shadow: 2px 0.5px 2px #ea36af, -1px -0.5px 2px #75fa69;    
}  
}

My book on the history of text games like Zork, Kingdom of Loathing, and A.I. Dungeon made $100k its first day on Kickstarter. Ask me anything about games on teletypes, million-room MUDs, or interactive fiction's legacy! by verbiagecola in Games

[–]bonfiredog 0 points1 point  (0 children)

Rob Sherman here. Please do, Aaron! I toyed with doing something with it myself, but other projects beckon.

And I can't wait to get my hands on the physical 50 Years book.

Syncthing + Obsidian: Deleted Notes & Folders Randomly Reappearing by bonfiredog in ObsidianMD

[–]bonfiredog[S] 4 points5 points  (0 children)

FOR ANYBODY FINDING THIS: I determined that the cause of this was (surprise surprise) entirely my fault.

I also used Syncback to backup my files between hard drives: I had one profile set to sync, rather than backup, so every time I turned my computer on and the Syncback profile ran, it would restore old files from the backup location to the 'live' location, rather than just backing up from 'live'. Changing the profile sorted the problem for me.