07 Feb, 2014, Ssolvarain wrote in the 1st comment:
Votes: 0
[*****] BUG: (mob)Progs: MAX_CALL_LEVEL exceeded, vnum 18432, mprog vnum 18438

I'm pretty sure this is the mprog's built in anti-infinite loop kicking in… but I need moar mob calls to make this stuff work.

Is MAX_CALL_LEVEL a variable somewhere, and can it be bumped up a few notches?
07 Feb, 2014, Kaz wrote in the 2nd comment:
Votes: 0
grep -l "MAX_CALL_LEVEL" *.h
07 Feb, 2014, Ssolvarain wrote in the 3rd comment:
Votes: 0
I asked a question, and it wasn't "how do I use grep?"
07 Feb, 2014, Sharmair wrote in the 4th comment:
Votes: 0
MAX_CALL_LEVEL is used to cut off when one mprog triggers another recursively and stop loops
or cycles. In the ROMs I have seen, it is a #define in mob.prog.c just before the driver function.
As the stock setting of 5 is rather low, you probably would not have a problem increasing it some,
in SMAUG as an example, the stock setting is 20. I would be careful though of unintended mprog
cycles, though unless you make it very high it should not hurt the MUD too bad if you hit one.
07 Feb, 2014, Ssolvarain wrote in the 5th comment:
Votes: 0
Thanks a lot. I just needed to know if it was possible :cyclops:
07 Feb, 2014, Rarva.Riendf wrote in the 6th comment:
Votes: 0
It is a variable with an arbitrary settings so changing those is always possible. Outcome only depends on your mprogs.
07 Feb, 2014, Ssolvarain wrote in the 7th comment:
Votes: 0
Yup, it works fine.

Here's what I needed it for, in case anyone is slightly interested, or has variable support for their mprogs.

Basically, it loads 3 random scrolls, puts them in a bag and hands them to the player.

18435
if carries $n gsloot
if var $i golchk == 3
var $i golchk = 0
var $i sctalk = 0
mob oload 18447
put all sack
give bag $n
say There you go, $n!
mob remove $n 18409 1
emote puts the box away.
break
else
if var $i sctalk == 0
say Well, let's see what we can get you.
emote whips out a box and ruffles through it.
var $i sctalk = 1
endif
mob call 18436 $n
endif
else
mob echoat $n $i {gsays,'{GYou don't have any gold loot on you.{g'{x
endif


18436
var $i scrchk = rand 1 27
if var $i scrchk < 14
mob call 18437 $n
else
mob call 18438 $n
endif

18437
if var $i scrchk == 1
mob oload 18414
scrchk = 0
endif
if var $i scrchk == 2
mob oload 18415
scrchk = 0
endif
if var $i scrchk == 3
mob oload 18416
scrchk = 0
endif
if var $i scrchk == 4
mob oload 18417
scrchk = 0
endif
if var $i scrchk == 5
mob oload 18418
scrchk = 0
endif
if var $i scrchk == 6
mob oload 18419
scrchk = 0
endif
if var $i scrchk == 7
mob oload 18420
scrchk = 0
endif
if var $i scrchk == 8
mob oload 18421
scrchk = 0
endif
if var $i scrchk == 9
mob oload 18422
scrchk = 0
endif
if var $i scrchk == 10
mob oload 18423
scrchk = 0
endif
if var $i scrchk == 11
mob oload 18424
scrchk = 0
endif
if var $i scrchk == 12
mob oload 18425
scrchk = 0
endif
if var $i scrchk == 13
mob oload 18426
scrchk = 0
endif
var $i golchk + 1
mob call 18435 $n

18438
if var $i scrchk == 14
mob oload 18427
scrchk = 0
endif
if var $i scrchk == 15
mob oload 18428
scrchk = 0
endif
if var $i scrchk == 16
mob oload 18429
scrchk = 0
endif
if var $i scrchk == 17
mob oload 18430
scrchk = 0
endif
if var $i scrchk == 18
mob oload 18431
scrchk = 0
endif
if var $i scrchk == 19
mob oload 18432
scrchk = 0
endif
if var $i scrchk == 20
mob oload 18433
scrchk = 0
endif
if var $i scrchk == 21
mob oload 18434
scrchk = 0
endif
if var $i scrchk == 22
mob oload 18435
scrchk = 0
endif
if var $i scrchk == 23
mob oload 18436
scrchk = 0
endif
if var $i scrchk == 24
mob oload 18437
scrchk = 0
endif
if var $i scrchk == 25
mob oload 18438
scrchk = 0
endif
if var $i scrchk == 26
mob oload 18439
scrchk = 0
endif
if var $i scrchk == 27
mob oload 18440
scrchk = 0
endif
var $i golchk + 1
mob call 18435 $n
07 Feb, 2014, Rarva.Riendf wrote in the 8th comment:
Votes: 0
err why not a simple (for the most part)

if var $i < 27
mob oload 18413 + i
07 Feb, 2014, Ssolvarain wrote in the 9th comment:
Votes: 0
Damn… I could have done that using something else we have, I think. I just didn't think about it at the time.

When I get some sleep finally, I'll look into using something along those lines. Thanks.
08 Feb, 2014, Idealiad wrote in the 10th comment:
Votes: 0
That seems kind of fragile magic-number wise. Can you do arrays and index into them in mob progs?
08 Feb, 2014, Rarva.Riendf wrote in the 11th comment:
Votes: 0
Even faster btw, rand 18413 1840

>That seems kind of fragile magic-number wise. Can you do arrays and index into them in mob progs?

vnum are magic numbers anyway to begin with.
08 Feb, 2014, Idealiad wrote in the 12th comment:
Votes: 0
Not if you treat them strictly as data and don't put them into logic. What if you want to swap a vnum in your rand for something outside of the range?
08 Feb, 2014, Ssolvarain wrote in the 13th comment:
Votes: 0
Rarva.Riendf said:
Even faster btw, rand 18413 1840


This helped the most.

Here's what I came up with, using showvar. A variable, like scrchk, won't work alone.

var $i scrchk = rand 18414 18440
mob showvar 1 $i scrchk
mob oload $1
var $i scrchk = 0
var $i golchk + 1
mob call 18435 $n


Much less writing, 2 less progs. Thanks :3
09 Feb, 2014, Rarva.Riendf wrote in the 14th comment:
Votes: 0
Idealiad said:
Not if you treat them strictly as data and don't put them into logic. What if you want to swap a vnum in your rand for something outside of the range?


THEN you start to think of another solution. and even then, if it is one vnum only a if is enough.
Making code that can evolve for the sake of it is not always necessary. And I would say than in mprogs, that depends heavily on the stability of the rest of the area to work with, it not mandatory at all.
Yes you can create an array putting vnums in them, so you can cange the array size and the content at will.
Ya know what ? More complicated (Personally I don't even know how you can do that in mprogs with the basic mprog engine) and the program itself will be less readable for no other purpose than a hypothetical futur change of mind.
Does it worth it ? Personally I would say no.
0.0/14