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
Misc ASSS Questions
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10
 
Post new topic   Reply to topic Printable version
 View previous topic  per-arena commands? Post :: Post ASSS Zone crashed after 120 days of be...  View next topic  
Author Message
Dr Brain
Flip-flopping like a wind surfer


Age:31
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Aug 03, 2011 7:30 am    Post subject: Reply to topic Reply with quote

sprintf in C is guaranteed to print a null character. Same with snprintf.

EDIT: at least all the documentation I can find online backs this up. If you can find documentation that doesn't, I'd be very interested to see it.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1009
Offline

PostPosted: Thu Aug 04, 2011 4:23 am    Post subject: Reply to topic Reply with quote

yeah, thats what i was reading everywhere, and i couldnt figure out why my otherwise flawless code wasnt running
i figured the only way i could be getting the results i was was that i needed to manually add \0, and once i did everything started working properly...


also:
so why does chatnet send Player1\nPlayer2\n\0 on 1 line instead of one per line when you enter an arena?
thats pretty dumb



edit:
i was using this for the endline business for awhile
char* nl=strchr(rbuf,'\n'); *nl=0;

and then later i had quite forgotten about something that turned to be amazing, something which i had used so often and later discarded for something better, something that works perfectly for chatnet clients in C:
STRTOK! \o/
_________________
SSC Distension Owner
SSCU Trench Wars Developer
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Thu Aug 04, 2011 5:50 am    Post subject: Reply to topic Reply with quote

Dr Brain wrote:
sprintf in C is guaranteed to print a null character. Same with snprintf.

EDIT: at least all the documentation I can find online backs this up. If you can find documentation that doesn't, I'd be very interested to see it.


Visual Studio:
http://msdn.microsoft.com/en-us/library/ybk95axf%28v=vs.71%29.aspx
http://msdn.microsoft.com/en-us/library/2ts7cx93%28v=vs.71%29.aspx
Back to top
View users profile Send private message Add User to Ignore List
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Thu Aug 04, 2011 5:59 am    Post subject: Reply to topic Reply with quote

Cheese wrote:

also:
so why does chatnet send Player1\nPlayer2\n\0 on 1 line instead of one per line when you enter an arena?
thats pretty dumb


Hint: asss has nothing to do with that, and it does not send you a \0
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:31
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Aug 04, 2011 8:12 am    Post subject: Reply to topic Reply with quote

Yes, sprintf is guaranteed to print a null character. _snprintf (notice the n) is a MS thing and doesn't conform to the standard snprintf which does always print a null.

Cheese, do you realize that \n means a new line? You can't have that string all one one line, because it's several lines.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Thu Aug 04, 2011 8:42 am    Post subject: Reply to topic Reply with quote

Dr Brain wrote:
Yes, sprintf is guaranteed to print a null character. _snprintf (notice the n) is a MS thing and doesn't conform to the standard snprintf which does always print a null.


Yea, VS does not have snprintf. But a common mistake is that people use #define snprintf _snprintf
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:31
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Aug 04, 2011 2:12 pm    Post subject: Reply to topic Reply with quote

Cheese has been talking about sprintf the whole time, so I don't think that's his issue. But if it is, I guess that should be a lesson about reading the documentation.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1009
Offline

PostPosted: Mon Aug 08, 2011 10:27 pm    Post subject: Reply to topic Reply with quote

so what characters are allowed in player names?
letters, numbers, and what else?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1009
Offline

PostPosted: Mon Aug 22, 2011 11:31 am    Post subject: Reply to topic Reply with quote

does anyone actually know how to use ToggleSet() in objects.c correctly?
I can't find source code that uses this anywhere.

I used this, which seems to work on windows, but not on linux:

Code: Show/Hide


   Target t;
   t.type=T_ARENA;
   t.u.arena=a;
   
   int top0=0;
   int top1=0;
   int topempty=0;
   int bottom0=0;
   int bottom1=0;
   int bottomempty=0;
   int hold0=0;
   int hold1=0;
   
   short ids[]={LVZ_TOPBASE_ARMY0,LVZ_TOPBASE_ARMY1,LVZ_TOPBASE_EMPTY,LVZ_BOTBASE_ARMY0,LVZ_BOTBASE_ARMY1,LVZ_BOTBASE_EMPTY,LVZ_SECTOR_HOLD_FREQ0,LVZ_SECTOR_HOLD_FREQ1};
   char states[]={top0,top1,topempty,bottom0,bottom1,bottomempty,hold0,hold1};
   obj->ToggleSet(&t,ids,states,sizeof(ids)/sizeof(ids[0]));


