Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
no... there will be a list on a php page which will be numbered according to thier line position in the file... so i'll paste a couple lines from the file so you can get a better idea...

258 Phontom Fungus
266 Yeth Hound
267 Mennlock
269 Medium Earth Elemental

the numbers represent the monster's attack value ($mnum) and the name is obviously $mname

now lets say these are lines 51-54... lets say a player put in the command to battle $mline which in this case would be 53

so $mline = 53 now which is the line i need to snag and then split to get the proper values.

most of the other code in here doesn't really have anything to do with what I'm doing... its about 4k lines of code... but i could give you an example of the player sending the command via IRC... this would be the command that i'm making which would trigger the sub that I originally asked for help with.

elsif ($arg[3] eq "battle") { if (!defined($username)) { privmsg("FIGHT Request Denied: You are not logged +in.", $usernick); } elsif ($rps{$username}{level} < 15) { privmsg("BATTLE Request Denied: Command available +to level 15+ users only.", $usernick, 1); } elsif ($arg[4] > 551) { privmsg("FIGHT Request Denied: This monster does n +ot exist.", $usernick, 1); } elsif ($arg[4] < 1) { privmsg("FIGHT Request Denied: This monster does n +ot exist.", $usernick, 1); } elsif (itemsum($username) > $arg[4]($mnum)) { privmsg("FIGHT Request Denied: Pick a harder monst +er!", $usernick, 1); } else { monster_battle($username, $arg[4]); } }
basically most of it is just a bunch of checks to make sure the fight is possible... once we determine that, to starts the monster_battle sub pitting the player against the monster that was specified. $arg4 is the input the player gives which in this case should be the line number 53 meaning that the player wishes to fight with a "Mennlock" with an attack rating of "267"

the line numbers will only be supplied on the php page which is just a quick reference to the player so that they can just type /msg botname battle 53

In reply to Re^4: Return full line from line number X by Rathlar
in thread Return full line from line number X by Rathlar

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [Eily]: meh, such good link ...
    [Eily]: here
    [Eily]: still not xD there
    [hippo]: See also Getting Started with Perl for some gentle introductory tutorials.

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (10)
    As of 2018-02-21 09:50 GMT
    Find Nodes?
      Voting Booth?
      When it is dark outside I am happiest to see ...

      Results (276 votes). Check out past polls.