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


Joined: 10 May 2002
Posts: 23
Location: USA

PostPosted: Sun Jun 01, 2003 6:50 am   

DR:TF traders script
 
I'm trying to make a traders script that will walk around delivering cargos to various destinations. First let me explain some basics then show you what I have. There are about 5 different destinations that the cargo can go to and at each destination you pick up another load which will be taken to one of the 5 different destinations. So with this snipet of code I am trying to develop a way to know where to take the next shipment. Remember 5 towns (A,B,C,D,E) and each town can ship cargo to any of the other four. I know I'm gonna have to make walking scripts to each of the four towns so what I'm trying to do is write a script that will call the right walking script. To start with you get a contract and read it. Now here is what I've come up with so far: (blue is what I type and what the mud shows, Red my own comments, black is script)

read contract

```````````````````````````````````````
Trading Contract Issued by: The Crossing

The guild office at Stone Clan requires 4 pewter goblets, to be delivered within about 1 andu.

The bearer of the goods and this contract will receive, upon safe and timely delivery of the merchandise, a payment in the form of the local currency.
```````````````````````````````````````


#Trigger {Trading Contract Issued by: (%w)
Captures the word "The" and puts it in %1 and then assigns it to Start

#Variable Start %1

#Trigger {The guild office at (%w)}

#Variable Destined %1


Grabs the word "Stone" and puts it in %1, then assigns it to Destined

#Variable Trip= %concat(@Start,@Destined)

creates the variable Trip with "TheStone" assigned to it.

Ok now here are my two questions:

1) Will the script run as I'm expecting and have explained?

2) This one I'm embarrassed to asked but how now do I get my walking script to start?

I know my walking script will be called TheStone so I guess what I'm asking is how to send the contents of my variable Trip to the mud to activate my walking script called TheStone


Jesman
Reply with quote
Jesman
Beginner


Joined: 10 May 2002
Posts: 23
Location: USA

PostPosted: Sun Jun 01, 2003 8:35 am   
 
hmmm don't what happened but the text between the two lines should also be in blue its the MUD's response to "read contract"

Jesman
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jun 01, 2003 8:45 am   
 
Assuming the code you listed is just a shortened variation to give us the gist of the example and NOT what you actually wrote, it should work as you described, other than the = in the #variable command (you don't need it there).

To execute your speedwalking paths, simply use #WALK or #SLOW, depending on whether you want to specify slow-walking mode or not.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Jesman
Beginner


Joined: 10 May 2002
Posts: 23
Location: USA

PostPosted: Sun Jun 01, 2003 10:27 am   
 
hmmm nope thats the whole block of code. Its basically used to get the name of the alias that I need to run to walk to my next destination.

oh and to get it to run all I need is to enter this next in the script...I think


@Trip


Jesman
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Jun 01, 2003 12:19 pm   
 
Or more properly:
#EXEC @Trip

Kjata
Reply with quote
Jesman
Beginner


Joined: 10 May 2002
Posts: 23
Location: USA

PostPosted: Mon Jun 02, 2003 10:02 am   
 
hmmm this script doesn't seem to be working right. This is the script:

read contract
#TRIGGER {Trading Contract Issued by: (%w)}
#VARIABLE Start %1
#TRIGGER {The guild office at (%w)}
#VARIABLE Destined %1
#VARIABLE Trip %concat( @Start, @Destined)
#SHOW @Trip
#EXEC @Trip

and this is the output from it:

> read contract
Variable: Start %w
Variable: Destined %w
%w%w
%w%w

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Trading Contract Issued by: Leth Deriel

The guild office at Tiger Clan requires 13 crates of chamomile,
to be delivered within 1 andu and a bit over 3 anlaen.

The bearer of the goods and this contract will receive,
upon safe and timely delivery of the merchandise, a payment
in the form of the local currency.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You estimate these goods are currently worth 351 Kronars on delivery.

Anyone know why the VARIABLE TRIP doesn't have the string "LethTiger" in it?

Jesman
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Jun 02, 2003 12:20 pm   
 
The script is not to be entered all into one alias. You need to create the first trigger:
#TRIGGER {Trading Contract Issued by: (%w)} {#VARIABLE Start %1}

and then second one which creates the other variable, concatenates them and executes the path:
#TRIGGER {The guild office at (%w)} {#VARIABLE Destined %1;#VARIABLE Trip %concat(@Start, @Destined);#SHOW @Trip;#EXEC @Trip}

Now when you send "read contract" to the MUD, the first trigger will fire, a bit later the second one fires, it creates the variable and walks to where it needs to go.

Kjata
Reply with quote
Jesman
Beginner


Joined: 10 May 2002
Posts: 23
Location: USA

PostPosted: Tue Jun 03, 2003 12:41 am   
 
aaaaa so then the problem with my script goes back to our other conversation about my understanding of TRIGGERS. In this case I didn't realise that you had to include the command in {} or that to have the TRIGGER execute multiple commands you need to include them all within {}'s

Thanks for all your help
Jesman
Reply with quote
Jesman
Beginner


Joined: 10 May 2002
Posts: 23
Location: USA

PostPosted: Tue Jun 03, 2003 1:59 am   
 
Ok still having problems with this TRIGGER here is the TRIGGER:

{The guild office at (%w)}

and here is the Value

