Page 1 of 1

sep->arg

Posted: Tue Sep 12, 2017 6:48 am
by Ememjr
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]

Re: sep->arg

Posted: Tue Sep 12, 2017 3:21 pm
by Jabantiz
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)

Re: sep->arg

Posted: Tue Sep 12, 2017 3:59 pm
by Ememjr
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