Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot

Members: 0
Guests: 4
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » SWR 2.0 MProg
Forum Rules | Mark all | Recent Posts

SWR 2.0 MProg
< Newer Topic :: Older Topic > If checks are a pain

Pages:<< prev 1 next >>
Post is unread #1 Nov 17, 2012, 11:12 am   Last edited Nov 17, 2012, 11:22 am by DemonAlucard
Go to the top of the page
Go to the bottom of the page

DemonAlucard
Fledgling
GroupMembers
Posts7
JoinedDec 2, 2009

Hello! I know you guys are probably not in the least bit interested in SWR 2.0 which is understandable but I have come here hoping to solve an issue. I know that there must be a way to have an mprog check a players inventory for a certain object vnum but I simply cannot figure it out for the life of me I thought that using If ovnumcarry(112) >= 1 would work to check a players inventory but it seems that this checks the mob and not the player so is there an extra step I can take or a different if check I might be missing that one of you may know about that I don't?

7>speech_prog fire
If ovnumcarry(112) >= 1
say Hah! Can't fool me you already have one now run along!
else
say WHAT?! You had the answers all along you tricked me!
scream
whine
stomp
say FINE! Take the blasted thing and leave me alone!
MPOLOAD 112
give singularity $n
hide
endif

I was attempting to design this prog to check and make sure that when the actor answered correctly they weren't abusing the mprog and getting more then one of the prize item. everything that I have done so far has failed miserably. Ideas?

EDIT: NEW dilemma! I put -----> If ovnumcarry(112) != 0 into the equation and now I can carry zero of the item and it STILL resolves as TRUE in the ifcheck x.x
       
Post is unread #2 Nov 17, 2012, 9:55 pm
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

Off the cuff...your mprog looks fine. I'd check mprog_driver and look for ovnumcarry and see if anything wrong is in there--specifically if it's actually checking for the item. failing that, not sure what to consider next..
       
Post is unread #3 Jan 26, 2013, 7:50 pm   Last edited Jan 26, 2013, 7:50 pm by Aurin
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

If your code for ovnumcarry looks like this:
  if(!str_cmp(chck, "ovnumcarry"))
  {
    OBJ_DATA               *pObj;
    int                     vnum = atoi(cvar);

    if(vnum < 1 || vnum > MAX_VNUM)
    {
      progbug(mob, "OvnumCarry: bad vnum [%s]", mob->name);
      return BERR;
    }
    lhsvl = 0;

    for(pObj = mob->first_carrying; pObj; pObj = pObj->next_content)
      if(pObj->pIndexData->vnum == vnum)
        lhsvl += pObj->count;
    rhsvl = is_number(rval) ? atoi(rval) : -1;

    if(rhsvl < 0)
      rhsvl = 0;
    if(!*opr)
      strcpy(opr, "==");
    return mprog_veval(lhsvl, opr, rhsvl, mob);
  }


The problem is the code, not your prog. The code is checking if the mob has the vnum, not if the actor has the vnum. I'd recommend using the "if iscarrying(vnum)" ifcheck. This one looks to see if the actor is carrying the object, not the mob.
       
Post is unread #4 Jan 26, 2013, 7:52 pm
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

So, change the first line of your mobprog from:
If ovnumcarry(112) >= 1 

To:
if iscarrying(112) >= 1
       
Pages:<< prev 1 next >>