Exploding Pennmush

With all the new things I have been learning it is a good thing that there is no players on my mud.....
I have destroyed it many time but now it seems my understanding of the workings and the soft code are at that point where I can let others see my proud new soft code any comments about it will be constructive to my learning
This is my bug reporter code

Note you need to renumber bug to point at bug data the dbref=#26
Also need to replace #27 with the dbref of the bug
Just replace #26 with bug data dbref

@create Bug
@link Bug = #2
@set Bug = WIZARD
&ADDBUG Bug=$bug=*:&[u(#27/counter)]%N #26=%0%r%rAuthor %N %#%rLocation %L%rDate [time()];@pemit %#=bug added;&counter me=add(u(#27/counter),1);@pemit %#=Thank you for your report an Admin will look into it.
&BUG Bug=$Bug *:@pemit/silent %#=[ansi(hb,[center([ansi(hr,Bug on %0)],63,-)]%r[ansi(n,[u(#26/%0)]%r[ansi(hb,repeat(-,63))]%rBug coded by Berg@mworlds%r
&BUG_TOPICS Bug=$Bug/topics:@switch [hasflag(%#,wizard)]=1,{@pemit/silent %#=ansi(h,repeat(-,25))[ansi(hr,Bug/topics)][ansi(h,repeat(-,25))]%r[align(2 30 2,,[regeditall([lattr(#26/*)],%B,%t%t)],,)]%r%r[ansi(h,repeat(-,63))]};@pemit %#=You are not an admin
&COUNTER Bug=4
&DELE_BUG Bug=$delBug *:@switch [hasflag(%#,wizard)]=1,{&%0 #26;@pemit %#=Topic deleted},{@pemit %#=You are not an admin}
@DESCRIBE Bug=%t%t%tCommands%r[repeat(=,60)]%r%tBug=%r%tBug/topics lists topics%r%tBug * displays that topic%r%tdelbug * remove the bug listing%r[repeat(=,60)]
@set Bug/DESCRIBE=no_command visual prefixmatch public nearby
&NO_TOPIC Bug=$Bug:@pemit %#=Type Bug help
&RESET Bug=$reset bug:@switch [hasflag(%#,wizard)]=1,{&counter #27=1},{@pemit %#=You are not an Admin.}

@create bug data
@link bug data = #2
@set bug data = NO_COMMAND
&BUG_HELP bug data=ansi(hg,If you want to report a bug here is and example%r%r)[ansi(hy,bug=Hi i found a bug its got eight legs and its freaking me out%r its in the corner of my room dont ask me where i am i dont know%rhurry please it looks hungry)]%r%r[ansi(hg,Well obviously you would report a game bug but thats the method %rto report them

I placed this in the master room and any player can add bugs but only admins can read delete and reset the counter
I don't know too much about licenses but if you like to use modify or even explode this code go ahead
I am not happy with the Bug/topics output but it works.
Hopefully this makes sense to others

Comment viewing options

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

A think you /may/ wish to do

A think you /may/ wish to do is, to make it a bit more... transferable...
Change #26 into [v(db`bugdata)] and change #27 into "me", without the double quotes.
Also, instead of using @switch, you may want to look at @assert and @break,
it will make your code look a lot nicer.

Can not Grasp the idea [v(db`bugdata)]

I have changed the #27 to "me" I understood that. But [v(db`bugdata)] I don't understand, mainly because I can't comprehend the hierarchical tree. Do I need to create an attribute that holds the bdref of bugdata on the Bug item? then call it instead of the dbref used in my code?
Sorry I am still learning
I do have a question about this, As I have placed bugdata inside the bug item itself can the bug item see bugdata and I just get the things I need from it by maybe using u(num(bugdata)/)?
I hope this does not sound silly.

You can ignore the tree bit

You can ignore the tree bit for now and use [v(bugdata)] instead, setting a BUGDATA attribute to contain the dbref.

Putting the bugdata object inside the bug item can work, but consider what will happen if there's another bugdata object in the neighborhood -- your item will get confused. If you're sure that won't happen, fine. If you're not, you need to use something more sophisticated than just num(bugdata) -- you need the locate() function to find "the first object named bugdata in my inventory" or similar.

Bug Edited

@create Bug
@link Bug = #2
@set Bug = WIZARD
@set Bug = !NO_COMMAND
&ADDBUG Bug=$bug=*:&[u(me/counter)]%N v(va)=%0%r%rAuthor %N %#%rLocation %L%rDate [time()];@pemit %#=bug added;&counter me=add(u(me/counter),1);@pemit %#=Thank you for your report an Admin will look into it.
&BUG Bug=$Bug *:@pemit/silent %#=[ansi(hb,[center([ansi(hr,Bug on %0)],63,-)]%r[ansi(n,[u(v(va)/%0)]%r[ansi(hb,repeat(-,63))]%rBug coded by Berg@mworlds%r
&BUG_TOPICS Bug=$Bug/topics:@switch [hasflag(%#,wizard)]=1,{@pemit/silent %#=ansi(h,repeat(-,25))[ansi(hr,Bug/topics)][ansi(h,repeat(-,25))]%r[wrap([regeditall([lattr(v(va)/*)],%B,[space(5)])],60)]%r%r[ansi(h,repeat(-,63))]};@pemit %#=You are not an admin
&COUNTER Bug=1
&DELE_BUG Bug=$delBug *:@switch [hasflag(%#,wizard)]=1,{&%0 v(va);@pemit %#=Topic deleted},{@pemit %#=You are not an admin}
@DESCRIBE Bug=%t%t%tCommands%r[repeat(=,60)]%r%tBug=%r%tBug/topics lists topics%r%tBug displays that topic%r%tdelbug remove the bug listing%r%treset bug will reset the bug count to 1%r[repeat(=,60)]%r[ansi(hwu,Attributes)]%r[ansi(hr,[edit(lattr(me/*),%b,%r)])]
@set Bug/DESCRIBE=no_command visual prefixmatch public nearby
&HELP Bug=ansi(hg,If you want to report a bug here is and example%r%r)[ansi(hy,bug=Hi i found a bug its got eight legs and its freaking me out%r its in the corner of my room dont ask me where i am i dont know%rhurry please it looks hungry)]%r%r[ansi(hg,Well obviously you would report a game bug but thats the method %rto report them
&NO_TOPIC Bug=$Bug:@pemit %#=Type Bug help
&RESET Bug=$reset bug:@switch [hasflag(%#,wizard)]=1,{&counter me=1},{@pemit %#=You are not an Admin.}

@create bug_data
@link bug_data = #2
@set bug_data = NO_COMMAND
&HELP bug_data=ansi(hg,If you want to report a bug here is and example%r%r)[ansi(hy,bug=Hi i found a bug its got eight legs and its freaking me out%r its in the corner of my room don't ask me where I am i dont know%rhurry please it looks hungry)]%r%r[ansi(hg,Well obviously you would report a game bug but thats the method %rto report them
@set bug_data/HELP=safe
@fo me=@va bug=num(bug_data)
@tele bug_data=bug

I changed the bug/topic to display properly
Added VA to hold dbref for bug_data
Changed the dbref in bug to say "me" instead
Thank you for the input it made me look at my code closely

I have commented most of my code now.

One more little suggestion.

One more little suggestion. Avoid:

@fo me=@va bug=num(bug_data)

Instead consider one of these:

@wait 0=@va bug=[num(bug_data)]

or, even better:

@set bug=va:[num(bug_data)]

Comment viewing options

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