 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Fri Mar 21, 2008 2:32 pm Post subject: toggling images |
 |
|
|
|
some of the parameters in toggling images have me confused. especially paramters *id and *ons in Toggle() and ToggleSet(); Can anyone please clarify those for me? |
|
Back to top |
|
 |
Goldeye Novice
Gender: Joined: Dec 15 2003 Posts: 57 Offline
|
Posted: Fri Mar 21, 2008 3:48 pm Post subject: |
 |
|
|
|
void (*Toggle)(const Target *t, int id, int on); |
The target's obvious, though apparently passing an arena changes the defaults not the active state for everyone there. <shrug>
id is the object id, on is boolean for whether it's on or not. 1=on 0=off.
void (*ToggleSet)(const Target *t, short *id, char *ons, int size); |
This is a way of efficiently passing a lot of parameters to Toggle. Toggle probably would repeat stuff that only needs to be done once per target, so this way you can a set of objects without that inefficeincy.
id and ons are both arrays. size is the number of objects in that array.
Think of it (functionally, though the details inside are different, obv) as this:
void ToggleSet(const Target *t, short *id, char *ons, int size)
{
int i;
for(i=0;i<size;i++)
{
Toggle(t,id[i],ons[i]);
}
|
Example:
This code turns on objects 3 and 2 and turns 7 off.
short id = { 3, 7, 2 }
char ons = { 1, 0, 1}
size = 3;
objects->ToggleSet(t, id, ons, size);
|
|
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Fri Mar 21, 2008 3:55 pm Post subject: |
 |
|
|
|
Very nice example. I never realized the relation between id and ons. obviously they correspond. Thank You! |
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
|
Back to top |
|
 |
tcsoccerman Server Help Squatter
Age:33 Gender: Joined: Jan 15 2007 Posts: 694 Location: Atlantis Offline
|
Posted: Fri Mar 21, 2008 10:27 pm Post subject: |
 |
|
|
|
oh ok. |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 65 page(s) served in previous 5 minutes.
|