PDA

View Full Version : keydown in gui


Loakey_P2P
11-12-2006, 12:09 AM
so i started scripting a new inventory with the new gscript2 gui stuff but i came to a problem not far into it . it has a bar on the right side of the screen with button's in it for items,weapons,armor,spells,prizes,stats,pets, and options and another smaller bar for brief discriptions . but it wont change the discription on mouse overs . ive tryed several way's and none have worked yet , can anyone help ? im not sure if i should do it in the button or with a timeout useing "in x, y" . ill have to do mouse to do different window's later too for the window to disply all stat's , or a list of item's or weapons .

//#CLIENTSIDE
function onTimeOut(){
if(this.mode == 1){
DiscriptionText.show();
} else {
DiscriptionText.hide();
}
setTimer(0.05);
}

function onCreated(){
new GuiTextProfile(Inventory_TextProfile){fontColor = "0 0 0";}
new GuiWindowCtrl(MainInventoryWindow){
width = 150;
height = 600;
profile = "GuiWindowProfile";
x = screenwidth - 200;
y = screenheight - 650;
canResize = false;
canMove = false;
canClose = false;
canMinimize = false;
canMaximize = false;
destroyonhide = false;
visible = false;
text = "Inventory";
}
new GuiWindowCtrl(DiscriptionWindow){
width = 400;
height = 50;
profile = "GuiWindowProfile";
x = screenwidth - 800;
y = screenheight - 70;
canResize = false;
canMove = false;
canClose = false;
canMinimize = false;
canMaximize = false;
destroyonhide = false;
visible = false;
text = "Brief Discription";
}
new GuiTextCtrl(DiscriptionText){
profile = "GuiTextProfile";
x = screenwidth - 790;
y = screenheight - 45;
text = "*Info: " @ client.itemdiscription;
}
new GuiButtonCtrl(ItemButtonWindow){
width = 110;
height = 40;
profile = "GuiButtonProfile";
x = screenwidth - 180;
y = screenheight - 615;
visible = false;
text = "Items";
setstring client.itemdiscription,the item list;
}
new GuiButtonCtrl(WeaponButtonWindow){
width = 110;
height = 40;
profile = "GuiButtonProfile";
x = screenwidth - 180;
y = screenheight - 560;
visible = false;
text = "Weapons";
setstring client.itemdiscription,the weapon list;

}
new GuiButtonCtrl(ArmorButtonWindow){
width = 110;
height = 40;
profile = "GuiButtonProfile";
x = screenwidth - 180;
y = screenheight - 505;
visible = false;
text = "Armor";
}
new GuiButtonCtrl(ToolButtonWindow){
width = 110;
height = 40;
profile = "GuiButtonProfile";
x = screenwidth - 180;
y = screenheight - 450;
visible = false;
text = "Tools";
}
new GuiButtonCtrl(PrizeButtonWindow){
width = 110;
height = 40;
profile = "GuiButtonProfile";
x = screenwidth - 180;
y = screenheight - 395;
visible = false;
text = "Prizes";
}
new GuiButtonCtrl(SpellButtonWindow){
width = 110;
height = 40;
profile = "GuiButtonProfile";
x = screenwidth - 180;
y = screenheight - 340;
visible = false;
text = "Spell";
}
new GuiButtonCtrl(StatButtonWindow){
width = 110;
height = 40;
profile = "GuiButtonProfile";
x = screenwidth - 180;
y = screenheight - 285;
visible = false;
text = "Stats";
}
new GuiButtonCtrl(SkillButtonWindow){
width = 110;
height = 40;
profile = "GuiButtonProfile";
x = screenwidth - 180;
y = screenheight - 230;
visible = false;
text = "Skills";
}
new GuiButtonCtrl(PetButtonWindow){
width = 110;
height = 40;
profile = "GuiButtonProfile";
x = screenwidth - 180;
y = screenheight - 175;
visible = false;
text = "Pets";
}
new GuiButtonCtrl(OptionButtonWindow){
width = 110;
height = 40;
profile = "GuiButtonProfile";
x = screenwidth - 180;
y = screenheight - 120;
visible = false;
text = "Options";
}
setTimer(0.05);
}

function onKeypressed(){
switch(params[1]){
case "q":
this.mode = 1 - this.mode;
if(this.mode == 1){
MainInventoryWindow.show();
DiscriptionWindow.show();
ItemButtonWindow.show();
WeaponButtonWindow.show();
ArmorButtonWindow.show();
ToolButtonWindow.show();
PrizeButtonWindow.show();
SpellButtonWindow.show();
StatButtonWindow.show();
SkillButtonWindow.show();
PetButtonWindow.show();
OptionButtonWindow.show();
} else {
MainInventoryWindow.hide();
DiscriptionWindow.hide();
DiscriptionText.hide();
ItemButtonWindow.hide();
WeaponButtonWindow.hide();
ArmorButtonWindow.hide();
ToolButtonWindow.hide();
PrizeButtonWindow.hide();
SpellButtonWindow.hide();
StatButtonWindow.hide();
SkillButtonWindow.hide();
PetButtonWindow.hide();
OptionButtonWindow.hide();
}
break;
}
}

coreys
11-12-2006, 12:48 AM
okay..first of all you don't have to do that many hide and shows...o___o

