Sign in to follow this  
Followers 0
skilzrulz

How to declare a IniRead as a variable.

5 posts in this topic

I have been trying to declare this IniRead as a variable, but it doesn't even work, it doesn't read the values I put in the Ini File, I have no clue whatsoever what is wrong.

Dim $X1, $Y1, $X2, $Y2, $SPEED, $H, $M
$H = @HOUR
$M = @MIN
;Calculate the 'next hour'
If $H < 23 Then
  $H = $H + 1
Else
  $H = 0
EndIf

Do;<--- The loop begin.
;delay start
  Opt ("MouseClickDelay", 60000 + R4())
;delay end


 $X1 = IniRead("config.ini", "MiningPos", "X1", "81")
 $Y2 = IniRead("config.ini", "MiningPos","Y1", "593")
 $X2 = IniRead("config.ini", "MiningPos", "X2", "87")
 $Y2 = IniRead("config.ini", "MiningPos", "Y2", "452")
 $SPEED = IniRead("config.ini", "MiningPos", "SPEED", "5")


  
  MouseClickDrag("Left", ($X1 + R5()) , ($Y1 + R5()) , ($X2 + R5()) , ($Y2 + R5()) , _
  ($SPEED + R3()))
; I add the number that gets returned by R5(), when it is negative, adding a
; negative number is the same as subtracting.
Until ($H = @HOUR And $M >= @MIN);<--- The loop stops
;                                  when the 'next hour' arrive.

there is an excert from the code, but the problem is it doesn't read the values from the INI file, here is the INIFile

[MiningPos];Only edit these if you know what they are.
X1=81
Y1=593
X2=87
Y2=452
SPEED=5

uhh thanks if you can help me out with this problem, you guys have been 100% big help.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I have been trying to declare this IniRead as a variable, but it doesn't even work, it doesn't read the values I put in the Ini File, I have no clue whatsoever what is wrong.

Dim $X1, $Y1, $X2, $Y2, $SPEED, $H, $M
$H = @HOUR
$M = @MIN
;Calculate the 'next hour'
If $H < 23 Then
  $H = $H + 1
Else
  $H = 0
EndIf

Do;<--- The loop begin.
;delay start
  Opt ("MouseClickDelay", 60000 + R4())
;delay end
 $X1 = IniRead("config.ini", "MiningPos", "X1", "81")
 $Y2 = IniRead("config.ini", "MiningPos","Y1", "593")
 $X2 = IniRead("config.ini", "MiningPos", "X2", "87")
 $Y2 = IniRead("config.ini", "MiningPos", "Y2", "452")
 $SPEED = IniRead("config.ini", "MiningPos", "SPEED", "5")
  
  MouseClickDrag("Left", ($X1 + R5()) , ($Y1 + R5()) , ($X2 + R5()) , ($Y2 + R5()) , _
  ($SPEED + R3()))
; I add the number that gets returned by R5(), when it is negative, adding a
; negative number is the same as subtracting.
Until ($H = @HOUR And $M >= @MIN);<--- The loop stops
;                                  when the 'next hour' arrive.

there is an excert from the code, but the problem is it doesn't read the values from the INI file, here is the INIFile

[MiningPos];Only edit these if you know what they are.
X1=81
Y1=593
X2=87
Y2=452
SPEED=5

uhh thanks if you can help me out with this problem, you guys have been 100% big help.

<{POST_SNAPBACK}>

Is config.ini in your script's home directory? If not then you need to put the full path to this file. How do you know that it isn't finding the file if your defualt values are the same as the ones in your configuration file? Are you getting an error? If so you need to post this error in your threads before anyone can help you b/c I do not know what kind of problems I am looking for in your script without an error to go off of or proff that it doesn't work as coded.

*** Matt @ MPCS

ADDITION:

Note: Your topic heading makes no sense whatsoever... you do not declare functions as variables. You can call a function and you can declare a variable. You can even declare a variable that contains the result of a function... but in no circumstance do you ever declare a function as a variable.

Edited by Matt @ MPCS

Share this post


Link to post
Share on other sites

It's not getting an error, the problem is that it doesn't grab that coorinate that's in the INI file, and yes it's in the bot's folder. Any suggestions?

Share this post


Link to post
Share on other sites

It's not getting an error, the problem is that it doesn't grab that coorinate that's in the INI file, and yes it's in the bot's folder. Any suggestions?

<{POST_SNAPBACK}>

What makes you think it isn't working? If your defualt return setting is the same as the setting from the file there will never be a return other than whatever that number is. Prove to me that you think there is something wrong. Your syntax is clean so it has to be something you think you are doing wrong that isn't actually wrong.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Do you have AIM or MSN. please, please contact me.

AIM: o0odakotao0o

MSN: o69dakota69o-hotmail-com

Edited by skilzrulz

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  
Followers 0