Games-Axmud

 view release on metacpan or  search on metacpan

lib/Language/Axbasic/Statement.pm  view on Meta::CPAN

        $self->ivAdd('parseDataHash', 'name', $nameExp);

        # Parsing complete
        return 1;
    }

    sub implement {

        # Called by LA::Line->implement directly after a call to $self->parse
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments or if there is an error
        #   1 otherwise

        my ($self, $check) = @_;

        # Local variables
        my (
            $stimulusExp, $stimulus, $responseExp, $response, $nameExp, $name, $string, $profile,
        );

        # Check for improper arguments
        if (defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->implement', @_);
        }

        # Retrieve the arguments stored by $self->parse
        $stimulusExp = $self->ivShow('parseDataHash', 'stimulus');
        $responseExp = $self->ivShow('parseDataHash', 'response');
        $nameExp = $self->ivShow('parseDataHash', 'name');          # May be 'undef'

        # Evaluate each expression
        $stimulus = $stimulusExp->evaluate();
        $response = $responseExp->evaluate();
        if (defined $nameExp) {

            $name = $nameExp->evaluate();
        }

        # Specify which profile to use
        if (defined $self->scriptObj->useProfile) {
            $profile = $self->scriptObj->useProfile;
        } else {
            $profile = $self->scriptObj->session->currentWorld->name;
        }

        # Prepare the client command
        $string = 'addmacro -s <' . $stimulus . '> -p <' . $response . '> -d ' . $profile;
        if ($name) {

            $string .= ' -n <' . $name . '>';
        }

        # Send the command
        if ($self->scriptObj->session->pseudoCmd($string, $self->scriptObj->pseudoCmdMode)) {

            # Macro created successfully. Update the LA::Script IVs
            if (! $name) {

                # GA::Generic::Cmd->addInterface uses the stimulus as a name, if no name is
                #   specified
                $name = $stimulus;
            }

            $self->scriptObj->push_indepInterfaceList($name, $profile, 'macro');
            $self->scriptObj->set_indepInterfaceName($name);

        } else {

            # Store the fact that creation of the macro failed
            $self->scriptObj->set_indepInterfaceName(undef);
        }

        # Implementation complete
        return 1;
    }
}

{ package Language::Axbasic::Statement::addstatus;

    use strict;
    use warnings;
#   use diagnostics;

    use Glib qw(TRUE FALSE);

    @Language::Axbasic::Statement::addstatus::ISA = qw(
        Language::Axbasic
        Language::Axbasic::Statement
    );

    # ADDSTATUS expression , expression
    # ADDCONSTATUS expression , expression
    # WINADDSTATUS expression , expression
    # WINADDCONSTATUS expression , expression

    ##################
    # Methods

    sub parse {

        # Called by LA::Line->parse directly after a call to LA::Statement->new
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments or if there is an error
        #   1 otherwise

        my ($self, $check) = @_;

        # Local variables
        my ($numberExp, $labelExp, $token);

        # Check for improper arguments
        if (defined $check) {



( run in 0.679 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )