Jump to content
Sign in to follow this  
Khryus

What's wrong with this?

Recommended Posts

Khryus

Func loadAccountsData()

if FileExists("accs.txt") and FileExists("pwds.txt") Then

$MaxAccs=5

Local $usrs[$MaxAccs]

Local $pwds[$MaxAccs]

Local $acc=FileOpen("accs.txt")

Local $pwd=FileOpen("pwds.txt")

For $i=1 To $MaxAccs Step 1

$usrs[$i] = FileReadLine($acc, $i)

$pwds[$i] = FileReadLine($pwd, $i)

Next

For $i=1 To $MaxAccs Step 1

GUICtrlSetData($UsernamesList, $usrs[$i]&"|")

GUICtrlSetData($PasswordsList, $pwds[$i]&"|")

Next

Else

MsgBox(16, "error", "Either accounts or password files weren't found.")

EndIf

EndFunc

I'm getting this error when I run the script via the SCiTE editor:

C:\Workspace\newgui.au3 (138) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$usrs[$i] = FileReadLine($acc, $i)

^ ERROR

$UsernamesList and $PassowrdsList are lists created earlier


"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
water

The array $usrs has 5 elements numbered from 0 to 4. You try to access elements 1 to 5 in your loop. Your script crashes when you try to access the non existant element 5.

Change the loop statement to "For $i=0 To $MaxAccs-1"

There is a very good tutorial explaining arrays in the wiki.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Khryus

Thanks, it works now :oops:


"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
water
:oops:

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Khryus

I have another problem:

Local $usrs[$MaxAccs]

Local $pwds[$MaxAccs]

I declared MaxAccs earlier, at the very start of the script. I want to use the one I declared at the top, not the one I'm forced to put inside the function.

Forced because if I remove that, it tells me that the variable $MaxAccs doesn't exist. I tried adding Global before $MaxAccs, but it still gives me the error. How can I fix?

This is the error I'm talking about: C:Workspacenewgui.au3 (130) : ==> Variable used without being declared.:

Edited by megablox

"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
water

What error do you get?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Khryus

C:Workspacenewgui.au3 (130) : ==> Variable used without being declared.:

I typed that in an edit


"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
water

Then there is either a typo in the variable declaration or you declare the variable AFTER calling the function.

Could you post the code where you define the variable and where you call the function?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Khryus

line 89 (after koda's gui generation bit) ;

Global $MaxAccs=5

more code down here

line 128;

Func loadAccountsData()
   if FileExists("C:\Program Files (x86)\Blackout RO Bot\dir\accs.txt") and FileExists("C:\Program Files (x86)\Blackout RO Bot\dir\pwds.txt") Then
      Local $usrs[$MaxAccs]
      Local $pwds[$MaxAccs]
      $acc=FileOpen("C:\Program Files (x86)\Blackout RO Bot\dir\accs.txt")
      $pwd=FileOpen("C:\Program Files (x86)\Blackout RO Bot\dir\pwds.txt")
      For $i=0 To $MaxAccs-1 Step 1
         $usrs[$i] = FileReadLine($acc, $i)
         $pwds[$i] = FileReadLine($pwd, $i)
      Next
      For $i=0 To $MaxAccs-1 Step 1
         GUICtrlSetData($UsernamesList, $usrs[$i]&"|")
         GUICtrlSetData($PasswordsList, $pwds[$i]&"|")
      Next
   Else
      MsgBox(16, "bRO - Devotion:error", "Either accounts or password files weren't found.")
   EndIf
EndFunc
Edited by megablox

"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
water

Is the semicolon in your code?

; Global $MaxAccs=5

If it is then this statement is a comment and hence the variable is not defined.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Khryus

No, there's no semicolon :<


"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
water

I have to leave now but will have a look at your code later!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Khryus

Okay, thanks. I'll just take a break then.Bye!

Edited by megablox

"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
JLogan3o13

Hi, megablox. Can you give some more info on the app, that may be part of your issue. I see Blackout RO Bot in your program files. Is this for Ragnarok online, or is it something else?


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
water

@JLogan3o13

Good point.

@megablox

I hope you've read the forum rules, if not you can find them here. Make sure you read the part regarding games thoroughly.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Khryus

@water Yes, I know I can't do bots. This is just a simple auto-login macro, nothing else. I am not that skilled to make a bot.

@JLogan Yes, this is related to Ragnarok Online.

What I was doing here is create a GUI, then have it automatically load the usernames and passwords from a list, then you would choose the account you wanted to log with and click a button, then the login process would automate.

That's all, but it doesn't seem to work :oops:


"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites
water

The forum rules include this sentence:

"SPAM tools including instant messenger or forum auto-posters. This includes forum or site auto-login methods."

I emphasized the important part relating to this thread.

I'm not sure how a Mod sees it but I fear this thread will soon be locked.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Melba23

megablox,

This is just a simple auto-login macro

Yes, this is related to Ragnarok Online

So you break the Forum Rules on 2 counts. Make sure you read and understand them before you post again. :oops:

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

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×