Jump to content

Array troubles (solved, thanks)


Nevin
 Share

Recommended Posts

I don't know what the hell I'm doing wrong here, but check this out. Run it like this and you get an error, comment the line I marked and it works fine.

Dim $IPermIn[65] ;extra element for array length at [0]
;Dim $Temp[64] declared below instead
Dim $Temp2[64]

$Input = inputbox("Input","64 bit binary string to encrypt:",""," M64",425,120)
if @error <> 0 Then
    msgbox(48,"Exiting program","Bad Input")
    Exit
EndIf

If StringregExp($Input,"[^01]") Then
    MsgBox(48,"Exiting program","Non-binary input detected.")
    Exit
EndIf

if Stringlen($Input) <> 64 Then
    Msgbox(48,"Exiting program","Input was too short")
    Exit
EndIf

$IPermIn = StringSplit($Input,"") ;Splits the input into an array of characters.  Element 0 is the number of characters returned, NOT the first character.

Dim $Temp[64] = [$IPermIn[40],$IPermIn[8],$IPermIn[48],$IPermIn[16],$IPermIn[56],$IPermIn[24],$IPermIn[64],$IPermIn[32],$IPermIn[39],$IPermIn[7],$IPermIn[47],$IPermIn[15],$IPermIn[55],$IPermIn[23],$IPermIn[63],$IPermIn[31],$IPermIn[38],$IPermIn[6],$IPermIn[46],$IPermIn[14],$IPermIn[54],$IPermIn[22],$IPermIn[62],$IPermIn[30],$IPermIn[37],$IPermIn[5],$IPermIn[45],$IPermIn[13],$IPermIn[53],$IPermIn[21],$IPermIn[61],$IPermIn[29],$IPermIn[36],$IPermIn[4],$IPermIn[44],$IPermIn[12],$IPermIn[52],$IPermIn[20],$IPermIn[60],$IPermIn[28],$IPermIn[35],$IPermIn[3],$IPermIn[43],$IPermIn[11],$IPermIn[51],$IPermIn[19],$IPermIn[59],$IPermIn[27],$IPermIn[34],$IPermIn[2],$IPermIn[42],$IPermIn[9],$IPermIn[50],$IPermIn[18],$IPermIn[58],$IPermIn[26],$IPermIn[33],$IPermIn[1],$IPermIn[41],$IPermIn[8],$IPermIn[49],$IPermIn[17],$IPermIn[57],$IPermIn[25]]

$Temp = $Temp2
;COMMENT THE ABOVE LINE

msgbox(0,"IPermIn",$IPermIn[5])
msgbox(0,"Temp",$Temp[5])

It seems like if you make a copy of this array, it is no longer an array. Weird, eh?

Edited by Nevin
Link to comment
Share on other sites

Didn't you want to switch this

$Temp2 = $Temp ???

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

and now I feel incredibly stupid.

Nice :)

Okay, no problem here. Thats what support forum is for.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...