Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Cycle Text Variable and Text Alignment?

edited September 2015 in Help! with 2.0
Hi again, folks. Might be seeing me more often...

I'm looking to create cycling text and variable(1), and to keep my text to the right- it keeps going under my sidebar(2)

How can I do this in Harlowe?

1: For example: In the intro, the player is referred to by lad, but I want this to be a link that can be clicked to cycle "lad" to "lass", and will change $gender to the respective gender...

2: Once my text has gone past the sidebar's height, it goes underneath the sidebar. I want to keep that entire section clear, since it looks sloppy.

Thanks in advance.

Comments

  • geniehere wrote: »
    1: For example: In the intro, the player is referred to by lad, but I want this to be a link that can be clicked to cycle "lad" to "lass", and will change $gender to the respective gender...
    This question has been asked and answered a number of times before, just searching the forums for 'cycling' will find other threads about this topic.
    One possible solution is to use Furkleindustries's Cycling Links.

    geniehere wrote: »
    2: Once my text has gone past the sidebar's height, it goes underneath the sidebar...
    Without knowing exactly how your side-bar works it is a little hard to answer this.
    But i am guessing that you are using a CSS float attribute to position the side-bar without using a related CSS clear attribute to clear the area directly below the side-bar.
  • Yes, I think that may be it, greyelf.

    This is my stat-bar attribute where save load and inventory are kept.
    #stats {
    float: left;
    padding-right: 1em;
    margin-right: 1em;
    margin-left: 1em;
    border-top: 1px solid green;
    border-left: 1px solid green;
    border-right: 1px solid green;
    border-bottom: 1px solid green;
    height: 450px;
    }
    
  • That is the CSS to position and style the side-bar, but how do you create the side-bar itself? Is it a passage, if so what does it contain and how is the passage (display:)'ed?

    Examples would help determine the HTML being generated by Harlowe, which in turn helps determine what CSS needs to be added to fix the issue.
  • edited September 2015
    Well I actually did some digging and figured out how to add that sidebar with some other posts by you and some others.

    Story Javascript
    if (! window.restrictedChange) {
    	window.restrictedChange = function(value, change, min, max) {
    		var result = value + change;
    		if (result < min)
    			result = min;
    		else if (result > max)
    			result = max;
    
    		return result;
    	};
    }
    

    stat <div> passage
    <div id="stats">[Save State]<save| | [Load State]<load|
    (click: ?save)[You've saved the game state.(savegame: "A","Test Save")]
    (click: ?load)[Loaded the previous state.(loadgame: "A")]
    
    (set: $inventory to (array:))
    (if: $inventory's length is 0)[You arent carrying anything!]
    (else:)[You're carrying:$inventory]
    
    </div>
    
  • Thank you for the example of the contents of the stat passage.

    I still have no answer to the how is the passage (display:)'ed? part of my last comment.
    eg.
    Are you using a (display: "stat") macro in every passage? and if so is it at the start or end of the passage?
    Are you using a (display:) macro in a header tagged passage? If so what else is in the passage?
    Have you tagged the stat passage as a header?

    Are you able to supply a copy of your story so I can look at the code to see how it works?
  • edited September 2015
    Yes greyelf, I'm using a header tagged passage. I had a bit of trouble understanding what you meant but that got me to go take a look.

    I tagged the stat passage as a header. I use Twine2 Online so I'll have to figure out how to duplicate the story so you can take a look if need be.
  • If you only have a single story project (or if you don't mind me seeing your other projects) then you just need to use Twine 2's Archive option to export your story(s) as a archive HTML file. You should be using this option to backup your story project(s) anyway.
    You can also use the Publish to File option to create a story HTML file from your story project.

    Once you have created a HTML file using either of the above methods then you just need to upload it to a file sharing/hosting site, then I can download and import that HTML file into my copy of Twine 2.
  • edited September 2015
    I have attached an Archive file which may solve your layout problem, use Twine 2's Import From File option to import it and have a look at it.

    Changes I made:
    1. I rewrote the CSS in the Story Stylesheet area.

    2. I removed Harlowe's side-bar because you were hiding it due to your background colour selection, this means that there is now no undo / redo buttons.

    3. Added a startup tagged passage named Startup in which to initialize all the $variables. I moved the assignment of $sex there from your main passage.

    4. Removed the mark tag that was wrapping the cyclelink and replaced it with CSS.

    5. Removed the script tag from your main passage, it served no purpose there.

    6. Fixed the markup link at the bottom of your main passage and renamed the passage it linked to.

    note: You may want to get a more experienced CSS coder to have a look at the CSS to see if I have made any errors.
Sign In or Register to comment.