PPF Home
Plugins
Developers
   Font size:      

BaseConvert (v1.0)

PDF
PDF

Description

Converts numbers between bases.

This plugin lets you specify a number and two number bases, and it will return a number that is the same number converted from the one base to the other.
For example, if you say you want to convert the number 1A from base 16 (hexadecimal) to base 10 (decimal), it will return 26.

This plugin can convert numbers between bases 2 to 36. How each base is specified is given in the configuration, and each base can have several names.
Per default, bases are specified as "b2" through "b36", or, for convenience, as one of "bin", "oct", "dec" or "hex".

Note that there is a limit on how large numbers can be converted, as it is kept in a "long" variable internally, which has a given size.

Configuration

The configuration file for this plugin is system/BaseConvert/BaseConvertConfig.xml

commandConvertBase

The command prefix for converting a number between bases.
In other words, what to put before X-Y to make it react.
You can set the authLevel to control who is allowed to access the command. The output is used to define where the output from the command will go.

  • authLevel - ANY, ADMIN, MASTER, TRUSTED, NONE
  • output - CHANNEL, PM, NOTICE

          <commandConvertBase authLevel="none" output="channel">!</commandConvertBase>

        

commandListConvBases

The command for listing the available bases that can be converted between.
You can set the authLevel to control who is allowed to access the command. The output is used to define where the output from the command will go.

  • authLevel - ANY, ADMIN, MASTER, TRUSTED, NONE
  • output - CHANNEL, PM, NOTICE

          <commandListConvBases authLevel="none" output="channel">!ConvBases</commandListConvBases>

        

Base

This group contains a list of Base elements, as defined below, that map base names to actual bases.

This element defines a base name and what base it maps to. When someone uses the given name as the base to convert to/from, the given base number will be used.

  • name - The name of the base
  • value - The base number to be used

          <Bases>
            <Base name="bin" value="2" />
            <Base name="oct" value="8" />
            <Base name="dec" value="10" />
            <Base name="hex" value="16" />
          </Bases>

        

Commands

!X-Y

Command: !X-Y
Description: Where X and Y are base names, convert the following number from base X to base Y.
Auth Level: none
Where to give command: channel, pm
Outputs to: same as given
Example(s):

  • !dec-hex 26
  • !b25-dec 5H
  • !dec-b6 18

!ConvBases

Command: !ConvBases
Description: This will return the list of available bases, or if a base name is given, show which base that is.
Auth Level: none
Where to give command: channel, pm
Outputs to: same as given
Example(s):

  • !ConvBases
  • !ConvBases oct

Change History

v1.0 First Version by EdorFaus