|
vraeth Beginner
Joined: 06 Jul 2008 Posts: 10
|
Posted: Sun Jul 06, 2008 5:33 am
Not a script writer |
hello all-
I've been an avid user of ZMud for many years...but, I've never done more than use the automap to accomplish anything, other than alias and triggers.
Here is what I'm looking to do, and if anyone can help me with it I'd really appreciate it.
First, a typical look command:
The forest clearing
You are in a clearing in the forest. Lots of fresh stumps of varying sizes
protrude from the ground and heavy logs are stacked neatly in a big pile
supported by stakes set into the ground. Paths lead north, east and west.
[Exits: north east west]
[ Mount ] (Charmed) a beautiful flaming bird is here carrying you on its back.
[ Pet ] (Charmed) A green spotted salamander slithers here.
[ Wild Elf ] Wearing a green, aromatic robe, a wild elf wanders in search of herbs.
<220/220 208/208 188/188>
forest
<14099>
The last line is my xp tnl, while the line above is the sector type.
Here is what I'm trying to do:
I'm using the automapper. I would like to be able to change the color of the rooms AS I MAP, to reflect the sector type.
Here's the second thing:
On this mud, you can gather wood materials in forest areas. Once you've done that, you can then grind that material down into pieces to make armor, tools, bows, arrows etc. REALLY like this feature.
Thing is, each ROOM (not necessarily zone) gives you a different type of wood. I need to be able to put that information into a db of some sort, as to what type is in each room. Then, using the sector in the prompt, if it is forest have ZMud send me a message as to what TYPE of wood I can gather in that room.
To me, this sounds like a lot of work, but I'm sure someone can give me an idea of how to do it in the necssary 10 lines or less ;)
Hope to hear from someone, and thanks very much in advance for the help. |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Jul 06, 2008 5:05 pm |
Actually this wouldn't be that hard at all...
Not something I can do while I'm away from zMUD, but it can be done pretty easily. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
vraeth Beginner
Joined: 06 Jul 2008 Posts: 10
|
Posted: Sun Jul 06, 2008 6:10 pm |
Well, I have no clue as to how to approach it. I'm not up to learning a new coding language. Been years since I've done anything worthwhile, and now find I don't have the incination. However, if I could get pointed in a direction, or get soem examples, I might very well pull it off....in 6 months or so lol
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Jul 06, 2008 6:46 pm |
Or I could just do it for you when I get home and can muck about with zMUD ;)
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
vraeth Beginner
Joined: 06 Jul 2008 Posts: 10
|
Posted: Sun Jul 06, 2008 9:23 pm |
Sounds great to me!
And, at the same time, I'll probably learn something. That's never a bad thing, as far as I'm concerned. So look forward to seeing you work! :) |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sun Jul 06, 2008 11:10 pm |
Ok, I need to know the types of wood to be gathered.
My idea is this:
Each type of wood will be given a different color or symbol to represent it. This color/symbol will be shown in the mapper, and will also be represented in the room. Perhaps in the room I would #SUB the sector type, so you would see 'forest (Ash)' for a room where you can harvest ash wood. Obviously I'll have to give you a way to choose for each room what type of wood can be gathered there, but this can be done with a simple alias:
ashwood sets to ash
oakwood sets to oak
etc etc. You'd know which rooms aren't set yet because they wouldn't have the designation that we choose shown. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Jul 06, 2008 11:45 pm |
First thing you need to do is get a trigger for that text at the bottom. It'll look something like
#trig {<%d/%d %d/%d %d/%d>} {}
#cond{(%w)} {} {within|param=1}
There's a lot of info in the manual about multistate triggers that explains exactly what this does - in a nutshell, it waits for the first pattern, then looks for the second one on the next line only. That should match the stuff you have above, but it depends on how the lines change. More examples always help.
From there, you need to decide what colour you want for each one. Say you want green for forests and yellow for deserts. With the %roomcol function, you can change it all you like:
#trig {<%d/%d %d/%d %d/%d>} {}
#cond{(%w)} {#if (%1="forest") {#call %roomcol(,green)};#if (%1="desert") {#call %roomcol(,yellow)}} {within|param=1}
And adding new ones is pretty trivial. I'm not sure if %roomcol can take hex colours, but I have a feeling it does, too, so you have as many options as you could want.
The tree-type thing is going to require a bit more thought, though - it'd be best, I think, to store it in the mapper's database, but I'll need to have a think about which field to use. |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Jul 07, 2008 12:48 am |
*Pokes Fang*
He doesn't want all the sector types colors, he wants all forests done for what type of wood the produce, which requires user input ;) |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
vraeth Beginner
Joined: 06 Jul 2008 Posts: 10
|
Posted: Mon Jul 07, 2008 3:53 am |
What I would like is to have something of both. I would like to have all of the mud mapped out in color dependant on terrain, but right now the forest is the most important part. However, for future reference, the sector types are:
City, field, forest, plain, wasteland, deser, hill, mountain, swim, underwater, air, inside, ruins
At least, those are the ones I can think of off the top of my head ;)
As for, types of wood, the list consists of 48 different types of wood, plus a nil value and random value, which some of the rooms have.
If you want, I'll put the full list here, but just being able to manually enter that into a DB and have it report that to me in the window when I enter a forest area would be good enough for what I want to accomplish.
thanks for all the help, and the insight. If this goes well, I may end up coming back with more questions to the point I want to code again lol.
I'll try that trigger shortly. Just became clan leader for our guild on this mud lol. |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Mon Jul 07, 2008 7:00 am |
Ok, for coloring the sectors, you can use Fang's trigger... and a simple matter of this alias will add your wood type to the room:
#ALIAS wt {%roomflags(,%-1)}
This will allow you to make UP the roomflags as you go. You enter each wood type manually as a string:
wt Oak
wt Random
wt Ash
wt Birch
etc... just stand in the room and issue the appropriate thing.
Then you can use a trigger to append it to the sector type or whatever you want to do with it. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
vraeth Beginner
Joined: 06 Jul 2008 Posts: 10
|
Posted: Mon Jul 07, 2008 8:04 am |
Thanks!
As for the script, there was an error in it, which I was able to correct. However, on forest sectors, it changed the color to yellow, not green, even when I removed the second part only worked with forest as follows:
#trig {<%d/%d %d/%d %d/%d>} {}
#cond {(%w)} {#if (%1="forest") {#call %roomcol(,green)}}
{within|param=1}
ALso, how do I hide this so that the scipt text isn't hitting on the screen? I don't mind when I'm testing it, but when it hits even when I look or when the tic happens, it quickly eats up space.
Will work on the ALIAS part tomorrow and see if I can get it done before work. Also, will this allow me to see via the map what rooms have what woods? |
|
|
|
vraeth Beginner
Joined: 06 Jul 2008 Posts: 10
|
Posted: Tue Jul 08, 2008 6:27 am |
First, my thanks Ral and Fang for helping with this. It's coming together, if nothing as 'grand' as I wanted, it is functional, and right now that's what I need.
I shortened the script to JUST color the forest areas. Why? Because they are the only areas you can gather wood in ;)
Since I don't plan on gathering other things (like planting and harvesting or gathering herbs) it is now changing the color as needed on the map via this:
#trig {"<forest>"}
#call {%roomcol(, #00ff00)}{}
I changed my prompt to a third line with xp, since it wouldn't read the line until after a return had been done...no worries, it's working (and you will note, it does accept the ANSI color standard!)
The ALIAS, however, seems to be an issue atm.
the Alias is WT with the following command value:
%roomflags(,%-1)
This works, sort of. when I type wt I get:
1.nothing, if the room has NOT been flagged, which is fine.
2. If it HAS been flagged, then whatever variable I use FOLLOWING the alias is set. That is fine and makes upgrading rooms easier. However, here is the problem:
Instead of sending the roomflag to my screen, it is sending it to the mud. thus, when I wt, if the room is set to OAK, it sends OAK as a COMMAND to the mud.
What I need is for it to just post the sector type to my screen without sending a command to the mud. Also, as noted, would like to make the scripts run QUIETLY in the background, though with the new <forest> flag instead of the prompt, it isn't going off NEARLY as often ;)
Thanks again guys, and hope to hear from you tomorrow.
Vraeth
*UPDATED*
Ok, played with it a little more, and this is what I have for the TRIGGER at this point
#trig {"<forest>"}
#call {%roomcol(, #00ff00)}
#call {%roomflags(,%-1)}{}
#say %ansi(green)Gather: %roomflags
This calls the roomflag, and then displays WHAT the flag is on a new line. Works great, and it doesn't send the information as a command to the mud. If it is blank, it returns nothing. May change that in the future, but for now it works.
HOWEVER, the ALIAS (wt) still gives me an issue whenever I type it and there is already a flag. Still sends the %roomflags value to the mud as a command. When I initally INPUT the value for the %roomflags it sends it then as well.
And, again, would like the script to run in the background, not sending the script to my window everytime the trigger hits when I'm walking through the forests of the mud.
So, what do I do to fix these last minor issues?
Did I say, I hadn't coded in a long time? Now look at me starting again *sage*
Vraeth |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Tue Jul 08, 2008 5:37 pm |
Ok, I'm not really up to date on the commands for the mapper, like roomflags... hehe, I don't use it. So I'll let someone else let you know how to correct your problem with it echoing to MUD. Probably using #NOOP %roomflags, but I'll let Fang or Vij or someone else tag that since they'll know for sure. Or perhaps if you want it to echo to screen you'd use #SAY or #ECHO in play of #NOOP... lol If you want the trigger to fire regardless of whether you have the xp line or not, change the options on the trigger to trigger on prompt instead of new line. You'll find these in the trigger editor on the options tab once you select the trigger.
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jul 08, 2008 6:55 pm |
#noop is deprecated and doesn't work properly in every case; #call is the way forward.
The way function and variable expansion works is that whatever's left after all the expansion is done is sent to the MUD. So if you put @something on a line on its own, and @something has the value "hello", then "hello" will be expanded out and be on a line on its own. zMUD knows what to do with text on lines on their own - send them to the MUD. If you want it to do something else, you need to use one of the commands like #say, #echo or #show.
(Note that this behaviour is different in CMUD.)
EDIT: Oh, and you have some extra brackets - you're doing #call {%roomflags(,%-1)}{} when you really mean #call {%roomflags(,%-1)} or even just #call %roomflags(,%-1) |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Jul 09, 2008 2:38 am |
So, I was right, just #CALL if you want nothing to echo to screen at all, and #ECHO if you want it to show to screen but not to MUD. And thanks for the #CALL info Fang, I don't mess with any com objects or any mapper things, so I've never had need for it (though I have used #NOOP in an otherwise empty MACRO to make it export and import properly).
As another option, since we've got wt as the command to SET the wood type, if you want it to SHOW you what type a room is set at (and you can add this to your sector type trigger)
#ALIAS showwt {#ECHO %roomflags(,)}
Or am I misreading the help on %roomflags Fang?
Cause I tried testing it with
#CALL %roomflags(,"This is my Clan Hall")
#ECHO %roomflags(,)
And I got nothing. I even tried it without the comma, but no joy. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
vraeth Beginner
Joined: 06 Jul 2008 Posts: 10
|
Posted: Wed Jul 09, 2008 5:22 am |
thanks Fang. removed the brackets, didn't affect anything. And thanks Ral, I already had it to show in the trigger, but I did change from Say to Echo. When I chose it, it was first thing that I read in help files lol.
Thing is, I would like for the trigger to not be visible, just run in the background without outputting ANY text to my screen, except the #echo
Once that is done, I've got another project to work on, this one probably much more involved than I want, but would like to have it anyway... |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jul 09, 2008 2:41 pm |
The trigger really shouldn't be outputting anything to the screen that's not a command you've told it to send (by leaving something on a line on its own), which'll appear in yellow to show it's being sent to the MUD as well, or that you've explicitly told it to send with one of the #say and #echo-type commands.
At a guess, I'd say it's printing the text of the script to the screen, which means there's a syntax error - my guess was that it was the extra brackets, but obviously not. Give us what you're running now so we can have a go too. If it's printing something else, tell us what.
Oh, and I have no idea about %roomflags. Looks like it should be working to me (though you'd need to omit the comma when retrieving to avoid setting the flags with a blank string). You could try using %roomnote instead. |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Jul 09, 2008 4:18 pm |
Yeah, thats what I thought (retrieving) and like I said, I tried both with and without the comma. So I'm not sure why that isn't working. I'll have a look at roomnote later. I might start using this stuff for myself.
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
vraeth Beginner
Joined: 06 Jul 2008 Posts: 10
|
Posted: Thu Jul 10, 2008 6:01 am |
Here is the layout of what I 'see' on the screen everytime I enter a forest room, or get a tic in one, or just look...
You rummage around the forest, finding some good pieces of wood that can be usable for material.
You figure the cleared forest floor will sprout some nice trees now that sunlight can reach it.
You receive 4068 experience points.
<262/262 425/425 158/351>
<forest> ::28578:: [<forest>-> #trig {"<forest>"};#call {%roomcol(, #00ff00)};#call {%roomflags(, )};#echo %ansi( green)Gather: %roomflags]
Gather:
everything from the beginning [ to the end } is in Bright Cyan color.
the current script is:
#trig {"<forest>"};#call {%roomcol(, #00ff00)};#call {%roomflags(, %-1)};#echo %ansi( green)Gather: %roomflags
I single lined the script to take up less scree area when it triggers |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jul 10, 2008 9:24 am |
That's why, then... you've got a #trig command in there!
The #trig commands we've been giving you above (whose syntax does not look like what you've got there, look closely at the above scripts - the second parameter is the script to be run) is a command to create new triggers. That's why we were using it above, so you can just enter it on the command line and it'll create the trigger you need.
I'm going to guess that this script is inside a trigger with the pattern <forest>, because it matches the right line.
Anyway. I have this feeling that there's an option somewhere that causes triggers to be echoed for debugging... you might want to see if you can find something that sounds like that.
Otherwise, when that happens, it means there's a syntax error in your script. I can't spot one there, so if it's still doing it with the #trig command removed, I'm stumped. |
|
|
|
vraeth Beginner
Joined: 06 Jul 2008 Posts: 10
|
Posted: Fri Jul 11, 2008 4:51 pm |
I'll have to try it tonight. Been a busy last couple days, and having to go in to work early today.
I see what you're referring to, I removed the #cond part of the script. So, that being the case, I should probably add it again to see the CONDITION of <forest> instead of the TRIGGER for it.
Will set it tight tonight. Thanks Fang :) |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Fri Jul 11, 2008 5:39 pm |
Or just do:
#TRIGGER {^~<forest~>}
And do away with the need for the rest of it.
But the trigger itself is containing another trig forest is what FANG was saying. Thats not good :) |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
vraeth Beginner
Joined: 06 Jul 2008 Posts: 10
|
Posted: Sat Jul 12, 2008 6:15 am |
Ok, found the toggle for the trigger to keep it from showing the sciptr on the screen. View > Preferences > General toggle script ;)
I removed the #trigger portion of the script. Seems to be working fine, though it seems to be losing the roomflags that I had previously set. Will look further to verify.
Sorry for the short response, but dead tired after a 12 hour work day and again tomorrow. |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Sat Jul 12, 2008 5:06 pm |
We understand :)
If you need anything else let us know. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
|
|
|
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
|
|