{#VARIABLE Destined %1;#VARIABLE Trip %concat(@Start, @Destined);#Show @Trip}

I get this error message:

{#VARIABLE Destined %1;#VARIABLE Trip %concat(@Start, @Destined);#Show @Trip}
^ syntax error

what am I doing wrong?

Jesman
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Jun 03, 2003 4:40 am   
 
You aren't really giving us enough to be certain, but it sounds like you have a missing space between the ending curly brace of your trigger pattern and the beginning curly brace of your trigger code-block:

#trigger {some pattern}{some code}

trigger {some pattern} {some code}

This would be an impossibility if you entered all triggers and such via the Settings Editor window, but it might happen if you entered each one via command-line.

If THAT'S not the problem, perhaps you used the wrong brace. Using a parenthesis when you should be using a curly brace will generate a syntax error.

li'l shmoe of Dragon's Gate MUD
Reply with quote
Jesman
Beginner


Joined: 10 May 2002
Posts: 23
Location: USA

PostPosted: Tue Jun 03, 2003 4:58 am   
 
I am using the Settings Editor for Triggers. I copy and pasted each section from it into the thread. This has me confused.

Jesman
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Jun 03, 2003 12:12 pm   
 
Here in this forum we tend to give scripts in a way that they can be copied from the forum, pasted into zMUD's command line and just by pressing Enter it creates all the settings necessary. So, unless otherwise specified, all scripts posted in this forum are meant to be entered into the command line.

You can use the Settings Editor if you want, though, you just need to know what parts of the command goes where. Here is an example of a trigger:
#TRIGGER "ID" {my trigger's pattern} {some commands} "class" {options}

If this trigger was to be created using the Settings Editor, the blue part goes in the Pattern box, the red part goes in the Value box, the green part means to create teh trigger inside a class folder with that name, the orange part is the trigger's ID which is entered in the ID box under the Options tab, and the purple part are the options for the trigger which are a set of checkboxes found in the Options tab. The parts in orange, green and purple are optional and you will normally not see them.

For aliases it is easier. They follow this form:
#ALIAS name {commands} "class"

So now you create a new alias and put the blue part in the Name box, the red part in the Value box and create the alias inside a class folder with the name given in the green part. In here, only the green part is optional (this is not completely true, some stuff happens if you omit one or both of the other parts, but it is generally not useful).

These two are the most commonly used. To find out more about the syntax of some of the other commands go to the Command Reference section of the help file and look at the help entries for the commands under the Create/modify settings items part.

Kjata
Reply with quote
monkeybone
Newbie


Joined: 02 Jun 2003
Posts: 6

PostPosted: Wed Jun 04, 2003 7:40 pm   
 
Well my brain is a bit foggy on a game I haven't played in many years, but here you go.

My suggest would be something like this:

Make 'flags' for contracts. Both for issued and where they are to be delivered.

For instance:

Trigger the line of when you get a contract from the clerk to READ CONTRACT

Trading Contract Issued by: The Crossing

You can do this with one trigger, but for ease make one for each outpost.

So for the trigger Trading Contract Issued by: The Crossing

#var crossingissue 1

Now you know who issued the contract.

Now trigger destination

The guild office at Stone Clan requires

#var stoneclancontract 1

The mistake most traders made back in the day was in not maximizing their deliveries. They wound up making deliveries to outposts where they had already been issued contracts or skipping other outposts along the way, in effect doubling the distance they would need to travel to receive another contract.

The beauty of a 'flag' system is then you can write logic.

#if (@crossingissue = 1 AND @stoneclancontract = 1 AND @lethissue = 0) {crossing_leth} {crossing_stoneclan}

Course I am doing all of this off the top of my head.

We also used to carry several containers. That way we could keep all contracts for a particular outpost in its own container.

So did they ever manage to come out with personally owned caravans and ships worth anything?
Reply with quote
Jesman
Beginner


Joined: 10 May 2002
Posts: 23
Location: USA

PostPosted: Thu Jun 05, 2003 12:01 am   
 
I didn't know I could pick up multiple contracts. Thanks for the heads up monkeybone.

I'm still having trouble with some of these Triggers.

I copy and pasted the second trigger and it works just fine but the first one doesnt seem to be working its this one:

TRIGGER {Trading Contract Issued by: (%w)} {#VARIABLE Start %1}

When I run "read contract" the @Trip variable contains "%wTiger". I can't think of any reason why this Trigger wont capture the word Leth.

Any suggestions or comments will be most appreciated as my forehead is becoming quite sore from banging it on the monitor.

Jesman
Reply with quote
Jesman
Beginner


Joined: 10 May 2002
Posts: 23
Location: USA

PostPosted: Thu Jun 05, 2003 12:48 am   
 
ok done some more testing and reading don't know what it means but hopefully this will help someone figure out the problem.

I assigned "testing" to the variable Start before I "read contract" the Trigger didn't change the variable and the variable Trip read "testingLeth"

Also in my reading under the command DEFault it has as a special character "7 Focus Char(:)". I don't know what a focus character is or does but is the (:) after by affecting the Trigger in any way?

Jesman
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Jun 05, 2003 1:11 pm   
 
The : should not affect the pattern since it does not have a special meaning within patterns.

It seems like the trigger is not fire for some reason. Perhaps there are more spaces in the output sent by the MUD than there are in the pattern. Or perhaps it's something else. Look very closesly at the output sent by the MUD and compare it with the pattern. Try to find any differences. You might also want to add a command like:
#SH The trigger fired

to the commands of the trigger. This way, when it fires you can get a message about it, so it helps when you are trying to get the pattern to match the text sent by the MUD.

Kjata
Reply with quote
Jesman
Beginner


Joined: 10 May 2002
Posts: 23
Location: USA

PostPosted: Sun Jun 08, 2003 12:45 pm   
 
Kjata,

YOU THE MAN!

I went in and took out all the spaces between : and %w ran the trigger (which didn't work but was expected) and then starting puting in one blank space at a time between : and %w. Just like you said the mud was sending some extra spaces that weren't showing up. After about 3 spaces the TRIGGER worked as expected. Thank you for all the help you have given me.

Jesman
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