Howdy, Stranger!

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

How To Use Quotation Marks Without Them Being Used In An Either Macro

Here is part of my game:
(either: 'An enemy downs one of your teammate!

(link: "Try To Save Him")[(either: "You go to save him, but you get attacked!
(set: $all $ally - 1)
[[Continue ->Fight]]","You go to save him, but you get attacked!
(set: $all $ally - 1)
[[Continue ->Fight]]","You save him, but as you run away, you get attacked.

[[Continue ->Fight]]","You save him and escape!

[[Continue ->Example Match]]")]
(link: "Leave Him")[(either: "You leave him to die.
(set: $all $ally - 1)
[[Continue ->Example Match]]","You leave him to die, but another teammate goes to save him. Unfortunately, he is downed too.

Forget that I han't put closed brackets or any of that; what I want to add in as well as that is this:
(link: "Try To Save Them")[(either: "You go to save them, but get attacked!
(set: $ally to $ally - 2)
[[Continue ->Fight]]","You go to save them, but you only manage to save one!
(set: $ally to $ally - 1)
[[Continue ->Example Match]]","You go to save them, but only save one, AND get attacked!
(set: $ally to $ally - 1)
[[Continue ->Fight]]","You save them both, but get attacked.

[[Continue ->Fight]]","You save them both!

[[Continue ->Example Match]]")]
(link: "Leave Them Both")[(either: "They both die.
(set: $ally to $ally - 2)
[[Continue ->Example Match]]","They both die.
(set: $ally to $ally - 2)
[[Continue ->Example Match]]","One manages to survive!
(set: $ally to $ally - 1)
[[Continue ->Example Match]]")]

But obviously, I've already used the single quote (') and the double quote ("), so I can't add this in without twine thinking that I'm closing the option for the either macro. Is there a way I can make twine think otherwise? I use Harlowe.

note: soz for asking all these questions at once, but for my game I'm trying to do a load'a awesome new stuff.

Comments

  • Deadshot wrote: »
    Here is part of my game:
    (either: 'An enemy downs one of your teammate!
    
    (link: "Try To Save Him")[(either: "You go to save him, but you get attacked!
    (set: $all $ally - 1)
    [[Continue ->Fight]]","You go to save him, but you get attacked!
    (set: $all $ally - 1)
    [[Continue ->Fight]]","You save him, but as you run away, you get attacked.
    
    [[Continue ->Fight]]","You save him and escape!
    
    [[Continue ->Example Match]]")]
    (link: "Leave Him")[(either: "You leave him to die.
    (set: $all $ally - 1)
    [[Continue ->Example Match]]","You leave him to die, but another teammate goes to save him. Unfortunately, he is downed too.
    

    Forget that I han't put closed brackets or any of that; what I want to add in as well as that is this:
    (link: "Try To Save Them")[(either: "You go to save them, but get attacked!
    (set: $ally to $ally - 2)
    [[Continue ->Fight]]","You go to save them, but you only manage to save one!
    (set: $ally to $ally - 1)
    [[Continue ->Example Match]]","You go to save them, but only save one, AND get attacked!
    (set: $ally to $ally - 1)
    [[Continue ->Fight]]","You save them both, but get attacked.
    
    [[Continue ->Fight]]","You save them both!
    
    [[Continue ->Example Match]]")]
    (link: "Leave Them Both")[(either: "They both die.
    (set: $ally to $ally - 2)
    [[Continue ->Example Match]]","They both die.
    (set: $ally to $ally - 2)
    [[Continue ->Example Match]]","One manages to survive!
    (set: $ally to $ally - 1)
    [[Continue ->Example Match]]")]
    

    But obviously, I've already used the single quote (') and the double quote ("), so I can't add this in without twine thinking that I'm closing the option for the either macro. Is there a way I can make twine think otherwise? I use Harlowe.

    note: soz for asking all these questions at once, but for my game I'm trying to do a load'a awesome new stuff.

    If you don't understand or don't have an answer, don't worry - I have a way but it looks messy and confusing. Please, instead, try to answer my other questions which are more important.
  • That is not a good way to use an (either:) macro to choose between different outcomes.

    You should use (either:) or (random:) to assign a value to a $variable and then use (if:), (else-if), and (else:) macros to determine which outcome happens.

    The following example shows one way to achieve similar results. I have added a lot of extra line-breaks and indentation to make it more readable, which will need to be removed/condensed in your version.
    You may notice that I have used the same variable name inside the (link:) macros as I used outside the links, this is ok in this particular case because that variable would be accessed until the Reader clicks on the link.
    (set: $opt to (either: 'A', 'B'))
    
    (if: $opt is 'A')[
    	An enemy downs one of your teammate!
    
    	(link: "Try To Save Him")[
    		(set: $opt to (either: 'A', 'B', 'C', 'D'))
    
    		(if: $opt is 'A')[
    			You go to save him, but you get attacked!
    			(set: $all $ally - 1)
    			[[Continue ->Fight]]
    
    		](else-if: $opt is 'B')[
    			You go to save him, but you get attacked!
    			(set: $all $ally - 1)
    			[[Continue ->Fight]]
    
    		](else-if: $opt is 'C')[
    			You save him, but as you run away, you get attacked.
    			[[Continue ->Fight]]
    
    		](else:)[
    			You save him and escape!
    			[[Continue ->Example Match]]
    		]
    	]
    
    	(link: "Leave Him")[
    		(set: $opt to (either: 'A', 'B'))
    	
    		(if: $opt is 'A')[
    			You leave him to die.
    			(set: $all $ally - 1)
    			[[Continue ->Example Match]]
    
    		](else:)[
    			You leave him to die, but another teammate goes to save him. Unfortunately, he is downed too.
    		]
    	]
    
    ](else:)[
    	Somthing else happens???
    	Your example do not explain what!
    ]
    
  • Have you tried using <q> and </q> for spots where you want to show quotation marks but not have harlowe interpret them as part of your code? (I might be misunderstanding your question.)
  • Have you tried using <q> and </q> for spots where you want to show quotation marks but not have harlowe interpret them as part of your code? (I might be misunderstanding your question.)

    You have not misunderstood, and thank you for the answer - I did not know you could do that. I think I'll try greyelf's way though.
  • edited September 2016
    greyelf wrote: »
    That is not a good way to use an (either:) macro to choose between different outcomes.

    You should use (either:) or (random:) to assign a value to a $variable and then use (if:), (else-if), and (else:) macros to determine which outcome happens.

    The following example shows one way to achieve similar results. I have added a lot of extra line-breaks and indentation to make it more readable, which will need to be removed/condensed in your version.
    You may notice that I have used the same variable name inside the (link:) macros as I used outside the links, this is ok in this particular case because that variable would be accessed until the Reader clicks on the link.
    (set: $opt to (either: 'A', 'B'))
    
    (if: $opt is 'A')[
    	An enemy downs one of your teammate!
    
    	(link: "Try To Save Him")[
    		(set: $opt to (either: 'A', 'B', 'C', 'D'))
    
    		(if: $opt is 'A')[
    			You go to save him, but you get attacked!
    			(set: $all $ally - 1)
    			[[Continue ->Fight]]
    
    		](else-if: $opt is 'B')[
    			You go to save him, but you get attacked!
    			(set: $all $ally - 1)
    			[[Continue ->Fight]]
    
    		](else-if: $opt is 'C')[
    			You save him, but as you run away, you get attacked.
    			[[Continue ->Fight]]
    
    		](else:)[
    			You save him and escape!
    			[[Continue ->Example Match]]
    		]
    	]
    
    	(link: "Leave Him")[
    		(set: $opt to (either: 'A', 'B'))
    	
    		(if: $opt is 'A')[
    			You leave him to die.
    			(set: $all $ally - 1)
    			[[Continue ->Example Match]]
    
    		](else:)[
    			You leave him to die, but another teammate goes to save him. Unfortunately, he is downed too.
    		]
    	]
    
    ](else:)[
    	Somthing else happens???
    	Your example do not explain what!
    ]
    

    Thanks, but what are all the spaces for? I find them unclear and hard to read with them. :confounded:
  • Deadshot wrote: »
    but what are all the spaces for? I find them unclear and hard to read with them. :confounded:
    I added the indentation and extra line-breaks in so that people can see where each section of the code starts and ends, see which section of code is contained within the associated hook of a macro, and to see the layering of the associated hooks.

    eg. there are associated hooks within associated hooks within associated hooks.

    This is a common practice (known as formatting) used when trying to make the code more readable/understandable. All of that formatting can be safely removed and some of it would need to be condensed anyway to remove unwanted line-breaks in the screen output.

    Here is a version of my previous code with most of the formatting removed, I believe it is now difficult to see the layering of the associated hooks.
    (set: $opt to (either: 'A', 'B'))
    (if: $opt is 'A')[An enemy downs one of your teammate!
    (link: "Try To Save Him")[
    (set: $opt to (either: 'A', 'B', 'C', 'D'))
    (if: $opt is 'A')[You go to save him, but you get attacked!
    (set: $ally to $ally - 1)
    [[Continue ->Fight]]]
    (else-if: $opt is 'B')[You go to save him, but you get attacked!
    (set: $ally to $ally - 1)
    [[Continue ->Fight]]]
    (else-if: $opt is 'C')[You save him, but as you run away, you get attacked.
    [[Continue ->Fight]]]
    (else:)[You save him and escape!
    [[Continue ->Example Match]]]]
    (link: "Leave Him")[
    (set: $opt to (either: 'A', 'B'))
    (if: $opt is 'A')[You leave him to die.
    (set: $ally to $ally - 1)
    [[Continue ->Example Match]]]
    (else:)[You leave him to die, but another teammate goes to save him. Unfortunately, he is downed too.]]]
    (else:)[
    	Somthing else happens???
    	Your example do not explain what!
    ]
    

    note: I have also corrected the setting of the $ally variable bugs which were in your original example
  • greyelf wrote: »
    Deadshot wrote: »
    but what are all the spaces for? I find them unclear and hard to read with them. :confounded:
    I added the indentation and extra line-breaks in so that people can see where each section of the code starts and ends, see which section of code is contained within the associated hook of a macro, and to see the layering of the associated hooks.

    eg. there are associated hooks within associated hooks within associated hooks.

    This is a common practice (known as formatting) used when trying to make the code more readable/understandable. All of that formatting can be safely removed and some of it would need to be condensed anyway to remove unwanted line-breaks in the screen output.

    Here is a version of my previous code with most of the formatting removed, I believe it is now difficult to see the layering of the associated hooks.
    (set: $opt to (either: 'A', 'B'))
    (if: $opt is 'A')[An enemy downs one of your teammate!
    (link: "Try To Save Him")[
    (set: $opt to (either: 'A', 'B', 'C', 'D'))
    (if: $opt is 'A')[You go to save him, but you get attacked!
    (set: $ally to $ally - 1)
    [[Continue ->Fight]]]
    (else-if: $opt is 'B')[You go to save him, but you get attacked!
    (set: $ally to $ally - 1)
    [[Continue ->Fight]]]
    (else-if: $opt is 'C')[You save him, but as you run away, you get attacked.
    [[Continue ->Fight]]]
    (else:)[You save him and escape!
    [[Continue ->Example Match]]]]
    (link: "Leave Him")[
    (set: $opt to (either: 'A', 'B'))
    (if: $opt is 'A')[You leave him to die.
    (set: $ally to $ally - 1)
    [[Continue ->Example Match]]]
    (else:)[You leave him to die, but another teammate goes to save him. Unfortunately, he is downed too.]]]
    (else:)[
    	Somthing else happens???
    	Your example do not explain what!
    ]
    

    note: I have also corrected the setting of the $ally variable bugs which were in your original example

    Thanks. I don't why, but I just don't like the indentations - no offence.
Sign In or Register to comment.