Please help to lvl :Keeping Time


#1

Use your new skill to choose what to do: self.now()

loop:
# If it’s the first 10 seconds, fight.
if self.now() < 10:
pass

# Else, if it's the first 30 seconds, collect coins.
# After 30 seconds, join the raid!

#2

Hello, Asik, and welcome. Please read the FAW and format your code properly.

What, exactly do you need help with? You tell us you need help, but we can’t help you with a problem we don’t know about.


#3

and how to understand? you can not help me?


#4

We can help you but we don’t know what you need help with?


#5

I can not pass this level : Keeping time ! and I ask you for help


#6

I do not understand how to use the command self.now


#7

Just setup coin collecting forever I didn’t take the time to do the self.now()


#8

Ah, here we go.
self.now(), when you call it, returns the number of seconds the level has been playing. For example:

if self.now() < 10:
#Collect coins!

For a better description, look at your Simple Wristwatch in the level.


#9

Can you write me what commands you need to enter to complete this level


#10

That works perfectly so… I used the simple collect coins code with if self.now() < 10:
I actually don’t know how to end it.


#11

I personally think you and other people should try it out a little longer to get the feeling if you just get the answer you won’t know how to use it.


#12

and to add to Magicfloatingcows comment, if you just copy code for this level you will just be back next level to ask again.

The only “new” thing for this level is using the watch to tell the passage of time and how to do that WAS GIVEN TO YOU, by the default level code. Anything else you need to do could be copied from previous levels. (I know, I know, I just said to copy stuff, but from yourself is OK) :smile:


#13

FAW? I believe you mean FAQ


#14

what is the actual full code for this level??? (any code is fine)


#15

The “actual full code”, as you put it, is not allowed to be given. Do you need help with this level? If so, then give us more information on what you need help with. Your code, formatted properly (read the FAQ before posting). A screenshot of your error, if any.


#16

whats wrong with this the flags are not working
``// Use your new skill to choose what to do: this.now()
loop {
// If it’s the first 10 seconds, fight.
if (this.now() < 10) {
var enemy = this.findNearest(this.findEnemies());
if (enemy) {
if (this.distanceTo(enemy) < 10) {
if (this.isReady(“cleave”)) {
this.cleave(enemy);
} else {
this.attack(enemy);
}
}
}

// Else, if it’s the first 30 seconds, collect coins.
if ((this.now() >= 10) && (this.now() <= 30)) {
var item = this.findNearest(this.findItems());
this.move(item.pos);
}
// After 30 seconds, join the raid!
if (this.now() > 30) {
var flag = this.findFlag();
if (flag) { this.pickUpFlag(flag);}
enemy = this.findNearest(this.findEnemies());
if (enemy) {
if (this.distanceTo(enemy)
< 10 && this.isReady(‘cleave’)) {
this.cleave(enemy);
} else {
this.attack(enemy);
}
}
}
}
}
``

(why isn’t formatting working)


#17

doesn’t matter decided to rewrite code and completed it thnx anyway


#18

I just didn’t follow the directions, but I finished!

if self.now() < 10:
    self.attack(enemy)
    pass
elif self.now() < 60:

#19

code combat is glitched for me it always says its wrong even simple codes like
loop:
enemy = self.findNearestEnemies()
self.attack(enemy)
says that i need to target a unit
it used to work but it does not now:disappointed:


#20

Have you tested if enemy is not null?

self.findNearestEnemies()

will not return an enemy if there is no enemy on the screen. Put an

if(enemy)

before attacking