Jump to content


Photo

Need help with GUI/script


  • Please log in to reply
4 replies to this topic

#1 Kazzy120

Kazzy120
  • Members
  • 14 posts

Posted 20 June 2012 - 11:38 AM

Okay so I am making an encyclopedia for an rpg universe for my friends to reference too when we are playing the game. I have everything seemingly functional, but the pictures that pop up that are sized for the window I made for it doesn't keep the picture in line. Which means it bleeds off of the gui completely. I have tried changing the size of the picture and the size of the picture area in the gui and it doesn't seem to work. Help Please.

width := A_ScreenWidth/1.5
height := A_ScreenHeight/1.5
pheight := height/1.5
pwidth := width/1.5
nheight := height/10
mheight := height/6
nwidth := width/4

gui,color, 3399CC
gui,color,, 3399CC
gui,font,000000

Gui, Add, Tab, x2 y2 w960 h590 ,Races|Jobs|Skills|Ships|Armor|Weapons|Ammo|Items|Places
Gui, Tab, Races
Gui, Add, ListBox, vrace grace x22 y42 w200 h520, Acor (Anthro Flying Squirel)|Aves (Anthro Bird)|Boggin(Anthro Badger)|Coggers (Gnomes)|Darten (Anthro Rabbit)|Erns (Anthro Moles)|Griph (Anthro Gryphin Hybrid)|Ingerii (Anthro Canine)|Malock (Anthro Dragon)|Miim (Anthro Mouse)|Sergs (Anthro Feline)|Tarnan (Human)
Gui, Add, Picture, x232 y40 w710 h380 vpic, 
Gui,add,edit,vdesc x227 y421 w853 h133 w%pwidth% h%mheight%

Gui, Tab, Jobs
Gui, Add, ListBox, vjob gjob x22 y42 w200 h520, Adventurer|Air Naval Officer|Air Naval Pilot|Alchemist|Boarder Jockey|Civillian Pilot|Electro Nut|Engineer|Gear Nut|Grease Monkey|Greasey Spoon|Gunner|Inventor|Mapper|Medic|Mercernary|Privateer|Scavenger|Scholar|Security
Gui, Add, Picture, x232 y40 w710 h380 vpict, 
Gui,add,edit,vdescr x227 y421 w853 h133 w%pwidth% h%mheight%

Gui, Tab, Skills
Gui, Add, ListBox, vskill gskill x22 y42 w200 h520, lol
Gui, Add, Picture, w%pwidth% h%pheight% x%nwidth% y%nheight% vpictu, 
Gui,add,edit,vdescri x227 y421 w853 h133 w%pwidth% h%mheight%

Gui, Tab, ships
Gui, Add, ListBox, vship gship x22 y42 w200 h520, lol
Gui, Add, Picture, w%pwidth% h%pheight% x%nwidth% y%nheight% vp, 
Gui,add,edit,vd x227 y421 w853 h133 w%pwidth% h%mheight%

Gui, Tab, Armor
Gui, Add, ListBox, varmor garmor x22 y42 w200 h520, lol
Gui, Add, Picture, w%pwidth% h%pheight% x%nwidth% y%nheight% vpi, 
Gui,add,edit,vde x227 y421 w853 h133 w%pwidth% h%mheight%

Gui, Tab, weapons
Gui, Add, ListBox, vweapon gweapon x22 y42 w200 h520, lol
Gui, Add, Picture, w%pwidth% h%pheight% x%nwidth% y%nheight% vpictur, 
Gui,add,edit,vdescrip x227 y421 w853 h133 w%pwidth% h%mheight%

Gui, Tab, ammo
Gui, Add, ListBox, vammo gammo x22 y42 w200 h520, lol
Gui, Add, Picture, w%pwidth% h%pheight% x%nwidth% y%nheight% vpicture, 
Gui,add,edit,vdescript x227 y421 w853 h133 w%pwidth% h%mheight%

Gui, Tab, items
Gui, Add, ListBox, vitem gitem x22 y42 w200 h520, lol
Gui, Add, Picture, w%pwidth% h%pheight% x%nwidth% y%nheight% vpictures, 
Gui,add,edit,vdescripti x227 y421 w853 h133 w%pwidth% h%mheight%

Gui, Tab, places
Gui, Add, ListBox, vplace gplace x22 y42 w200 h520, lol
Gui, Add, Picture, w%pwidth% h%pheight% x%nwidth% y%nheight% vpicturess, 
Gui,add,edit,vdescriptio x227 y421 w853 h133 w%pwidth% h%mheight%

Gui, Show, x171 y83 h595 w965, Age of Air Tome
Return

