Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: Raylin on November 02, 2009, 04:40:44 pm

Title: Ugh. ERR: ARGUMENT.
Post 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.

Code: [Select]
{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?
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Builderboy on November 02, 2009, 05:06:26 pm
Hmmm, I can't can't get it to misbehave on my calculator...  Where are you getting the error?
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Raylin on November 02, 2009, 05:09:12 pm
Oh, I forgot a part.
After the X=4 condition, type:

Code: [Select]
If X=5
D->B

It happens when this code is evaluated.
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Builderboy on November 02, 2009, 05:26:46 pm
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.
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Raylin on November 02, 2009, 05:28:49 pm
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?
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Raylin on November 02, 2009, 05:40:45 pm
EDIT BUMP DOUBLE POST SORRY WANT PEOPLE TO SEE THIS EDIT NOT SPAM.
Title: Re: Ugh. ERR: ARGUMENT.
Post by: DJ Omnimaga on November 02, 2009, 05:43:55 pm
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
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Raylin on November 02, 2009, 05:44:55 pm
Oh. Really?
Didn't know that.
Title: Re: Ugh. ERR: ARGUMENT.
Post by: DJ Omnimaga on November 02, 2009, 05:45:53 pm
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
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Raylin on November 02, 2009, 05:47:36 pm
Lol. All right then. Thanks in advance.
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Builderboy on November 02, 2009, 06:46:04 pm
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
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Raylin on November 02, 2009, 06:50:15 pm
But, is it FASTER?
Title: Re: Ugh. ERR: ARGUMENT.
Post by: jsj795 on November 02, 2009, 08:28:17 pm
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
Title: Re: Ugh. ERR: ARGUMENT.
Post by: DJ Omnimaga on November 02, 2009, 08:49:29 pm
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
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Raylin on November 02, 2009, 08:50:41 pm
Quote
layer

Do you mean, the 'latter'? :P
Title: Re: Ugh. ERR: ARGUMENT.
Post by: DJ Omnimaga on November 02, 2009, 08:51:17 pm
lol yeah just edited my post, sorry for the typo XD
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Raylin on November 02, 2009, 08:54:23 pm
In any case, I will probably stop all the mystery and making a project thread soon. Be ready...

FOR THE MAGIC. *flourishes hands*
Title: Re: Ugh. ERR: ARGUMENT.
Post by: DJ Omnimaga on November 02, 2009, 08:58:48 pm
I hope you don't give up. A lot of projects tends to die very fast :(
Title: Re: Ugh. ERR: ARGUMENT.
Post by: Builderboy on November 02, 2009, 11:50:13 pm
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 :)