[TIB] Re: data type issue


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

[TIB] Re: data type issue



Incidentally.. I tried the following and it didn't work either.

ALL->TMP
Eq>St(ROLL,TMP2)
TMP+" "+TMP2->ALL

This removed any possible self referencing variable problem (which I 
hadn't actuall hit yet but didn't want to anyway), and supposedly turned 
the contents of ROLL into a string.. but I still got the data type error.


On Mon, 3 Feb 2003, Tib wrote:

> I'm working on a die rolling program for when I play warhammer 40k and 
> need to roll obnoxious amounts of dice all at once and count the results. 
> Found my old TI-86 and figured it wouldn't be too hard. And it hasn't been 
> much of a challenge up till now. Here's what I've got so far:
> 
> 
> ClLCD
> Input "# of dice? ",D
> ClLCD
> For(R,1,D)
> randInt(1,6)->ROLL
> End
> 
> Now this is all fine and dandy.. for rolling a bunch of dice individually. 
> What I'd like to do is as follows:
> 
> ClLCD
> " "->ALL
> Input "# of dice? ",D
> ClLCD
> For(R,1,D)
> randInt(1,6)->ROLL
> ALL+" "+ROLL->ALL
> End
> Disp ALL
> 
> 
> 
> There's a little bit more to it than this, but you see my problem right 
> now I hope.. variable ALL is going to be used to store all the die rolls 
> so they can be output at the end in one lump rather than line by line. 
> Unfortunately the only way I can figure to do this so far is by the method 
> above ('ALL+" "+ROLL->ALL'), but this makes ALL a string and not an 
> integer, and as soon as I try to add each roll onto the end it complains 
> about data type problems. Is there a way to switch an integer into a 
> string and then tack it onto the end? Or maybe I am going about it wrong 
> and doing things in some sort of array format would work better (if that's 
> possible on a TI-86.. i'm working with no programming manual right now so 
> i've got no clue what the possibilities are). 
> 
> Additionally, I'd like to add the option of it checking the results of 
> each die roll and if it's above a certain number it increments a 'success' 
> variable. In the end, I'd like something that ouputs similar to below:
> 
> 40k-roller:
> 
> # of dice?: (input 6)
> # to succeed?: (input 4)
> 
> [clears screen]
> 
> Rolled:
> 2,5,3,3,6,1
> 
> Successes:
> 2
> 
> Done.
> 
> 




References: