Jump to content



Photo
- - - - -

Argument Error With Matrices And If Clauses

argument error matrix if basic

  • Please log in to reply
3 replies to this topic

#1 Spyro543

Spyro543

    Newbie

  • Members
  • Pip
  • 9 posts
  • Gender:Male
  • Location:Ohio, US
  • Interests:C++, C, PIC18F processors, RPGs (yay), calculators, screwdrivers, and cows. Moo.

  • Calculators:
    fx9750GII hacked to a fx9860GII
    TI-Nspire Non-Cas Touchpad w/ 84+ Keypad

Posted 22 March 2013 - 12:58 AM

First off, here's my code:
In The code, you'll see me writing [] and (). These correspond to the filled square character and the empty square character.
{7,21}->Dim Mat C
Fill(0, Mat C)
1->X
RanInt#(3,6)->Y
0->A
0->B
0->K
While X<22
Y+RanInt#(-1,1)->Y
If Y>7
Then 7->Y
IfEnd
If Y<2
Then 2->Y
IfEnd
Locate X,Y,"()"
1->Mat C[Y,X]
For Y+1->I to 7 Step 1
Locate X,I,"[]"
2->Mat C[Y,X]
Next
X+1->X
WhileEnd
Locate 1,2,"I"
9->Mat C[2,1]
1->X
2->Y
While K!=47
Locate 1,1,"()"
Locate 2,1,A
Locate 6,1,B
Locate 5,1,"[]"
If Mat C[Y+1,X]=0
Then Locate X,Y," "
0->Mat C[Y,X]
Y+1->Y
9->Mat C[Y,X]
Locate X,Y,"I"
IfEnd
Getkey->K
If K=38 And X>1 And Mat C[Y,X+1]=0
Then 0->Mat C[Y,X+1]
Locate X,Y," "
X+1->X
9->Mat C[Y,X]
Locate X,Y,"I"
IfEnd
If K=27 And X<27 And Mat C[Y,X-1]=0
Then 0->Mat C[Y,X-1]
Locate X,Y," "
X-1->X
9->Mat C[Y,X]
Locate X,Y,"I"
IfEnd
WhileEnd

I hand-typed this code while looking at my calc screen so if you see any weird typing mistakes just ignore them :P

This is a world generation program that I will be using for my secret project (even though it's not so secret, because you now see my source code :P)

I'm getting ARGUMENT ERROR at the line that says:
If K=27 And X<27 And Mat C[Y,X-1]=0

What is going on here? Everything should be OK...

Also, everything else works fine, the world generator and the player falling mechanism.

#2 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 22 March 2013 - 02:11 PM

Can you run the program, then go into run-mat mode and just type X, EXE, Y, EXE, and tell me the values of both?

Also, see if X ever gets below 2 or above 22. If it does, then X-1 will be out of range.

#3 Spyro543

Spyro543

    Newbie

  • Members
  • Pip
  • 9 posts
  • Gender:Male
  • Location:Ohio, US
  • Interests:C++, C, PIC18F processors, RPGs (yay), calculators, screwdrivers, and cows. Moo.

  • Calculators:
    fx9750GII hacked to a fx9860GII
    TI-Nspire Non-Cas Touchpad w/ 84+ Keypad

Posted 22 March 2013 - 05:11 PM

I actually solved the problem just an hour ago. I also added some (seeeeeecret) features :) you'll see a post about my project soon!

#4 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 22 March 2013 - 06:24 PM

I actually solved the problem just an hour ago. I also added some (seeeeeecret) features :) you'll see a post about my project soon!


Awesome, can't wait! :)



Also tagged with one or more of these keywords: argument, error, matrix, if, basic

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users