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
Wrong objects getting turned on
Goto page Previous  1, 2
 
Post new topic   Reply to topic Printable version
 View previous topic  possible? lvz question Post :: Post Manual Doors?  View next topic  
Author Message
Dark_Nexus
Newbie


Age:39
Gender:Gender:Female
Joined: Jan 02 2004
Posts: 23
Offline

PostPosted: Sun Jan 11, 2004 12:43 am    Post subject: Whew, finished, but i want to make it faster faster faster! Reply to topic Reply with quote

when i was testing everything i realized that i end up doing toggle_objects() 3 times, which makes the objects do this wave effect when they turn off, cool? yes, but still no, not supposed to work like this, and also, the letters take some time getting up, so here is what i have done....overloaded some functions a little modification here and there...

this first modification is so that i can have mulitple object arrays going so that when i turn it on, it all happens at once. the functions allows me to pass off 3 different numbers, combine them as 1 number, and then assign them to witch array i want, there are a total of 3 arrays. this is an overload of the original queue_enable() functions, which just assigns int id to a single array slot.

Code: Show/Hide
void botInfo::queue_enable(int array,int id1, int id2, int id3)
{
   static int id;
   if (num_objects2 == MAX_OBJECTS || num_objects3 == MAX_OBJECTS)
   toggle_objects();

   if (id2 < 10 && id2 > -10) id = id1 * 1000 + id2 * 100 + id3;
   else                       id = id1 *10000 + id2 * 100 + id3;
   
   switch (array)
   {
   case 2:
      {
         object_array2[num_objects2].id = id;
         object_array2[num_objects2].disabled = false;
         ++num_objects2;
         break;
      }

   case 3:
      {
         object_array3[num_objects3].id = id;
         object_array3[num_objects3].disabled = false;
         ++num_objects3;
         break;
      }

}



next up is the toggle function, it just turns on all 3 arrays.

Code: Show/Hide
void botInfo::toggle_objects()
{
   Player *p = object_dest;

   if (!p)
   {
      tell(makeToggleObjects(UNASSIGNED, (Uint16 *)object_array1, num_objects1));
      tell(makeToggleObjects(UNASSIGNED, (Uint16 *)object_array2, num_objects2));
      tell(makeToggleObjects(UNASSIGNED, (Uint16 *)object_array3, num_objects3));
   }
   else
   {
      tell(makeToggleObjects(p->ident, (Uint16 *)object_array1, num_objects1));
      tell(makeToggleObjects(p->ident, (Uint16 *)object_array2, num_objects2));
      tell(makeToggleObjects(p->ident, (Uint16 *)object_array3, num_objects3));
   }

   num_objects1 = 0;
   num_objects2 = 0;
   num_objects3 = 0;
}


lastly is a new function i added, it goes through each array, turns each object off, and then uses togge_objects()

Code: Show/Hide
void botInfo::reset_objects()
{
   int objlen = sizeof(object_array1);
   
   for(int num_objects;num_objects < objlen;num_objects++)
   {
      object_array1[num_objects].disabled = true;
      object_array2[num_objects].disabled = true;
      object_array2[num_objects].disabled = true;
   }
   toggle_objects();
}


and putting all of these wonderful functions into action.... under EVENT_PlayerDeath, if a message is already up it will clear it off the screen so that nothing gets overlapped, behold....

Code: Show/Hide

if (countdown[0] > 0)
         {
         reset_objects();
         }


and at the bottom of all of this, after it decides what letters to turn on we have...

countdown[0] = 7;


i am getting an error that causes the bot to shutdown in here...

Code: Show/Hide
void botInfo::queue_enable(int id)
{
   if (num_objects1 == MAX_OBJECTS)
   toggle_objects();
   
   object_array1[num_objects1].id = id;
   object_array1[num_objects1].disabled = false;
   ++num_objects1;
}


or so the debugger tells me, i don't know what is wrong with it, any help would be appreciated icon_smile.gif
_________________
"In fact, about the only reasonable holiday is 4th of July (US). We celebrate something that actually happened by blowing shit up."
-Mr Ekted
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun Jan 11, 2004 12:55 pm    Post subject: Reply to topic Reply with quote

Well is the queue_enable(int) ever being called in your program? More likely it's getting confused with your queue_enable(int, int, int, int). But I didn't see any errors in that function either. Probably it's just making a bad function call at some point.

I'm actually not quite getting the point of making multiple object arrays because the bot can only do up to 20 objects at one time and therefore will always have some sort of 'wave' effect. I have toggled more than 20 objects in one function before, and I didn't notice a thing in-game.

The only difference between your method and mine was that I had an array of IDs like I mentioned before, so the computer didn't have to calculate the ID on-the-spot. Maybe it saved calculation time?
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Dark_Nexus
Newbie


Age:39
Gender:Gender:Female
Joined: Jan 02 2004
Posts: 23
Offline

PostPosted: Sun Jan 11, 2004 2:29 pm    Post subject: :( Reply to topic Reply with quote

could very well be, i am not really sure though, i will check out the declarations and what not, but the line it gets stuck on is

object_array1[object_array1].id = id;

the reason for the 3 arrays was because i figured it was having issues turning on so many objects, but now that i went and looked, it has an overflow feature, where if the MAX_OBJECTS is reached in the array, it will do toggle_objects() and then begin storing id's again, i will probably just revert back to this form
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> LVZ/LVL Questions All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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: 81 page(s) served in previous 5 minutes.

phpBB Created this page in 0.479571 seconds : 27 queries executed (93.7%): GZIP compression disabled