Getting drunk

OurJud
This is another one of those silly aesthetics/atmosphere touches that will probably never be used, but I would like to have a bottle of whiskey in my player's apartment that they can drink from whenever they're there. Setting up a script to have them pour a glass when a command is typed is simple enough, but what would be the easiest way to have them get drunk if they repeatedly type the 'drink whiskey' command?

I have a feeling it will involve counters and integers - things I've never used.

jaynabonne
Someone else had a similar request. Check out this thread:

viewtopic.php?f=10&t=4569&p=30030

There is a game file posted by me there at the end of the thread which solves his problem and might either address yours or give some ideas.

OurJud
Thanks, Jay. It's obviously not as simple as I was hoping. Maybe an idea for my next game.

The Pixie
You can use CSS to make the text get progressively more blurred.

http://css-tricks.com/fun-with-blurred-text/

HegemonKhan
in code:

a playable test game for you (let me know if anything doesn't work)

(edited, thanks Pixie for spotting my errors)

<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="testing game stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attr name="alcohol_level" type="int">0</attr>
</object>
<object name="beer_object_1">
<inherit name="editor_object" />
<alias>beer</alias>
<drink type="script">
player.alcohol_level = player.alcohol_level + 10
msg ("You drink some beer, becoming more drunk.")
</drink>
<displayverbs type="simplestringlist">drink</displayverbs>
<inventoryverbs type="simplestringlist">drink</inventoryverbs>
</object>
</object>
<turnscript name="alcohol_level_global_turnscript">
<enabled />
<script><![CDATA[
if (player.alcohol_level = 100) {
msg ("You die of alcohol poisoning.")
msg ("GAME OVER")
finish
} else if (player.alcohol_level < 100 and player.alcohol_level > 50) {
msg ("You're majorly drunk.")
} else if (player.alcohol_level = 50) {
msg ("You're drunk.")
} else if (player.alcohol_level < 50 and player.alcohol_level > 0) {
msg ("You're just buzzed.")
} else if (player.alcohol_level = 0) {
msg ("You're sober.")
} else {
msg ("It's not possible to have a negative alcohol level, nor to have it over 100.")
}
]]></script>
</turnscript>
</asl>

The Pixie
A few comments about your code, HK. Couple of typos: You have a square bracket before an else, and towards the end there is "if else if else". Also, you have a less than symbol, so the whole thing needs wrapping in CDATA tags.

Your conditions can be simplified; at each one you only need to check if the alcohol is greater. Eg, rather than (player.alcohol_level < 50 and player.alcohol_level > 0) just do (player.alcohol_level > 0). You know it has to be less than 50 otherwise it would not get here.

I would suggest having alcohol drop by one each turn, too, so the player slowly sobers up. Here is an alternative:

    <script><![CDATA[
if (player.alcohol_level > 100) {
msg ("You die of alcohol poisoning.")
msg ("GAME OVER")
finish
}
else if (player.alcohol_level > 60) {
msg ("You're majorly drunk.")
}
else if (player.alcohol_level > 30) {
msg ("You're drunk.")
}
else if (player.alcohol_level > 0) {
msg ("You're just buzzed.")
}
else {
msg ("You're sober.")
player.alcohol_level = 0
}
player.alcohol_level = player.alcohol_level - 1
]]></script>

The Pixie
Here is another version that blurs the text as you get drunk. It assumes all your text is black. If you use another colour, just replace "black" with your text colour. If you use multiple colours it will not work so well.
    <script><![CDATA[
if (player.alcohol_level > 100) {
msg ("You die of alcohol poisoning.")
msg ("GAME OVER")
finish
}
else if (player.alcohol_level > 60) {
msg ("You're majorly drunk.")
JS.eval ("$('#divOutput').css('text-shadow', '0 0 2px black,0 0 5px black,0 0 15px black')")
}
else if (player.alcohol_level > 30) {
msg ("You're drunk.")
JS.eval ("$('#divOutput').css('text-shadow', '0 0 2px black,0 0 5px black')")
}
else if (player.alcohol_level > 0) {
JS.eval ("$('#divOutput').css('text-shadow', '0 0 2px black')")
msg ("You're just buzzed.")
}
else {
msg ("You're sober.")
player.alcohol_level = 0
}
player.alcohol_level = player.alcohol_level - 1
]]></script>

OurJud
Thanks, all. I'm going to experiment with the blurring methods :)

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums