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
LVZ toggling with mervbot

 
Post new topic   Reply to topic Printable version
 View previous topic  MervBot Memory-Leak Checking Post :: Post twcore issues.  View next topic  
Author Message
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Thu Jun 02, 2005 4:39 pm    Post subject: LVZ toggling with mervbot Reply to topic Reply with quote

I thought lately someone had updated the lvz toggling of Mervbot because it didn't work (it crashed the bot). Now it doesn't crash the bot but it doesn't toggle the right objects.

Here is some more detailed information:

I try to toggle the following objects:
Code: Show/Hide
8:BOT>Mavbot> +123
8:BOT>Mavbot> +138
8:BOT>Mavbot> +142
8:BOT>Mavbot> +150


And what I get is (from the console):
Code: Show/Hide
BOT>Mavbot  Object number 123 enabled
BOT>Mavbot  Object number 19917 disabled
BOT>Mavbot  Object number 138 enabled
BOT>Mavbot  Object number 19917 disabled


I'm pretty sure I am using the right methods in the right way with the right numbers.

Someone has the same problem or can help me fix this?

EDIT: Yes, I'm using the latest core sa_tongue.gif
_________________
Nickname: Maverick (I changed my name!)
TWCore developer | Subspace statistics
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Thu Jun 02, 2005 5:28 pm    Post subject: Reply to topic Reply with quote

What method are you using?
Code: Show/Hide
   queue_enable(id);
   toggle_objects();

Works for me, make sure your max objects is high enough for it.

Or even this works.
Code: Show/Hide
   objectInfo oi;
   oi.id = objid;
   oi.disabled = 0;
   tell(makeToggleObjects(UNASSIGNED,(Uint16 *)&oi,1));
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Thu Jun 02, 2005 8:56 pm    Post subject: Reply to topic Reply with quote

objoff(Maverick);
Back to top
View users profile Send private message Add User to Ignore List
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Thu Jun 02, 2005 9:17 pm    Post subject: Reply to topic Reply with quote

LvzObject SoloAce;
SoloAce.change_layer = 1;
Soloace.Layer = LAYER_BelowAll;
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Thu Jun 02, 2005 9:20 pm    Post subject: Reply to topic Reply with quote

Wow you really suck at this, where does the "Soloace" come from?
Back to top
View users profile Send private message Add User to Ignore List
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Thu Jun 02, 2005 9:24 pm    Post subject: Reply to topic Reply with quote

From my shift key sucking, I was going to edit it but you beat me
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Thu Jun 02, 2005 9:24 pm    Post subject: Reply to topic Reply with quote

I knew you were gonna try to, haha, easy. sa_tongue.gif
Back to top
View users profile Send private message Add User to Ignore List
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Thu Jun 02, 2005 10:28 pm    Post subject: Reply to topic Reply with quote

Comon guys, Solo, please stop spaming the forums with useless chit-chat that doesn't have anything to do w/ solving the issue presented. I have put up w/o saying anything over the past couple days but it's becoming very irritating and I'd appreciate it if you'd only post messages that would help aid in a solution. I mean I know this is all in the name of fun and whatnot but it's getting old.
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Fri Jun 03, 2005 2:41 am    Post subject: Reply to topic Reply with quote

how odd.. Yes i'm using the correct methods "queue_enable()" and "toggle_objects()".
The queue_enable methods are used inside a for loop, the chat output tells me that that is working ok.

I will try this evening in a clean plugin again. Might it be caused by me using an older tutorial plugin?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Fri Jun 03, 2005 2:44 am    Post subject: Reply to topic Reply with quote

Care to post your code?
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Fri Jun 03, 2005 2:55 am    Post subject: Reply to topic Reply with quote

Sure, I will do this evening because I'm at work right now.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Fri Jun 03, 2005 4:26 am    Post subject: Reply to topic Reply with quote

You could've said it earlier, Cypher. sa_tongue.gif

I don't think you should let anything happening here get to you; But if it's really so irritating for you I'll just take it easy with the nonsense, and FOCUS ON THE REAL BUSINESS.

Couldn't you just do sendPublic("*objon ..."); ? sa_tongue.gif Guess not.
Back to top
View users profile Send private message Add User to Ignore List
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Fri Jun 03, 2005 4:36 am    Post subject: Reply to topic Reply with quote

Seems like you don't know the difference, Solo Ace.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Fri Jun 03, 2005 4:52 am    Post subject: Reply to topic Reply with quote

I'm sure I knew it when I was trying to figure out how it worked, "Maverick".
I can think of a bunch of things it would do, but whatever, my question wasn't serious as you could see.
Back to top
View users profile Send private message Add User to Ignore List
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Fri Jun 03, 2005 1:05 pm    Post subject: Reply to topic Reply with quote

I tried using the object packets a while ago in a plugin, and I used the proper syntax, but it didn't seem to work. I ended up just making a macro for objons and objoffs sa_tongue.gif
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Fri Jun 03, 2005 2:14 pm    Post subject: Reply to topic Reply with quote

Well you should always use *objset above *objon and *objoff sa_tongue.gif

ok here is my code that I use:
Code: Show/Hide

