Difference between revisions of "Drugs (Programming)"

From Hellmoo Wiki Archive
Jump to navigation Jump to search
imported>Marvin
m
imported>Marvin
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
---+++Generic Drug (#276)
Drugs are used to affect some change on the player over time.  In this simplest case this is simply the player ingesting a drug of some sort.  For instance, the speed drug will boost your reflexes and lower your cool for a while.  Drugs can also be used to cause things like diseases, or bleeding, or damn near anything else.


Drugs are used to affect some change on the player over time.  In this simplest case this is simply the player ingesting a drug of some sort.  For instance, the speed drug will boost your reflexes and lower your cool for a while.  Drugs can also be used to cause things like diseases, or bleeding, or damn near anything else.
To get an idea of what is possible, take a look at the output of the command '@leaves $drug':


To get an idea of what is possible, take a look at *@leaves $drug*:
<pre>
   thc (#798)
   thc (#798)
   crank (#5066)
   crank (#5066)
Line 25: Line 23:
   nutrition (#895)
   nutrition (#895)
   caffeine (#2652)
   caffeine (#2652)
</pre>
Drugs are a way for you to affect a players stats or cause some action on
  every heartbeat.
---++++Verbs
*$creature:ingest(OBJ drug, INT doses)* -- add this many doses of the drug to
  the creature's bloodstream
*$drug:onset(user, doses)* -- do whatever needs doing when use first takes the
  drug.  By default this just prints a the drug's .onset_msg to the user, if
  it exists.


*$drug:reup(OBJ drug, INT doses)* -- do whatever needs doing when the user takes
Drugs are a way for you to affect a players stats or cause some action on every heartbeat.
  this many more doses of the drug.  By default this just prints the drug's
  .reup_msg to the user, if it exists.


*$drug:overdose(OBJ user)* -- do whatever needs doing when user overdoses on
== Verbs ==
  this drug.  By default this just prints the drug's .overdose_msg to the user.


*$drug:metabolize(OBJ user)* -- this verb is responsible for removing the drug
*$creature:ingest(OBJ drug, INT doses) -- add this many doses of the drug to the creature's bloodstream
  from the user's bloodstream when his heart beats.  How this happens is
  governed by the properties defined below.  This verb also checks for an
  overdose condition and triggers that.  If the drug is metabolized in part,
  the verb will print the drug's .decay_msg, if it exists.  If the drug is
  completely metabolized, the verb will print the drug's .final_decay_msg, if
  it exists.


*$drug:effect(OBJ user)* -- this is the verb that calls :metabolism on every
*$drug:onset(user, doses) -- do whatever needs doing when use first takes the drugBy default this just prints a the drug's .onset_msg to the user, if it exists.
  heartbeatThis is what you would override to cause the drug to perform
  some action on every heartbeat, like inserting actions into the action
  queue, etc.


---++++Properties
*$drug:reup(OBJ drug, INT doses) -- do whatever needs doing when the user takes this many more doses of the drug.  By default this just prints the drug's .reup_msg to the user, if it exists.


*.onset_msg* -- what's printed to the user when they first take the drug, if
*$drug:overdose(OBJ user) -- do whatever needs doing when user overdoses on this drug.  By default this just prints the drug's .overdose_msg to the user.
  anything


*.reup_msg* -- what's printed to the user when they take more of the drug, if
*$drug:metabolize(OBJ user) -- this verb is responsible for removing the drug from the user's bloodstream when his heart beats.  How this happens is governed by the properties defined below.  This verb also checks for an overdose condition and triggers that.  If the drug is metabolized in part, the verb will print the drug's .decay_msg, if it exists.  If the drug is completely metabolized, the verb will print the drug's .final_decay_msg, if it exists.
  anything


*.decay_msg* -- what's printed when the user partially metabolizes the drug, if
*$drug:effect(OBJ user) -- this is the verb that calls :metabolism on every heartbeat.  This is what you would override to cause the drug to perform some action on every heartbeat, like inserting actions into the action queue, etc.
  anything


*.final_decay_msg* -- what's printed when all of the drug is metabolized, if
== Properties ==
  anything


*.overdose_msg* -- what's printed when the user overdoses on this drug, if
* .onset_msg -- what's printed to the user when they first take the drug, if anything
  anything
* .reup_msg -- what's printed to the user when they take more of the drug, if anything
* .decay_msg -- what's printed when the user partially metabolizes the drug, if anything
* .final_decay_msg -- what's printed when all of the drug is metabolized, if anything
* .overdose_msg -- what's printed when the user overdoses on this drug, if anything


Note that the _msg properties can also be lists of strings.  If so, the
Note that the _msg properties can also be lists of strings.  If so, the drug will pick one of these strings at random when printing the message
drug will pick one of these strings at random when printing the message


*.halflife* -- this is a list {INT chance, INT min, INT max} that determines how
* .halflife -- this is a list {INT chance, INT min, INT max} that determines how the drug gets metabolized.  First, the drug rolls to see if the metabolization happens at all.  This is where 'chance' comes in.  Chance is the percentage chance (0-100) that any of the drug gets metabolized.  If roll succeeds then the drug eliminated between 'min' and 'max' doses from the user's bloodstream, at random.
  the drug gets metabolized.  First, the drug rolls to see if the
  metabolization happens at all.  This is where 'chance' comes in.  Chance is
  the percentage chance (0-100) that any of the drug gets metabolized.  If
  roll succeeds then the drug eliminated between 'min' and 'max' doses from
  the user's bloodstream, at random.


*.overdosage* -- the threshold number of doses that can trigger an overdose
* .overdosage -- the threshold number of doses that can trigger an overdose


*.skill_mods* -- a list of lists, with each sublist containing {OBJ skill, FLOAT
* .skill_mods -- a list of lists, with each sublist containing {OBJ skill, FLOAT modifier}.  For each dose in the user's bloodstream (up to the .overdosage level) this modifier will be added to that skill for the user.  Negative numbers mean a penalty, positive numbers are a bonus.   
  modifier}.  For each dose in the user's bloodstream (up to the .overdosage
  level) this modifier will be added to that skill for the user.  Negative
  numbers mean a penalty, positive numbers are a bonus.  Note that these can
  be fractional, so that if you set it mod to be {skill, 0.25} you will only
  get a +1 when you have four doses (the fractional part is ignored in the
  final comparison).


*.addiction* -- this points to the addiction drug that corresponds to this drug,
Note that these can be fractional, so that if you set it mod to be {skill, 0.25} you will only get a +1 when you have four doses (the fractional part is ignored in the final comparison).
  if the drug is addictive.  See ProgDrugAddiction for more info on that.


-- Main.SpunKy - 02 May 2004
* .addiction -- this points to the addiction drug that corresponds to this drug, if the drug is addictive.  See [[Drug Addiction (Programming)|Drug Addiction]] for more info on that.


[[Category:Needs work]] [[Category:Programming]]
[[Category:Needs work]] [[Category:Programming]]

Latest revision as of 01:06, 3 January 2009

Drugs are used to affect some change on the player over time. In this simplest case this is simply the player ingesting a drug of some sort. For instance, the speed drug will boost your reflexes and lower your cool for a while. Drugs can also be used to cause things like diseases, or bleeding, or damn near anything else.

To get an idea of what is possible, take a look at the output of the command '@leaves $drug':

 thc (#798)
 crank (#5066)
 bleeding (#814)
 healing (#796)
 shock (#646)
 radiation sickness (#1324)
 rot (#1522)
 black lung (#1883)
 ebola (#1813)
 stage I zombie rot (#2511)
 stage II zombie rot (#2282)
 organic tobacco (#1328)
 suffocation (#1042)
 coma (#919)
 thirst (#1065)
 water (#1088)
 curare (#1530)
 alcohol (#1112)
 nutrition (#895)
 caffeine (#2652)

Drugs are a way for you to affect a players stats or cause some action on every heartbeat.

Verbs

  • $creature:ingest(OBJ drug, INT doses) -- add this many doses of the drug to the creature's bloodstream
  • $drug:onset(user, doses) -- do whatever needs doing when use first takes the drug. By default this just prints a the drug's .onset_msg to the user, if it exists.
  • $drug:reup(OBJ drug, INT doses) -- do whatever needs doing when the user takes this many more doses of the drug. By default this just prints the drug's .reup_msg to the user, if it exists.
  • $drug:overdose(OBJ user) -- do whatever needs doing when user overdoses on this drug. By default this just prints the drug's .overdose_msg to the user.
  • $drug:metabolize(OBJ user) -- this verb is responsible for removing the drug from the user's bloodstream when his heart beats. How this happens is governed by the properties defined below. This verb also checks for an overdose condition and triggers that. If the drug is metabolized in part, the verb will print the drug's .decay_msg, if it exists. If the drug is completely metabolized, the verb will print the drug's .final_decay_msg, if it exists.
  • $drug:effect(OBJ user) -- this is the verb that calls :metabolism on every heartbeat. This is what you would override to cause the drug to perform some action on every heartbeat, like inserting actions into the action queue, etc.

Properties

  • .onset_msg -- what's printed to the user when they first take the drug, if anything
  • .reup_msg -- what's printed to the user when they take more of the drug, if anything
  • .decay_msg -- what's printed when the user partially metabolizes the drug, if anything
  • .final_decay_msg -- what's printed when all of the drug is metabolized, if anything
  • .overdose_msg -- what's printed when the user overdoses on this drug, if anything

Note that the _msg properties can also be lists of strings. If so, the drug will pick one of these strings at random when printing the message

  • .halflife -- this is a list {INT chance, INT min, INT max} that determines how the drug gets metabolized. First, the drug rolls to see if the metabolization happens at all. This is where 'chance' comes in. Chance is the percentage chance (0-100) that any of the drug gets metabolized. If roll succeeds then the drug eliminated between 'min' and 'max' doses from the user's bloodstream, at random.
  • .overdosage -- the threshold number of doses that can trigger an overdose
  • .skill_mods -- a list of lists, with each sublist containing {OBJ skill, FLOAT modifier}. For each dose in the user's bloodstream (up to the .overdosage level) this modifier will be added to that skill for the user. Negative numbers mean a penalty, positive numbers are a bonus.

Note that these can be fractional, so that if you set it mod to be {skill, 0.25} you will only get a +1 when you have four doses (the fractional part is ignored in the final comparison).

  • .addiction -- this points to the addiction drug that corresponds to this drug, if the drug is addictive. See Drug Addiction for more info on that.