Sign in to follow this  
Followers 0
xxaviarxx

Control inputs to numbers decimals and negatives?? -probably solved-

3 posts in this topic

#1 ·  Posted (edited)

Is there a good quick way of making input locations read only decimals numbers and possibly negative symbols? I am making a calculator of sorts to check the prices of guild items for my guild members. The guild members will type in the stats such as Strength Dexterity Endurance etc (based on class and type of item) of the item and either (haven't figured which one I like better) read only input boxes will display the price of the item or labels will display the price.

I did some searching and Melba's script showed up from 5 years ago, so I was wondering if there is a better way to do this in the newer versions. 

I have taken into consideration these rules and believe that a calculator is not in violation of the rules as it does not do anything even remotely close to the following rules. If you would like to see the code I have written so far to double check please check the spoiler (if it made the spoiler correctly) at the bottom of the post. Also if you see any better ways of doing parts of my code please let me know. I am more than willing to improve the structure etc of the code when and where possible.

Automation of software/sites contrary to their EULA (see Reporting bullet below)

Launching, automation or script interaction with games or game servers, regardless of the game.

Running or injecting any code (in any form) intended to alter the original functionality of another process.

 

 

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$PriceChecker = GUICreate("Price Checker", 519, 450, 192, 114)
$Tab1 = GUICtrlCreateTab(2, 4, 513, 441)
$VALUE = GUICtrlCreateTabItem("Price Checker")
$STR = GUICtrlCreateLabel("Strength", 14, 54, 82, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$DEX = GUICtrlCreateLabel("Dexterity", 14, 96, 85, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$END = GUICtrlCreateLabel("Endurance", 14, 138, 107, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$INT = GUICtrlCreateLabel("Intelligence", 14, 180, 112, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$SPR = GUICtrlCreateLabel("Spirit", 14, 222, 51, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$StrInput = GUICtrlCreateInput("0", 166, 54, 41, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetFont($StrInput, 8, 400, 0, "Arial")
$DexInput = GUICtrlCreateInput("0", 166, 96, 41, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetFont($DexInput, 8, 400, 0, "Arial")
$EndInput = GUICtrlCreateInput("0", 166, 138, 41, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetFont($EndInput, 8, 400, 0, "Arial")
$IntInput = GUICtrlCreateInput("0", 166, 180, 41, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetFont($IntInput, 8, 400, 0, "Arial")
$SprInput = GUICtrlCreateInput("0", 166, 222, 41, 22, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetFont($SprInput, 8, 400, 0, "Arial")
$ClassSelector = GUICtrlCreateCombo("", 318, 54, 145, 25, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE))
GUICtrlSetData($ClassSelector, "--- Select A Class ---|Jewelry|Gladiator|Knight|Wizard|Warlock|Guardian|Holy Knight|Ranger|Sharp Shooter|Reaper|Spectre", "--- Select A Class ---")
GUICtrlSetFont($ClassSelector, 8, 400, 0, "Arial")
$GearSelector = GUICtrlCreateCombo("", 318, 93, 145, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Ring|Necklace|Earring|Weapon|Shield|Shield Skin|Aura|Badge", "--- Select A Gear Type ---")
GUICtrlSetFont($GearSelector, 8, 400, 0, "Arial")
$Group1 = GUICtrlCreateGroup("", 318, 221, 145, 73)
GUICtrlSetFont($Group1, 8, 400, 0, "Arial")
$Buy = GUICtrlCreateRadio("Buy From GS", 326, 237, 121, 17)
GUICtrlSetState($Buy, $GUI_CHECKED)
GUICtrlSetFont($Buy, 12, 800, 0, "Arial")
$Sell = GUICtrlCreateRadio("Sell To GS", 326, 261, 113, 17)
GUICtrlSetFont($Sell, 12, 800, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$RP = GUICtrlCreateLabel("Raid Points", 14, 397, 130, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$RPOUTPUT = GUICtrlCreateInput("0", 198, 397, 41, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_READONLY))
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xD4D0C8)
$SSP = GUICtrlCreateLabel("Soulstone Points", 270, 397, 162, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$SSPOUTPUT = GUICtrlCreateInput("0", 454, 397, 41, 22, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_READONLY))
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xD4D0C8)
$Enchanted = GUICtrlCreateCheckbox("Enchanted", 318, 134, 113, 17)
GUICtrlSetFont($Enchanted, 12, 800, 0, "Arial")
$EnchantedList = GUICtrlCreateCombo("", 318, 173, 145, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Weapon|Shield", "--- Select A Gear Type ---")
GUICtrlSetFont($EnchantedList, 8, 400, 0, "Arial")
GUICtrlSetState($EnchantedList, $GUI_DISABLE)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ClassSelector
            Global $Choice = GUICtrlRead($ClassSelector)
            Switch $Choice
                Case "--- Select A Class ---"
                    SelectClass()
                Case "Jewelry"
                    Jewelry()
                Case "Gladiator"
                    Gladiator()
                Case "Knight"
                    Knight()
                Case "Wizard"
                    Wizard()
                Case "Warlock"
                    Warlock()
                Case "Guardian"
                    Guardian()
                Case "Holy Knight"
                    HolyKnight()
                Case "Ranger"
                    Ranger()
                Case "Sharp Shooter"
                    SharpShooter()
                Case "Reaper"
                    Reaper()
                Case "Spectre"
                    Spectre()
            EndSwitch
        Case $Enchanted
            Switch GUICtrlRead($Enchanted)
                Case $GUI_CHECKED
                    GUICtrlSetState($EnchantedList, $GUI_ENABLE)
                    GUICtrlSetState($GearSelector, $GUI_DISABLE)
                    If Not ($Choice = "Jewelry") Then
                        GUICtrlSetData($GearSelector, "--- Select A Gear Type ---")
                    ElseIf ($Choice = "Jewelry") Then
                        GUICtrlSetData($GearSelector, "--- Select Jewelry Type ---")
                    EndIf
                Case $GUI_UNCHECKED
                    GUICtrlSetState($EnchantedList, $GUI_DISABLE)
                    GUICtrlSetState($GearSelector, $GUI_ENABLE)
                    If Not ($Choice = "Jewelry") Then
                        GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---")
                    ElseIf ($Choice = "Jewelry") Then
                        GUICtrlSetData($EnchantedList, "--- Select Jewelry Type ---")
                    EndIf
            EndSwitch
    EndSwitch
WEnd

Func SelectClass()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Ring|Necklace|Earring|Weapon|Shield|Shield Skin|Aura|Badge", "--- Select A Gear Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Weapon|Shield", "--- Select A Gear Type ---")
EndFunc   ;==>SelectClass

Func Jewelry()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select Jewelry Type ---|Ring|Necklace|Earring", "--- Select Jewelry Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select Jewelry Type ---|No Data Found", "--- Select Jewelry Type ---")
EndFunc   ;==>Jewelry

Func Gladiator()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Karen Axe|Canyon Axe|NQ Axe|DP Axe|Aura|Badge", "--- Select A Gear Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Axe", "--- Select A Gear Type ---")
EndFunc   ;==>Gladiator

Func Knight()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Karen 1h|Karen 2h|Karen Shield|Canyon 1h|Canyon 2h|Canyon Shield|NQ 1h|NQ 2h|NQ Shield|DP 1h|DP 2h|DP Shield|Ice Shield|Fire Shield|Virgil Shield|Aura|Badge", "--- Select A Gear Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|1h Sword|2h Sword|Shield", "--- Select A Gear Type ---")
EndFunc   ;==>Knight

Func Wizard()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Karen Staff|Canyon Staff|NQ Staff|DP Staff|Aura|Badge", "--- Select A Gear Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Staff", "--- Select A Gear Type ---")
EndFunc   ;==>Wizard

Func Warlock()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Karen Wand|Canyon Wand|NQ Wand|DP Wand|Aura|Badge", "--- Select A Gear Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Wand", "--- Select A Gear Type ---")
EndFunc   ;==>Warlock

Func Guardian()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Karen Hammer|Karen Shield|Canyon Hammer|Canyon Shield|NQ Hammer|NQ Shield|DP Hammer|DP Shield|Ice Shield|Fire Shield|Virgil Shield|Aura|Badge", "--- Select A Gear Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Hammer|Shield", "--- Select A Gear Type ---")
EndFunc   ;==>Guardian

Func HolyKnight()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Karen Mace|Karen Shield|Canyon Mace|Canyon Shield|NQ Mace|NQ Shield|DP Mace|DP Shield|Ice Shield|Fire Shield|Virgil Shield|Aura|Badge", "--- Select A Gear Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Mace|Shield", "--- Select A Gear Type ---")
EndFunc   ;==>HolyKnight

Func Ranger()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Karen Crossbow|Canyon Crossbow|NQ CrossBow|DP Crossbow|Aura|Badge", "--- Select A Gear Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Crossbow", "--- Select A Gear Type ---")
EndFunc   ;==>Ranger

Func SharpShooter()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Karen Bow|Canyon Bow|NQ Bow|DP Bow|Aura|Badge", "--- Select A Gear Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Bow", "--- Select A Gear Type ---")
EndFunc   ;==>SharpShooter

Func Reaper()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Karen Claws|Canyon Claws|NQ Claws|DP Claws|Aura|Badge", "--- Select A Gear Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Claws", "--- Select A Gear Type ---")
EndFunc   ;==>Reaper

Func Spectre()
    GUICtrlSetData($GearSelector, "")
    GUICtrlSetData($GearSelector, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Karen Dual Swords|Canyon Dual Swords|NQ Dual Swords|DP Dual Swords|Aura|Badge", "--- Select A Gear Type ---")
    GUICtrlSetData($EnchantedList, "")
    GUICtrlSetData($EnchantedList, "--- Select A Gear Type ---|Hat|Shirt|Pants|Boots|Dual Swords", "--- Select A Gear Type ---")
EndFunc   ;==>Spectre

 

Edited by xxaviarxx

Share this post


Link to post
Share on other sites



Is there a good quick way of making input locations read only decimals numbers and possibly negative symbols?

 

Share this post


Link to post
Share on other sites

 

I figured another way around this, as in my case only the outputs would have a possible of decimals, I am just making labels that change based on the stats inputed. If I knew how to use a UDF properly inside of another script, which i could look at the example you provided in that post, and If I need it in the future I will more thank likely use it. Thank you for this post as it will more than likely help me sometime in the future.

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