Jump to content

Defining a variable with a 2D array -> Error in expression?


ddr4lyfe
 Share

Recommended Posts

I'm trying to add a row to a 2D array if a searched for value is not found in said 2D array. I'm using a temp 2D array to place the values that will be added into the 2D array, but when trying to add those values to a variable I error out, stating there's an error in my expression. Below is all of the relevant code as well as the error I'm receiving:

#include <Array.au3>
#include <MsgBoxConstants.au3>

Global $playersArray[10][3]
Local $addArray[1][3]
;ConsoleWrite ("Searching for " & $pName & @CRLF)
Local $foundViewer = _ArraySearch ($playersArray, "rossy__", 0, 0, 0, 0, 1, 0)
If $foundViewer == -1 Then
   ConsoleWrite ("ArraySearch Error: " & @error & @CRLF)
   $addArray = [["rossy__", 1000, 0]]
   _ArrayDisplay ($addArray, "Array to add")
   $addPlayer = _ArrayAdd ($playersArray, $addArray)
   If $addPlayer >= -1 Then
      ConsoleWrite ("Added " & $pName & " to the array" & @CRLF & @CRLF)
   Else
   ConsoleWrite ("Add error: " & @error & @CRLF & @CRLF)
   EndIf
   @error = 0
   $foundViewer = 0
Else
   ConsoleWrite ($pName & " has already joined!" & @CRLF)
EndIf
_ArraySort ($playersArray, 1, 0)
ConsoleWrite ("$playersArray sorted" & @CRLF & @CRLF)
_ArrayDisplay ($playersArray, "Current players")

 

>"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:UsersUserDesktoparrayex2.au3"    

ArraySearch Error: 6
"C:UsersUserDesktoparrayex2.au3" (10) : ==> Error in expression.:
$addArray = [["rossy__", 1000, 0]]
$addArray = ^ ERROR
>Exit code: 1    Time: 0.047

 

As far as I can tell everything is fine, but apparently not?

Link to comment
Share on other sites

ddr4lyfe,

This appears to be game related.  Please see the forum rules in my sig.  If you can explain how this is not in violation of these rules you will get some help.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

ddr4lyfe,

This appears to be game related.  Please see the forum rules in my sig.  If you can explain how this is not in violation of these rules you will get some help.

kylomas

 

It's for an IRC bot that will take bets from users for the bot's guessing game and reward those who guess correctly with equal shares of the total amount bet. So while I suppose it is game related, it's all within the bot and .au3 files and doesn't interact with any published games, offline or online.

Is that what you're looking for?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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