Admin Toy

I have spent many hours hammering out a foundation for my Mud and
decided to make a toy to make moving around less of a hassle.
I call it "Personal Transporter" it has no relation to any
Startrek theme just the name suits it.
I have been playing with new commands and as the penny drops the
concepts are forming in my head.
So here it is for you to peruse its very basic and I have tried to
make portable by using (va) to store the the dbref of the data holder.
It needs refining so as not to add the same room twice but i cant figure out a way to do this yet I will look into that soon but the brains in lockdown at the moment.


@create Personal teleporter
@link Personal teleporter = me
@set Personal teleporter = STICKY
@set Personal teleporter = WIZARD
@set Personal teleporter = NO_WARN
@power Personal teleporter = Tport_Anything
@power Personal teleporter = Tport_Anywhere
@DESCRIBE Personal teleporter=to add a room type in addroom %rTo see the list of rooms type where%rand finaly to teleport to a room in the list tel # thats its number on the list
&ADD_ROOM Personal teleporter=$addroom *:&[u(me/counter)] v(va)=%l-[name(%l)];&counter me=add(u(me/counter),1)
&CMD_LISTED Personal teleporter=$where:@pemit %#=center(ansi(hr,Room List),60,ansi(hg,-))%r[u(me/MAP_ATTR)%r[repeat(ansi(hg,-),60)]%rBug coded by Berg@mworlds%r
&CMD_TEL Personal teleporter=$tel *:@tel %#=[elements(u(v(va)/%0),1,-)]
&COUNTER Personal teleporter=3
&COUNTER1 Personal teleporter=2
@set Personal teleporter/COUNTER1=no_command
&FUN_ATTR Personal teleporter=[ansi(h,extract(%0,1))]%t%t[ansi(hc,[u(v(va)/%0)])]
&MAP_ATTR Personal teleporter=map(fun_attr,lattr(v(va)/*),,%r)


@create telepoter_data
@link telepoter_data = num(Personal teleporter)
&va Personal teleporter=num(telepoter_data)
@tele telepoter_data=Personal teleporter

I do like the map() command thats a new one to my thoughts for today.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

When you are adding the

When you are adding the dbref# to the list, do a hasattr() check to see if you already have it, from what i can see you are just creating a new attribute with the dbref#, why not go for a list?

Also, doing add(u(me/counter),1) can be shortened down to inc(u(me/counter)) if all you are doing is incrementing the value by one.

Version 2?

I could not work out how list worked I reread the help files many times and the method did not take shape in my mind.
This is probably due to the fact that my ability to learn has some what slowed over the years but that aside I did come up with a solution. The code bellow stops you from duplicating a room dbref.

@create Personal teleporter
@link Personal teleporter = #3
@set Personal teleporter = STICKY
@set Personal teleporter = WIZARD
@set Personal teleporter = NO_WARN
@power Personal teleporter = Tport_Anything
@power Personal teleporter = Tport_Anywhere
&ADD_ROOM Personal teleporter=$addroom *:@switch match([u(me/map_match)],%l,-)=>0,{@pemit %#=that location is already stored},{&[u(me/counter)] v(va)=%l-[name(%l)]-%0;&counter me=inc(u(me/counter))}
&CMD_LISTED Personal teleporter=$where:@pemit %#=[ansi(hg,center(ansi(hr,Room List),60,-))]%r[u(me/MAP_ATTR)%r[repeat(ansi(hg,-),60)]%rBug coded by Berg@mworlds%r
&CMD_TEL Personal teleporter=$tel *:@tel %#=[elements(u(v(va)/%0),1,-)]
&COUNTER Personal teleporter=2
@DESCRIBE Personal teleporter=to add a room type in addroom %rTo see the list of rooms type where%rand finaly to teleport to a room in the list tel # thats its number on the list
@set Personal teleporter/DESCRIBE=no_command visual prefixmatch public nearby
&FUN_ATTR Personal teleporter=[ansi(h,extract(%0,1,1))]%b%b[ansi(hc,[u(v(va)/%0)])]
&FUN_MATCH Personal teleporter=[u(v(va)/%0)]
&MAP_ATTR Personal teleporter=map(fun_attr,lattr(v(va)/*),,%r)
&MAP_MATCH Personal teleporter=map(fun_match,lattr(v(va)/*),,-)
@VA Personal teleporter=num(teleporter_data)

I modified ADD_ROOM
added FUN_MATCH and MAP_MATCH

Using th inc() command is in place and functions nicely.
Thank you
Because I was already using map() to list the rooms stored I just used match() on that to see if the room dbref was already there, I did it this way only because I can understand it.
You hear the comment "re-inventing the wheel" a lot in many posts about mushcode on the net, well I'm still learning how to make a wheel.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.