Jump to content
Sign in to follow this  
danthe0

Need help with Function - Select - INIRead features :(

Recommended Posts

danthe0

I seem to be having problems with INIRead and < operators, it only reads up to certain values as set in the INI file, particularly the 1st digit it encounters (i.e. 1 from 100, 4 from 40, 3 from 25 (why is it rounded?))

Here is what I have :

HotKeySet("{ESC}","suspend")
HotKeySet("{numpad0}","ADDSTAT")
HotKeySet("{numpad1}","RESET")
$ini = "C:\Temp\Temp.ini"
Dim $str = IniRead($ini,"Stats","strlast","0"),$dex = IniRead($ini,"Stats","dexlast","0")
Dim $strset = IniRead($ini,"Stats","strlimit","0"),$dexset = IniRead($ini,"Stats","dexlimit","0")

Func ADDSTAT()
$str = IniRead($ini,"Stats","strlast","0")
$dex = IniRead($ini,"Stats","dexlast","0")
$strset = IniRead($ini,"Stats","strlimit","0")
$dexset = IniRead($ini,"Stats","dexlimit","0")
Select
    Case $str < $strset
        ConsoleWrite("strlimit "&$str+1&@LF)
        IniWrite($ini,"Stats","strlast",$str+1)
        Send("Increase Strength")
        Send("{ENTER}")
    Case $dex < $dexset
        ConsoleWrite("dexlimit "&$dex+1&@LF)
        IniWrite($ini,"Stats","dexlast",$dex+1)
        Send("Increase Dexterity")
        Send("{ENTER}")
    Case Else
EndSelect
If $str = $strset And $dex = $dexset Then
    ConsoleWrite("TRUE")
    IniWrite($ini,"Stats","strlast","0")
    IniWrite($ini,"Stats","dexlast","0")
EndIf
EndFunc

While 1
Sleep(1000)
WEnd
Func Suspend()
    Exit
EndFunc

Func RESET()
    IniWriteSection($ini, "Stats", "strlast=0"&@LF&"dexlast=0"&@LF&"strlimit=30"&@LF&"dexlimit=400")
EndFuncoÝ÷ Ù8^IÈ©Ýëh!8î²Û-¢-êÞjw`÷¬¶©®)í²ÚÙèµÊ'¶)îx.¦Ú'z+az½ôøÓH§uéí²Úåh­ÖËk)¢·k-®X¦Ý춹b+xuìeh­Õ×±)¢·g^ÆX¦ÝÝ{b+xuìeh­çø§uéíJ'^6^"¯y©l¢ÚâyÛ¬x(¶«ëa¡Û2zÛa{+-Y`j÷­ëêÞ²émNÙ¶"ëw¬N¬¶ j÷­ëêÞ²ém±«­¢+Ù]¡¥±Ä(ÀÌØíÍÑÈô%¹¥I ÀÌØí¥¹¤°ÅÕ½ÐíMÑÑÌÅÕ½Ðì°ÅÕ½ÐíÍÑɱÍÐÅÕ½Ðì°ÅÕ½ÐìÀÅÕ½Ðì¤(ÀÌØíÍÑÉÍÐô%¹¥I ÀÌØí¥¹¤°ÅÕ½ÐíMÑÑÌÅÕ½Ðì°ÅÕ½ÐíÍÑɱ¥µ¥ÐÅÕ½Ðì°ÅÕ½ÐìÀÅÕ½Ðì¤(%%ÀÌØíÍÑȱÐìÀÌØíÍÑÉÍÐQ¡¸($%M±À ÄÀÀÀ¤($%
½¹Í½±]É¥Ñ ÅÕ½ÐíÍÑÈÅÕ½ÐìµÀìÀÌØíÍÑȵÀí1¤(%¹%)]¹

*Second side note*; To activate, press num1, then continue with num0 num0 for results.

Thanks in advance, I hope this will be settled as soon as possible.

Edited by danthe0

Share this post


Link to post
Share on other sites
evilertoaster

perhaps it's a bug, i think the vairiants are suposed to realize they are numbers here but maybe not... either way you can use Number() to manually make them a number instead of a string.

I rewrote it abit when i was testing it but you can see what I did-

HotKeySet("{ESC}","suspend")
HotKeySet("{numpad0}","ADDSTAT")
HotKeySet("{numpad1}","RESET")
$ini = @ScriptDir &"\stats.ini"
$str = IniRead($ini,"Stats","strlast",0)
$dex = IniRead($ini,"Stats","dexlast",0)
$strset = IniRead($ini,"Stats","strlimit",0)
$dexset = IniRead($ini,"Stats","dexlimit",0)
Func ADDSTAT()
    $str = IniRead($ini,"Stats","strlast",0)
    $dex = IniRead($ini,"Stats","dexlast",0)
    $strset = IniRead($ini,"Stats","strlimit",0)
    $dexset = IniRead($ini,"Stats","dexlimit",0)
    MsgBox(0,"Debug 1","str="&$str&@CRLF&"dex="&$dex&@CRLF&"strset="&$strset&@CRLF&"dexset="&$dexset&@CRLF&"str<strset="&($str<$strset)&@CRLF&"dex<dexset="&($dex<$dexset))
    If Number($str) < Number($strset) then
            IniWrite($ini,"Stats","strlast",$str+1)
            MsgBox(0,"Debug 2",$str&"%"&$dex&"%"&$strset&"%"&$dexset)
    EndIf
    If Number($dex) < Number($dexset) Then
            IniWrite($ini,"Stats","dexlast",$dex+1)
            MsgBox(0,"Debug 3",$str&"%"&$dex&"%"&$strset&"%"&$dexset)
    EndIf
    If Number($str) = Number($strset) And Number($dex) = Number($dexset) Then
        IniWrite($ini,"Stats","strlast",0)
        IniWrite($ini,"Stats","dexlast",0)
    EndIf
EndFunc
While 1
    Sleep(1000)
WEnd
Func Suspend()
    Exit
EndFunc
Func RESET()
    IniWrite($ini,"Stats","strlast",0)
    IniWrite($ini,"Stats","strlimit",30)
    IniWrite($ini,"Stats","dexlast",0)
    IniWrite($ini,"Stats","dexlimit",400)
EndFunc
Edited by evilertoaster

Share this post


Link to post
Share on other sites
danthe0

Aye, thanks for that reply, the Number() function works great, it was just what I needed, thanks for your efforts in helping me in this minor problem. Currently doing more testing on it, will confirm soon.

Edit: It works like a charm, just missing a Number() there. Thanks again for what you did. *Off to bed now...*

Edited by danthe0

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  

×