Level: A Mayhem of Munchkins Help

I’m confused on what I’m doing wrong with my code because well it looks right at least from my perspective.

From running my code it doesn’t accept the self.attack line. I tried mixing it up with self.attack(enemy) though that doesn’t change things either. I’m confused

loop:
//declaring the loop/starting it above
enemy = self.findNearestEnemy()
//initializing the variable inside loop to be constantly updated
self.attack() = enemy
//the attack line.

The error is always “Assigning to rvalue.” though I don’t get it. Thank you ahead of time!

Your code:

self.attack() = enemy

Should be:

self.attack(enemy)

“Assigning to rvalue” means you’re trying to assign a value to the result of an expression (an rvalue). Assignment can only be performend on lvalues such as identifiers (names), attribute references and so on.

Though, I believe technical terms such as lvalue/rvalue are quite confusing for beginners, and thus unsuitable for a teaching game. It is possible to remap these error messages in Aether, but it may not be easy to find a suitable, simple and descriptive error message to replace this one. WDYT @nick?

The error message doesn’t have to try to explain why you can’t assign to certain things on the left; it just has to get the player to fix the code. The act of fixing the code is way better for learning than anything else. So usually what we do is to look at the highest-occurrence errors that don’t have good messages, then come up with rules to rewrite the error message to make those mistakes obvious, and it can be things that end up generating messages just like what you said, “Should be self.attack(enemy), not self.attack() = enemy.”

At least, that’s the plan–in practice we need more people in order to do everything, so we haven’t touched the error messages in a while. I can show you where to do it in Aether if you’re interested in helping with them?

I believe it is a bit more complex than that. One can easily copy-paste correct solutions without ever truly understanding the solution or the problem itself. But of course, they will hardly understand what’s going on if they don’t manage to get it working first.

I assume it is around here, right?
I’m still struggling to bring some of my own projects up to date, but I should have some more free time soon.

Interesting approach. By any chance, would that data be publicly available?

Yup, that’s most of it. We have a few things in transforms.coffee as well.

We have the user code problem breakdowns per-level in the admin-only campaign editor analytics; I don’t know if the scripts that we had to output the overall reports are up to date, but if they are, they’d be in the scripts directory somewhere. I can check more later when I have a minute.

wait so like what would the code be then.