Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
seluma
Newbie


Joined: 17 Jan 2009
Posts: 4

PostPosted: Sat Jan 17, 2009 11:38 pm   

question
 
so i am am second in command of a guild on torilmud.. one of the things i do is take equipment requests for guildmates and try to get them for the quildmates, im tired of looking through seperate files for different bits of information on which zones someone needs for whatever questpiece from what mob ect ect ect.... so i was wondering if someone here could help this zmud noob figure out how to do something.

i want to be able to type an alias say grequest bob and pull up the item names and the location of the items for everything bob has requested
grequest bob

bob has requested: a knife from the kitchen, a plunger from the bathroom, a shirt from the closet

or whatever...

tho other thing is i want to be able to display some gear that my group has collected and if the item matches a request item idd like it to say

a knife
requested by: bob sam edd bill
a plunger
requested by: bob


its kinda wierd to explain but it would help me out alot if there are any questions about what i mean im sure i can clarify a little more

also if possible i would like to see an option be available for automated adding like

bob tells you radd a knife from kitchen

i would add the knife to the requested list and the location and return to bob this

a knife from the kitchen has been added to youre request list
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sun Jan 18, 2009 3:36 am   
 
You need a trigger that matches these things:


1. The Person telling; this will go in the request database as a key
2. The Tell text exactly used to tell anything; for the trigger matches
3. The item and location requested; basically this is at your discretion. You have two choices

3 a. The Item (any numbers of words) and it's location can be in any form, as you will be reading these.
3 b. The text is explicit:

eg. (%w) tells you, request (*) from (*)
example: Bob tells you, request the fork of horripilation from Morrowind the best game eva

Explicit requires the word "Request", all the text following until the word "from" is the item. All the text after that is the location.

Perhaps it would be better to save all your tells and parse them later


a trigger like the above returns

%1 = Bob
%2 = the fork of horripilation
%3 = Morrowind the best game eva

then that trigger would do something like this:

#addkey Dispersals %1 %concat( %db( @Didpersals, %1), %2, "|", %3)
#exec Tell %1 Acknowledged, I will get to it someday. A %2 you say?

Now you will want a nifty way to search both items locations and peoples, but you can simply use the

Code:
#loopdb @Dispersals {#sh %key %item( %val,1) %item( %val,2)
#co firebrick }
method

Be happy to help but you do need the exact text to trigger on and decide if you want to instruct people about how to use the macro. Prob not.

None of that is tested, just corrected that my first example would only allow one request. Now the simple two item display would not be so swift and has to be redone, on it goes.

Why not try using the Notebook script I wrote in scripts? Oh, Fang Xianfu seems to have a better one too. Still it is not trigger thing


Last edited by Leitia on Sun Jan 18, 2009 3:55 am; edited 1 time in total
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sun Jan 18, 2009 3:54 am   
 
You should be able to just copy and paste this into the command line. I wrote it all off the top of my head so no guarantees that I am not missing a brace or something.
Code:
#CLASS Requests
#VAR ReqByName {}
#VAR ReqByItem {}
#VAR ReqByPlace {}
#VAR TempReq1 {} {}
#VAR TempReq2 {} {}
#ALIAS showReqN {#LOOPDB @ReqByName {#SHOW {%key: %replace(%val,"---", " from ")}}}
#ALIAS showReqI {#LOOPDB @ReqByItem {#SHOW {%key}; #SHOW requested by: %val}}}
#ALIAS showReqP {#LOOPDB @ReqByPlace {#SHOW %key --- %val}
#ALIAS remReq {
 #IF (%word(%db(@ReqByName,%1),1,"---")=%-2) {
  TempReq1=%word(%db(@ReqByName,%1),2,"---")
  TempReq2=%remove(%concat(%-2,", "),%db(@ReqByPlace,@TempRec1))
  #IF (%begins(@TempReq2,",")) {TempReq2=%right(@TempReq2,2)}
  #SHOW {Removing %1:%-2 from @TempReq2}
  #IF (@TempReq2) {#ADDKEY RecByPlace {@TempReq1}  {@TempReq2}} {#DELKEY RecByPlace {@TempReq1}}
  TempReq2=%remove(%concat(%-2,"---",@TempReq1),%db(@ReqByName,%1))
  #IF (%begins(@TempReq2,",")) {TempReq2=%right(@TempReq2,2)}
  #IF (@TempReq2) {#ADDKEY ReqByName {%1} {@TempReq2}} {#DELKEY ReqByName {%1}}
  TempReq2=%remove(%1,%db(@ReqByItem,%-2))
  #IF (%begins(@TempReq2," ")) {TempReq2=%right(@TempReq2,1)}
  #IF (@TempReq2) {#ADDKEY ReqByItem {%-2} {@TempReq2}} {#DELKEY ReqByItem {%-2}}
 }
}
#TRIGGER {^(%w) tells you (*) from (*)} {
 TempReq2=%concat(%db(@ReqByName,%1),", ",%2,"---",%3)
 #IF (%begins(@TempReq2,",")) {TempReq2=%right(@TempReq2,2)}
 #ADDKEY ReqByName {%1} {@TempReq2}
 TempReq2=%concat(%db(@ReqByPlace,%3),", ",%2)
 #IF (%begins(@TempReq2,",")) {TempReq2=%right(@TempReq2,2)}
 #ADDKEY ReqByPlace {%3} {@TempReq2}
 TempReq2=%concat(%db(@ReqByItem,%2)," ",%1)
 #IF (%begins(@TempReq2," ")) {TempReq2=%right(@TempReq2,1)}
 #ADDKEY ReqByItem {%2} {@TempReq2}
}
#CLASS 0
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sun Jan 18, 2009 3:56 am   
 
