Omnimaga
Calculator Community => TI Calculators => TI-BASIC => Topic started by: Raylin on November 02, 2009, 04:40:44 pm
-
So, I'm making my Shin Megami Tensei spin-off and I get to a road block.
Currently, I am making the Persona screen where you can see the status and skills of all the Persona you currently embody.
The enemy stats are stored in a complex list consisting of one complex number and one real integer.
{1.5+5.1i, 1 -> L1
L1(1->A
L1(2->D
For(X,1,5
DelVar B
If X=1
int(imag(Ai->B
If X=2
10fPart(imag(Ai->B
If X=3
int(imag(A->B
If X=4
10fPart(imag(A->B
7X+7(X>1)+7(X>3->C
Text(C,79,B
End
Apparently, the above code gives out an ERR: ARGUMENT.
Comments? Corrections? CURES, maybe?
-
Hmmm, I can't can't get it to misbehave on my calculator... Where are you getting the error?
-
Oh, I forgot a part.
After the X=4 condition, type:
If X=5
D->B
It happens when this code is evaluated.
-
Aha, well, since D is an imaginary number, it will throw an error if plugged into the Text( command. Note that if there is a single imaginary number in a list, it turns the entire list into imaginary numbers, even if they have no imaginary part to them
The fix? Throw an imag( in there at the right place.
-
You, sir, are a lifesaver.
And, now we know.
TI-BASIC is a sneaky little devil.
EDIT: Also, do you know if making the entire If statement thing into a boolean algorithm will make the game faster or is it just a waste of time?
-
EDIT BUMP DOUBLE POST SORRY WANT PEOPLE TO SEE THIS EDIT NOT SPAM.
-
oh, actually, on Simplemachines/SMF forum system, if you edit your post and it's the very last post of a topic, this topic will be marked as unread. Else, what I sometimes do is copy my post, delete it then repost it with the edit. It bumps it up. Double posting is fine if there has been several hours between two posts, though
-
Oh. Really?
Didn't know that.
-
Yeah I just discovered it like a few months ago, when Iambian edited one of his posts I alerady read
I think most people are going to dinner soon, though, including myself, so it will most likely take a while before someone notices the edit x.x
-
Lol. All right then. Thanks in advance.
-
I actually think Boolean statements would make this less memory efficient O.O for the If X=#, that has 5 bytes worth of info:
1:Newline
2:If
3:X
4:=
5:#
but if we were to combine this into a single line with Boolean expressions, not only would we now need to close most parenthesis, but the Boolean expression would take up equal space
(X=#) has 5 bytes as well, but in Boolean expression, you need to close all the parenthesis in each expression except the last
-
But, is it FASTER?
-
I think it depends... If converting it into Boolean gets too wordy, it will actually drag them down. Sometimes, If statement is easier and sometimes faster... You just have to test them out through the speed indicator in the upper right hand corner... I usually go by the one where it takes less memory, hoping that it makes the program run faster :P
-
Of course it all depends if the programmer wants to optimize for size or for speed. I personally often go for the latter, unless the speed increase is not signifiant enough to justify a size increase
-
layer
Do you mean, the 'latter'? :P
-
lol yeah just edited my post, sorry for the typo XD
-
In any case, I will probably stop all the mystery and making a project thread soon. Be ready...
FOR THE MAGIC. *flourishes hands*
-
I hope you don't give up. A lot of projects tends to die very fast :(
-
Well, you also need to take into account when you actually need speed. In some scenarios, an increase in speed, however significant, does not pose any advantage. This is particularly applicable in menus :)