Jump to content
Sign in to follow this  
kcd-clan

Arrays?

Recommended Posts

There's no need for the Dim inside the loop - that tries to recreate the array each time.

What are you trying to do exactly? Where did $x_val come from? Why are you trying to turn an integer into an array?

Share this post


Link to post
Share on other sites

D:\desk\autoit\pong\main.au3 (14) : ==> Expected a "=" operator in assignment statement.:

$x_val[$i] = " "

; Varables
Global $x_val=75
Global $y_val=75
Global $x_offset=0
Global $y_offset=0
Global $i=0
; Inclusion
#include <Array.au3>
; Main Functions
Func setboard()
For $i=0 To $i=$x_val
    $x_val[$i] = " "
If $i = 20 Then $i = "O"
    $out = $x_val[$i]
Next
    ToolTip($out,$x_offset,$y_offset)
EndFunc
Edited by kcd-clan

Visit mEMy programs made.Iul - IulG-V Console - G-V Console_RandomLetter - _RandomLetter()Saftey Kill - Saftey Killcolorzone() = colorzone()

Share this post


Link to post
Share on other sites

maybe

; Inclusion
#include <Array.au3>

; Varables
Global $x_va1[21]
Global $x_val = 75
Global $y_val = 75
Global $x_offset = 0
Global $y_offset = 0
Global $i = 0

; Main Functions
Func setboard()
    For $i = 0 To $x_val
        $x_va1[$i] = " "
        If $i = 20 Then $i = "O"
        $out = $x_va1[$i]
        ToolTip($out, $x_offset, $y_offset)
    Next
    
EndFunc ;==>setboard

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Sorry to butt in, but

Global $x_va1[21]

Global $x_val = 75

^^ They are not the same though they look the same..

The first one has the number one (1) at the end while the other has the letter "l"

#)

edit: Typo (that>has)

Edited by nfwu

Share this post


Link to post
Share on other sites

Sorry to butt in, but

Global $x_va1[21]

Global $x_val = 75

^^ They are not the same though they look the same..

The first one has the number one (1) at the end while the other has the letter "l"

#)

edit: Typo (that>has)

They REALLY look the same.

Still, that's some ugly code for more than just that reason. If you set $i to be something while it's looping, the loop never ends. If it were to get past the part where $i is set to o, then it would be out of bounds because $x_val is 75 and the max index of $x_va1 is 20....

I'm starting to think I really don't know what's going on here - the code isn't really understandable and I still can't tell what he's trying to do.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...