Hoarding Gold, More guiding hints/help needed


#1

Some info on how to use the + operator is needed to complete this level.
My first problem was that I couldn’t stop collecting coins after I reached 25.

At first, I wasn’t sure what to do with “coin.value”. I ended up using: totalGold = coin.value, which just made me pick up all the coins. After reading another post on this level, I changed it to totalGold = totalGold + coin.value (or totalGold += coin.value). That did the trick, but how would someone with no coding experience know to do that? In hindsight, the 3rd and 4th hints made a lot more sense, but could have been clearer. Perhaps:

// Pick up (coins) and add (their) value to (totalGold).
// Get (each coin’s) value with: coin.value

My second problem was that I couldn’t tell Naria how much gold I’d collected.

I used: this.say(“I have " totalGold " gold”); I found out I had to use “+” as a concatenate operator. I changed it to: this.say(“I have " + totalGold + " gold”); Now all my code works, I just wish I didn’t have seek outside help to make it happen.

I really enjoy Code Combat and even convinced my wife to start playing (so I can crush her in multiplayer). However, she hit the same brick wall I did on this level and hasn’t played in over a week now. My hope in writing this is to get the hints and help/guide updated so that other beginners can get through this level (my kids haven’t got to this one yet)

p.s. This is the first forum I’ve actually joined. not sure how/if I should categorize this… scribe?, .


#2

Thanks for the hints.
Glad to see you in here.
When in doubt, don’t categorize, and ask for a category (just as you did ;)). I’m not 100% certain, but this could also fit Artisan. Your choice.
But to get back to the topic: Did you know that you can actually solve this yourself? In the [level-editor][1] you can adjust the help-texts ect. Simply submit a patch after you finished, and if it fits the intentions, it will be accepted and included in the level.

The concrete level in the editor is actually [this][2] one, the above is the general link.

EDIT: You can access the example-code by doubleclicking the Hero-Placeholder, scrolling down to programming.Programmable, expanding programmable methods and then plan.

You can adjust languages, source and comments.
[1]: http://codecombat.com/editor/level
[2]: http://codecombat.com/editor/level/hoarding-gold