Variable not showing the value/variable is blank [Solved]

Ask gaming related questions (AHK v1.1 and older)
User avatar
SnowFlake
Posts: 368
Joined: 28 Apr 2015, 05:41
Contact:

Variable not showing the value/variable is blank [Solved]

04 Dec 2015, 07:37

Hello

So i have this script that does different things depending on the name/string in the DropDownList, for example if it says "Maple" then set the Xp = 13 and walk right 5 times but if if the DropDownListsays Spirit" then set the Xp = 22 and walk right 3 times

but the problem is that it doesn't show up in the GUI/in the "XP gained tab"


Problem Area:
Gui Add, DropDownList, x8 y24 w120 vTree_type, Fir|Cactus|Oak|Willow|Maple|Spirit|Blue Palm|Magic Oak

GuiControlGet, Tree_type2,, Tree_type

IF (Tree_type2 = "Maple")
{
XP += 897
}

LV_Modify(1,,,,,,,XP "/" XP*2)


Full code:

Code: Select all

/* 
Script name: RPG MO Wood Bot
Made by: FloowSnaake
Autohotkey version: 1.1.22.07
Tested on: Windows 7 64 Bit Ultimate and Windows 8 32 Bit
Date: 12/11/2015
 
 
This is what you NEED to do for the bot to work!
((
 
How to use/run Script:
1) Download Autohotkey (http://ahkscript.org/download/ahk-install.exe).
2) Install Autohotkey 64 or 32 Bits.
3) Copy the Code.
4) Paste it in to notepad or any other text editor you use-
5) Save it as sand "RPG MO Wood Bot.ahk".
6) Double click at "RPG MO Wood Bot.ahk".
7) Now its running, you should see a small icon with a Spade on it in the corner of the Taskbar/Startbar.
8) Now when its running you should see a GUI/ a window on the screen.
9) You have to have be in Reval and standing at (9, 34).
10) Select what option you want to run/bot. 
 
You need the Steam version Or Client version/Downlad
Mods or Keybindings that HAVE to be on/right before starting the bot
 
Mods that need to be ON:
Enhanced Market
Keybinding Extensions
Pet Inventory
Chest Inventory
Miscellaneous Improvments
 
Keybindings:
   E = Deposit All+ in chest
   X = Unload pet inventory
   C = Load pet inventory
    
   Q =Toggle inventory
   Z = Withdraw 1 or ALL
    
    
   Game Options ---> Video:
   Smoother Layout = Off
   Game size = (2.25x)
   Fullscreen = Off
    
   ))
    
    
   RPG MO Wood Bot Hotkeys:
   F1 or Escape = Exit script.
   
*/
    
   #SingleInstance force
   SetWorkingDir, %A_ScriptDir%
    
    
   CoordMode, Mouse, client
   CoordMode, Pixel, client
   CoordMode, Tooltip, client
    
   DetectHiddenText, On
   OnExit, Quit
   Blank =
    
   Global price
   Global Funcy_Price
   Global Checkt
   Global Petbox
   Global Debug_Mod
   Global Alarm
   Global Drop_Crystal
   Global SandC
   Global SandS
   Global total
   Global loops
   Global XP
   Global Sell_Sand_time
   Global loops
   Global Fast
   Global Normal
   Global Slow
   Global Anounce_Sell
   Global Runs
   Global Account1
   Global Account2
   Global Acc2
   Global Blank
   Global Game_Path_Dir
    
   IfExist,RPG MO Wood Bot.ini
   {
      FileReadLine,Read_Acc1,RPG MO Wood Bot.ini,1
      FileReadLine,Read_Acc2,RPG MO Wood Bot.ini,2
      FileReadLine,Read_GamePath,RPG MO Wood Bot.ini,3
      FileReadLine,Read_StartKey,RPG MO Wood Bot.ini,4
      Hotkey,%Read_StartKey%,Botkey
       
      Account1 = %Read_Acc1%
      Account2 = %Read_Acc2%
      Game_Path_Dir = %Read_GamePath%
   }
    
   IfNOTExist,RPG MO Wood Bot.ini
   {
      Gui, Start: Add, Text, w110 h20,Account 1:
      Gui, Start: Add, Edit, w100 h20 vAcc1, Account name
       
      Gui, Start: Add, Text, w110 h20,Account 2:
      Gui, Start: Add, Edit,Disabled w100 h20 vAcc2,DISABLED
       
      
      Gui, Start: Add, Text, w110 h20 ,Bot Start Hotkey:
      Gui, Start: Add, Hotkey, w70 h20 vStartKey,^T
       
      Gui, Start: Add, Text, w110 h20,RPG MO Path
      Gui, Start: Add, Edit, w100 h20 vGame_Path,
      Gui, Start: Add, Button,gBrowse,Browse
      Gui, Start: Add, Button,gsave, Save
       
      Gui, Start: Show,, Settings
      return
       
      save:
      Gui, Start: Submit
      FileAppend,%Acc1%`n%Acc2%`n%Game%`n%StartKey%,RPG MO Wood Bot.ini
      Reload
      return
       
      Browse:
      FileSelectFile, Game, 3, , Select RPG MO exe, RPG MO Client (*.exe)
      if Game =
      MsgBox,You user didn't select the game!
      else
         GuiControl,,Game_Path,%Game%
      return
   }
    

Gui Add, Text, x10 y6 w52 h13, Tree Type:
Gui Add, DropDownList, x8 y24 w120 vTree_type, Fir|Cactus|Oak|Willow|Maple|Spirit|Blue Palm|Magic Oak
Gui Add, CheckBox, x224 y24 w90 h20 vDebug_Mod, Debug Mode
Gui Add, CheckBox, x144 y24 w70 h20 vPetbox, Have Pet
Gui Add, CheckBox, x328 y24 w110 h20 vDrop_Crystal, Alarm on Capatcha
Gui Add, Text, x448 y24 w110 h20, Wood Sell Price:
Gui Add, Edit, x528 y24 w30 h20 vprice, 200
Gui Add, Text, x752 y24 w99 h20, Sell Wood every run:
Gui Add, Edit, x856 y24 w30 h20  vSell_Sand_time, 20
Gui Add, CheckBox, x568 y24 w170 h20 Checked vAnounce_Sell, Announce selling in Trade Chat
Gui, Add, ListView,grid  x8 y56 w950 h62 ,Account|Runs|Status|Wood Cut|Profit|XP Gained
  
  LV_ModifyCol(1, 100) , LV_ModifyCol(2, 0) , LV_ModifyCol(2, 40) , LV_ModifyCol(3, 255) , LV_ModifyCol(4, 85) , LV_ModifyCol(5, 70) , LV_ModifyCol(6,80), LV_Add(1,"","","","","","","","","") , LV_Add(2,"","","","","","","","","") , LV_Modify(1,,Account1,0,"Bot Not Started",0,0,0,0,0,0)  , LV_Modify(2,,Account2,"-","DISABLED","-","-","-","-","-","-")
  
Gui Add, Button, x8 y136 w90 h23 gStart_Bot, Run to Stash
Gui Add, Button, x112 y136 w90 h23 gStartRPG, Start RPG MO
Gui Add, Link, x216 y136 w71 h13, <a href="http://www.mpgh.net/forum/showthread.php?t=1051017">Bot Homepage</a>
Gui Add, Button, x300 y136 w100 h30, Config Walking Path

GuiControl,Choose,Tree_type2,Fir
  
Gui Show, w967 h172, RPG MO Wood Bot
    
   WinActivate,ahk_exe RPG MO.exe
   WinMove, ahk_exe RPG MO.exe,,,,854,480
return
 
GuiClose:
   ExitApp
    
   StartRPG:
   Run, %Game_Path_Dir%
return
 
 
BotKey:
   Start_Bot:
   Gui, Submit ,NoHide
   GuiControlGet, Tree_type2,, Tree_type 
   
   WinActivate,ahk_exe RPG MO.exe
   WinMove, ahk_exe RPG MO.exe,,,,854,480
    
   LV_Modify(1,,,,"Bot Started")
    
   Gui, Submit ,NoHide
    
   GuiControl, Disable,Anounce_Sell
   GuiControl, Disable,Sell_Sand_time
   GuiControl, Disable, Start RPG MO
   GuiControl, Disable, Run to Stash
   GuiControl, Disable, Walk_Speed
   GuiControl, Disable, price
   GuiControl, Disable, PetBox
   GuiControl, Disable, Alarm
   GuiControl, Disable, Drop_Crystal
   GuiControl, Disable, Debug_Mod
    
   WinActivate,RPG MO - Early Access
   WinActivate,RPG MO - Web Browser Game
    
   IF (Alarm = 1)
   {
      PixelGetcolor, Capatcha, 278, 156
      IfEqual, Capatcha, 0x333333, {
         SoundBeep,,2000
         WinActivate,RPG MO - Early Access
         WinActivate,RPG MO - Web Browser Game
         MsgBox, 20528, CAPATCHA WARNING!, CAPATCHA WARNING!
      }}
    
      
   IF (Petbox = 1)
   {
      PixelGetcolor, Empty_Pet_Inv, 830,346
      IfNOTEqual, Empty_Pet_Inv, 0x3F4243, {
         LV_Modify(1,,,,"Pet Inventory is Full")
         Sleep, 300
         Digg_And_Stash()
      }
       
      LV_Modify(1,,,,"Pet Inventory is Empty")
      Click 795,375
      Sleep 300
      Send, {Left 2} 
      LV_Modify(1,,,,"Pet Inventory is Full")
       
       
      Loop
      {
         LV_Modify(1,,,,"Waiting on Inventory to be Full")
         Sleep, 4000
         PixelGetcolor, Player_Full_Sand,829, 215
         IfEqual, Player_Full_Sand, 0xA4D1E1, {
            LV_Modify(1,,,,Account1 "Inventory is Full")
            Sleep, 300
            break
         }}}
   Digg_And_Stash()
return
 
Digg_And_Stash(){
   Going2stash()
   Stash_All()
    
   IF (loops = Sell_Sand_time)
   {
      loops = 0
      Sell_sand(price)
      LV_Modify(1,,,,"Anouncing in trade chat")  
      IF (Anounce_Sell = 1)
      {
         Anounces("[SELL] " Tree_type2 " Full_INV "  " For price " ea )
         Sleep, 700
      }}
    
   Going2tree()
    
   GuiControl, Enable,Anounce_Sell
   GuiControl, Enable, Start RPG MO
   GuiControl, Enable, Run to Stash
   GuiControl, Enable, Walk_Speed
   GuiControl, Enable, price
   GuiControl, Enable, PetBox
   GuiControl, Enable, Alarm
   GuiControl, Enable, Drop_Crystal
   GuiControl, Enable, Debug_Mod
}
return
 
Sell_sand(Funcy_Price){
   LV_Modify(1,,,,"Selling " Tree_type2 " wood in the market for: " Funcy_Price )  
   Click,L,448,105
   Sleep, 1000
   Click,L,528,103
   Sleep, 1000
   Click,L,382,168
   Sleep, 1000
   Send {S}
   Sleep 700
   Send {Enter}
   Sleep 700
   Click,L,390,227
   Click 2
   send %Funcy_Price%
   Sleep 700
   Click,L,478,254
   Sleep, 1000
   Click,L,370,310
   Sleep, 1000
   LV_Modify(1,,,, Tree_type2 " wood sold in the market for: " Funcy_Price ) 
   Sleep 700
}
return
 
Going2tree(){
   LV_Modify(1,,,,"Going to " Tree_type2 " tree")  
   Sleep, 400
   
    IF (Tree_type2 = "Cactus")
   {
    K("Down","7")
   K("Right","1")
   K("Down","13")
   K("Left","8")
   }
   
   IF (Tree_type2 = "Maple")
  { 
   K("Down","7")
   K("Right","1")
   K("Down","10")
   K("Right","50")
   K("Up","10")
   K("Right","2")
   K("Up","8")
}

   LV_Modify(1,,,,"Cutting " Tree_type2 " tree")
   Sleep, 300
   loops+= 1
   Runs+= 1
   LV_Modify(1,,,Runs)
}
return
 
Going2stash(){
   LV_Modify(1,,,,"Going to Stash")
    
      Full_INV += 39
   
     IF (Tree_type2 = "Fir")
   {
      XP += 195
   }
     IF (Tree_type2 = "Cactus")
   {
      XP += 312
   }
     IF (Tree_type2 = "Oak")
   {
      XP += 507
}
     IF (Tree_type2 = "Willow")
   {
      XP += 702
}
     IF (Tree_type2 = "Maple")
   {
      XP += 897
}
     IF (Tree_type2 = "Spirit")
   {
      XP += 1170
}
     IF (Tree_type2 = "Blue Palm")
   {
      XP += 1755
}
     IF (Tree_type2 = "Magic Oak")
   {
      XP += 2145
   }
   
   LV_Modify(1,,,,,Full_INV)
   LV_Modify(1,,,,,,Full_INV*price "$") 
   LV_Modify(1,,,,,,,XP "/" XP*2)
    
   Sleep, 300
   
    IF (Tree_type2 = "Maple")
   {
     K("Down","7")
     K("Left","2")
     K("Down","3")
     K("Left","50")
     K("Up","10")
     K("Left","1")
     K("Up","7")
     K("Left","2")
     Sleep, 300
   }
   
    IF (Tree_type2 = "Cactus")
   {
   K("Right","5")
   K("Up","13")
   K("Left","1")
   K("Up","7")
   K("Left","2")
   Sleep, 300
}

}
return
 
Stash_All(){
   LV_Modify(1,,,,"Stashing Inventory")
   Sleep, 500
   send, {E Down}
   Sleep, 300
   send, {E Up}
   Sleep, 1000
    
   IF (Petbox = 1)
   {
      LV_Modify(1,,,,"Stashing Pets Inventory") 
      Click 831,374
      Sleep 500
      Click 831,374
       
      Sleep, 1000
      send, {E Down}
      Sleep, 300
      send, {E Up}
      Sleep, 2000
   }
   LV_Modify(1,,,, "Inventory Stashed")
}
return
 
Anounces(message){
   Sleep, 700
   send, {Enter}
   Sleep, 3000
   K("Up","3")
   Sleep, 3000
   SendRaw,%message%
   Sleep, 4000
   send, {Enter}
   Sleep, 3000
}
return
 
C(clc,x,y){
   Loop, %clc%
   {
      Click %x%, %y%   
      Click Down Left
      Sleep, 300   
      Click up Left
   }
}
return
 
 
K(key,times){
   Loop, %times%
   {
      Random,Sleepy,230,240
       
      IF (Debug_Mod = 1)
      {
         ToolTip,Walking: %key% Steps: %A_index% /  %times% /  %total%,0,0
      } 
       
      Send,{%key% Down}
      Sleep, %Sleepy%
      Send,{%key% Up}
      Sleep, 200
      total++
   }
   Sleep, 100
}
return
 
; For the walking speed
/*
K(key,times){
   Loop, %times%
   {
      Random,Sleepy,230,240 
       
      IF (Debug_Mod = 1)
      {
         ToolTip,Walking: %key% Steps: %A_index% /  %times% /  %total%,0,0
      } 
       
      Send,{%key% Down}
      Sleep, %Sleepy%
      Send,{%key% Up}
       
      IF (Walk_Speed = "Fast")
      {
         Sleep, 150
      }
       
      IF (Walk_Speed = "Normal")
      {
         Sleep, 200
      }
       
      IF (Walk_Speed = "Slow")
      {
         Sleep, 500
      }
      total++
   }
   Sleep, 100
}
return
*/
 
Esc::
   F1::
   ExitApp
return
 
Quit:
   send, {Up Up}
   send, {Down Up}
   send, {Right Up}
   send, {Left Up}
   ExitApp
return
Last edited by SnowFlake on 04 Dec 2015, 12:38, edited 1 time in total.
:yawn:
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Variable not showing the value/variable is blank

04 Dec 2015, 10:17

Include toward the top, above the Ifs, within the Going2stash() function a line to get GuiControlGet, Tree_type2,, Tree_type. I haven't tested the code at all though.
User avatar
SnowFlake
Posts: 368
Joined: 28 Apr 2015, 05:41
Contact:

Re: Variable not showing the value/variable is blank

04 Dec 2015, 12:36

Thank you i have now solved the problem ^^
:yawn:

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 46 guests