17 Feb, 2016, Ssolvarain wrote in the 1st comment:
Votes: 0
This came to me just now, and I think I should write it down somewhere. I think it's kinda cool, so I thought I would share it.


Ok, so, on end of time we have variables in our mprogs. We can also assign a range of numbers to a variable, from which it picks randomly.

So if I do

var $i variablename = rand 1 2


it will assign a variable named variablename to the player represented by $i (which is the name of the mobile itself).

Now, I can also assign variables to mobs. Variables on mobs will save over crashes and copyovers. This opens up the door to some really interesting stuff.

Now, on to the point before I forget it.

I can set up a mob to start in room vnum 2000. I'd have an mprog (which would use mob call to activate it by whichever means) that would start like this:

Mprog 2000
if var $i roomcounter == 0
var $i roomvnum = 2000
mob call 2001
endif


This part generates the random exit number in the following mprog, 2002. This part also removes the possibility of it going backwards.

Mprog 2001
var $i rooms = rand 1 6
showvar 1 $i rooms
if var $i rooms == 1
and lastexit == 3
mob call 2001
break
endif
if var $i rooms == 2
and lastexit == 4
mob call 2001
breakR
endif
if var $i rooms == 3
and lastexit == 1
mob call 2001
break
endif
if var $i rooms == 4
and lastexit == 2
mob call 2001
break
endif
if var $i rooms == 5
and lastexit == 6
mob call 2001
break
endif
if var $i rooms == 6
and lastexit == 5
mob call 2001
break
endif
mob call 2002


This part will generate the random exits, and notes the last exit direction it linked.
Mprog 2002
if var $i rooms == 1
mob link north 2001
mob var $i lastexit == 1
endif
if var $i rooms == 2
mob link east 2001
mob var $i lastexit == 2
endif
if var $i rooms == 3
mob link south 2001
mob var $i lastexit == 3
endif
if var $i rooms == 4
mob link west 2001
mob var $i lastexit == 4
endif
if var $i rooms == 5
mob link up 2001
mob var $i lastexit == 5
endif
if var $i rooms == 6
mob link down 2001
mob var $i lastexit == 6
endif
var $i roomcounter + 1
if var $i roomcounter == 100
mob zecho BUILDING IS NOW COMPLETE!
mob goto 8 and get deleteeeed
break
endif
mob call 2003


The following part will allow it to iterate:
Mprog 2003
var $i roomvnum + 1
mob showvar 1 $i roomvnum
mob goto $1
var $i rooms = 0
mob call 2001


Since I can't use a direct variable in mprogs, I have to use showvar to give me a variable that I'm then able to use within mobprogs.

This should run 100 times, creating a linear, but random path.

I'm curious about how I might go about making it create branches. I'll think on it, and see if I can't improve this set of mprogs for future use. This also reaffirms my place as the laziest builder ever.
20 Feb, 2016, Lyanic wrote in the 2nd comment:
Votes: 0
Doesn't this seem a bit convoluted to accomplish such a simple goal? This is the problem I've always had with DSLs in OLC. Sure, they make basic content creation more safely accessible to non-programmers, but at the expense of power and flexibility. I suspect you've become a bit too advanced for the tool you're trying to use. Your approach is clever. Clever code isn't necessarily good code, though. Nor should cleverness be requisite to accomplish what you are attempting.
21 Feb, 2016, Rarva.Riendf wrote in the 3rd comment:
Votes: 0
I agree Lyanic.
mprog are for really basic stuff in ROM
When you want something a little more complicated, just create a spec.
Then you do not have to pull your hair out for basic things.
21 Feb, 2016, Ssolvarain wrote in the 4th comment:
Votes: 0
I just like to see what I can accomplish with mprogs. If muds weren't in a dead end, I'd be a lot more interested in working on muds that have more powerful scripting. I actually want to nab Fallout 4's geck whenever they release it, and see where that takes me.
22 Feb, 2016, Rarva.Riendf wrote in the 5th comment:
Votes: 0
Well mprog in Rom is pretty limited to some commands (that are even buggy as you lose some context info for messages as I found out) , and it does not even have any variable per mobile without coding anything.
Basically, everything a little complicated will be a spec. (and thus may crash the mud if badly coded, but then you are not limited at all)
Or every thing you may want to do will need an update of the mprog engine to add the commands there.
I find it is a waste of time, since anything complicated will need to be reviewed as you cannot trust builder with their scripts anyway (easy way to cheat), and coding a spec is as fast as doing a script to begin with. (because you have access to the exact same method, + all the others)
0.0/5