ship:
if A_GuiEvent = DoubleClick
{


gui,submit,nohide
GuiControl,, p,*w%pwidth% *h%pheight% %A_ScriptDir%\ships\pictures\%ship%.png
fileread,now,%A_ScriptDir%\ships\descriptions\%ship%.txt
GuiControl,, d, %now%


}
return
armor:
if A_GuiEvent = DoubleClick
{


gui,submit,nohide
GuiControl,, pi,*w%pwidth% *h%pheight% %A_ScriptDir%\armor\pictures\%armor%.png
fileread,now,%A_ScriptDir%\armor\descriptions\%armor%.txt
GuiControl,, de, %now%


}
return
race:
if A_GuiEvent = DoubleClick
{


gui,submit,nohide
GuiControl,, pic,*w%pwidth% *h%pheight% %A_ScriptDir%\races\pictures\%race%.png
fileread,now,%A_ScriptDir%\races\descriptions\%race%.txt
GuiControl,, desc, %now%


}
return
job:
if A_GuiEvent = DoubleClick
{


gui,submit,nohide
GuiControl,, pict,*w%pwidth% *h%pheight% %A_ScriptDir%\jobs\pictures\%job%.png
fileread,now,%A_ScriptDir%\jobs\descriptions\%job%.txt
GuiControl,, descr, %now%


}
return
skill:
if A_GuiEvent = DoubleClick
{


gui,submit,nohide
GuiControl,, pictu,*w%pwidth% *h%pheight% %A_ScriptDir%\skills\pictures\%skill%.png
fileread,now,%A_ScriptDir%\skills\descriptions\%skill%.txt
GuiControl,, descri, %now%


}
return
weapon:
if A_GuiEvent = DoubleClick
{


gui,submit,nohide
GuiControl,, pictur,*w%pwidth% *h%pheight% %A_ScriptDir%\weapons\pictures\%weapon%.png
fileread,now,%A_ScriptDir%\weapons\descriptions\%weapon%.txt
GuiControl,, descrip, %now%


}
return
ammo:
if A_GuiEvent = DoubleClick
{


gui,submit,nohide
GuiControl,, picture,*w%pwidth% *h%pheight% %A_ScriptDir%\ammo\pictures\%ammo%.png
fileread,now,%A_ScriptDir%\ammo\descriptions\%ammo%.txt
GuiControl,, descript, %now%


}
return
item:
if A_GuiEvent = DoubleClick
{


gui,submit,nohide
GuiControl,, pictures,*w%pwidth% *h%pheight% %A_ScriptDir%\items\pictures\%item%.png
fileread,now,%A_ScriptDir%\items\descriptions\%item%.txt
GuiControl,, descripti, %now%


}
return
place:
if A_GuiEvent = DoubleClick
{


gui,submit,nohide
GuiControl,, picturess,*w%pwidth% *h%pheight% %A_ScriptDir%\places\pictures\%place%.png
fileread,now,%A_ScriptDir%\places\descriptions\%place%.txt
GuiControl,, descriptio, %now%


}
return
GuiClose:
ExitApp

It is only partly complete, because I don't want to move on until I fix the picture where I want it to be. Thanks for any help.

#2 tomoe_uehara

tomoe_uehara
  • Members
  • 2073 posts

Posted 20 June 2012 - 12:06 PM

Try use w%pwidth% h-1

#3 Kazzy120

Kazzy120
  • Members
  • 14 posts

Posted 20 June 2012 - 12:19 PM

Fixed it! Thanks anyway. If you feel the script could be more efficient tell me.

I changed
gui,submit,nohide
GuiControl,, pic,*w%pwidth% *h%pheight% %A_ScriptDir%\races\pictures\%race%.png
fileread,now,%A_ScriptDir%\races\descriptions\%race%.txt
GuiControl,, desc, %now%

To

gui,submit,nohide
GuiControl,, pic,*w710 *h380 %A_ScriptDir%\races\pictures\%race%.png
fileread,now,%A_ScriptDir%\races\descriptions\%race%.txt
GuiControl,, desc, %now%

What does w%pwidth% h-1 do exactly even though I have fixed what was needed.

#4 tomoe_uehara

tomoe_uehara
  • Members
  • 2073 posts

Posted 20 June 2012 - 12:29 PM

You can make your GUI a lot compact by using Loop, but you have to complete the rest of your GUI first.
w%width% h-1 means the height will be locked, so if the original image is w=200 h=100, if you do w400 h-1, it's height will be (400/200)*100=200


#5 Kazzy120

Kazzy120
  • Members
  • 14 posts

Posted 21 June 2012 - 12:24 AM

Oh thanks So lets say I use w-1 will it be locked? I am not sure what you mean by looped. I literally learned all these basics by using the GUI creation thing that AHK supports and reading the help manual. I'll look up loop.