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
sikkar
Newbie


Joined: 29 Sep 2004
Posts: 8

PostPosted: Mon Feb 14, 2005 1:01 am   

Anyone bored and wanna make me a script?
 
alright i get output from the mud like this

You are to find and capture a druidess.

what i need it to do is travel to the mob and capture it, then getquest

I tried a simple trig but it can give different outputs like

You are to find and capture a druidess.
You are to find and capture an druidess.
You are to find and capture the druidess.

such like that, but not always, so (a|an|the) isn't working for me

also if it outputs

That's not the mob you're searching for.

I'd like the trigger to either try to capture 2.mobname
or k mobname, then travel, capture mobname again, repeating untill

...You succeeded in snaring it!

is given.

also,

if
...You missed! an undead giant gets angry and attacks!

i would like it to capture 2.mobname kill mobname, travel mobname and capture, (like before)
if

Nobody by that name.

is given while it is trying that i want it to stopquest, then use getquest again




thanks in advance for any kind soul willing to make this.
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Mon Feb 14, 2005 5:10 am   
 
You dont really give enough enough info for someone to make a complete script for you.
To make a trigger to match every possible out from the mud
you need to provide a sample of every possible variation
so statements like:
such like that, but not always, so (a|an|the) isn't working for me
isnt really very helpful/informative you need to show else what else might come and how it varies.
As well you might wish to provide some of the specifics of the syntax of the commands needed as well as any special circumstances.
for example on the mud I haunt,one cannot just stack commands after a portal command, because after one enters a portal there is a 5-10 seconds waitstate where any further commands would be executed in the portal 'chamber';

A good idea might be to enumerate all the variations of the input from the mud.
but to actually try to implement the program yourself and post your code here along with any problems you encouter with your code.
that way we could work together at shaping it until it meets all the requirements to function successfully on your mud.
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
sikkar
Newbie


Joined: 29 Sep 2004
Posts: 8

PostPosted: Sat Feb 19, 2005 7:00 pm   how'd i know it wouldnt work to just ask for it hehe
 
Ok, i'm very new to trying to make scripts...i've been strictly confined to VERY basic triggers...but i want to learn (so i've been reading the boards)

alright, so what i did to make this easier (i think)

is make a list (using variable) of all the outcomes i want the to act on...

so 2 questions

1. Is their a way to set another variable off what is in the list, example...

Alien, Ailne, Aelin ect, i could designate to use just alien for furth down the script?

2. how do i make an if/then statement in zmud off a trigger

so off the line

The message goes, 'You are to find and capture (*).'

it would check to see if %1 is in the list (@qmob), and if so act a certain way, and if not, act another way.


I'll just take it a step at a time, since I want to learn, and trying to have one of you guys write the whole thing for me wouldn't help that much

P.s...talked to me like I'm an idiot cuz when it comes to this...i am :P
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sat Feb 19, 2005 7:56 pm   
 
1. Is their a way to set another variable off what is in the list, example...
Alien, Ailne, Aelin ect..

#VA alist {Alien|Ailne|Aelin}
okay now we have alist named alist containing 3 items including the string alien
to assign alien to a variable do this:
#VA anitem %item(@alist,1)
okay now we have a variable that contains the string alien.

2. how do i make an if/then statement ...[that] it would check to see if %1 is in the list (@qmob), and if so act a certain way, and if not, act another way.

#TRIGGER {You are to find and capture (*).} {
#if %ismember(%1,@qmob) {act a certain way} {act another way}
}


%ismember will return 0 (false) if %1 is not an item in the qmob list
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
sikkar
Newbie


Joined: 29 Sep 2004
Posts: 8

PostPosted: Sat Feb 19, 2005 9:48 pm   
 
#if %ismember(%1,@qmob) {act a certain way} {act another way}
}



so {act a certain way} is if %ismember returns true?


*goes to play with it*

oooo...thanks :p
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sat Feb 19, 2005 10:26 pm   
 
yeah:)
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
sikkar
Newbie


Joined: 29 Sep 2004
Posts: 8

PostPosted: Sat Feb 19, 2005 10:34 pm   
 
ok, don't think your answer for question one works with what i am talking about

#TRIGGER {You are to find and capture (*).} {
#if %ismember(%1,@qmob) {act a certain way} {act another way}
}


so I am using that first part, but if "aeline" is the captured part, is there a way i can get it to recognize it as alien, so would i have to have it do a check on @alist?

i think that would work like that, but that'd be an insane amount of checks to run, seeing as there is probably 50 different mobs in #qmob

so i could set up a variable like @alist for each mob in the @qmob list...

ooo wait, all the possibilities would have to be in @qmob (so any way the letters in alien could be arranged), then i could have it check alist, to see if the %1 is in alist, if it is, it would return alien as per @anitem? or how does that work?


meh thats not it at all :/


hrm, *is to tired to think this through atm*

lets try it this way...

If @qmob contains 20 items, the first item being Alien, the next 9 being variations of incorrect spelling, is their a way to have it set so if the input for the trigger is say 2 on the list, then it would return 1, being alien
something like
#VA mobq %item(@qmob,1) // now this would fine the first item in qmob, and set @mobq to that correct?



and would that also work for say 11 being the return for 12-19 or so on...?


example...

i am given this

You are to find and capture eAlin.

now "eAline" is %1, and is in the @qmob list, and is say number 2, is there a way to dictate that instead of using "eAline" (or %1) that it would use "Alien" instead..

#if %ismember(%1,@qmob) {travel %1;capture %1} {stopquest;getquest}


so the way that is set up it would just try to travel to and capture "eAline"
is there a way to set it so that any variation of "Alien" would come back as such instead of the misspelling?
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sat Feb 19, 2005 11:53 pm   
 
theres a way but its fairly complicated (maybe someone has better ie easier way)
here is an example first the variable:

#var qmob ""
#additem qmob {alien|aiellen|eilien}
#additem qmob {predator|prdator|praydator}

the qmob variable is now a list containing other lists
in each list the first item is the correct spelling of the word
so %item(@qmob,1) returns the aliens list and %item(@qmob,2) returns the predator list.

now here's an example alias demonstrating how we could do the things you wish to do

#ALIAS foo {
#va temp.listlen %numitems(@qmob)
#va temp.index 1
#va temp.found 0
#while (@temp.index <= @temp.listlen) {
#va temp.list %item(@qmob,1)

#if %ismember(%1,@temp.list) {
#va temp.found %item(@temp.list,1)
#add temp.index @temp.listlen}

#add temp.index 1}
#if @temp.found {#echo found:@temp.found} {#echo i found nothing}
}

lines 1 to 3:
instead of making 3 seperate variables to hold the temporary values we're working with i made 1 complex variable that holds the temporary
data we're working with.
1)First we get the total number of items in our
qmob list.

2)then we set our index to 1 so that we start at the begining of the list.

3)the found variable will be used to hold the correct spelling of the word
we're after we set it to 0 because none of the words we're gonna be after is gonna be "0" and also 0 evaluates to false so we can use it in an
if statement later

4) our while statement says that for as long as or index is not greater than the total number of items in our list, to do the things in the {}s that follow

5) we set temp.list to the current sublist we're on ie to the alien or predator sublist
6) now we see if %1 is known variation of word in this list.

7) if it is a variation we get the correct spelling, which is the first variation
in the list,and assign it to temp.found

8) since we found what we're looking for no need to continue the while statement, so we add listlen to index, since listlen + index is greater than listlen we know the next while check will fail.

9) this increases index by 1 so that the next iteration of while we'll look at another item (sublist) in the qmob list
if the %1 isnt a variation of any of the words we know eventually this will make index > listlen and the while loop will stop running

10) okay now we're done with checking the list and sublist check if we found anything if so echo that we found it, if not echo that we didnt.

thats it all done, the colouring above is just so you can seperate the various parts easily:)
I know the explanation was very verbose, but you did say you wanted to understand it, hopefully this helps out a bit.
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
sikkar
Newbie


Joined: 29 Sep 2004
Posts: 8

PostPosted: Sun Feb 20, 2005 5:32 pm   
 
#TRIGGER {You are to find and capture (*).} {
#if %ismember(%1,@qmob) {
#if %ismember(%1,@alienlist){travel alien;capture alien}
{#if %ismember(%1,@predatorlist){travel predator;capture predator}
{#if %ismember(%1,@wishbearlist){travel wishbear;capture wishbear}
{#if %ismember(%1,@kougalist){travel kouga;capture kouga}

{stopquest;getquest}//now i know that the mob should be in one of the previous variables so how would i end it here?, i figured just having it as the original #if statements return false would work
}
{stopquest;getquest}
}



that right there looks like it would work for my purpose, as long as i made @qmob with every variation of all mobs, and then made another variable with each seperate mobs variations. then i could use what i know to be the correct .

only thing wrong with that script above is the ending of the true sides, false statement (does that make sense) as i asked above in the script.



now i understand that way, i think


i just woke up, but i had that part in my mind when i woke up so it was easy, still not understanding the use of 1 complex variable, though it seems it would be much easier...

my question is then, if used %ismember on the "all-in-one" variable, would it look at each seperate list in the variable?

ugh i'll ask more questions when i understand your last post :P
*goes to get some coffee*

Thanks man, your helping a ton.
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sun Feb 20, 2005 6:15 pm   
 
In the code that you just posted you didnt put the mob name to any variable so you wouldnt have it.
Since it looks like you're keeping seperate lists for each mob
you can forget about qmob.
here's an example based on the code you just posted

Code:
#TRIGGER {You are to find and capture (*).} {
#var mob ""
#if %ismember(%1,@alienlist) {#var mob %item(@alienlist,1)}
#if %ismember(%1,@predatorlist) {#var mob %item(@predatorlist,1)}
#if %ismember(%1,@wishbearlist) {#var mob %item(@wishbearlist,1)}
#if %ismember(%1,@kougalist) {#var mob %item(@kougalist,1)}
#if (@mob = "") {#echo we didnt find anything because the variable mob is empty} {travel @mob;capture @mob}
}


we check each list for %1 and if its found we assign the correct spelling
to the variable mob, using #var mob %item(@list,1)
where list is the moblist that matches.

%item(@list,1) returns the first item in the list which you should always make the correct spelling of the mobname.

the above example is much simpler because you keep seperate lists
and only the list that matches will return true for %ismember
and so only that list will set the correct name in the mob variable.

the line that has #if (@mob = "") checks to see if we found anything at all
since at the start we set mob to equal an empty string "",it will return true
only if none of the lists had %1 in it.

if it matches you can then use that variable like we did above
with travel @mob

if the mob in question was alien travel @mob
would send travel alien to the mud
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
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