this piece of code works on windows machines, but seems to segfault on linux machines at core/objects.c:686
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Mon Aug 22, 2011 2:39 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide

short ids[64];
char ons[64];

ids[0] = 5000; ons[0] = 1;
ids[1] = 5001; ons[1] = 1;
ids[2] = 5002; ons[2] = 1;
ids[3] = 5003; ons[3] = 1;

objs->ToggleSet(&tgt, ids, ons, 4);


Last edited by JoWie on Mon Aug 22, 2011 6:40 pm, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1009
Offline

PostPosted: Mon Aug 22, 2011 5:31 pm    Post subject: Reply to topic Reply with quote

but why does the prototype have char in it? :(
void (*ToggleSet)(const Target *t, short *id, char *ons, int size);



these didnt work either

Code: Show/Hide


   short ids[8];
   ids[0]=LVZ_TOPBASE_ARMY0;
   ids[1]=LVZ_TOPBASE_ARMY1;
   ids[2]=LVZ_TOPBASE_EMPTY;
   ids[3]=LVZ_BOTBASE_ARMY0;
   ids[4]=LVZ_BOTBASE_ARMY1;
   ids[5]=LVZ_BOTBASE_EMPTY;
   ids[6]=LVZ_SECTOR_HOLD_FREQ0;
   ids[7]=LVZ_SECTOR_HOLD_FREQ1;
   short states[8];
   states[0]=top0;
   states[1]=top1;
   states[2]=topempty;
   states[3]=bottom0;
   states[4]=bottom1;
   states[5]=bottomempty;
   states[6]=hold0;
   states[7]=hold1;
   obj->ToggleSet(&t,ids,states,8);


   // short ids[]={LVZ_TOPBASE_ARMY0,LVZ_TOPBASE_ARMY1,LVZ_TOPBASE_EMPTY,LVZ_BOTBASE_ARMY0,LVZ_BOTBASE_ARMY1,LVZ_BOTBASE_EMPTY,LVZ_SECTOR_HOLD_FREQ0,LVZ_SECTOR_HOLD_FREQ1};
   // short states[]={top0,top1,topempty,bottom0,bottom1,bottomempty,hold0,hold1};
   // obj->ToggleSet(&t,ids,states,sizeof(ids)/sizeof(ids[0]));
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Mon Aug 22, 2011 6:45 pm    Post subject: Reply to topic Reply with quote

typo, i edited my post.

anyways i have used that function a lot, i've never had a crash.

line 686 tells you something went wrong much earlier on.
maybe a corrupted lvz, or you are using toggleset really early in the arena creation and the thread locking or whatever messes up
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Age:30
Gender:Gender:Male
Joined: May 08 2003
Posts: 1252
Location: Montreal, Canada
Offline

PostPosted: Mon Aug 22, 2011 6:59 pm    Post subject: Reply to topic Reply with quote

Cheese wrote:
but why does the prototype have char in it? icon_sad.gif
... just use a char array and put 0 or 1, don't use 'short's for the state
_________________
DCME co-developer
17th Parallel Head Sysop
Subspace: The Future
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1009
Offline

PostPosted: Tue Dec 13, 2011 2:47 pm    Post subject: Reply to topic Reply with quote

when im in another zone and i do ?find player, and that player is located in an asss zone, what file handles reporting to the biller/me the zone name?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:31
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Dec 13, 2011 9:54 pm    Post subject: Reply to topic Reply with quote

I don't believe that the request goes to the target's zone at all. The biller knows where all the logged in players are, and so just supplies the name of the zone to the player issuing the ?find command.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1009
Offline

PostPosted: Thu Dec 15, 2011 4:00 pm    Post subject: Reply to topic Reply with quote

what does objects->Image() do?
is it supposed to send a packet to the client telling it that the lvz thing is changing from one picture to a different one?

additionally, im trying to move around a lvz picture, by using
lvz->Move(&tgt,num,srcx*16,srcy*16,0,0);
lvz->Toggle(&tgt,num,1);
they appear, but they dont appear to be going anywhere...
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
some resol
Guest


Offline

PostPosted: Sat Dec 17, 2011 6:56 am    Post subject: Reply to topic Reply with quote

Help on '?objimage':
Targets: any
Args: <id> <image>
Change the image associated with an object id.
Object commands: ?objon ?objoff ?objset ?objmove ?objimage ?objlayer ?objtimer ?objmode ?objinfo ?objlist

Looks like it sets the image id like in a lvz, and you can also change the layer and mode and all the other stuff on the fly.
Back to top
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1009
Offline

PostPosted: Tue Jan 17, 2012 1:26 am    Post subject: Reply to topic Reply with quote

so if i draw a region in one spot, and a region with the same name in another spot, is there a way to iterate through each separate box?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:31
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Jan 17, 2012 6:58 am    Post subject: Reply to topic Reply with quote

There is no concept of a box, even. What are you trying to do?
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Tue Jan 17, 2012 8:13 am    Post subject: Reply to topic Reply with quote

Regions are not kept in memory in such a way that makes such a thing easy.

Regions are kept in the same way as tiles:
A spare matrix that effectively means you can do tiles[tile x][tile y] = tile id;
Sparse means 0 values are not stored.

In regions it looks like
regions[tile x][tile y] = region id (u8);
If regions overlap, you get another region id. So one region may have multiple id's

So if you want to retrieve a "box" of a region, you would have to go about it in the same way as retrieving a "box" of wormholes.
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1009
Offline

PostPosted: Thu Apr 05, 2012 2:59 am    Post subject: Reply to topic Reply with quote

Code: Show/Hide

asss 1.5.0 built at Jul 20 2011 21:20:59


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff1b71700 (LWP 28580)]
0x00000000004358fa in cleanup (p=0x6ede70, a=0x6ef680, reason=2) at core/flagcore.c:105
105                     if (ad->fis[i].state == FI_CARRIED &&
(gdb) l
100             adata *ad = P_ARENA_DATA(a, adkey);
101
102             LOCK();
103             ad->during_cleanup = TRUE;
104             for (i = 0; i < ad->count; i++)
105                     if (ad->fis[i].state == FI_CARRIED &&
106                         ad->fis[i].carrier == p)
107                     {
108                             ad->fis[i].state = FI_NONE;
109                             ad->fis[i].carrier = NULL;
(gdb)

(gdb) bt
#0  0x00000000004358fa in cleanup (p=0x6ede70, a=0x6ef680, reason=2) at core/flagcore.c:105
#1  0x0000000000436d36 in shipfreqchange (p=0x6ede70, newship=8, oldship=0, newfreq=9999, oldfreq=0) at core/flagcore.c:469
#2  0x000000000042e742 in SetShipAndFreq (p=0x6ede70, ship=8, freq=9999) at core/game.c:958




i think i found a bug in the flag core
so what would cause this?
only thing i can think of is that fis is bad
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1009
Offline

PostPosted: Fri Jul 26, 2013 12:13 pm    Post subject: Reply to topic Reply with quote

so i had the idea of changing the way how the asss core loads modules, in hopes to resolve circular references in interfaces


proposed process:
a MM_PRELOAD call for all modules at program start, only legal actions in this is reg_interface()
after this all modules have interfaces up
then MM_LOAD call is made
all modules then call get_interface()

downside:
all modules would have to check on each interface function if itself is loaded if a dependency is missing or noop

anyone see any problems with this?
would this work?
it seems (deceptively?) easy to implement
if this gets put in, module load order wouldnt matter at all
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1009
Offline

PostPosted: Fri Jul 26, 2013 2:59 pm    Post subject: Reply to topic Reply with quote

alternative idea:


10 pass MM_LOAD, all modules keep track of interface count, then report success in MM_AFTERLOAD, otherwise unload themselves
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:31
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sun Jul 28, 2013 7:37 am    Post subject: Reply to topic Reply with quote

Cheese wrote:
anyone see any problems with this?


Every single module ever written would have to be modified. That's a pretty big problem.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1009
Offline

PostPosted: Sun Jul 28, 2013 1:22 pm    Post subject: Reply to topic Reply with quote

not significant compared to a permanent future of having to deal with shit
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Questions All times are GMT - 5 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Page 10 of 10

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

phpBB Created this page in 0.244008 seconds : 50 queries executed (58.8%): GZIP compression disabled