 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Dark_Nexus Newbie

Age:39 Gender: Joined: Jan 02 2004 Posts: 23 Offline
|
Posted: Sun Jan 11, 2004 12:43 am Post subject: Whew, finished, but i want to make it faster faster faster! |
 |
|
|
|
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.
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.
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()
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....
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...
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  _________________ "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 |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Jan 11, 2004 12:55 pm Post subject: |
 |
|
|
|
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 |
|
 |
Dark_Nexus Newbie

Age:39 Gender: Joined: Jan 02 2004 Posts: 23 Offline
|
Posted: Sun Jan 11, 2004 2:29 pm Post subject: :( |
 |
|
|
|
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 |
|
 |
|
|
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: 81 page(s) served in previous 5 minutes.
|