Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
toggling images

 
Post new topic   Reply to topic Printable version
 View previous topic  Accurate collisions Post :: Post Billing and billing_ssc?  View next topic  
Author Message
tcsoccerman
Server Help Squatter


Age:33
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Fri Mar 21, 2008 2:32 pm    Post subject: toggling images Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email AIM Address
Goldeye
Novice


Gender:Gender:Male
Joined: Dec 15 2003
Posts: 57
Offline

PostPosted: Fri Mar 21, 2008 3:48 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide
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.

Code: Show/Hide
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:
Code: Show/Hide

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.
Code: Show/Hide

short id = { 3, 7, 2 }
char ons = { 1, 0, 1}
size = 3;
objects->ToggleSet(t, id, ons, size);
Back to top
View users profile Send private message Add User to Ignore List Send email
tcsoccerman
Server Help Squatter


Age:33
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Fri Mar 21, 2008 3:55 pm    Post subject: Reply to topic Reply with quote

Very nice example. I never realized the relation between id and ons. obviously they correspond. Thank You!
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Fri Mar 21, 2008 10:20 pm    Post subject: Reply to topic Reply with quote

I think they call them parallel arrays.

Code: Show/Hide
short id[] = { 3, 7, 2 };
char ons[] = { 1, 0, 1 };
objects->ToggleSet(t, id, ons, sizeof(id) / sizeof(id[0]));

_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
tcsoccerman
Server Help Squatter


Age:33
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Fri Mar 21, 2008 10:27 pm    Post subject: Reply to topic Reply with quote

oh ok.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 65 page(s) served in previous 5 minutes.

phpBB Created this page in 0.422512 seconds : 29 queries executed (94.0%): GZIP compression disabled