That's really impressive.
Reply with quote
seluma
Newbie


Joined: 17 Jan 2009
Posts: 4

PostPosted: Sun Jan 18, 2009 4:51 am   
 
wow... that rocks guys thank you so much :) im gonna go test it out right now!
Reply with quote
seluma
Newbie


Joined: 17 Jan 2009
Posts: 4

PostPosted: Sun Jan 18, 2009 5:07 am   
 
does this record all the info if i log out of zmud? i cant quite get it to work either... unless it records it and im just not seeing it record anywhere...

Dazok tells you 'request sack from IC'

is basically what i want to trigger off of and i need it to store it when im not logged in and or have zmud closed sothat i dont need to add it all every time i log into the mud
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sun Jan 18, 2009 1:54 pm   
 
It will hold on to all the information it records between sessions. So far it sounds like it just isn't recording things because the trigger doesn't quite have the pattern you want. You should adjust the pattern for the trigger to get it to record properly.
from
^(%w) tells you (*) from (*)
to
^(%w) tells you ' request (*) from (*)'$

To do that you open up the Settings Editor then open the class Requests. The trigger will have a little gun picture, click on that, paste in the new pattern and click save. You can find all the different request recorded in the ReqBy* variables there. I don't suggest editting them directly, as the 3 variables are used to store mostly the same information in different ways. While you have it open you should look at each of the different aliases and make sure the script portion looks like it contains the scripts up above. If I forgot a } or ) they will be messed up, and knowing where it is would let me fix it.

Use the showReq* aliases from command line to display the information, and the remReq alias to get rid of a request. You can rename these aliases once you have things working right.

Leitia, what is impressive is that you typed up a nearly perfect description for the script I was typing at the same time.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sun Jan 18, 2009 4:34 pm   
 
I was really glad that worked out like that, although I can program I am more verbose then practical and was happy not to have to program where I am not there to debug

I can't believe I said that, "I can program". Seems, unlikely, yet I can. (too much gaming)
Reply with quote
seluma
Newbie


Joined: 17 Jan 2009
Posts: 4

PostPosted: Sun Jan 18, 2009 9:16 pm   
 
for some reason the script wont let me access any of the names....

like showreqp torna should show everything listed by torna right? it showes absolutly nothing
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sun Jan 18, 2009 11:40 pm   
 
A missing } threw one thing off, and changing the pattern to your specification worked perfectly.
Code:
#CLASS {Requests}
#ALIAS showReqN {#LOOPDB @ReqByName {#SHOW {%key: %replace(%val,"---", " from ")}}}
#ALIAS showReqI {#LOOPDB @ReqByItem {#SHOW {%key};#SHOW {requested by: %val}}}
#ALIAS showReqP {#LOOPDB @ReqByPlace {#SHOW %key --- %val}}
#ALIAS remReq {#IF (%word(%db(@ReqByName,%1),1,"---")=%-2) {TempReq1=%word(%db(@ReqByName,%1),2,"---");TempReq2=%remove(%concat(%-2,", "),%db(@ReqByPlace,@TempRec1));#IF (%begins(@TempReq2,",")) {TempReq2=%right(@TempReq2,2)};#SHOW {Removing %1:%-2 from @TempReq2};#IF (@TempReq2) {#ADDKEY RecByPlace {@TempReq1} {@TempReq2}} {#DELKEY RecByPlace {@TempReq1}};TempReq2=%remove(%concat(%-2,"---",@TempReq1),%db(@ReqByName,%1));#IF (%begins(@TempReq2,",")) {TempReq2=%right(@TempReq2,2)};#IF (@TempReq2) {#ADDKEY ReqByName {%1} {@TempReq2}} {#DELKEY ReqByName {%1}};TempReq2=%remove(%1,%db(@ReqByItem,%-2));#IF (%begins(@TempReq2," ")) {TempReq2=%right(@TempReq2,1)};#IF (@TempReq2) {#ADDKEY ReqByItem {%-2} {@TempReq2}} {#DELKEY ReqByItem {%-2}}}}
#VAR ReqByName {}
#VAR ReqByItem {}
#VAR ReqByPlace {}
#VAR TempReq1 {} {}
#VAR TempReq2 {} {}
#TRIGGER {^(%w) tells you 'request (*) from (*)'$} {TempReq2=%concat(%db(@ReqByName,%1),", ",%2,"---",%3);#IF (%begins(@TempReq2,",")) {TempReq2=%right(@TempReq2,2)};#ADDKEY ReqByName {%1} {@TempReq2};TempReq2=%concat(%db(@ReqByPlace,%3),", ",%2);#IF (%begins(@TempReq2,",")) {TempReq2=%right(@TempReq2,2)};#ADDKEY ReqByPlace {%3} {@TempReq2};TempReq2=%concat(%db(@ReqByItem,%2)," ",%1);#IF (%begins(@TempReq2," ")) {TempReq2=%right(@TempReq2,1)};#ADDKEY ReqByItem {%2} {@TempReq2}}
#CLASS 0


I tested it by entering at the command line:
#SHOW joe tells you 'request a cat from the magma pipe'
#SHOW joe tells you 'request a dog from the pen'
showreqn
showreqp
showreqi
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net