Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Hello Perlmonks. A while ago I began work on a Multi User Dungeon, but since then I have decided to cut out the "Dungeon" elements and go with a purely survival theme.

#!/usr/bin/perl use warnings; if ($diff = easy){ $wood = 120; } elsif ($diff = hard){ $wood = 75; } if ($diff = easy){ $food = 50; } elsif ($diff = hard){ $food = 20; } $maxRNG = 6; $RNG = rand($maxRNG); NAME: print "May I have your name please?\n"; chomp($name = <>); print "Thank you $name.\n"; sleep 1; system("clear"); goto DIFFICULTY; DIFFICULTY: print "Please enter a difficulty level: easy, or hard.\n"; chomp($diff = <>); print "you chose $diff.\n"; sleep 1; system("clear"); goto BEGIN; BEGIN: print "You have crash landed on a strange alien planet and must find a + way to get back to earth.\n"; goto PTURN; PTURN: print "\n"; print "You have $wood wood and $food food.\n"; print "You can:\n"; if($wood = 10){ print "BUILD a HUT with 10 wood\n"; }

As you can see I have set the amount of $wood to a selection in $diff. But this is not working. When I run it, I enter hard and it keeps the amount at 120. What am I doing wrong?

In reply to SImulation of an Inventory. by Dipseydoodle

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
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (2)
    As of 2021-02-27 04:30 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found