[TIB] TI-83 Basic stumper


[Prev][Next][Index][Thread]

[TIB] TI-83 Basic stumper





Thanks for responding to my first post,
even though it wasn't very informative
or questioning.

Here's a question I have been struggling
with on the TI-83:
  Is there a way in Basic to convert an
integer number to its string representation
in a string variable?  For example, in
my current project, "Rogue", I have piles
of gold pieces which the player can pick
up as in the following snippet:

  If (player wants to pick up gold)
  randInt(10,100->G                {number of gold pieces}
  Disp "YOU PICK UP THE",G,"GOLD PIECES."

But that displays as

  YOU PICK UP THE
                85
  GOLD PIECES.

and what I want is more like

  YOU PICK UP THE
  85 GOLD PIECES.

which could be accomplished easily
if I could get the value of G into
Str1, for example:

  Disp "YOU PICK UP THE",Str1+" GOLD PIECES."


To forestall for-dummies answers: *YES*, I
know you can use a While loop like this:

  randint(10,100->G
  "->Str1
  While G
  sub("0123456789",10fPart(.1G)+1,1)+Str1->Str1
  iPart(.1G->G
  End

but I'm looking for a speedy and less involved
method, something like

  randint(10,100->Y1:Eqn>String(Y1,Str1

which of course doesn't work, but it would be
nice if it did.  (Handling 0 and negative numbers
isn't required, BTW.)

Thanks!

-Arthur
ajo at andrew dot cmu dot edu




Follow-Ups: