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
minish1
Beginner


Joined: 24 Feb 2005
Posts: 23

PostPosted: Sun Sep 17, 2006 9:20 pm   

trigger/variable help
 
I need help creating a trigger that displays exits/objects that i find

mud syntax:

You find a hidden exit: cubbyhole
You found a small bag

I'd like a trigger that puts "cubbyhole" in a list called exits, however I'd also like the trigger to reset the entire list each time i search, and if there are multiple exits, it will put them all on the variable @exits. Then I'd like another list of objects found, also to reset upon each search. For the output, I'd like it to be "gt exits: @exits(each item on the list seperated by commas) objects: @objects(each item seperated by commas)

so,

search
mud output:
You find a hidden exit: cubbyhole
You find a hidden exit: west
You find a small bag
You find a small knife

triggered command:
gt EXITS: cubbyhole, west, OBJECTS: small bag, small knife

so for example if i search and find nothing, i dont want it to output the previous search results, and if i only find an exit, i dont want it to display the objects list

I appreciate any help in this matter, this is way over my head!
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Sep 18, 2006 1:02 am   
 
Code:

#ALIAS gt {#echo %replace(%concat(%if(@exits!=%null,%concat(":EXITS: ",@exits, ": "),""),%if(@items!=%null,%concat(":OBJECTS: ",@items, ":"),"")), "|", ", ");#class SearchRoom;#var search 0;#class ""} "SearchRoom"
#VAR test1 {You find a hidden exit: cubbyhole
You find a hidden exit: west
You find a small bag
You find a small knife } {_nodef} "SearchRoom"
#VAR test2 {You find a hidden exit: cubbyhole
You find a hidden exit: west } {_nodef} "SearchRoom"
#VAR test3 {You find a small bag
You find a small knife } {_nodef} "SearchRoom"
#VAR exits {cubbyhole|west} {_nodef} "SearchRoom"
#VAR items {small bag|small knife} {_nodef} "SearchRoom"
#TRIGGER {^You find a hidden exit: (*)} {#class SearchRoom;#if (@search=1) {#VAR exits %additem(%1,@exits)};#class ""} "SearchRoom"
#ONINPUT {^search} {#class SearchRoom;search;#var search 1;#var exits %null;#var items %null;#class "";#alarm +3 {gt}} "SearchRoom" {notrig}
#TRIGGER {^You find %w ({^hidden exit}*)$} {#class SearchRoom;#if (@search=1) {#VAR items %additem(%1,@items)};#class ""} "SearchRoom"


This creates a class "SearchRoom" That contains what you asked for. The search oninput trigger has an alarm that fires 3 seconds after you type search. That calls the gt alias which gives you the output you wanted.

Repeatedly typeing gt gives you the results repeatedly.

When you type search you clear the results and get a new set of results based on mud input.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
minish1
Beginner


Joined: 24 Feb 2005
Posts: 23

PostPosted: Mon Sep 18, 2006 11:31 pm   
 
the command "gt" is to group mention something on my mud, i dont want it to give results of a search everytime i gt. i just want to tell my group mates any exits/objects i find after every search... also, i tried that code and it doesn't work properly, when i type "gt" it enters the same text, regardless of the results of a search
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Tue Sep 19, 2006 4:54 am   
 
You didn't mention what gt stood for or when you wanted to use your information.

The alias gt can be renamed to whatever you like and the command #show replaced by the letters gt.

I placed the alarm trigger inside the search trigger to set it off.

If you do not type search, you will always get the same results each time you type gt I said that.

Quote:

Repeatedly typeing gt gives you the results repeatedly.


You requested.

Quote:

search
mud output:
You find a hidden exit: cubbyhole
You find a hidden exit: west
You find a small bag
You find a small knife

triggered command:
gt EXITS: cubbyhole, west, OBJECTS: small bag, small knife

so for example if i search and find nothing, i dont want it to output the previous search results, and if i only find an exit, i dont want it to display the objects list


I ran tests with this code on zmud with blank settings before posting it, and after receiving your response.

Here is the output.

Quote:

search
You find a hidden exit: cubbyhole
You find a hidden exit: west
You find a small bag
You find a small knife
:EXITS: cubbyhole, west: :OBJECTS: small bag, small knife:
search
You find a hidden exit: cubbyhole
You find a hidden exit: west
:EXITS: cubbyhole, west:
search
You find a small bag
You find a small knife
:OBJECTS: small bag, small knife:


I used the variables @test1 @test2 and @test3 respectively to get these results.

When you load these settings from a text file zmud replaces the new lines with a ;

This does work in a controled invironment.

You asked for help. The code and the extra input I've given with this post are a good start. But it is help, not the whole thing done for you and wrapped up in a nice package, I am sorry If I made it apear that way in my previous post.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
minish1
Beginner


Joined: 24 Feb 2005
Posts: 23

PostPosted: Thu Sep 21, 2006 2:58 am   
 
i said, i wanted the "triggered command" to be "gt EXITS:blah blah blah, OBJECTS: blah blah blah"

ok, so IF i find something WHEN i type the mud specific command "search" it outputs

You find an object
or
You find a hidden exit: exit

"gt" is a mud specific command that "group mentions" a message to people in your group... for example

on my mud, if i have people in my group, i type "gt hi"

it then says to them, minish1 group mentions "hi"

therefore, WHEN i type search, not any other alias, IF i find something hidden(because there is not always hidden things in the room i'm in), i want it to then trigger a command.... "gt EXITS: blah blah, OBJECTS: blah blah"


so when i tried the code you gave me, when i search for something, it effects nothing.... regardless of if/what i find... it always outputs the same things when i type "gt"

once again, i do not want any alias etc etc to do this, i want a trigger, that outputs a list of objects/items hidden in the room
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Sep 21, 2006 5:20 am   
 
Minish1 I'm sorry I just spent an hour typing a response and lost it because my login timed out.

change the name of the alias from gt to findtell

in the value of findtell
change

#echo to gt

In the trigger search change

#alarm +3 {gt}

to


#alarm +15 {findtell}

Given that I just lost an hours worth of explaining the why of these changes and it is after midnight here. If this doesn't help you I am sorry I give up. Ask your friends in the mud to help you if nobody else offers you help with my code or helps you another way. I'm done here Sorry.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
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