I do not understand the error message the game is giving me. I have the Boss Star III equipped and plenty of gold. Please explain what I’m doing wrong. Thank you!
friend = self.findNearest(self.findFriends())
friend will refer to the soldier you just summoned. There is no
getNearestFriends method, which is what it’s trying to tell you (but there is a bug causing it to give you a bad error message).
After 25 minutes of tweaking the code for griffin soldier I get that the parentheses don’t match. How are they not matching? Thank you
Well, here’s what I see off the top of my head:
- You haven’t indented your for-loop properly. It should be:
for enemy in enemies: if self.gold > 49: ...
In line 11, you put
"griffin-rider" == self.findNearest(self.findFriends()).
Not only can you not assign things to strings, but you use
==, which is a comparison, not an equality. Use only one
In line 12, you say
self.command("griffin-rider" "attack" enemies).
You need to put commas between you statements, like this:
You command your griffin rider to attack
enemiesis a list, and can not be attacked. You should attack
The error statement about parentheses is probably another bug that gives you an incorrect error message.
Thank you for your help. I implemented your changes and it now looks like this.
What is rvalue? Thank you again Chronist Gilver
an “rvalue” is a “Rightside VALUE” meaning that you are trying to assign to something that goes on the RIGHT side of an assignment (“only” variables can go on the left).
"griffin-rider" = self.findNearest(self.findFriends()) // "a string" = the_return_of_some_function
As Chronist said, “you [can] not assign things to strings”…
One other problem I see is the name of the array of enemies. In line 7, you wrote
enemy = self.findEnemies, but in line 8 referred to “enemies” as the array. Which is it?
Honestly, I don’t know, but that is what the code provided by my glasses tell me to use.
Think about what you are doing with findEnemies()… you are finding enemie"S" plural. You now have multiple enemies inside. enemies is your set of enemies. an enemy singular is inside of the group of enemies plural. read your code like a sentence and it should pop out at you.
“make a list of enemies and put them in a list called enemy. for each enemy in the list called enemies” but you didn’t call your list enemies, called your list enemy.