Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Candle on Thu 17/11/2005 23:02:22

Title: Change image on mouse press
Post by: Candle on Thu 17/11/2005 23:02:22
I have a keypad that will have an image so when you click on the keypad button it shows a diff image showing you pressed the button.
How could I Ã,  code itÃ,  ?I could do a mouseover but would like to do a keypress.

Image of keypad
(http://img209.imageshack.us/img209/9739/keypad6sz.th.png) (http://img209.imageshack.us/my.php?image=keypad6sz.png)

I think I got it, but this one error ? what do I have wrong?

Display("1.", btnPlay.PushedGraphic);

---------------------------
Compile Error
---------------------------
There was an error compiling your script. The problem was:

In: 'Room 73 script'



Error (line 14): undefined symbol 'btnPlay'

Title: Re: Change image on mouse press
Post by: SSH on Fri 18/11/2005 09:35:13
Is it a GUI or using hotspots?
Title: Re: Change image on mouse press
Post by: Candle on Fri 18/11/2005 09:37:43
Is using hotspots with images .
Title: Re: Change image on mouse press
Post by: Ashen on Fri 18/11/2005 10:40:20
On a general note, that line wouldn't actually do anything. Well, it'd display '1.', but it wouldn't change anything - the extra parameter (btnPlay.NormalGraphic) is useless.

I think you're using SSH's Keypad Module (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23566.0), right? So, I can't really help, not knowing how it works.

I'd guess, however, that it uses GUIs (hence the reference to btnPlay) and you don't want to (since you said so in the thread). You probably need to replace that line with one that changes the image of the object you're using instead, something like:

   oPlay.Graphic = 27; // where '27' is the spriteslot of the new image.

If you want more help, you'll have to post code (or wait for someone who knows more about the module).

Oh, and if you are using SSH's module, could you edit your title - or at least the first post - to say so?
Title: Re: Change image on mouse press
Post by: PyroMonkey on Fri 18/11/2005 13:18:37
You might have to reference the module in the function you're using or something, in the () after the function command, but I haven't used modules yet so I wouldn't know.
Title: Re: Change image on mouse press
Post by: Candle on Fri 18/11/2005 20:24:30
I just went with the images staying on so thanks anyways.