[SOLVED] Changing the graphic of a button...

Started by De-Communizer, Sun 09/11/2008 17:26:03

Previous topic - Next topic

De-Communizer

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!

DoorKnobHandle

It should be:

Code: ags

if ( whoisplayer == 1 )


Apart from that it should work if you put it in the right place (and whoisplayer is a correct variable).

De-Communizer

Ah, so it was just a stupid mistake on my part. Thanks!

Trent R

Even though the issue solved, I have to ask why use a global variable? Why not "if (player==cJohn)" ?


~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

SMF spam blocked by CleanTalk