Axe Software Forums
  Quest Developer Forum
  How do you eat?


Author Topic:   How do you eat?
Cheeselord posted 01-10-2001 05:02 GMT     
How do I make an object umm... edible? Because in every mud it seems like you ahve to eat to stay alive, and this one is based on Cheese!
MaDbRiT posted 01-10-2001 09:10 GMT          
quote:
How do I make an object umm... edible?

You need to set up what is called a 'daemon' if your player needs to eat (or sleep or whatever) to stay alive.

My 'manual coding' tutorial for Quest 2.0 covers how to do this, and although there is a better way in Quest 3.0 - the Q2 version will still work.

If I get a chance I will code a quick demo of an 'eat daemon' in Quest 3.0 and post it here later.

Al

MaDbRiT posted 01-10-2001 11:51 GMT          
Well there are any number of ways to do an 'eat' daemon & eat routines in Quest 3.0 - I've chosen to do it by using an 'eat' action in those things I want edible and strength reviving.

The following can be cut, pasted and run as a quest game :-)

quote:

define game <Eat daemon Demo>
asl-version <300>
game version <0.1a>
game author <MaDbRiT a.k.a. Al Bampton>
game copyright <� 2001>
game info <This is a demo, nothing more>
start <startroom>
startscript do <SetupProc>
afterturn set <strength;%strength% - 10>

define variable <strength>
type numeric
value <100>
display <!%% Strength>
onchange if (%strength% <=0) then {
msg <|n|n|crYou have starved to death...|n|n|cb>
playerlose
}
end define

command <eat #object#> {
if action <#object#;eat>) then {
if got <#object#> then {
doaction <#object#;eat>
}
else msg <You dont have the #object#.>
}
else msg <You can't eat that.>
}

end define

define room <startroom>
look <This looks like a room ideal for starting an adventure from.>
prefix <the>

define object <cheese>
look <Stilton - your favourite!>
prefix <a piece of>
action <eat> {
msg <Yummy - that was good (you feel much better too.)>
set <strength;110>
hide <cheese>
}
take <>
end define

define object <hat>
look <a black trilby>
prefix <a trilby>
take <>
end define

end define

define procedure <SetupProc>
set numeric <hunger;0>
end define

define text <intro>
This 'game' is a demo of making an 'eat daemon' in Quest 3.0
end define

define text <win>
GAME OVER you have WON!
end define

define text <lose>
GAME OVER you lose.
end define


Hope that helps

Al

Cheeselord posted 01-10-2001 15:09 GMT          
Ooooh, that does help :) But, how would I make it so that every time you eat your strength goes up by 20 points, for example. Because in your example it seems that I'd have to assume what they had before they ate.
MaDbRiT posted 01-10-2001 19:22 GMT          
In my example eating just returns the player to 100% strength, to give him just a 20% 'boost' to his strength, you change the cheese object currently defined like so:-

quote:

define object <cheese>
look <Stilton - your favourite!>
prefix <a piece of>
action <eat> {
msg <Yummy - that was good (you feel much better too.)>
set <strength;110>
hide <cheese>
}
take <>
end define

to become :-

quote:

define object <cheese>
look <Stilton - your favourite!>
prefix <a piece of>
action <eat> {
msg <Yummy - that was good (you feel much better too.)>
set <strength;%strength% +30>
hide <cheese>
}
take <>
end define

Just the one line changed - that's all there is to it.

Al