just hide or show the parent.

Chompy
11-12-2006, 01:03 AM
in that script, there are no parent as I see..

Loakey_P2P
11-12-2006, 04:01 PM
okay..first of all you don't have to do that many hide and shows...o___o

just hide or show the parent.

yea , i can understand that but i wasnt sure if it would still be able to tell a different set of height or width or other part's to each button . but that wasnt my question . my question concerned the clicking of each button to set a string or open a different window for each on . i remmber seeing some command on the wikipidia site several day's ago but im not sure if it's the one im looking for . it was some kind of action command . i noticed it already has a built in if clicked , highlight button command but i need to figure out how to make it do thing's when the button is pressed . ill add an image to show what it look's like thus far .

http://www.geocities.com/mysticalninja420/newinventory.png

Chompy
11-12-2006, 04:40 PM
Loakey, if you made a bitmap for the GUIs it would look realy cool :p
(So they fit the GUI displaying HP, MP etc..)

Admins
11-12-2006, 05:16 PM
Add the buttons to the window, then you just need to show/hide the window instead of showing/hiding each individual button:

new GuiWindowCtrl(DiscriptionWindow){
new GuiButtonCtrl(ItemButtonWindow){
}
...
}


To display the description of the button when you move the mouse over it, use the hint-attribute, like

new GuiButtonCtrl(ItemButtonWindow){
hint = "This is the item button";
}


To react to the button click, use the onAction-event:

function ItemButtonWindow.onAction() {
...
}

Loakey_P2P
11-12-2006, 06:55 PM
ight , sounds simple enough . thank's stefan :)

Chompy
11-12-2006, 07:03 PM
new GuiControlProfile(profile_name){
...
bitmap = "imagename.png";
}
new GuiWindowCtrl(window_gui){
profile = profile_name;
...
}

too make a new profile with an bitmap :]
also, check out http://wiki.graal.net/index.php/Creation/Dev/Script/Client/GuiControlProfile
for use of GuiControlProfile()

Loakey_P2P
11-13-2006, 03:00 PM
well for the longest time sl has had some kind of personal made gui or inventory . what im attempting to do is to make a inventory and gui from the basic image's stefan and graal so graciously provided in the "graal/levels3d/gui" folder . its just my opion but there realy isnt anything gained in person images and out or the ordinary scripting . sometimes something really good looking and well working comes out , but not too often .

this last atempt to restore sl was not just to finish but to also upgrade everything and try to simplify it at the same time . to reconstuct the server and better organize it , make it all work at it's best but also make it so nothing takes a rocket scientist to figure out and do . also we talked to some oldbies to get a better understanding of what sl was ment to be in the begining . which isnt where sl was going . so were gona try to make sl more what it was intended to be while incorperateing what everone spent so long on .

i got the actions to work but now i have a new issue , when they click a button a window open's display the weapon's or item's they have . but if they go to a different section i need to make the last place opened close before the new section open's . here's what i tryed just off the top of my head so yes i know its wrong .

function ItemButtonWindow.onAction(){
@ client.lastclicked @ ListWindow.hide();
sleep("0.01");
ItemListWindow.show();
DiscriptionWindow.show();
DiscriptionText.show();
client.lastclicked = "Item";
}

i just need to know how to make the hide command use a client string to define the prefix of the command . but im not even sure if it's possable .

Chompy
11-13-2006, 06:15 PM
(@ client.lastclicked @ "ListWindow").hide();
or
(@ client.lastclicked @ "ListWindow").destroy();
something like that?

Loakey_P2P
06-04-2009, 11:11 PM
well for the longest time sl has had some kind of personal made gui or inventory . what im attempting to do is to make a inventory and gui from the basic image's stefan and graal so graciously provided in the "graal/levels3d/gui" folder . its just my opion but there realy isnt anything gained in person images and out or the ordinary scripting . sometimes something really good looking and well working comes out , but not too often .

this last atempt to restore sl was not just to finish but to also upgrade everything and try to simplify it at the same time . to reconstuct the server and better organize it , make it all work at it's best but also make it so nothing takes a rocket scientist to figure out and do . also we talked to some oldbies to get a better understanding of what sl was ment to be in the begining . which isnt where sl was going . so were gona try to make sl more what it was intended to be while incorperateing what everone spent so long on .

i got the actions to work but now i have a new issue , when they click a button a window open's display the weapon's or item's they have . but if they go to a different section i need to make the last place opened close before the new section open's . here's what i tryed just off the top of my head so yes i know its wrong .

function ItemButtonWindow.onAction(){
@ client.lastclicked @ ListWindow.hide();
sleep("0.01");
ItemListWindow.show();
DiscriptionWindow.show();
DiscriptionText.show();
client.lastclicked = "Item";
}

i just need to know how to make the hide command use a client string to define the prefix of the command . but im not even sure if it's possable .

holy s*** . i have no idea what i was talking about back then .

Gambet
06-05-2009, 12:03 AM
holy s*** . i have no idea what i was talking about back then .


Did that honestly warrant you reviving a thread that is nearly 3 years old?

Pelikano
06-05-2009, 07:03 PM
Did that honestly warrant you reviving a thread that is nearly 3 years old?

I really don't think so

Crow
06-05-2009, 07:04 PM
I really don't think so

Then again, you weren't asked.