HOW DO I MAKE IT LOOP!?!

Look up for() loops in the reference, I think it even provides an example in there somewhere.

And to my knowledge, the second part is not correct. :oP

I think what you want to do is just have a loop that repeats every 3000 ticks, and if hunger is already 0 when the loop completes, then kill the player. Otherwise, remove one from the hunger.
You have a lot of replies here. However, I would suggest using an event loop such as Deadron's Event Loop library. The library's event loop would take care of calling the update indefinately. You would update by filling in your base_EventCycle() proc. Plus, you could slow down or speed up every update in the game by changing the speed of the event loop.
In response to ACWraith
a = b sets a's value equal to b's value
a == b checks if a's value is equal to b's value

for() loops infinately, since the condition is alwease true
so does while(1). There are many ways to loop, here are a few
mob/verb/loop
for()
spawn(1) world << "Looped!"

mob/verb/loop2
while(1)
spawn(1) world << "Looped!"

mob/verb/loop3
loop_field:
spawn(1) world << "Looped!"
goto loop_field

To loop a set amount of times, there are many things you can do
mob/verb/loop4(amt as num)
var/a = 0
while(a < num)
world << "Looping for the [a]\st time"
a++ // increase a

mob/verb/loop5(amt as num)
var/a = 0
for(a = 0,a < num,a++)
world << "Looping for the [a]\st time"
a++ // increase a

Etc....

Look up goto, for(), while()

Alathon
In response to Watabou
Watabou wrote:
Can you just right down the complete code FIXED? So we dont flood the entire Forum with MY thingymajiggy?! :D

The only reason this thread is getting floody is that when you have trouble you post "it doesn't work" and you say what the error is, but you don't happen to say which line the error is on. Also, your second post about a missing condition is inexcusable, since once you were told how to fix the first one, you should have been able to fix the second without a problem. Nobody's going to post a complete fix for you.

Inconsistent indentation:
Your code is not indented properly; some lines are in too far or not far enough. This is caused most often by mixing tabs and spaces, which is common if you cut and paste code.

Missing condition:
Usually, this means you put in = instead of == when you wanted to check if two things are equal.

Lummox JR
In response to Lummox JR
mob/var/time = 12

for
time = 1
if(time = 24)
time += 1
world<<"The time is now [time]:00!"
usr.Hunger -= 1
usr.Thirst -= 1
if(usr.Hunger = 0)
usr.Strength -= 2
if(usr.Thirst = 0)
usr.Strength -= 2

loading Chippie Pets.dme
Foods.dm:4:error: missing condition

Chippie Pets.dmb - 1 error, 0 warnings (double-click on an error to jump to it)
In response to Watabou
Well, you've repeated your post, but you obviously haven't paid attention to a word I said.

  • Mark which line has the error; use a comment or something to show which one it is. We can't go by line number because a snippet of code could occur anywhere within a file.
  • I see the error; it's obvious, and I already told you what the most common cause is (as it is in this case) and how to fix it. Refer to my post again for what I said on the "missing condition" error, and then take another look at the line where the error is. (That's the third line in your posted code, which I can only assume is the "line 4" the compiler error speaks of.)

    [EDIT]
    Correction: The fifth line (including the blank one) was the one I was thinking of. The third line is "for", which is also giving you an error because you're completely misusing for(). The correct form is for() (an infinite loop_, for(item in list), or for(init,condition,after-each-iteration).
    [END EDIT]

    If you want help fixing errors, you're actually going to have to read what people post when they tell you what the problem is. At least 3 different people, myself included, have explained the cause of this particular bug. So I say again, it's inexcusable that you still haven't fixed it.

    Lummox JR
In response to Lummox JR
time = 1//THERE!

THERE MR.HAPPY!
In response to Watabou
Watabou wrote:
time = 1//THERE!

THERE MR.HAPPY!

You didn't read what I wrote about your problem with "for", did you? The error may say it's on the line with time=1, but the real problem is on the line before it. The trouble is that you need something besides "for" on a line. You need it to be followed by something in parentheses, and what's in those parentheses will depend on what you're trying to do. This is the condition that goes with the for statement, and because you don't have a condition, you get an error called--appropriately enough--"missing condition".

Lummox JR

In response to Lummox JR
Well, Ok, Can you tell me WHAT THE HECK GOES IN THE For Parenthisis?
In response to Watabou
Watabou wrote:
Well, Ok, Can you tell me WHAT THE HECK GOES IN THE For Parenthisis?

It depends on what, exactly, you want to loop through. If you just want to loop forever, then just put for(). If you want to loop through items in a list, you use for(item in list). And so on.
If you want to loop while a condition is true, then you need to use while() or do-while, as in while(still_running>0).

Lummox JR
Page: 1 2