RAMMRODD Posted December 4, 2008 Posted December 4, 2008 (edited) I'm trying to make a Myspace Mobsters Information program. Basically you make money you buy property for x amount of dollars, and that property gives you x amount of hourly income based on how good it is. The thing I'm having a hard time with is once the user inputs values, having a submit function that then (in the same gui) spits out results. Example: Input your data Vacant lots [input box for the number] Seaside Lots [input box for number] [submit] once submit is hit I want it to say Input your data Vacant lots [input box for the number] your hourly income from Vacant lots is $XXX Seaside Lots [input box for number] your hourly income from Seaside lots is $XXX submitting the input to output the results is what I'd like (well having it instantly update as the numbers change would be perfect :-) ) I can create the gui and have it say the first part (without output) but I cant seem to get it to add the output to the gui expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> HotKeySet("{g}", "getinfo") func getinfo() GuiCreate("Sample GUI", 400, 400) $submit=GUICtrlCreateButton("Submit", 10, 30, 100) $num_vac=GUICtrlCreateInput("2", 10, 10, 50, 20) $Button_1=0 ;$num_store ;$num_plaza ;$num_seaside ;_______cost_____________ $vac_cost=5000+(500*$num_vac) ;$store_cost=50000+(5000*$num_store) ;$plaza_cost=1000000+(100000*$num_plaza) ;$seaside_cost=4000000+(400000*$num_seaside) ;___________income__________________ $vac_in=100*$num_vac ;$store_in=300*$num_store ;$plaza_in=2000*$num_plaza ;$seaside_in=8000*$num_seaside While 1 $msg = GUIGetMsg() Select Case $msg = $Button_1 GUICtrlCreateLabel("Vacant Lot Income = " , 10, 10, 150, 20) EndSelect WEnd endfunc GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd I only wrote about the vacant lot and seaside lot but my script (if you can even call it a script XD ) lists all of the property that will eventually be in it just have them comment'd out. Any advice would be great, I know its probably in a nasty format, but thats what I've came up with from the help file and examples Thanks EDIT I got this working a little better, but I keep getting an error saying I'm using $num_vac without declaring it....am I missing something? expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> _Main() ;_________Vacant Lots $vac_cost $num_vac=0 $vac_cost=5000+(500*$num_vac) $vac_in=100*$num_vac ;_____Empty Storefront $num_store=0 $store_cost=50000+(5000*$num_store) $store_in=300*$num_store ;__________Plaza $num_plaza=0 $plaza_cost=1000000+(100000*$num_plaza) $plaza_in=2000*$num_plaza ;_________________Seaside Lot $num_seaside=0 $seaside_cost=4000000+(400000*$num_seaside) $seaside_in=8000*$num_seaside $output Func _Main() $vac_in=100*$num_vac GuiCreate("Sample GUI", 500, 200) GUICtrlCreateLabel("Vacant Lots = " , 10, 20, 150, 20) GUICtrlCreateLabel("Empty Storefronts= " , 10, 40, 150, 20) GUICtrlCreateLabel("Plazas= " , 10, 60, 150, 20) GUICtrlCreateLabel("Seaside Lots = " , 10, 80, 150, 20) GUICtrlCreateLabel("Income" , 186, 5, 150, 20) GUICtrlCreateLabel("Cost per $1" , 256, 5, 150, 20) $num_vac=GUICtrlCreateInput ("0", 120,20, 20, 20) $num_store=GUICtrlCreateInput ("0", 120,40, 20, 20) $num_plaza=GUICtrlCreateInput ("0", 120,60, 20, 20) $num_seaside=GUICtrlCreateInput ("0", 120,80, 20, 20) $submit=GUICtrlCreateButton("Submit", 200, 150, 100) GUISetState() Do $msg = GUIGetMsg() Select Case $msg = $submit $output=GUICtrlCreateLabel($vac_in, 200, 20, 100, 20) GUICtrlCreateLabel(5 ,200, 40, 150, 20) GUICtrlCreateLabel(5 ,200, 60, 200, 20) GUICtrlCreateLabel(5 ,200, 80, 250, 20) GUICtrlCreateLabel(5 ,280, 20, 150, 20) GUICtrlCreateLabel(5 ,280, 40, 150, 20) GUICtrlCreateLabel(5 ,280, 60, 200, 20) GUICtrlCreateLabel(5 ,280, 80, 250, 20) EndSelect Until $msg = $GUI_EVENT_CLOSE While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit endfunc Edited December 4, 2008 by RAMMRODD
RAMMRODD Posted December 5, 2008 Author Posted December 5, 2008 If I need to explain better I will lol. Basically I want to have a label say "How many vacant lots do you have?" have an input box for the number of vacant lots. Then behind the scenes add the number to a formula to output numbers based on the formula to the right of the original number.....hope that helped...maybe not.
Rental Posted December 5, 2008 Posted December 5, 2008 do the _main() call after all the variables, it runs _main() before the $num_vac variable is even called
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now