sep->arg

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

sep->arg

Post by Ememjr » Tue Sep 12, 2017 6:48 am

so i am working with mounts to allow moving mounts to the mounts tab on the character sheet
btw the bag id of the mounts page is -8

so a regular inventory move cammand comes through as move 12 15 135604 1 for example which is
inventoy index# 12 to slot 15 of of bag id 135604 with a count of 1
when moving a mount from inventory to the mounts in chararacter sheet the command is move 21 -1 -8
which is move inventory index# 21 to slot -1(auto slot on character since there are no specific slots) to bag id -8 (mounts)

so i need to add to the code to actually do the work and was looking at this to get the idea of how to code it.

Code: Select all

else if(sep->arg[4][0] && strncasecmp("move", sep->arg[0], 4) == 0 && sep->IsNumber(1) && sep->IsNumber(2) && sep->IsNumber(3) && sep->IsNumber(4))
the part i dont understand is what sep->arg[4][0]

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: sep->arg

Post by Jabantiz » Tue Sep 12, 2017 3:21 pm

arg is essentially a map of char arrays so arg[4][0] is getting index 4 of the map and the first letter of the char array. If the char array is empty it will fail that if check.

If you don't like that there is an IsSet function on separator it looks like so you could replace sep->arg[4][0] with sep->IsSet(4)

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: sep->arg

Post by Ememjr » Tue Sep 12, 2017 3:59 pm

ok i see, so this particulalar else if is first checking that argument 4 is actually there and that argument 0 is move and that arguments 1-4 are numbers

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests