Jump to content
Sign in to follow this  
kcd-clan

Arrays?

Recommended Posts

kcd-clan

Ok i need to do this

Create a array like this $n[$i]= " "

Well read the script you will see waht i wanan do..

For $i=0 To $i=$x_val
        $i+1
Dim $x_val[$i]=" "
Next

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
MadBoy

For $i=0 To $i=$x_val
    Dim $x_val[$i]=" "
Next

Should work..


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites
greenmachine

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
kcd-clan

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
Valuater

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
greenmachine

Uhh, you can't have an int variable and an array with the same name. Rename your variables to be unique and you'll be ok.

Share this post


Link to post
Share on other sites
nfwu

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
greenmachine

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
Valuater

neither did i guys.... i just fixed his syntax errors only

8)


NEWHeader1.png

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.