1
2
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 To loop a set amount of times, there are many things you can do mob/verb/loop4(amt as num) 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.
|
In response to Lummox JR
|
|
time = 1//THERE!
THERE MR.HAPPY! |
In response to Watabou
|
|
Watabou wrote:
time = 1//THERE! 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 |
1
2
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.