void botInfo::updateLVZ(String jackpot) {
   //First turn off old lvz
   String oldjp = String(jp),tmp;
   int len = 8-oldjp.len;
   int i =0;
   if(jp>0) {
      for(i=0;i<oldjp.len;i++) {
         //sendPublic("*objoff 1"+String(i+1+len)+String(oldjp[i]-48));
         tmp = "1"+String(i+1+len)+String(oldjp[i]-48);
         queue_disable(atoi(tmp));
         sendChannel("-1"+String(i+1+len)+String(oldjp[i]-48));
      }
   }


   //Then turn on new lvz   
   len = 8-jackpot.len;
   for(i=0;i<jackpot.len;i++) {
      //sendPublic("*objon 1"+String(i+1+len)+String(jackpot[i]-48));
      tmp = "1"+String(i+1+len)+String(jackpot[i]-48);
      queue_enable(atoi(tmp));
      sendChannel("+1"+String(i+1+len)+String(jackpot[i]-48));
   }

   //Apply the lvz changes
   toggle_objects();
}


The function is called with f.ex:
Code: Show/Hide
updateLVZ("3820");
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Fri Jun 03, 2005 3:10 pm    Post subject: Reply to topic Reply with quote

You should really be using the binary packet for this. Sending so much text is a waste of bandwidth.
_________________
4,691 irradiated haggis!


Last edited by Mr Ekted on Fri Jun 03, 2005 4:40 pm, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Fri Jun 03, 2005 3:51 pm    Post subject: Reply to topic Reply with quote

Doesn't Mervbot do that with the toggle_objects(); methods?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Fri Jun 03, 2005 4:52 pm    Post subject: Reply to topic Reply with quote

Mav, make sure your MAX_OBJECTS in spawn.h is higher than 16, it was 1 on old plugin versions because Ctm .37 only allowed toggling 1 object at a time. You are trying to toggle up to 16 at once.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Fri Jun 03, 2005 5:12 pm    Post subject: Reply to topic Reply with quote

Raised it to 255, still same problem.

Also, max lvz number doesn't explain how it disables object numbers 19917. Seems like a bug to me.
Does someone know where the code is located that actually does tell(makeToggleObjects()) ?

BTW. Have the same problem in another, similar plugin.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Purge
Episode I > Eposide III
Jar-Jar is kool


Age:35
Gender:Gender:Male
Joined: Sep 08 2004
Posts: 2019
Offline

PostPosted: Fri Jun 03, 2005 5:38 pm    Post subject: Reply to topic Reply with quote

Try and look in clientprot.h.
Back to top
View users profile Send private message Add User to Ignore List
Muskrat
Server Help Squatter


Age:38
Joined: Aug 24 2004
Posts: 829
Location: Swamp
Offline

PostPosted: Fri Jun 03, 2005 5:49 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide
clientMessage *generateObjectToggle      (Uint16 player, objectInfo *objects, Uint16 num_objects)
{   clientMessage *ret = new clientMessage(4 + 2 * num_objects);
   if (ret == NULL) return NULL;
   char *msg = ret->msg;

   /*   Field   Length   Description
      0      1      Type byte: 0x0a
      1      2      Player ident (-1 = all players)
      3      1      LVZ type byte: 0x35
   The following are repeated until the end of the message
      4      2      LVZ bitfield
   */

   msg[0] = 0x0a;
   *(Uint16*)&msg[1] = player;
   msg[3] = 0x35;

   memcpy(msg + 4, objects, 2 * num_objects);

   return ret;
}


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

   if (!p)   tell(makeToggleObjects(UNASSIGNED, (Uint16 *)object_array, num_objects));
   else   tell(makeToggleObjects(p->ident, (Uint16 *)object_array, num_objects));

   num_objects = 0;
}

void botInfo::queue_enable(int id)
{
   if (num_objects == MAX_OBJECTS)
      toggle_objects();

   object_array[num_objects].id = id;
   object_array[num_objects].disabled = false;
   ++num_objects;
}


If its going to send the same amount of object queues each time, I'd suggest making MAX_OBJECTS that number, then you wont even need the toggle_objects() in yours.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Underlord
Novice


Gender:Gender:Male
Joined: Feb 17 2004
Posts: 55
Offline

PostPosted: Fri Jun 03, 2005 6:00 pm    Post subject: Reply to topic Reply with quote

looks like the bug from old core/spawn.h

the bug dealt with the union objectInfo incorrectly set. compare your spawn.h and clientprot.h to this...

Code: Show/Hide

union objectInfo
{
   struct
   {
      Uint16 id            : 15;   // Object ident
      Uint16 disabled         : 1;   // 1=off, 0=on
   };

   Uint16 n;
};

#define MAX_OBJECTS 20
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Sat Jun 04, 2005 10:49 am    Post subject: Reply to topic Reply with quote

Woo biggrin.gif Got the problem solved.

Seems like I was using older tutorial code as a base - especially spawn.h. I replaced all code with the newest from the tutorial bot from catid.ssihosting.com and it works now grav_cool-hands.gif

Thanks alot for helping me, guys icon_wink.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot 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: 357 page(s) served in previous 5 minutes.

phpBB Created this page in 0.516209 seconds : 48 queries executed (91.3%): GZIP compression disabled