Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: De-Communizer on Sun 09/11/2008 17:26:03

Title: [SOLVED] Changing the graphic of a button...
Post by: De-Communizer on Sun 09/11/2008 17:26:03
I've got a GUI (modified from the existing Statusline), and on it is a button (btnPortrait) which is intended to change depending on which character the player is using, with a global int variable "whoisplayer". The way I've got it set up at the moment is:

if (whoisplayer = 1) {
  btnportrait.NormalGraphic = 74;
  }

As far I thought, it should have set the button to look like sprite 74, when the int was 1. When trying to compile, it complains about a "parse error in expr near 'whoisplayer'". I've little doubt this is something to do with a deificiency of my understanding about how scripts work, but cana anyone tell me where I'm going wrong?

Much obliged!
Title: Re: Changing the graphic of a button...
Post by: DoorKnobHandle on Sun 09/11/2008 17:30:47
It should be:


if ( whoisplayer == 1 )


Apart from that it should work if you put it in the right place (and whoisplayer is a correct variable).
Title: Re: Changing the graphic of a button...
Post by: De-Communizer on Sun 09/11/2008 17:39:27
Ah, so it was just a stupid mistake on my part. Thanks!
Title: Re: [SOLVED] Changing the graphic of a button...
Post by: Trent R on Sun 09/11/2008 18:39:48
Even though the issue solved, I have to ask why use a global variable? Why not "if (player==cJohn)" ?


~Trent