Main Menu

New guy with a problem

Started by japh42, April 15, 2008, 06:52:28 PM

Previous topic - Next topic

japh42


Hi,
     I've been wanting to program a game since 1984-5, but could never really learn to program.
From what I had heard at the time, BASIC was supposed to be kind of like English.  Imagine my surprise when I couldn't enter;

"10 Draw a line from the top left of the screen to the lower right, make it blue and 5 pixels wide"
"20 Now make it spin clockwise really really fast"

The only other language that got me going for a while was AdvanBASIC on my Atari 800 (15 years ago).


Looking for a language to program in I found PlayBasic.

Now, PlayBasic has helped me understand things with debug and trace and this forum.

My problem is...

   earlier I do this;

      REM Rolling for CONSTITUTION - CN
      DIE1=RND(4)+2
      DIE2=RND(4)+2
      DIE3=RND(4)+2

      CN=DIE1+DIE2+DIE3

Later I do this;

   FOR HITS=CN*RNDRANGE(1,8)
      HP=HP+HITS                     REM   ERROR 1006 FOR/NEXT ERROR EXPECTING 'TO'
   NEXT HITS


What I want to do is set HITS to the result of multiplying the value already in CN by RDNRANGE(1,8)
So, if CN has been previously set to 12 then I want HITS to equal something from (in this example)
12 and 96 when the loop is done.  I know I need the TO but where?

(should have seen me trying to figure out another problem, had all RDN as RDM.  Which reminds me, is there a search and replace in PlayBasic? Could not find it under EDIT.)






kevin


For requires the following syntax


     For   CounterVariable =   StartingValue   to   EndValue


   So your loop should look like this.


  FOR HITS=0  to  CN*RNDRANGE(1,8)
      HP=HP+HITS
   NEXT HITS



Quote(should have seen me trying to figure out another problem, had all RDN as RDM.  Which reminds me, is there a search and replace in PlayBasic? Could not find it under EDIT.)

  Replace is under SEARCH.

japh42


Thanks!!

Now could you just come to my house and program the thin g for me??  hahaha!


Thanks again, quick response.

kevin


  I'd recommend running through the tutorials in the help.  THese can be found under   HELP\ABOUT.    There's tutorials on Arrays/Arrays/ Loops/ Decisions / Types..  While they don't cover everything, there's more than enough in there to get up to speed..
   

QuoteNow could you just come to my house and program the thin g for me??  hahaha!

    You must have very deep  pockets....  :)

   

japh42


Yup!

Just started going through those today.

I'll need to have a die roll 1-100 and look up the result so I realized I'll have to learn Arrays and such sooner than I expected to.



At this point in time, I would settle for shallow pockets :)