ID:148841
 
if there is anything wrong....
turf/bedleft
icon = 'bedl.dmi'

density=0
Entered(mob/M as mob)
M.icon_state = "sleep"
M<<sound("inn.wav")
bedloop
if(M.hp <= M.maxhp)
M<<"ZzZ...."
M.hp + 10
M.mp + 8
sleep(50)
goto bedloop
else
M<<"ZzZ...."
sleep(50)
goto bedloop

Exited(mob/M as mob)
M.icon_state = ""
Is something supposed to be wrong? If so, WHAT IS IT?
Erdrickthegreat2 wrote:
if there is anything wrong....

That's what you're supposed to tell us. What don't you like about the results of this code? Without knowing that, how can we possibly fix it?

That said, I do have a suggestion for improving the Entered() proc:
turf/bedleft/Entered(mob/M as mob)
M.icon_state = "sleep"
M<<sound("inn.wav")
while (M.loc == src)
if(M.hp <= M.maxhp)
M.hp += 10
M.mp += 8
sleep(50)
M<<"ZzZ...."

This is cleaner and may work better, too. Oh, and it'll compile.
In response to Air Mapster
turf/bedleft
icon = 'bedl.dmi'

density=0
Entered(mob/M as mob)
M.icon_state = "sleep"
M<<sound("inn.wav")
while(M.loc == src)
if(M.hp <= M.maxhp)
M<<"ZzZ...."
M.hp + 10
M.mp + 8
sleep(50)

else
M<<"ZzZ...."
sleep(50)


Exited(mob/M as mob)
M.icon_state = ""




So like this?
The problem was the lag from the loop
In response to Erdrickthegreat2
Maybe he had 'bedbugs' ?

:)
In response to digitalmouse
digitalmouse wrote:
Maybe he had 'bedbugs' ?

:)

ARGG DISEASED! Muhhaha my bedbugs are working wonders! I WILL TAKE OVER THE WORLD... maybe
In response to digitalmouse
Clever.
In response to Erdrickthegreat2
looks a little bit like dwl..
In response to Air Mapster
Air Mapster wrote:

if(M.hp <= M.maxhp)
M.hp += 10
M.mp += 8

Also, this isnt a code problem, but there is a common mistake I noticed in a lot of games.
If M.maxhp = 100, and M.hp = 98, at the end of that your going to have 108 hp.
So you'll probably want to add something like a if(M.hp > M.maxhp) M.hp = M.maxhp.
And the same with the MP part too. Although from the look of this MP doesnt have a max.
-DogMan
In response to digitalmouse
digitalmouse wrote:
Maybe he had 'bedbugs' ?

:)

I used to respect you, but after a joke like that, you are my new god.
-DogMan
In response to Dog Man
Dog Man wrote:
Air Mapster wrote:

if(M.hp <= M.maxhp)
M.hp += 10
M.mp += 8

Also, this isnt a code problem, but there is a common mistake I noticed in a lot of games.
If M.maxhp = 100, and M.hp = 98, at the end of that your going to have 108 hp.
So you'll probably want to add something like a if(M.hp > M.maxhp) M.hp = M.maxhp.
And the same with the MP part too. Although from the look of this MP doesnt have a max.

Actually his code is flawed on a few levels. MP probably does have a max, but it's only going up if HP is deemed able to go up.
The most common solution I see is to add extra lines like this:
M.hp += 10
if(M.hp > M.maxhp) M.hp = M.maxhp
M.mp += 8
if(M.mp > M.maxmp) M.mp = M.maxmp

But while this will work, it's bad form. A better form is to do this:
M.hp = min(M.hp+10, M.maxhp)
M.mp = min(M.mp+8, M.maxmp)

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Dog Man wrote:
Air Mapster wrote:

if(M.hp <= M.maxhp)
M.hp += 10
M.mp += 8

Also, this isnt a code problem, but there is a common mistake I noticed in a lot of games.
If M.maxhp = 100, and M.hp = 98, at the end of that your going to have 108 hp.
So you'll probably want to add something like a if(M.hp > M.maxhp) M.hp = M.maxhp.
And the same with the MP part too. Although from the look of this MP doesnt have a max.

Actually his code is flawed on a few levels. MP probably does have a max, but it's only going up if HP is deemed able to go up.
The most common solution I see is to add extra lines like this:
M.hp += 10
> if(M.hp > M.maxhp) M.hp = M.maxhp
> M.mp += 8
> if(M.mp > M.maxmp) M.mp = M.maxmp

But while this will work, it's bad form. A better form is to do this:
M.hp = min(M.hp+10, M.maxhp)
> M.mp = min(M.mp+8, M.maxmp)

Lummox JR

Lummox, your the most efficient guy I know. Im surprized you dont talk in some sort of system where numbers replace words or something...
You should write a tutorial on efficient ways to do things.
-DogMan
In response to Dog Man
If he was really efficient, he would replace words such as "you" and "are" with "u" and "r".
In response to WizDragon
His efficient, not annoying.
-DogMan
In response to Dog Man
While it is definitely annoying, it is still saving a very small amount of forum space when you use shorthand words such as those.
In response to WizDragon
WizDragon wrote:
While it is definitely annoying, it is still saving a very small amount of forum space when you use shorthand words such as those.

Definitely not a price I'm willing to pay to save Dantom 6 bytes a post.

Lummox JR
In response to Dog Man
Dog Man wrote:
I used to respect you, but after a joke like that, you
are my new god.

Save the grovelling until after I figure out how to get this hosting server working...
In response to digitalmouse
Hey, I was serious... Well maybe not but it didnt have anything to do with HrH (Im guessing thats the hosting server you where talking about)
-DogMan
On a side note I once worshiped a 'Magic Golf Tee' for a month. I threw it out a car window for some reason in one part of the city, then about 2 months later I found it in a completely differnt section of the city. And it was the same tee, theres no doubt about it.