beer!

darkgoddessnight
06 Oct 2006, 22:51
I still have an endless amount of beer despita all the help I have gotten fromelexxorine. Could someone please tell me why my mug of beer never becomes empty. the barkeeper is starting to complain.

Thanks

define room <town1, inn1, room1>
alias <The Silver Dagger Inn and Tavern: Common Room>
look <The common room is large and comfortable as far as inns go. Tables and chairs are placed here and there in an artistic yet homey fashion. Brightly colored rugs that lay about the oak floor give the place some color. A worn counter has been placed near a dark oak door, behind which stands Gier, a rotund barkeep. A menu has been hung on the wall behind him, allowing customers to choose from a variety of drinks and specialties. A staircase near the back leads up to the second floor and an archway opens to another room. Another door leads to the outside.>

define object <Gier>
alias <Gier>
suffix <the barkeep>
gender <he>
invisible
type <TLTcontainer>
type <TLTcontainer>
type <TLTactor>
end define

define object <counter>
alias <a worn counter>
alt <counter; worn counter>
look <It looks like this counter has been through a lot.>
displaytype <surface>
article <it>
gender <it>
invisible
type <surface>
type <TLTcontainer>
type <TLTcontainer>
properties <listHeader=On the counter you see; listHeader=On the counter you see>
action <look on> exec <examine>
end define

define object <staircase>
alias <staircase>
look <This staircase leads up to the second floor where you assume the inn bedrooms are.>
examine <This staircase leads up to the second floor where you assume the inn bedrooms are.>
invisible
type <TLTobject>
properties <not takeable>
end define

define object <rugs>
alias <rugs>
displaytype <decoration>
article <it>
gender <it>
invisible
type <TLTscenery>
end define

define object <oak door>
alias <a dark oak door>
alt <door; oak door; dark oak door>
displaytype <entrance/exit>
article <it>
gender <it>
invisible
type <door>
type <TLTclosable>
properties <not closed>
action <go> goto <town1, inn1; room 2>
end define

define object <door to the outside>
invisible
type <door>
action <go>
end define

define object <menu>
alias <menu>
invisible
type <TLTscenery>
type <TLTreadable>
properties <readMessage=You read the menu.>
action <read> msg <beer|nwhite wine|nred wine|n|n>
end define

define object <archway>
invisible
end define

define object <beer>
invisible
action <order> {
msg <Grier pours you a mug of beer and sets it on the counter.>
clone <beer1; mug of beer; TLRcontainers>
property <mug of beer; isIn=counter>
set numeric <drinkamount; 10>
}
end define

end define

define room <inn 1, storage room>

define object <beer1>
alias <mug of beer>
alt <beer>
take
displaytype <drink>
article <it>
gender <it>
type <drinkable>
action <drink> {
if ( drinkamount = 0 ) then {
msg <You finish off the last drop and are left holding the empty mug.>
lose <mug of beer>
create object <empty mug; town1, inn1, room1>
give <empty mug>
}
else {
msg <You take a drink of beer from the mug.>
dec <drinkamount; 1>
}
}
end define

end define

paul_one
07 Oct 2006, 08:26
Actually, what it should be is:

at the start of the game:
startscript {
set numeric <drinkamount; 1>
}

And your if should be:
 if ( drinkamount < 1 ) then {
msg <You finish off the last drop and are left holding the empty mug.>
lose <mug of beer>
create object <empty mug; town1, inn1, room1>
give <empty mug>
}
else {
msg <You take a drink of beer from the mug.>
dec <drinkamount; 1>
}


This is the normal coding convention.. So that instead of specifying ONE value that you want a variable to be - find a whole RANGE of values, it shouldn't be...
If you get my drift.

darkgoddessnight
07 Oct 2006, 13:08
I thankyou, the economy thanks you, the bartenders thankyou :)

darkgoddessnight
07 Oct 2006, 16:52
alright, this isn't working exactly how I had planned. You see, since this is a multiplayer game, with several different drink types (none of which are actually in the game yet...except for the beer) there are going to be different drink amounts for different drinks and different players drinking the same type of drink where I would think properties or values would come in as in giving each mug of beer the property of drinkamount=10, but I don't know how to decrement the property, just the numeric variable. Does any of this make sense?

Not that your code didn't work, just when i signed in with a second player all the bartender gave me was a drop because player number 1 drank it all and it wouldn't let me reset the drinkammount.