Howdy, Stranger!

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

[Sugar Cube] Multiple items to unlock thing?

I've been trying to figure it out myself but I've been unable to work it out.

I'm trying to set it so that you collect multiple items (hidden that is) when you go to certain passages/areas and you need all of them in order to unlock a new route.
Think of it that you need to collect multiple keys to unlock a huge door.

I know how to set if/then codes and such (sorry if I'm using the wrong terminology my mind isn't great).

Is it possibly to set the coding so you need multiple items to go to a certain passage and continue down that storyline.

ALSO: I was trying to search earlier, but how do you set a "main menu" for your game? Like create one that shows your saves or the credits.

Thank you and please mention if I need to be clearer or if you don't understand (I have a bad time explaining things sorry).

Comments

  • edited October 2016
    Sorry, I use Harlowe, but this is probably a thing in Sugarcube what you just gotta adapt into it? I dunno, but in Harlowe you can use 'and' in code.
    (if: $key1 is true and $key2 is true and $key3 is true)[[[Open The Big Scary Door...]]](else:)[You must have all the keys to open the door.]
    

    Could that be helpful? And for a title screen:
    (text-style: "shadow")[<big><big><big><big>''The Big Scary Door...''</big></big></big></big>]
    <small>By LordFang</small>
    [[New Game]]
    (if: (saved-games:) contains "Slot A")[{
    (link: "Load Game A")[(load-game:"Slot A")]}
    (if: (saved-games:) contains "Slot B")[{
    (link: "Load Game B")[(load-game:"Slot B")]}
    (if: (saved-games:) contains "Slot C")[{
    (link: "Load Game C")[(load-game:"Slot C")]}
    [[Credits]]
    

    That's the normal kinda thing I'd do.

    Does this help? Sorry if it doesn't, I dunno if Harlowe and Sugarcube are alike at all.
  • I tried it and it seems to work! Thank you very much :)
  • LordFang wrote: »
    I tried it and it seems to work! Thank you very much :)

    Oh! I thought you'd have to change it for it to work in sugarcube. Cool!
  • edited October 2016
    If LordFang was referring to the code as a whole, then they would have had to change it because it is not valid in SugarCube. If it did work as-is, then they're using Harlowe, not SugarCube.

    If LordFang simply meant that the and (logical-AND) operator worked, then yes. SugarCube and Harlowe do share many of the same wordy operators.

    The correct syntax for SugarCube would be: (reusing the original example)
    <<if $key1 and $key2 and $key3>>[[Open The Big Scary Door...]]<<else>>You must have all the keys to open the door.<</if>>
    


    PS/FYI: Regardless of the story format involved, you do not need to compare boolean values to the boolean literals within a conditional. In other words:
    → Instead of this:
    (if: $key1 is true and $key2 is true and $key3 is true) …
    <<if $key1 is true and $key2 is true and $key3 is true>> …
    
    → Do this:
    (if: $key1 and $key2 and $key3) …
    <<if $key1 and $key2 and $key3>> …
    
    Conditionals reduce to boolean values, so if your value is already a boolean, then just use the value. Forcing a comparison in that case is both unnecessary and inefficient.
  • If LordFang was referring to the code as a whole, then they would have had to change it because it is not valid in SugarCube. If it did work as-is, then they're using Harlowe, not SugarCube.

    If LordFang simply meant that the and (logical-AND) operator worked, then yes. SugarCube and Harlowe do share many of the same wordy operators.

    Yeah I was using the "and" part. I figured that on my own shortly after making this post, but I also tried out Deadshot's code on a Harlowe version just to test around with things
Sign In or Register to comment.