Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Icey on Thu 27/01/2011 21:53:30

Title: gui not working right
Post by: Icey on Thu 27/01/2011 21:53:30
I have a gui & its img acts like a key or a switch in the game. know at a point in the game the player must walk on a region that start the players to talk then they move to a certain spot.
//
if (player1.NormalGraphic == 10){
  Dave.Walk(825, 264, eBlock, eAnywhere);
 
}
if (player1.NormalGraphic == 45){
  chris.Walk(825, 264, eBlock, eAnywhere);
 
}
if (player1.NormalGraphic == 63){
  muffy.Walk(825, 264, eBlock, eAnywhere);
 
}
  if (player1.NormalGraphic == 73){
  tifa.Walk(825, 264, eBlock, eAnywhere);
 
}
//team mate

if (player2.NormalGraphic == 10){
  Dave.Walk(876, 302, eBlock, eAnywhere); 
}
  if (player2.NormalGraphic == 45){
  chris.Walk(876, 302, eBlock, eAnywhere);
 
}


  if (player2.NormalGraphic == 63){
  muffy.Walk(876, 302, eBlock, eAnywhere);
 
}
  if (player2.NormalGraphic == 73){
  tifa.Walk(876, 302, eBlock, eAnywhere);
 
}
//play commence sounds
Display("commence!");

//battle gui fade in

  }


The problem is is that the [team mate] section works but it seems to set muffy as the the selected team mate but tifa was set as the team mate before the battle.
Title: Re: gui not working right
Post by: Khris on Thu 27/01/2011 22:09:39
We can't really help you much with this. The code has no obvious error, I'd double check the slot numbers and try different combinations to see which ones fail.
Title: Re: gui not working right
Post by: Icey on Thu 27/01/2011 23:07:26
I could try that.
Title: Re: gui not working right
Post by: Icey on Fri 28/01/2011 20:50:35
BTW I dont know how to work slots and stuff. I found it in the Manuel(ddq) but I just dont know how to work it.
Title: Re: gui not working right
Post by: Icey on Fri 28/01/2011 21:33:47
NVM you just have to set the team mate before hand.
Title: Re: gui not working right
Post by: Khris on Sat 29/01/2011 19:03:02
A slot number is simply the sprite's number from the Sprite manager.
Title: Re: gui not working right
Post by: Icey on Sat 29/01/2011 23:49:13
ok. Also I had the commands for the team mates mixed up. It checked for tifa's pic and it told muffy to walk & the same goes for tifa. :)
Title: Re: gui not working right
Post by: monkey0506 on Sun 30/01/2011 22:24:13
You might be less likely to confuse yourself like that if you'd use more descriptive names like cTifa and cMuffy instead of player1 and player2.

You can always use the player keyword as a direct reference to the current player:

player.Walk(x, y); // and such

And if you need to check it then you do it just like you normally would any other value:

if (player == cTifa) { } // do something here?
Title: Re: gui not working right
Post by: Icey on Sun 30/01/2011 22:28:05
I see.

But player 1 & player 2 are just names for buttons in a gui. player1 stands for leader and player 2 stands for ally.
Title: Re: gui not working right
Post by: monkey0506 on Sun 30/01/2011 22:46:46
Duh..If I'd looked at your code for more than 1/2 of a nanosecond I might have realized that. I just saw the names of player1 and player2 and was wondering why you'd call them that.

For Button controls it's common convention to use a prefix like btn (i.e., btnTifa, btnMuffy). Some users prefer to use a single character prefix (like bTifa and bMuffy) instead, but that creates ambiguity in various cases (like between Labels and ListBoxes, or InventoryItems and InvWindows).

It's ultimately a matter of personal preference, but as I said in my previous post (albeit completely brain dead when it came to recognizing what actual type you were using..O_o), using more descriptive script names can help you out in finding logical errors in your code.
Title: Re: gui not working right
Post by: Icey on Sun 30/01/2011 22:58:09
I am saying I understand you.

But P1 & p2 are just buttons it's what's on them that counts in the game. there are not four buttons pacifically for tifa,muffy,chris, & dave. There is only two of the CATB(cross assault time battle)