view release on metacpan or search on metacpan
window. Added a black border to make them visible
- Fixed several issues with automapper tracking, which keeps the current room
in the visible portion of the map
- When moving around a map in 'connect offline' mode, Axmud displays room
titles/descriptions. For some worlds, the description was displayed twice;
this will no longer happen
- Users are now prompted for confirmation before deleting a single room
Major new features
- Axmud now supports the CHARSET and NEW-ENVIRON protocols, IAC GA control
sequences and TCP keep alive packets
- If you want Axmud to store its data files in a different location (for
example, on an external hard drive, on a USB stick or on a network drive),
you can now do so without editing the Axmud source code. In Axmud's
installation directory (folder) there's an empty file called 'datadir.cfg'.
You can edit that file to specify a path to a directory, e.g.
'F:\mydata\axmud' or '/home/myname/data/axmud'. Alternatively, you can use
the new ';setdatadirectory' and ';listdatadirectory' commands. Restart Axmud
to apply the changes
- Axmud could already auto-detect weblinks like 'http://deathmud.com', and make
them clickable. It can now detect shorter weblinks like 'deathmud.com'.
share/help/axbasic/func/getexitdest
share/help/axbasic/func/getexitdrawn_
share/help/axbasic/func/getexitnum
share/help/axbasic/func/getexitstatus_
share/help/axbasic/func/getexittwin
share/help/axbasic/func/getexittype_
share/help/axbasic/func/getlight_
share/help/axbasic/func/getlostroom
share/help/axbasic/func/getmapmode_
share/help/axbasic/func/getobject_
share/help/axbasic/func/getobjectalive
share/help/axbasic/func/getobjectcount
share/help/axbasic/func/getobjectnoun_
share/help/axbasic/func/getobjecttype_
share/help/axbasic/func/getornament_
share/help/axbasic/func/getrandomexit_
share/help/axbasic/func/getregion_
share/help/axbasic/func/getregionnum
share/help/axbasic/func/getroomdescrip_
share/help/axbasic/func/getroomexits
share/help/axbasic/func/getroomguild_
share/help/axbasic/keyword/speak
share/help/axbasic/keyword/speed
share/help/axbasic/keyword/stop
share/help/axbasic/keyword/sub
share/help/axbasic/keyword/titlewin
share/help/axbasic/keyword/unflashwin
share/help/axbasic/keyword/unshift
share/help/axbasic/keyword/until
share/help/axbasic/keyword/waitactive
share/help/axbasic/keyword/waitalias
share/help/axbasic/keyword/waitalive
share/help/axbasic/keyword/waitarrive
share/help/axbasic/keyword/waitdead
share/help/axbasic/keyword/waitep
share/help/axbasic/keyword/waitgp
share/help/axbasic/keyword/waithook
share/help/axbasic/keyword/waithp
share/help/axbasic/keyword/waitmacro
share/help/axbasic/keyword/waitmp
share/help/axbasic/keyword/waitnextxp
share/help/axbasic/keyword/waitnotactive
lib/Games/Axmud/Cmd.pm view on Meta::CPAN
if (! $session->statusTask || ! $session->currentChar) {
return $self->error(
$session, $inputString,
'This command can only be used when the Status task is running and when there\'s'
. ' a current character profile',
);
}
if ($status eq '-a' || $status eq 'alive') {
$session->currentChar->ivPoke('lifeStatus', 'alive');
} elsif ($status eq '-s' || $status eq 'sleep') {
$session->currentChar->ivPoke('lifeStatus', 'sleep');
} elsif ($status eq '-p' || $status eq 'passout') {
$session->currentChar->ivPoke('lifeStatus', 'passout');
} elsif ($status eq '-d' || $status eq 'dead') {
$session->currentChar->ivPoke('lifeStatus', 'dead');
} else {
return $self->error(
$session, $inputString,
'Invalid life status (try -a -s -p -d / alive sleep passout dead)',
);
}
# Tell the Status task that its task window must be updated with a new background colour
$session->statusTask->set_lifeStatusChangeFlag();
# Operation complete
return $self->complete(
$session, $standardCmd,
'Current character\'s life status set to \'' . $session->currentChar->lifeStatus
lib/Games/Axmud/EditWin.pm view on Meta::CPAN
# Sensitise the second entry
$entry2->set_sensitive(TRUE);
}
});
}
# Right column
$self->addCheckButton($grid, 'Concrete (not abstract) object', 'concreteFlag', FALSE,
7, 12, 1, 2);
$self->addCheckButton($grid, 'Alive', 'aliveFlag', FALSE,
7, 12, 2, 3);
$self->addCheckButton($grid, 'Sentient', 'sentientFlag', FALSE,
7, 12, 3, 4);
$self->addCheckButton($grid, 'Portable (can be carried)', 'portableFlag', FALSE,
7, 12, 4, 5);
$self->addCheckButton($grid, 'Saleable (can be sold)', 'saleableFlag', FALSE,
7, 12, 5, 6);
# Tab complete
return 1;
lib/Games/Axmud/EditWin.pm view on Meta::CPAN
$self->addLabel($grid, 'Times killed',
7, 9, 2, 3);
$self->addEntryWithIcon($grid, 'deathCount', 'int', 0, undef,
9, 12, 2, 3);
$self->addLabel($grid, 'Max lives',
7, 9, 3, 4);
$self->addEntryWithIcon($grid, 'lifeMax', 'int', 0, undef,
9, 12, 3, 4);
$self->addLabel($grid, 'Life status',
7, 9, 4, 5);
@comboList = ('alive', 'sleep', 'passout', 'dead');
$self->addComboBox($grid, 'lifeStatus', \@comboList, '',
TRUE, # No 'undef' value used
9, 12, 4, 5);
$self->addLabel($grid, 'Alignment',
7, 9, 5, 6);
$self->addEntryWithButton($grid, 'alignment', TRUE,
9, 12, 5, 6);
# Bottom section
$self->addLabel($grid, '<b>Character nickname</b>',
lib/Games/Axmud/EditWin.pm view on Meta::CPAN
# (Import a list of standard colour tags, putting bold colours first)
@comboList = ($axmud::CLIENT->constColourTagList, $axmud::CLIENT->constBoldColourTagList);
# Background colour parameters
$self->addLabel($grid, '<b>Background colour parameters</b>',
0, 12, 0, 1);
$self->addCheckButton($grid, 'Allow background colour changes', 'allowColourFlag', TRUE,
1, 6, 1, 2);
$self->addLabel($grid, 'Character alive',
1, 3, 2, 3);
$self->addComboBox($grid, 'aliveColour', \@comboList, '',
TRUE, # No 'undef' value used
3, 6, 2, 3);
$self->addLabel($grid, 'Alive, health below 50%',
1, 3, 3, 4);
$self->addComboBox($grid, 'alive50Colour', \@comboList, '',
TRUE, # No 'undef' value used
3, 6, 3, 4);
$self->addLabel($grid, 'Alive, health below 30%',
1, 3, 4, 5);
$self->addComboBox($grid, 'alive30Colour', \@comboList, '',
TRUE, # No 'undef' value used
3, 6, 4, 5);
$self->addLabel($grid, 'Alive, health below 10%',
1, 3, 5, 6);
$self->addComboBox($grid, 'alive10Colour', \@comboList, '',
TRUE, # No 'undef' value used
3, 6, 5, 6);
# (right column)
$self->addLabel($grid, 'Character asleep',
7, 9, 2, 3);
$self->addComboBox($grid, 'asleepColour', \@comboList, '',
TRUE, # No 'undef' value used
9, 12, 2, 3);
$self->addLabel($grid, 'Character passed out',
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$session, $standardCmd,
'Cannot kill - current location is empty',
);
} else {
# Choose the first minion, sentient or creature in @objList
OUTER: foreach my $obj (@objList) {
if (
$obj->aliveFlag
&& (
($obj->category eq 'minion' && ! $obj->ownMinionFlag)
|| $obj->category eq 'sentient'
|| $obj->category eq 'creature'
)
) {
push (@targetList, $obj->noun);
last OUTER;
}
}
lib/Games/Axmud/Generic.pm view on Meta::CPAN
return $self->complete(
$session, $standardCmd,
'Cannot kill - current location is empty',
);
} else {
foreach my $obj (@objList) {
if (
$obj->aliveFlag
&& (
($playerFlag && $obj->category eq 'char')
|| ($obj->category eq 'minion' && ! $obj->ownMinionFlag)
|| $obj->category eq 'sentient'
|| $obj->category eq 'creature'
)
) {
push (@targetList, $obj->noun);
}
}
lib/Games/Axmud/Generic.pm view on Meta::CPAN
$session, $standardCmd,
'Cannot interact - current location is empty',
);
} else {
# Choose the first minion, sentient or creature in @objList
OUTER: foreach my $obj (@objList) {
if (
$obj->aliveFlag
&& (
($obj->category eq 'minion' && ! $obj->ownMinionFlag)
|| $obj->category eq 'sentient'
|| $obj->category eq 'creature'
)
) {
push (@targetList, $obj->noun);
last OUTER;
}
}
lib/Games/Axmud/Generic.pm view on Meta::CPAN
return $self->complete(
$session, $standardCmd,
'Cannot kill - current location is empty',
);
} else {
foreach my $obj (@objList) {
if (
$obj->aliveFlag
&& (
($playerFlag && $obj->category eq 'char')
|| ($obj->category eq 'minion' && ! $obj->ownMinionFlag)
|| $obj->category eq 'sentient'
|| $obj->category eq 'creature'
)
) {
push (@targetList, $obj->noun);
}
}
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# $childHash{number} = 'undef'
childHash => {},
# These variables are the same for each kind of object (the same for all weapons, the
# same for all decorations, etc)
# Flag set to FALSE if this object is an abstract concept ('region' and 'room', possibly
# 'custom'), TRUE if this object is a concrete thing (everything else, possibly
# including 'custom')
concreteFlag => FALSE,
# Flag set to TRUE if this object is alive, FALSE if not
aliveFlag => FALSE,
# Flag set to TRUE if this object is sentient (capable of speech, in theory), FALSE if
# not
sentientFlag => FALSE,
# Flag set to TRUE if the object can be carried (in theory), FALSE if not
portableFlag => FALSE,
# Flag set to TRUE if the object can be bought and sold (in theory), FALSE if not
saleableFlag => FALSE,
# Private properties for this object, in a customisable hash
privateHash => {},
lib/Games/Axmud/Generic.pm view on Meta::CPAN
# Group 3 IVs ('character', 'minion', 'sentient', 'creature' and optionally 'custom')
# -----------------------------------------------------------------------------------
# (Group 3 IVs are for available for use in any code you write to handle attacks)
if (
$category eq 'character' || $category eq 'minion' || $category eq 'sentient'
|| $category eq 'creature' || $category eq 'custom'
) {
# The current status of the fight with this object:
# 'waiting' - the fight hasn't started yet (but will soon)
# 'alive' - the target is alive
# 'kill' - the target is dead
# 'flee' - the target has run away in a direction that can be followed
# 'escape' - the target has run away, and can't be pursued for some reason
# The current status of the interaction with this object:
# 'waiting' - the interaction hasn't started yet (but will soon)
# 'interact' - the target is interacting (and alive)
# 'finish' - the interaction has finished
# 'flee' - the target has run away in a direction that can be followed
# 'escape' - the target has run away, and can't be pursued for some reason
$self->{targetStatus} = undef;
# What kind of attack this attack: 'fight' for a fight, and 'interaction' for an
# interaction
$self->{targetType} = undef;
# For targets who move after a fight starts. The path from the original location to the
# target's presumed current location, e.g. 'n;nw;w'
$self->{targetPath} = undef;
lib/Games/Axmud/Generic.pm view on Meta::CPAN
{ $_[0]->{modelFlag} }
sub number
{ $_[0]->{number} }
sub parent
{ $_[0]->{parent} }
sub childHash
{ my $self = shift; return %{$self->{childHash}}; }
sub concreteFlag
{ $_[0]->{concreteFlag} }
sub aliveFlag
{ $_[0]->{aliveFlag} }
sub sentientFlag
{ $_[0]->{sentientFlag} }
sub portableFlag
{ $_[0]->{portableFlag} }
sub saleableFlag
{ $_[0]->{saleableFlag} }
sub privateHash
{ my $self = shift; return %{$self->{privateHash}}; }
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
$self->{_objName} = $name;
$self->{_objClass} = $class;
$self->{_parentFile} = $parentFile; # May be 'undef'
$self->{_parentWorld} = $parentProf; # May be 'undef'
$self->{_privFlag} = FALSE, # All IVs are public
# Set group 1 IVs
$self->{parent} = $parentRegion;
$self->{childHash} = {};
$self->{concreteFlag} = FALSE;
$self->{aliveFlag} = FALSE;
$self->{sentientFlag} = FALSE;
$self->{portableFlag} = FALSE;
$self->{saleableFlag} = FALSE;
$self->{privateHash} = {};
# No group 2 IVs for regions
# No group 3 IVs for regions
# No group 4 IVs for regions
# Set group 5 IVs
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
# Set group 1 IVs
$self->{name} = 'room';
$self->{category} = 'room';
$self->{modelFlag} = FALSE;
$self->{number} = undef;
$self->{parent} = $parentRegion;
$self->{childHash} = {};
$self->{concreteFlag} = FALSE;
$self->{aliveFlag} = FALSE;
$self->{sentientFlag} = FALSE;
$self->{portableFlag} = FALSE;
$self->{saleableFlag} = FALSE;
$self->{privateHash} = {};
$self->{sourceCodePath} = undef;
$self->{notesList} = [];
# No group 2 IVs for rooms
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
# Deal with universal IVs
foreach my $iv ( qw (_objName _objClass _privFlag) ) {
delete $self->{$iv};
}
# Deal with flag scalars which are FALSE by default
foreach my $iv (
qw (
concreteFlag aliveFlag sentientFlag portableFlag saleableFlag unspecifiedFlag
currentlyDarkFlag exclusiveFlag
)
) {
if (exists $self->{$iv} && ! $self->{$iv}) {
delete $self->{$iv};
}
}
# Deal with non-flag scalars which are undefined by default
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
if ( ! exists $self->{childHash} )
{ return %{$axmud::DEFAULT_ROOM->{childHash}}; }
else
{ return %{$self->{childHash}}; }
}
sub concreteFlag {
if ( ! exists $_[0]->{concreteFlag} )
{ $axmud::DEFAULT_ROOM->{concreteFlag} } else { $_[0]->{concreteFlag} }
}
sub aliveFlag {
if ( ! exists $_[0]->{aliveFlag} )
{ $axmud::DEFAULT_ROOM->{aliveFlag} } else { $_[0]->{aliveFlag} }
}
sub sentientFlag {
if ( ! exists $_[0]->{sentientFlag} )
{ $axmud::DEFAULT_ROOM->{sentientFlag} } else { $_[0]->{sentientFlag} }
}
sub portableFlag {
if ( ! exists $_[0]->{portableFlag} )
{ $axmud::DEFAULT_ROOM->{portableFlag} } else { $_[0]->{portableFlag} }
}
sub saleableFlag {
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
$self->{_objName} = $name;
$self->{_objClass} = $class;
$self->{_parentFile} = $parentFile; # May be 'undef'
$self->{_parentWorld} = $parentProf; # May be 'undef'
$self->{_privFlag} = FALSE, # All IVs are public
# Set group 1 IVs
$self->{parent} = $parent;
$self->{childHash} = {};
$self->{concreteFlag} = TRUE;
$self->{aliveFlag} = FALSE;
$self->{sentientFlag} = FALSE;
$self->{portableFlag} = TRUE;
$self->{saleableFlag} = TRUE;
$self->{privateHash} = {};
# Set group 2 IVs (but leave other IVs set to their default values)
$self->{noun} = $name;
# No group 3 IVs for weapons
# Set group 4 IVs (but leave other IVs set to their default values)
$self->{explicitFlag} = TRUE;
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
$self->{_objName} = $name;
$self->{_objClass} = $class;
$self->{_parentFile} = $parentFile; # May be 'undef'
$self->{_parentWorld} = $parentProf; # May be 'undef'
$self->{_privFlag} = FALSE, # All IVs are public
# Set group 1 IVs
$self->{parent} = $parent;
$self->{childHash} = {};
$self->{concreteFlag} = TRUE;
$self->{aliveFlag} = FALSE;
$self->{sentientFlag} = FALSE;
$self->{portableFlag} = TRUE;
$self->{saleableFlag} = TRUE;
$self->{privateHash} = {};
# Set group 2 IVs (but leave other IVs set to their default values)
$self->{noun} = $name;
# No group 3 IVs for armours
# Set group 4 IVs (but leave other IVs set to their default values)
$self->{explicitFlag} = TRUE;
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
$self->{_objName} = $name;
$self->{_objClass} = $class;
$self->{_parentFile} = $parentFile; # May be 'undef'
$self->{_parentWorld} = $parentProf; # May be 'undef'
$self->{_privFlag} = FALSE, # All IVs are public
# Set group 1 IVs
$self->{parent} = $parent;
$self->{childHash} = {};
$self->{concreteFlag} = TRUE;
$self->{aliveFlag} = FALSE;
$self->{sentientFlag} = FALSE;
$self->{portableFlag} = TRUE;
$self->{saleableFlag} = TRUE;
$self->{privateHash} = {};
# Set group 2 IVs (but leave other IVs set to their default values)
$self->{noun} = $name;
# No group 3 IVs for garments
# Set group 4 IVs (but leave other IVs set to their default values)
$self->{explicitFlag} = TRUE;
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
$self->{_objName} = $name;
$self->{_objClass} = $class;
$self->{_parentFile} = $parentFile; # May be 'undef'
$self->{_parentWorld} = $parentProf; # May be 'undef'
$self->{_privFlag} = FALSE, # All IVs are public
# Set group 1 IVs
$self->{parent} = $parent;
$self->{childHash} = {};
$self->{concreteFlag} = TRUE;
$self->{aliveFlag} = TRUE;
$self->{sentientFlag} = TRUE;
$self->{portableFlag} = FALSE;
$self->{saleableFlag} = FALSE;
$self->{privateHash} = {};
# Set group 2 IVs (but leave other IVs set to their default values)
$self->{noun} = $name;
# Group 3 IVs - use default values
# No group 4 IVs for characters
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
$self->{_objName} = $name;
$self->{_objClass} = $class;
$self->{_parentFile} = $parentFile; # May be 'undef'
$self->{_parentWorld} = $parentProf; # May be 'undef'
$self->{_privFlag} = FALSE, # All IVs are public
# Set group 1 IVs
$self->{parent} = $parent;
$self->{childHash} = {};
$self->{concreteFlag} = TRUE;
$self->{aliveFlag} = TRUE;
$self->{sentientFlag} = TRUE; # Minions are made sentient by default
$self->{portableFlag} = FALSE;
$self->{saleableFlag} = FALSE;
$self->{privateHash} = {};
# Set group 2 IVs (but leave other IVs set to their default values)
$self->{noun} = $name;
# Group 3 IVs - use default values
# No group 4 IVs for minions
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
$self->{_objName} = $name;
$self->{_objClass} = $class;
$self->{_parentFile} = $parentFile; # May be 'undef'
$self->{_parentWorld} = $parentProf; # May be 'undef'
$self->{_privFlag} = FALSE, # All IVs are public
# Set group 1 IVs
$self->{parent} = $parent;
$self->{childHash} = {};
$self->{concreteFlag} = TRUE;
$self->{aliveFlag} = TRUE;
$self->{sentientFlag} = TRUE;
$self->{portableFlag} = FALSE;
$self->{saleableFlag} = FALSE;
$self->{privateHash} = {};
# Set group 2 IVs (but leave other IVs set to their default values)
$self->{noun} = $name;
# Group 3 IVs - use default values
# No group 4 IVs for sentients
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
$self->{_objName} = $name;
$self->{_objClass} = $class;
$self->{_parentFile} = $parentFile; # May be 'undef'
$self->{_parentWorld} = $parentProf; # May be 'undef'
$self->{_privFlag} = FALSE, # All IVs are public
# Set group 1 IVs
$self->{parent} = $parent;
$self->{childHash} = {};
$self->{concreteFlag} = TRUE;
$self->{aliveFlag} = TRUE;
$self->{sentientFlag} = FALSE;
$self->{portableFlag} = FALSE;
$self->{saleableFlag} = FALSE;
$self->{privateHash} = {};
# Set group 2 IVs (but leave other IVs set to their default values)
$self->{noun} = $name;
# Group 3 IVs - use default values
# No group 4 IVs for creatures
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
$self->{_objName} = $name;
$self->{_objClass} = $class;
$self->{_parentFile} = $parentFile; # May be 'undef'
$self->{_parentWorld} = $parentProf; # May be 'undef'
$self->{_privFlag} = FALSE, # All IVs are public
# Set group 1 IVs
$self->{parent} = $parent;
$self->{childHash} = {};
$self->{concreteFlag} = TRUE;
$self->{aliveFlag} = FALSE;
$self->{sentientFlag} = FALSE;
$self->{portableFlag} = TRUE;
$self->{saleableFlag} = TRUE;
$self->{privateHash} = {};
# Set group 2 IVs (but leave other IVs set to their default values)
$self->{noun} = $name;
# No group 3 IVs for portables
# Set group 4 IVs (but leave other IVs set to their default values)
$self->{explicitFlag} = TRUE;
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
$self->{_objName} = $name;
$self->{_objClass} = $class;
$self->{_parentFile} = $parentFile; # May be 'undef'
$self->{_parentWorld} = $parentProf; # May be 'undef'
$self->{_privFlag} = FALSE, # All IVs are public
# Set group 1 IVs
$self->{parent} = $parent;
$self->{childHash} = {};
$self->{concreteFlag} = TRUE;
$self->{aliveFlag} = FALSE;
$self->{sentientFlag} = FALSE;
$self->{portableFlag} = FALSE;
$self->{saleableFlag} = FALSE;
$self->{privateHash} = {};
# Set group 2 IVs (but leave other IVs set to their default values)
$self->{noun} = $name;
# No group 3 IVs for decorations
# Set group 4 IVs (but leave other IVs set to their default values)
$self->{explicitFlag} = FALSE;
lib/Games/Axmud/ModelObj.pm view on Meta::CPAN
$self->{_objName} = $name;
$self->{_objClass} = $class;
$self->{_parentFile} = $parentFile; # May be 'undef'
$self->{_parentWorld} = $parentProf; # May be 'undef'
$self->{_privFlag} = FALSE, # All IVs are public
# Set group 1 IVs (most should be set separately for each instance of this object)
$self->{parent} = $parent;
$self->{childHash} = {};
# $self->{concreteFlag} = FALSE;
# $self->{aliveFlag} = FALSE;
# $self->{sentientFlag} = FALSE;
# $self->{portableFlag} = FALSE;
# $self->{saleableFlag} = FALSE;
# $self->{privateHash} = {};
# Group 2 IVs - use default values
# No group 3 IVs for custom model objects
# Group 4 IVs - use default values
# No group 5 IVs for custom model objects
lib/Games/Axmud/Obj/Mission.pm view on Meta::CPAN
sub statusTaskChange {
# Called by GA::Task::Status->deadSeen, ->passedOutSeen or ->asleepSeen when the character
# dies, passes out or falls asleep
# Terminates the current mission
#
# Expected arguments
# $session - The calling function's GA::Session
# $status - The Status task's new ->lifeStatus IV: 'sleep', 'passout' or
# 'dead' (if it's 'alive', this function does nothing)
#
# Return values
# 'undef' on improper arguments
# 1 otherwise
my ($self, $session, $status, $check) = @_;
# Local variables
my $comment;
# Check for improper arguments
if (
! defined $session || ! defined $status
|| (
$status ne 'alive' && $status ne 'sleep' && $status ne 'passout'
&& $status ne 'dead'
) || defined $check
) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->statusTaskChange', @_);
}
if ($status eq 'alive') {
# Do nothing
return 1;
} else {
$comment = 'Mission terminated because character has ';
if ($status eq 'sleep') {
$comment .= 'fallen asleep';
} elsif ($status eq 'passout') {
lib/Games/Axmud/Obj/Telnet.pm view on Meta::CPAN
# - Added new function ->_disable_mccp, called by ->_fillbuf
# - Added new function ->axmud_session, called by ->new
# - In ->new, commented out automatic handling of TELOPT_ECHO and TELOPT_SGA, which are now
# handled by Axmud itself
# - Added some new constants to @EXPORT_OK and %Axmud_Telopts describing various MUD protocols,
# and modified ->_log_option to use them
# - Modified ->localfamily, ->_parse_family and ->_parse_localfamily to cope with the error seen
# on Debian/Ubuntu:
# 'WARNING: Argument "2.020_03" isn't numeric in numeric ge (>=)'
# - Commented out $VERSION as it causes Kwalitee errors
# - Modified ->open to enable TCP keepalive packets on all connections
# - Modified ->_interpret_tcmd so it doesn't gobble up IAC GA
{ package Games::Axmud::Obj::Telnet;
use strict;
use warnings;
# use diagnostics;
## Module export.
use vars qw(@EXPORT_OK);
lib/Games/Axmud/Obj/Telnet.pm view on Meta::CPAN
"flags" => 0 });
die "unknown local host: $localhost: $err\n"
if $err or !@ai;
$local_addr = $ai[0]{addr};
}
bind $self, $local_addr
or die "problem binding to \"$localhost\": $!\n";
}
## Enable keepalive packets
setsockopt($self, SOL_SOCKET, SO_KEEPALIVE, 1);
## Open connection to server.
connect $self, $remote_addr
or die "problem connecting to \"$host\", port $port: $!\n";
};
alarm 0;
## Check for error.
if ($@ =~ /^timed-out$/) { # time out failure
lib/Games/Axmud/Obj/WorldModel.pm view on Meta::CPAN
# Again, nothing we can do
return undef;
}
# Count the number of living and non-living things in the Locator task's room
$livingCount = 0;
$nonLivingCount = 0;
foreach my $obj ($session->locatorTask->roomObj->tempObjList) {
if ($obj->aliveFlag) {
$livingCount++;
} else {
$nonLivingCount++;
}
}
# Now, if the count is 0, we remove an entry from the hash IV (if it exists); otherwise we
# add an entry (or replace the existing one)
if ($livingCount) {
$regionmapObj->storeLivingCount($modelRoomObj->number, $livingCount);
lib/Games/Axmud/Profile.pm view on Meta::CPAN
# commands per fraction of a second)
# If this variable is set, commands are counted as they are sent. When the maximum is
# reached, further commands are stored temporarily. If this value is set to 0, no
# maximum is used; all commands are sent immediately
excessCmdLimit => 0,
# The time period (in seconds) to wait before sending stored commands. The value 1
# means 'wait 1 seconds before sending the next batch of commands). The minimum value
# (in case this IV is set to 0) is the same as GA::Session->sessionLoopDelay
excessCmdDelay => 1,
# Some worlds don't explicitly state when a dead character is resurrected. If this flag
# is set to TRUE, the Status task will change the character's ->lifeStatus to 'alive'
# whenever one of the triggers which detect the current health points (etc) fires, if
# the character is dead, asleep or passed out. Otherwise, the Status task will wait
# for an explicit regenerated, come around or woken up trigger to fire.
lifeStatusOverrideFlag => FALSE,
# Command prompt patterns - a list of patterns which match the world's command prompts
# Useful at worlds that don't use EOR or GA, since we don't want to test triggers
# against incomplete lines, but we do want to test them against prompts
# Also useful at worlds (like Dead Souls) that, when display several room statements
# at once, add the beginning of the room statement to the end of the previous prompt
lib/Games/Axmud/Profile.pm view on Meta::CPAN
# The character's skill advance history - a list of GA::Obj::SkillHistory objects, each
# representing an advance, in the order they were advanced
skillHistoryList => [],
# Number of lives left
lifeCount => 0,
# Number of times killed
deathCount => 0,
# Total number of lives, including already used up
lifeMax => 0,
# 'alive', 'sleep', 'passout', 'dead'
lifeStatus => 'alive',
# Many worlds have a 'wimpy' setting, allowing the char to automatically run away before
# death
remoteWimpy => 0,
remoteWimpyMax => 100,
# Axmud's local wimpy fulfills the same purpose, however the maximum value is always
# 100
localWimpy => 0,
constLocalWimpyMax => 100,
lib/Games/Axmud/Task.pm view on Meta::CPAN
push (@corpseList, $obj);
} else {
push (@otherList, $obj);
}
}
# If there are five torches in @otherList, we'd prefer to display them on a single line,
# like we do with corpses. (We don't display multiple orcs, for example, on a single line
# because the task marks which ones are alive, and which are dead)
# ->combineDuplicates compiles a hash in the form
# $otherHash{blessed_reference_to_non_model_object} = multiple
# In this example, it will return a hash containing one key-value pair. The key will be the
# first object in @otherList, the corresponding value will be 5
%otherHash = $self->combineDuplicates(@otherList);
# The keys of %otherHash are stringified blessed references, so we need to modify @otherList
# to eliminate the duplicates that don't appear in %otherHash
foreach my $obj (@otherList) {
if (exists $otherHash{$obj}) {
lib/Games/Axmud/Task.pm view on Meta::CPAN
if ($word ne $nounString) {
push (@newWordList, $word);
}
}
$unknownWordString = join(' ', @newWordList);
# Display the information, in a single line, in different colours
# (Some strings surrounded by square brackets, empty strings aren't displayed at all)
# (* means a being that's still alive, - a being that's been killed)
if (
$obj->category eq 'char'
|| $obj->category eq 'minion'
|| $obj->category eq 'sentient'
|| $obj->category eq 'creature'
) {
if ($obj->aliveFlag) {
$column = '*';
} else {
$column = '-';
}
} else {
$column = ' ';
}
lib/Games/Axmud/Task.pm view on Meta::CPAN
}
return 1;
}
sub combineDuplicates {
# Called by $self->refreshWin
# If there are five torches in the room, we want to display them on a single line, but if
# there are five orcs in the room, we want to display them on separate lines so the user
# can see which are alive and which are dead
# This function is called with a list of all the objects in the current room's
# ->tempObjList which aren't alive and aren't corpses or body parts
# It compares the objects in the list against each other, trying to eliminate duplicates.
# However, we can't set an object's ->multiple, because ->refreshWin (and therefore this
# function) might be called more than once; instead, we return a hash in the form
# $hash{blessed_reference_to_non_model_object} = multiple
# When an object is processed, its blessed reference is added to the hash, with the
# corresponding multiple set to 1
# When an object is processed that matches one already in the hash, the object is eliminated
# and the hash object's multiple is increased
#
# Expected arguments
lib/Games/Axmud/Task.pm view on Meta::CPAN
#
# Expected arguments
# (none besides $self)
#
# Optional arguments
# $minionFlag - If set to TRUE, minions are ignored. If set to FALSE (or 'undef'),
# minions are included
#
# Return values
# 'undef' on improper arguments or if the current room isn't known
# Otherwise returns the number of objects whose ->aliveFlag is TRUE (includes 'character',
# 'minion', 'sentient', 'creature' objects and perhaps also some 'custom' objects).
# The number returned may be 0
my ($self, $minionFlag, $check) = @_;
# Local variables
my $count;
# Check for improper arguments
if (defined $check) {
lib/Games/Axmud/Task.pm view on Meta::CPAN
# No objects to count
return 0;
}
# Count the living objects
$count = 0;
foreach my $obj ($self->roomObj->tempObjList) {
if (
$obj->aliveFlag
&& (! $minionFlag || $obj->category ne 'minion')
) {
$count++;
}
}
return $count;
}
sub resetModelRoom {
lib/Games/Axmud/Task.pm view on Meta::CPAN
return $self->ivPoke('stage', 3);
} else {
# Continue waiting for XP to recover
return $self->ivPoke('stage', 4);
}
# Monitor life status
} elsif (
$self->monitorStatistic eq 'alive' || $self->monitorStatistic eq 'sleep'
|| $self->monitorStatistic eq 'passout' || $self->monitorStatistic eq 'dead'
) {
if ($charObj->lifeStatus eq $self->monitorStatistic) {
# Life status matches; resume execution
return $self->ivPoke('stage', 3);
} else {
# Continue waiting for the right life status
lib/Games/Axmud/Task.pm view on Meta::CPAN
# Flag set to TRUE every time the character's health points change from one band to another
# (which means the task window's background colour must change) - bands are 0-10%, 11-30%,
# 31-50%, 51-100%
$self->{healthChangeFlag} = FALSE;
# If this flag is set to TRUE, the task attempts to convert time strings (e.g. 'twenty past
# two in the morning') into a 24-hour clock time using the current dictionary. The flag
# is set to TRUE at stage 2 if the current dictionary provides enough vocabulary
$self->{convertTimeFlag} = FALSE;
# When this flag is TRUE, the background colour of the task window changes, depending on
# whether the character is alive, dead, asleep (etc) and also depending on how many health
# points the character has. If FALSE, the colour scheme never changes
$self->{allowColourFlag} = TRUE;
# The colours to use. Each value must be a standard Axmud colour tag
# Which window background colour to use when character is alive
$self->{aliveColour} = 'GREEN';
# Which colour to use when alive, but health points below 50%
$self->{alive50Colour} = 'YELLOW';
# Which colour to use when alive, but health points below 30%
$self->{alive30Colour} = 'yellow';
# Which colour to use when alive, but health points below 10%
$self->{alive10Colour} = 'RED';
# Which window background colour to use when character is asleep
$self->{asleepColour} = 'cyan';
# Which window background colour to use when character is passed out
$self->{passedOutColour} = 'magenta';
# Which window background colour to use when character is dead
$self->{deadColour} = 'black';
# The Status task tracks five types of variable - character, fixed, pseudo, local, counter
# and custom
# Status task variables have a name_in_this_form. Names must be unique; a custom variable
lib/Games/Axmud/Task.pm view on Meta::CPAN
# Give the new (cloned) task the same initial parameters as the original one
$clone->{cmdHash} = {$self->cmdHash};
$clone->{timerHash} = {$self->timerHash};
$clone->{updateFlag} = $self->updateFlag;
$clone->{lifeStatusChangeFlag} = $self->lifeStatusChangeFlag;
$clone->{healthChangeFlag} = $self->healthChangeFlag;
$clone->{convertTimeFlag} = $self->convertTimeFlag;
$clone->{allowColourFlag} = $self->allowColourFlag;
$clone->{aliveColour} = $self->aliveColour;
$clone->{alive50Colour} = $self->alive50Colour;
$clone->{alive30Colour} = $self->alive30Colour;
$clone->{alive10Colour} = $self->alive10Colour;
$clone->{asleepColour} = $self->asleepColour;
$clone->{passedOutColour} = $self->passedOutColour;
$clone->{deadColour} = $self->deadColour;
# (The constant hashes retain their own values)
$clone->{localVarHash} = {$self->localVarHash};
$clone->{customVarHash} = {$self->customVarHash};
$clone->{counterVarHash} = {$self->counterVarHash};
lib/Games/Axmud/Task.pm view on Meta::CPAN
);
}
# Preserve some task parameters (the others are left with their default settings, some of
# which will be re-initialised in stage 2)
# Preserve the list of commands to send
$newTask->ivPoke('cmdHash', $self->cmdHash);
# Preserve the background colour scheme
$newTask->ivPoke('allowColourFlag', $self->allowColourFlag);
$newTask->ivPoke('aliveColour', $self->aliveColour);
$newTask->ivPoke('alive50Colour', $self->alive50Colour);
$newTask->ivPoke('alive30Colour', $self->alive30Colour);
$newTask->ivPoke('alive10Colour', $self->alive10Colour);
$newTask->ivPoke('asleepColour', $self->asleepColour);
$newTask->ivPoke('passedOutColour', $self->passedOutColour);
$newTask->ivPoke('deadColour', $self->deadColour);
# Preserve the counters
$newTask->ivPoke('counterVarHash', $self->counterVarHash);
$newTask->ivPoke('counterBaseHash', $self->counterBaseHash);
$newTask->ivPoke('fightCountFlag', $self->fightCountFlag);
$newTask->ivPoke('interactCountFlag', $self->interactCountFlag);
$newTask->ivPoke('counterStartTime', $self->counterStartTime);
# Preserve some gauge variables
lib/Games/Axmud/Task.pm view on Meta::CPAN
return undef;
}
# If there's been a change in life status, or if the character's health points have moved
# into a new band, then the task window's background colour must also be changed
if (
$self->allowColourFlag
&& ($self->lifeStatusChangeFlag || $self->healthChangeFlag)
) {
if ($charObj->lifeStatus eq 'alive') {
# If either ->healthPoints or ->healthPointsMax not known, assume health is 100%
if (
! defined $charObj->healthPoints
|| ! defined $charObj->healthPointsMax
|| $charObj->healthPointsMax == 0
) {
$colour = $self->aliveColour;
} else {
$health = $charObj->healthPoints / $charObj->healthPointsMax;
if ($health <= 0.10) {
$colour = $self->alive10Colour;
} elsif ($health <= 0.30) {
$colour = $self->alive30Colour;
} elsif ($health <= 0.50) {
$colour = $self->alive50Colour;
} else {
$colour = $self->aliveColour;
}
}
} elsif ($charObj->lifeStatus eq 'sleep') {
$colour = $self->asleepColour;
} elsif ($charObj->lifeStatus eq 'passout') {
$colour = $self->passedOutColour;
} elsif ($charObj->lifeStatus eq 'dead') {
$colour = $self->deadColour;
} else {
# Just in case $lifeStatus has been set to a valid value, use the default colour
$colour = $self->aliveColour;
}
# Set the background colour
$self->defaultTabObj->paneObj->applyMonochrome($self->defaultTabObj, $colour);
# Update the title bar
if ($charObj->lifeStatus eq 'sleep') {
$self->setTaskWinTitle('(SLEEP)', TRUE);
} elsif ($charObj->lifeStatus eq 'passout') {
$self->setTaskWinTitle('(PASSED OUT)', TRUE);
lib/Games/Axmud/Task.pm view on Meta::CPAN
}
sub checkHealthChange {
# Called by $self->setValue
# When the character's health points (GA::Profile::Char->healthPoints) or maximum health
# points (GA::Profile::Char->healthPointsMax) change, it might be necessary to change the
# background colour of the window
# If the world doesn't explicitly state when the character wakes up after falling asleep,
# when they come around after passing out, or when they resurrect after dying, it might
# also be necessary to change the life status to 'alive' if the character's health points
# score is read
# This function decides whether it's necessary, and sets $self->healthChangeFlag to TRUE if
# so
#
# Expected arguments
# $hp - The new health points value
# $hpMax - The new maximum health points value
#
# Return values
# 'undef' on improper arguments, if there's no current character set or if the task
lib/Games/Axmud/Task.pm view on Meta::CPAN
return $axmud::CLIENT->writeImproper($self->_objClass . '->checkHealthChange', @_);
}
# Do nothing if there's no current character set
$charObj = $self->session->currentChar;
if (! $charObj) {
return undef;
}
# If the character's life status isn't 'alive' and the override flag is set, the character
# is no longer asleep, passed out or dead. Change the life status to 'alive' again
if (
$charObj->lifeStatus ne 'alive'
&& $self->session->currentWorld->lifeStatusOverrideFlag
) {
$charObj->ivPoke('lifeStatus', 'alive');
# The task window's background colour should be changed
return $self->ivPoke('healthChangeFlag', TRUE);
# Otherwise, only consider changing the background colour, if the relevant IVs are non-zero
} elsif ($self->allowColourFlag && $charObj->healthPoints && $charObj->healthPointsMax) {
# Get the character's healt points as a percentage of the maximum
$old = $charObj->healthPoints / $charObj->healthPointsMax;
$new = $hp / $hpMax;
lib/Games/Axmud/Task.pm view on Meta::CPAN
if (! $obj) {
return undef;
}
# Respond to the fired trigger
# Import the current character profile
$charObj = $self->session->currentChar;
# If the character is not already alive...
if ($charObj && $charObj->lifeStatus ne 'alive') {
$charObj->ivPoke('lifeStatus', 'alive');
# The next time the task window is updated, its background colour will change
$self->ivPoke('lifeStatusChangeFlag', TRUE);
}
return 1;
}
sub passedOutSeen {
lib/Games/Axmud/Task.pm view on Meta::CPAN
if (! $obj) {
return undef;
}
# Respond to the fired trigger
# Import the current character profile
$charObj = $self->session->currentChar;
# If the character is not already alive...
if ($charObj && $charObj->lifeStatus ne 'alive') {
$charObj->ivPoke('lifeStatus', 'alive');
# The next time the task window is updated, its background colour will change
$self->ivPoke('lifeStatusChangeFlag', TRUE);
}
return 1;
}
sub deadSeen {
lib/Games/Axmud/Task.pm view on Meta::CPAN
if (! $obj) {
return undef;
}
# Respond to the fired trigger
# Import the current character profile
$charObj = $self->session->currentChar;
# If the character is not already alive...
if ($charObj && $charObj->lifeStatus ne 'alive') {
$charObj->ivPoke('lifeStatus', 'alive');
# The next time the task window is updated, its background colour will change
$self->ivPoke('lifeStatusChangeFlag', TRUE);
}
return 1;
}
##################
# Accessors - set
lib/Games/Axmud/Task.pm view on Meta::CPAN
{ $_[0]->{updateFlag} }
sub lifeStatusChangeFlag
{ $_[0]->{lifeStatusChangeFlag} }
sub healthChangeFlag
{ $_[0]->{healthChangeFlag} }
sub convertTimeFlag
{ $_[0]->{convertTimeFlag} }
sub allowColourFlag
{ $_[0]->{allowColourFlag} }
sub aliveColour
{ $_[0]->{aliveColour} }
sub alive50Colour
{ $_[0]->{alive50Colour} }
sub alive30Colour
{ $_[0]->{alive30Colour} }
sub alive10Colour
{ $_[0]->{alive10Colour} }
sub asleepColour
{ $_[0]->{asleepColour} }
sub passedOutColour
{ $_[0]->{passedOutColour} }
sub deadColour
{ $_[0]->{deadColour} }
sub constCharVarHash
{ my $self = shift; return %{$self->{constCharVarHash}}; }
sub constFixedVarHash
lib/Games/Axmud/Win/Map.pm view on Meta::CPAN
# (Mode 'hidden_content')
@list = $roomObj->ivKeys('hiddenObjHash');
}
foreach my $number (@list) {
my $obj = $self->worldModelObj->ivShow('modelHash', $number);
if ($obj) {
if ($obj->aliveFlag) {
$livingCount++;
} else {
$nonLivingCount++;
}
}
}
if ($livingCount || $nonLivingCount) {
$self->drawInteriorCounts(
lib/Language/Axbasic.pm view on Meta::CPAN
'peekpairs', 'peekshow', 'peekvalues', 'perl', 'persist', 'play', 'poke', 'pokeadd',
'pokedec', 'pokedechash', 'pokedelete', 'pokedivide', 'pokeempty', 'pokefalse',
'pokeinc', 'pokeinchash', 'pokeint', 'pokeminus', 'pokemultiply', 'pokeplus', 'pokepop',
'pokepush', 'pokereplace', 'pokeset', 'pokeshift', 'poketrue', 'pokeundef',
'pokeunshift', 'pop', 'print', 'profile', 'pseudo', 'push', 'radians', 'randomize',
'read', 'redim', 'redirect', 'relay', 'rem', 'require', 'reset', 'restore', 'return',
'revpath', 'select', 'send', 'setalias', 'setgauge', 'sethook', 'setmacro', 'setstatus',
'settimer', 'settrig', 'shift', 'silent', 'size', 'skipiface', 'sleep', 'sort',
'sortcase', 'sortcaser', 'sortr', 'speak', 'speed', 'step', 'stop', 'string', 'sub',
'tab', 'text', 'titlewin', 'then', 'to', 'typo', 'unflashwin', 'unshift', 'until',
'upper', 'waitactive', 'waitalias', 'waitalive', 'waitarrive', 'waitdead', 'waitep',
'waitgp', 'waithook', 'waithp', 'waitmacro', 'waitmp', 'waitnextxp', 'waitnotactive',
'waitpassout', 'waitscript', 'waitsleep', 'waitsp', 'waittask', 'waittimer',
'waittotalxp', 'waittrig', 'waitxp', 'warning', 'while', 'winaddcongauge',
'winaddconstatus', 'winaddgauge', 'winaddstatus', 'windelgauge', 'windelstatus',
'winsetgauge', 'winsetstatus', 'write', 'writewin',
);
foreach my $keyword (@keywordList) {
$keywordHash{$keyword} = undef;
lib/Language/Axbasic.pm view on Meta::CPAN
'delstatus', 'deltimer', 'deltrig', 'emptywin', 'error', 'flashwin', 'login',
'move', 'multi', 'nextiface', 'openentry', 'openwin', 'paintwin', 'pause', 'peek',
'peekequals', 'peekexists', 'peekfind', 'peekfirst', 'peekget', 'peekindex',
'peekkeys', 'peeklast', 'peekmatch', 'peeknumber', 'peekpairs', 'peekshow',
'peekvalues', 'perl', 'play', 'poke', 'pokeadd', 'pokedec', 'pokedechash',
'pokedelete', 'pokedivide', 'pokeempty', 'pokefalse', 'pokeinc', 'pokeinchash',
'pokeint', 'pokeminus', 'pokemultiply', 'pokeplus', 'pokepop', 'pokepush',
'pokereplace', 'pokeset', 'pokeshift', 'poketrue', 'pokeundef', 'pokeunshift',
'profile', 'relay', 'revpath', 'send', 'setalias', 'setgauge', 'sethook',
'setmacro', 'setstatus', 'settimer', 'settrig', 'skipiface', 'sleep', 'speak',
'speed', 'titlewin', 'unflashwin', 'waitactive', 'waitalias', 'waitalive',
'waitarrive', 'waitdead', 'waitep', 'waitgp', 'waithook', 'waithp', 'waitmacro',
'waitmp', 'waitnextxp', 'waitpassout', 'waitscript', 'waitsleep', 'waitsp',
'waittask', 'waittimer', 'waittotalxp', 'waittrig', 'waitxp', 'warning',
'winaddcongauge', 'winaddconstatus', 'winaddgauge', 'winaddstatus', 'windelgauge',
'windelstatus', 'winsetgauge', 'winsetstatus', 'write', 'writewin',
],
# A list of keywords that are ignored when the Axbasic script isn't being run from
# within a task
taskKeywordList => [
'addcongauge', 'addgauge', 'addconstatus', 'addstatus', 'break', 'closewin',
'delgauge', 'emptywin', 'flashwin', 'openentry', 'openwin', 'paintwin', 'pause',
'setalias', 'setgauge', 'sethook', 'setmacro', 'settimer', 'settrig', 'sleep',
'titlewin', 'unflashwin', 'waitactive', 'waitalias', 'waitalive', 'waitarrive',
'waitdead', 'waitep', 'waitgp', 'waithook', 'waithp', 'waitmacro', 'waitmp',
'waitnextxp', 'waitnotactive', 'waitpassout', 'waitscript', 'waitsleep', 'waitsp',
'waittask', 'waittimer', 'waittotalxp', 'waittrig', 'waitxp', 'winaddcongauge',
'winaddconstatus', 'winaddgauge', 'winaddstatus', 'windelgauge', 'windelstatus',
'winsetgauge', 'winsetstatus', 'writewin',
],
# A list of logical operators ('and', 'or', 'not')
logicalOpList => \@logicalOpList,
# A list of regular expression with which to split a line of Axbasic into a series of
lib/Language/Axbasic.pm view on Meta::CPAN
'counttask' => 'S',
'delexit' => 'N',
'delregion' => 'S',
'delroom' => 'N',
'deltempregions' => '',
'disconnectexit' => 'N',
'getexitdest' => 'N',
'getexitnum' => 'N',
'getexittwin' => 'N',
'getlostroom' => '',
'getobjectalive' => 'N',
'getobjectcount' => 'N',
'getregionnum' => '',
'getroomexits' => '',
'getroomnum' => '',
'getroomobjects' => ';S',
'ifacecount' => '',
'ifacedefined' => 'N',
'ifacepos' => '',
'ifacenum' => '',
'ifacestrings' => '',
lib/Language/Axbasic/Function.pm view on Meta::CPAN
return 0;
} else {
# Automapper is lost. Return the number of the previous room
return $mapObj->lastKnownRoom->number;
}
}
}
{ package Language::Axbasic::Function::Intrinsic::Numeric::getobjectalive;
use strict;
use warnings;
# use diagnostics;
use Glib qw(TRUE FALSE);
@Language::Axbasic::Function::Intrinsic::Numeric::getobjectalive::ISA = qw(
Language::Axbasic::Function::Intrinsic::Numeric
);
# Getobjectalive (number)
##################
# Methods
sub evaluate {
# Called by LA::Expression::Function->evaluate (using arguments in the form 'N')
#
# Expected arguments
# $arg - The first (and only) argument in the argument list
lib/Language/Axbasic/Function.pm view on Meta::CPAN
|| ! $roomObj->tempObjList
|| $arg < 0
|| scalar $roomObj->tempObjList <= $arg
) {
# Locator task doesn't know current location, current location is empty or the
# numbered object doesn't exist
return 0;
} else {
# Return the object's ->aliveFlag
$thisObj = $roomObj->ivIndex('tempObjList', $arg);
if (! $thisObj->aliveFlag) {
return 0;
} else {
return 1;
}
}
}
}
{ package Language::Axbasic::Function::Intrinsic::Numeric::getobjectcount;
lib/Language/Axbasic/Function.pm view on Meta::CPAN
if ($obj->category eq $arg) {
$count++;
}
}
} elsif ($arg eq 'living') {
foreach my $obj ($taskObj->roomObj->tempObjList) {
if ($obj->aliveFlag) {
$count++;
}
}
} elsif ($arg eq 'not_living') {
foreach my $obj ($taskObj->roomObj->tempObjList) {
if (! $obj->aliveFlag) {
$count++;
}
}
} else {
# Unrecognised string
return 0;
}
lib/Language/Axbasic/Statement.pm view on Meta::CPAN
package Language::Axbasic::Statement::sortr;
package Language::Axbasic::Statement::speak;
package Language::Axbasic::Statement::speed;
package Language::Axbasic::Statement::stop;
package Language::Axbasic::Statement::sub;
package Language::Axbasic::Statement::titlewin;
package Language::Axbasic::Statement::unflashwin;
package Language::Axbasic::Statement::unshift;
package Language::Axbasic::Statement::until;
package Language::Axbasic::Statement::waitactive;
package Language::Axbasic::Statement::waitalive;
package Language::Axbasic::Statement::waitarrive;
package Language::Axbasic::Statement::waitdead;
package Language::Axbasic::Statement::waitep;
package Language::Axbasic::Statement::waitgp;
package Language::Axbasic::Statement::waithp;
package Language::Axbasic::Statement::waitmp;
package Language::Axbasic::Statement::waitnextxp;
package Language::Axbasic::Statement::waitnotactive;
package Language::Axbasic::Statement::waitpassout;
package Language::Axbasic::Statement::waitscript;
lib/Language/Axbasic/Statement.pm view on Meta::CPAN
# ($self->scriptObj->setError has already been called)
return undef;
}
# Implementation complete
return 1;
}
}
{ package Language::Axbasic::Statement::waitalive;
use strict;
use warnings;
# use diagnostics;
use Glib qw(TRUE FALSE);
@Language::Axbasic::Statement::waitalive::ISA = qw(
Language::Axbasic
Language::Axbasic::Statement
);
# WAITALIVE [ expression ]
##################
# Methods
sub parse {
lib/Language/Axbasic/Statement.pm view on Meta::CPAN
'number_NUM_out_of_range',
$self->_objClass . '->implement',
'NUM', $timeout,
);
}
}
# Inform the parent task that it should start waiting
$self->scriptObj->parentTask->setUpMonitoring(
'status',
'alive',
undef,
$timeout,
);
# Halt execution of the Axbasic script to allow control to be passed back to the parent task
$self->scriptObj->set_scriptStatus('wait_status');
# Implementation complete
return 1;
}
nsis/ipc_run/Run.txt view on Meta::CPAN
## dup2s on to these descriptors, since we unshift these. This way
## each process emits output to the same file descriptors that the
## last child will write to. This is probably not quite correct,
## since each child should write to the file descriptors inherited
## from the parent.
## TODO: fix the inheritance of output file descriptors.
## NOTE: This sharing of OPS among kids means that we can't easily put
## a kid number in each OPS structure to ping the kid when all ops
## have closed (when $self->{PIPES} has emptied). This means that we
## need to scan the KIDS whenever @{$self->{PIPES}} is empty to see
## if there any of them are still alive.
for ( my $num = 0; $num < $#{ $self->{KIDS} }; ++$num ) {
for ( reverse @output_fds_accum ) {
next unless defined $_;
_debug(
'kid ', $self->{KIDS}->[$num]->{NUM}, ' also to write ', $_->{KFD},
' to ', ref $_->{DEST}
) if _debugging_details;
unshift @{ $self->{KIDS}->[$num]->{OPS} }, $_;
}
}
nsis/ipc_run/Run.txt view on Meta::CPAN
## Undocumented feature (don't depend on it outside this module):
## returns -1 if we have I/O channels open, or >0 if no I/O channels
## open, but we have kids running. This allows the select loop
## to poll for child exit.
sub pumpable {
my IPC::Run $self = shift;
## There's a catch-22 we can get in to if there is only one pipe left
## open to the child and it's paused (ie the SCALAR it's tied to
## is ''). It's paused, so we're not select()ing on it, so we don't
## check it to see if the child attached to it is alive and it stays
## in @{$self->{PIPES}} forever. So, if all pipes are paused, see if
## we can reap the child.
return -1 if grep !$_->{PAUSED}, @{ $self->{PIPES} };
## See if the child is dead.
$self->reap_nb;
return 0 unless $self->_running_kids;
## If we reap_nb and it's not dead yet, yield to it to see if it
## exits.
share/docs/guide/ch16.html view on Meta::CPAN
<p>To read out content lists automatically, type <strong>;switch content</strong>.</p>
<h3>16.7.3 Auto-read the room title permanently</h3>
<p>The command <strong>;switch title</strong> will make the Locator task automatically read out room titles for the rest of the session. However, the next time you start Axmud, a brand new Locator task will start, and it won't know that it's suppose...
<p>The client command <strong>;permswitch</strong> is the solution to this problem. (It's spelled with a semicolon, followed by perm and switch as a single word, without spaces.)</p>
<p>To read out room titles in this session, and in all future sessions, type <strong>;permswitch title</strong>.</p>
<h3>16.7.4 The Status task</h3>
<p>The Status task gathers information about your character, such as the their health points and experience points.</p>
<p>Like the Locator task, the Status task doesn't magically know how to gather this information. Both tasks work best when connected to a pre-configured world.</p>
<p>The client command <strong>;read</strong> can be used to read out some of this information, as long as the world provides the information and Axmud knows how to collect it.</p>
<p>Type <strong>;read health</strong> to read out the character's health points. You can also type <strong>;read energy</strong>, <strong>;read magic</strong>, <strong>;read guild</strong>, <strong>;read social</strong>, <strong>;read experience</st...
<p><strong>;read status</strong> will read the character's life status - alive, dead, passed out or asleep.</p>
<p><strong>;read alignment</strong> will read the character's alignment (good or evil).</p>
<p><strong>;read age</strong> will read the character's age.</p>
<p><strong>;read time</strong> will read the game time.</p>
<p><strong>;read bank</strong> and <strong>;read purse</strong> will reveal information about your character's finances. Money is tracked by the Inventory task, so you will need to start that task before you can use it.</p>
<p>The client commands <strong>;starttask</strong> and <strong>;addinitialtask</strong> are both typed as a semicolon followed by a single word with no spaces.</p>
<p>To start the Inventory task, type <strong>;starttask inventory</strong>. To make the inventory task start in every session, type <strong>;addinitialtask inventory</strong>.</p>
<h3>16.7.5 Status task alerts</h3>
<p>It would be very useful for the Status task to issue an audible warning when your character's health points fall to a certain level, and again when they recover.</p>
<p>You can do this with the client command <strong>;alert</strong>.</p>
<p>To get an audible warning when your character's health points fall to 20%, type <strong>;alert health down 20</strong>.</p>
share/docs/guide/ch16.mkd view on Meta::CPAN
###16.7.4 The Status task
The Status task gathers information about your character, such as the their health points and experience points.
Like the Locator task, the Status task doesn't magically know how to gather this information. Both tasks work best when connected to a pre-configured world.
The client command **;read** can be used to read out some of this information, as long as the world provides the information and Axmud knows how to collect it.
Type **;read health** to read out the character's health points. You can also type **;read energy**, **;read magic**, **;read guild**, **;read social**, **;read experience**, **;read level** and **;read lives**.
**;read status** will read the character's life status - alive, dead, passed out or asleep.
**;read alignment** will read the character's alignment (good or evil).
**;read age** will read the character's age.
**;read time** will read the game time.
**;read bank** and **;read purse** will reveal information about your character's finances. Money is tracked by the Inventory task, so you will need to start that task before you can use it.
The client commands **;starttask** and **;addinitialtask** are both typed as a semicolon followed by a single word with no spaces.
share/docs/tutorial/ch04.html view on Meta::CPAN
MOVE "west"
MOVE "south"
PRINT "Finished!"
END
</code></pre>
<h2><a name="4.8">4.8 Missions</a></h2>
<p>By the way, a script as simple as the one above can just as easily be written as a <em>mission</em>.</p>
<p>Axmud missions are scripts that require absolutely no programming knowledge. See the <a href="../guide/index.html">Axmud Guide</a> for more details about how to write them.</p>
<h2><a name="4.9">4.9 More waiting statements</a></h2>
<p>WAITTRIG waits for a trigger to fire, but there are a number of statements that wait for something else. Many of them depend on a properly-configured Status task that's running right now.</p>
<p>The Status task recognises four states of being for the current character: <strong>"alive"</strong>, <strong>"sleep"</strong>, <strong>"pass_out"</strong> and <strong>"dead"</strong>. Whenever the character is not asleep, passed out or dead, they'...
<p>WAITALIVE, WAITSLEEP, WAITPASSOUT and WAITDEAD pause the script until the character's status changes. (If the character is already alive, sleep, passed out or dead, the script resumes immediately).</p>
<p>Each of those statements can be used with a timeout, measured in seconds.</p>
<pre><code> ! Wait for the character to fall asleep
WAITSLEEP
! Wait, but give up after 60 seconds
WAITSLEEP 60
</code></pre>
<p>Most worlds keep track of the character's health points. You can wait for your character's health to recover to a certain minimum level before resuming execution.</p>
<pre><code> ! Wait for HP to recover to at least 50% of maximum
WAITHP 50
</code></pre>
share/docs/tutorial/ch04.mkd view on Meta::CPAN
##<a name="4.8">4.8 Missions</a>
By the way, a script as simple as the one above can just as easily be written as a *mission*.
Axmud missions are scripts that require absolutely no programming knowledge. See the [Axmud Guide](../guide/index.html) for more details about how to write them.
##<a name="4.9">4.9 More waiting statements</a>
WAITTRIG waits for a trigger to fire, but there are a number of statements that wait for something else. Many of them depend on a properly-configured Status task that's running right now.
The Status task recognises four states of being for the current character: **"alive"**, **"sleep"**, **"pass_out"** and **"dead"**. Whenever the character is not asleep, passed out or dead, they're considered alive.
WAITALIVE, WAITSLEEP, WAITPASSOUT and WAITDEAD pause the script until the character's status changes. (If the character is already alive, sleep, passed out or dead, the script resumes immediately).
Each of those statements can be used with a timeout, measured in seconds.
! Wait for the character to fall asleep
WAITSLEEP
! Wait, but give up after 60 seconds
WAITSLEEP 60
Most worlds keep track of the character's health points. You can wait for your character's health to recover to a certain minimum level before resuming execution.
share/docs/tutorial/ch13.html view on Meta::CPAN
PRINT Getobject$ (3)
</code></pre>
<p>We can also retrieve each object's type, in this case the strings <strong>"weapon"</strong>, <strong>"sentient" and "portable"</strong>:</p>
<pre><code> PRINT Getobjecttype$ (1)
...
</code></pre>
<p>We can furthermore retrieve the main noun, in this case the strings <strong>"axe"</strong>, <strong>"orc"</strong> and <strong>"treasure"</strong>:</p>
<pre><code> PRINT Getobjectnoun$ (1)
...
</code></pre>
<p>This function will tell us whether Axmud believes the object is alive, or not. The function returns 1 for living beings and 0 for everything else, possibly including any nasty monsters you've recently dispatched to the afterlife:</p>
<pre><code> PRINT Getobjectalive (1)
...
</code></pre>
<p>Axmud might store <strong>10 gold coins</strong> as a single object, or as ten separate ones, depending on the current world profile's settings. In this case, the functions <strong>Getroomobjects ()</strong> and <strong>Getobjectcount ()</strong> ...
<pre><code> ! Display 1, because Axmud has stored the gold coins
! as a single object
PRINT Getroomobjects (1)
! Display the actual number of objects in the game,
! which is 10
PRINT Getobjectcount (1)
</code></pre>
share/docs/tutorial/ch13.mkd view on Meta::CPAN
We can also retrieve each object's type, in this case the strings **"weapon"**, **"sentient" and "portable"**:
PRINT Getobjecttype$ (1)
...
We can furthermore retrieve the main noun, in this case the strings **"axe"**, **"orc"** and **"treasure"**:
PRINT Getobjectnoun$ (1)
...
This function will tell us whether Axmud believes the object is alive, or not. The function returns 1 for living beings and 0 for everything else, possibly including any nasty monsters you've recently dispatched to the afterlife:
PRINT Getobjectalive (1)
...
Axmud might store **10 gold coins** as a single object, or as ten separate ones, depending on the current world profile's settings. In this case, the functions **Getroomobjects ()** and **Getobjectcount ()** return different results:
! Display 1, because Axmud has stored the gold coins
! as a single object
PRINT Getroomobjects (1)
! Display the actual number of objects in the game,
! which is 10
PRINT Getobjectcount (1)
share/help/axbasic/func/getobjectalive view on Meta::CPAN
Getobjectalive (number)
Synopsis:
Tests whether an object is considered alive
Notes:
The Locator task's current room has a numbered list of objects; 'number'
is the position of an object in that list (the first object is numbered
1).
This function returns 1 if the object is considered alive, 0 if it is not.
If the Locator task isn't running, if it doesn't know about the current
location or if the numbered object doesn't exist, 0 is returned.
To get the number of objects in the curent location, see the
Getroomobjects () function.
share/help/axbasic/keyword/waitalive view on Meta::CPAN
WAITALIVE [ expression ]
Synopsis:
Pauses execution until the character's life status is 'alive'
Notes:
The Status task recognises four states of being for the character:
"alive", "sleep", "pass_out" and "dead". Whenever the character is not
asleep, passed out or dead, they're considered alive.
The expression is a timeout measured in seconds. If specified, the script
gives up waiting after that period and resumes execution.
WAITALIVE relies on the Status task to supply the character's current life
status. If the Status task is not running, the Axbasic script pauses
briefly and resumes execution on the next task loop.
If the Status task doesn't know about the character's status, it assumes
that the character is alive.
See also the help for WAITSLEEP, WAITDEAD and WAITPASSOUT.
Requires:
If the script is not being run as a task, the WAITALIVE statement is
ignored (and no error message is generated). Execution continues with
the next statement.
Examples:
WAITALIVE
WAITALIVE 100
share/help/axbasic/keyword/waitdead view on Meta::CPAN
WAITDEAD [ expression ]
Synopsis:
Pauses execution until the character's life status is 'dead'
Notes:
The Status task recognises four states of being for the character:
"alive", "sleep", "passout" and "dead". Whenever the character is not
asleep, passed out or dead, they're considered alive.
The expression is a timeout measured in seconds. If specified, the script
gives up waiting after that period and resumes execution.
WAITDEAD relies on the Status task to supply the character's current life
status. If the Status task is not running, the Axbasic script pauses
pauses briefly and resumes execution on the next task loop.
If the Status task doesn't know about the character's status, it assumes
that the character is alive.
See also the help for WAITALIVE, WAITSLEEP and WAITPASSOUT.
Requires:
If the script is not being run as a task, the WAITDEAD statement is
ignored (and no error message is generated). Execution continues with
the next statement.
Examples:
WAITDEAD
WAITDEAD 100
share/help/axbasic/keyword/waitpassout view on Meta::CPAN
WAITPASSOUT [ expression ]
Synopsis:
Pauses execution until the character's life status is 'passed_out'
Notes:
The Status task recognises four states of being for the character:
"alive", "sleep", "passout" and "dead". Whenever the character is not
asleep, passed out or dead, they're considered alive.
The expression is a timeout measured in seconds. If specified, the script
gives up waiting after that period and resumes execution.
WAITPASSOUT relies on the Status task to supply the character's current
life status. If the Status task is not running, the Axbasic script
pauses briefly and resumes execution on the next task loop.
If the Status task doesn't know about the character's status, it assumes
that the character is alive.
See also the help for WAITALIVE, WAITSLEEP and WAITDEAD.
Requires:
If the script is not being run as a task, the WAITPASSOUT statement is
ignored (and no error message is generated). Execution continues with
the next statement.
Examples:
WAITPASSOUT
WAITPASSOUT 100
share/help/axbasic/keyword/waitsleep view on Meta::CPAN
WAITSLEEP [ expression ]
Synopsis:
Pauses execution until the character's life status is 'sleep'
Notes:
The Status task recognises four states of being for the character:
"alive", "sleep", "passout" and "dead". Whenever the character is not
asleep, passed out or dead, they're considered alive.
The expression is a timeout measured in seconds. If specified, the script
gives up waiting after that period and resumes execution.
WAITSLEEP relies on the Status task to supply the character's current life
status. If the Status task is not running, the Axbasic script pauses
briefly and resumes execution on the next task loop.
If the Status task doesn't know about the character's status, it assumes
that the character is alive.
See also the help for WAITALIVE, WAITDEAD and WAITPASSOUT.
Requires:
If the script is not being run as a task, the WAITSLEEP statement is
ignored (and no error message is generated). Execution continues with
the next statement.
Examples:
WAITSLEEP
WAITSLEEP 100
share/help/cmd/read view on Meta::CPAN
Reads the first <chars> characters of the current room's description
;read exit
;read exits
Reads the current room's exit list
;read content
;read contents
Reads the current room's contents list
(Status task)
;read status
Reads the current character's life status (alive, dead etc)
;read life
;read lives
Reads the current character's life and death counts
;read health
Reads the current character's health points. Note that world
profiles are free to store anything in variables like these, so
you might be read something different altogether
;read energy
Reads the current character's energy points
;read magic
share/help/cmd/setlife view on Meta::CPAN
slf / setlife Sets the Status task's current life status
Format:
;slf <switch> Sets character's life status
;slf <status> Sets character's life status
Notes:
This command updates the current character's life status, as displayed by
the current Status task. (Updating the task also updates the life
status stored in the current character profile.)
Your character's life status - 'alive', 'sleep', 'passout' or 'dead' - is
normally set automatically by triggers. If the Status task is showing
the wrong life status, it's possible to edit the current character
profile manually (before resetting the Status task), but it's usually
quicker to use this command.
<switch> can be any of the following:
-a - character is alive
-s - character is asleep
-p - character is passed out
-d - character is dead
Alternatively, you can use any of the following <status> strings:
'alive', 'sleep', 'passout', 'dead'.
Note that, when the current character's life status is updated because of
one of the Status task's triggers (for example, when the trigger reacts
to a pattern that means your character has died), certain events happen
(such as writing special log files). Those events don't take place if
you change the character's life status with this command (or if you
edit the current character profile manually.)
User commands:
slf / setlife
share/help/cmd/switch view on Meta::CPAN
;switch exit
;switch exits
Toggles reading of room exits
;switch content
;switch contents
Toggles reading of room contents
(Status task)
;switch life
Toggles reading of changes to the current character's life status
(alive, dead etc)
(Watch task)
;toggle watch
Toggles reading of all Watch task messages
User commands:
swi / switch