Create and Fuck your AI Slut -70% OFF
x

HTML Help with sugarcube attribute directive + apostrofy

McLOVINu

Active Member
Mar 18, 2018
894
409
187
Here goes my code attempts, none work:
Code:
@data-title='$charactername + "'s room"'
@data-title="$charactername + ''s room'"
Now, if I remove the ' both work, but it is missing the apostrophe.

I want the title to show as "Name's room".

edit: typo
edit2: and escaping doesn't work, ie \'
edit3: another similar question added =
Also, how can I put a viarable into this sort of LINK?
Code:
[img[Name's room|pics/location/home/bedroom1.jpg]]
Into something like this:
Code:
[img[$charactername's room|pics/location/home/bedroom1.jpg]]
 
Last edited:

osanaiko

Engaged Member
Modder
Jul 4, 2017
3,350
6,435
707
edit3: another similar question added =
Also, how can I put a viarable into this sort of LINK?
Code:
[img[Name's room|pics/location/home/bedroom1.jpg]]
Into something like this:
Code:
[img[$charactername's room|pics/location/home/bedroom1.jpg]]
Would have been better to make another post in the thread than edit the question into the first one which had already been answered.

Anyway, one way to do what you want would be to assign the possessive string to another variable. You could do this immediately after setting the $charactername variable in the first place:
Code:
<<set $charactername_apos = "$charactername + '\'s'">>
and then use that new variable in your link
Code:
[img[$charactername_apos room|pics/location/home/bedroom1.jpg]]
or anywhere else you need, like for the title
Code:
@data-title="$charactername_apos room"
 

McLOVINu

Active Member
Mar 18, 2018
894
409
187
Thanks, I'll try both when I get some free time.

I still can't figure out how to fix the 'video pausing' issue.
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
3,350
6,435
707
I still can't figure out how to fix the 'video pausing' issue.
Unfortunately that's not so much a Twine/Sugarcube question, as it is a complex browser DOM/API issue. You'd be better off searching places like stack overflow or MDN for answers to such esoteria.
 

Alcahest

Forum Fanatic
Donor
Game Developer
Jul 28, 2017
4,143
5,021
758
Code:
<<set $charactername_apos = "$charactername + '\'s'">>
I don't think that works... for data-title at least (I can't speak for the [] notation as I don't use it).

This should work.
Code:
<<set $charactername_apos = $charactername + "\'s">>

and then

@data-title="$charactername_apos + ' room'"

but don't know if that works with the [] notation.