Jump to content

Variable Error (Subscript used on non-accessible variable)


Puls3
 Share

Recommended Posts

Hi, This is my first post on the AutoIt Forums, I most of the time was able to get help from this community by merely searching though google and have been able to solve hundreds of problems this way, though in this case I was incapable of finding a solution to my problem. I am quite confident that it is a user error (And my fault) but I haven't been able to determine what I did wrong, any and all help would be greatly appreciated! I have uploaded my whole script pardon passwords to provide as much information as possible.

I declared a global array at the top of the script and am having issues when I try to set it's value, and I fail to understand why.

Error Message:

"D:\Projects\AutoIt\Arena\Base.au3" (270) : ==> Subscript used on non-accessible variable.:
$ExpMax[$i] = IniRead($TempSavePath, "Combatant" & $i, "ExpMax", $ExpMax[0])
$ExpMax^ ERROR

ConsoleWrite Log:

Ran.
Checking launch parameters.
No launch parameters.
Initiating load.
Checking for save file.
Save file not found.
Load canceled.
Loading or creating Combatant 1

Base.au3

Edited by Puls3
added code

No, I'm not making a bot, keylogger, password stealer, virus, or anything else malicious, there are over a million different reasons someone would ask for whatever I did. Yes, I need to figure out the answer to the exact question I asked because I have valid reasons as to why I'm not using the alternatives. No, I cannot prove I'm not doing anything malicious because this is a forum and that is impossible.

Thank you AutoIt community for always accusing people of doing something evil, good day.

 - The Infamous Impulsive Puls3

Link to comment
Share on other sites

  • Moderators

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team

Edited by Melba23
See below

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Locked Post Misunderstanding:

My post was locked due to it being about game automation, this was 100% a misunderstanding and I would like to clearly state that I am creating a UI based game of my own inside AutoIt and Autoit only, all code of the game so far is inside the posted script, It cannot be about game automation if the game is written inside AutoIt (And written by me) as it would be a game feature and not automation. I already read the rules and found no way to appeal a locked post due to a misunderstanding so I apologize if I should have taken another action instead of re-posting with an explanation, though this forum really should add the ability to appeal locked posts. The "Game" is merely a simulation of a fight between two simulated fighters and as you can see in the script does not interact with any outside information besides the save files created by the script.

 

Edited by Puls3
removed code

No, I'm not making a bot, keylogger, password stealer, virus, or anything else malicious, there are over a million different reasons someone would ask for whatever I did. Yes, I need to figure out the answer to the exact question I asked because I have valid reasons as to why I'm not using the alternatives. No, I cannot prove I'm not doing anything malicious because this is a forum and that is impossible.

Thank you AutoIt community for always accusing people of doing something evil, good day.

 - The Infamous Impulsive Puls3

Link to comment
Share on other sites

  • Moderators

Puls3,

Quote

Locked Post Misunderstanding:

My post was locked due to it being about game automation, this was 100% a misunderstanding and I would like to clearly state that I am creating a UI based game of my own inside AutoIt and Autoit only, all code of the game so far is inside the posted script, It cannot be about game automation if the game is written inside AutoIt (And written by me) as it would be a game feature and not automation. I already read the rules and found no way to appeal a locked post due to a misunderstanding so I apologize if I should have taken another action instead of re-posting with an explanation, though this forum really should add the ability to appeal locked posts.

Thread unlocked - but it would have helped if you had stated all of that in the OP. And all you have to do to appeal is send me a PM - but no harm done.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I discovered what I was doing wrong on my own, It was a simple error that I had missed.

Func Defaults()
    $Name[0] = "Combatant"
    $Level[0] = 1
    $Exp[0] = 0
    $ExpMax = 20; <---
    $Dead[0] = 0
    $Health[0] = 20
    $HealthMax[0] = 20
    $Attack[0] = 1
    $Defense[0] = 1
EndFunc

 

I turned it from an array into a simple variable as I forgot to add a "[0]" to the end, and so $ExpMax[$i], no matter what number was put into it, would not exist as it was no longer an array.

No, I'm not making a bot, keylogger, password stealer, virus, or anything else malicious, there are over a million different reasons someone would ask for whatever I did. Yes, I need to figure out the answer to the exact question I asked because I have valid reasons as to why I'm not using the alternatives. No, I cannot prove I'm not doing anything malicious because this is a forum and that is impossible.

Thank you AutoIt community for always accusing people of doing something evil, good day.

 - The Infamous Impulsive Puls3

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

×
×
  • Create New...