Howdy, Stranger!

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

Clicker game ala Kittens Game/Candy Box help

Hello again, forums. So, I'm working on my next big thing. Title and theming is all a WIP, of course, but for now I'm trying to figure out the coding.
Enclosed is my work in progress, and I have a few issues I'd like help with! Sorry if anything's like, super obvious, it could be I'm just being a dingus.
- You don't really collect the $cheese, it just like. Resets itself to however much you got on your last cheese adventure.
- Cheese is the only working variable for some reason? No error messages get displayed for your other options, but it doesn't actually add anything and still displays 0.
- Fight is so broken. How do I fight. I'm just an eel

Comments

  • Okay, I think I may fixed those issues, mostly?? This is still a mess, but it is basically working. I'm solving issues as they arise. Does anyone see any glaring issues I haven't noticed yet?
  • There are a number of issues with your examples, some minor some not.

    1. The CSS you are using to hide the Undo/Redo links does not hide the tw-sidebar HTML element itself, this mean that it still takes up (invisible) horizontal space which can effect narrow screens, I have included tw-sidebar CSS in my example.

    2. A better place to initialise your variables is within a startup tagged passage, this passage automatically gets processed at the start before the first passage is shown to the reader. My example includes one.

    3. You should not include the is operator when testing if a variable is greater than / less than a value, the same goes for the "or equal to" variations of the same.

    4. It is easy to misspell the name of a variable so I find it safer to use the it keyword when either increasing or decreasing the value of a variable.
    (set: $defense to $defense + $drop)
    
    becomes
    
    (set: $defense to it + $drop)
    
    ... you also need to make sure you always include the dollar sign $ at the start of your variable names otherwise the code wont work, as is the case with the above code in your example which was missing the $ on the $drop variable.


    5. There should be no extra coma at the end of your argument lists.
    (either: "shifty", "loyal", "curious", "kind",)
    
    should be
    
    (either: "shifty", "loyal", "curious", "kind")
    

    I have attached a modified version of your example which include the above changes.
  • Thank you, greyelf! You've always got very helpful comments. I'll take a scan through what you've linked and comment if I have any more issues.
  • So, here's what I've done in the past few days, just so everyone can see.
    Issues: fighting the enemies after world expansion is so, so broken, should be able to fix that on my own, though. I need to rephrase the world expansion code. And I'm not sure of an efficient way to stop people from spending more cheese/materials/other resources than they have. One person who I gave the link to test mentioned going 500 cheese into the negative, LOL.
  • And I'm not sure of an efficient way...
    The answer is simple and you are already using in other parts of your story.

    Use an (if:) macro to test is there are enough materials to make an item.

    In your main passage you are currently using a condition to hide links:
    (if: $materials > 10)[ [[craft]]]
    
    ... you need to do the same in the target passages to conditionally hide their links as well.


    eg. In your craft passage you could change the boards link to something like the following:
    (if: $cheese >= 5 and $materials >= 10)[ [[boards]] (-5 cheese, -10 materials)]
    
  • A special shout-out to everybody who is willing to answer dumb questions from noobies, like greyelf. Seriously, you're the best! Mouse Clicker's coming along pretty smooth now.
    I'm considering changing the name to "Cheese Death" or something similar, though, haha.
Sign In or Register to comment.