Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Processing Parenthesis Correctly
|
Processing Parenthesis Correctly
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2 3
| Posted by
| Metsuro
USA (389 posts) Bio
|
| Date
| Reply #15 on Tue 09 Jan 2007 10:00 PM (UTC) |
| Message
| | Are you ever going to release your full script system maybe one day? |
Everything turns around in the end | | Top |
|
| Posted by
| Gohan_TheDragonball
USA (183 posts) Bio
|
| Date
| Reply #16 on Wed 10 Jan 2007 11:46 PM (UTC) |
| Message
| I released the script system on mudbytes a couple months ago. however sometime this week i will update it to include the new parenthesis evaluator addition.
http://www.mudbytes.net/index.php?a=files&s=viewfile&fid=740
Another thing I will also include is my update to the variable code. I made it so builders can create and access variables on a player mobile. Originally I used some snippet that allowed access to 5 variables on a character, but I felt it was limited, so I went added the ability to do stuff like:
setvar $n lastloc South City
In this example I have a policeman with a quest to help find his baton, and that variable is used to help with what city the baton might have been lost in, since the city it is lost in changes each time.
say I am not too sure, but I would suggest looking in the vicinity of $i.getvar(lastloc) its the last place i remember having it. | | Top |
|
| Posted by
| Samson
USA (683 posts) Bio
|
| Date
| Reply #17 on Thu 11 Jan 2007 02:15 PM (UTC) |
| Message
| | So is this script system a replacement of, or an addition to the existing prog system? It looks like much of what you've done finishes the system that the original Smaugdevs probably wanted. Like so many other things they wrote but never finished. :) | | Top |
|
| Posted by
| Gohan_TheDragonball
USA (183 posts) Bio
|
| Date
| Reply #18 on Thu 11 Jan 2007 06:40 PM (UTC) |
| Message
| Well many of it is in addition to prog system with minor modifications to the original system. The script system before was merely a prog that performed at a specific time at which it went line by line, ifchecks were evaluated but not adhered to when the next line was performed as it returned each time. So what I did was do a force mpsleep when a script goes off, saving the data like ifchecks and performers each time. It still goes line by line, but now will perform correctly. Another thing I did was make it so you can have multiple scripts inside one base script group.
Group = Mining
Script 0: Setup Variables for Miner, Verify shovel, check if miner has max amount of minerals.
Script 1: Decide whether to try and mine current room or travel towards predetermined room from script 0.
Script 2: Travel back towards assigned shop and drop off minerals.
Unless specified by the script, whichever script the group is currently running will loop itself. If the script needs to stopped they can jump to script -1, and as long as the group is on -1 it won't run.
Also added was the variable stuff. The variables have a name, they have a value, and also have two fields called allow and restrict. this way a builder could restrict that variable from only being modified by a specific vnum, whether that be room, object, or mobile. An example of the ifcheck for these is.
if var($i, randnum) <= 30
Also I fixed it so the above ifcheck works, stock smaug didn't work very well with multiple arguments that weren't the symbols like $n or $t.
Another thing added was the $f siginfier, which allows a builder to access a coded function like rand or increment or add, eg.
setvar $i randrank $f.rand(20,100)
or
if str($n) > $f.add(20,$f.rand(10,15)) | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #19 on Thu 11 Jan 2007 10:25 PM (UTC) |
| Message
| You know, it seems to me that it would be very easy to write a scripting system in Lua, that keeps basically the same syntax (modulo just a few tiny changes) and gives you the full power of Lua. The hard part would be binding the functions to their C equivalents, but really, that isn't all that hard to do, either.
It seems to me that it would be a much better use of time to do that (or use any other scripting language) than to continue trying to hack at the fundamentally broken SMAUG mudprog language.
I'll give this a think and see what comes up. Of course, my codebase is quite far from stock, so I'm not sure how useful it would be to other people if I released anything I might do for my own code. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Gohan_TheDragonball
USA (183 posts) Bio
|
| Date
| Reply #20 on Fri 12 Jan 2007 08:18 AM (UTC) |
| Message
| well i guess that depends on what would need to be changed, considering you would mostly likely have to completely redo everything anyways, whether or not your mud is stock or almsot a new codebase should not matter.
and no matter what you keep saying, i think the mob progz in smaug work wonderfully, and with the additions i have made to it, i don't need any other system. | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #21 on Fri 12 Jan 2007 04:25 PM (UTC) |
| Message
| No, to introduce Lua you wouldn't have to redo everything at all. You'd need to redo the entrance points of the script, and figure out a way to bridge to the if-checks and so forth. That would be the hardest part.
But if I were to do something for my MUD, it wouldn't be easy to port to stock SMAUG(FUSS) because the data structures by this point are quite different (it's C++, for one). I mean, it wouldn't be impossible, but for inexperienced coders looking for a plug'n'play solution, it wouldn't be at all appropriate.
The reason the mudprog language isn't good is because the whole thing is a hack. Even all this work you've done isn't right yet. Does it handle multiple sets of parentheses? Nested parentheses? Have you implemented functions? Do you have proper control flow? Can you make function calls inside function calls that use player attributes? Can you do all of this with functions of several arguments? Can you construct expressions, e.g. boolean expressions, of arbitrary complexity? Do you have any kind of type checking, script variables, and so forth? Do you have complete (or even very high) confidence that what you wrote will work in all cases it claims to cover?
Sure, mudprog "gets the job done" (usually), but the fact that you've had to make all these changes should raise a red flag. And you're still a very far ways away from a proper language that lets you express more or less arbitrary constructs. I just don't see the point anymore of spending so much effort on mudprog, when the whole thing is built on a hack and it flies in the face of any kind of good compiler practice.
See, mudprog becomes so hackish that the code becomes very hard to read and understand. It's built by people who (no offense) didn't really know much about compilers and so did what they could and got something that seems to work. But there are much simpler ways of achieving their goals, if you know something about compilers. The resulting code is much cleaner and easier to maintain. I look at your code and it's nearly incomprehensible; I have to stop and look at it for a long time before it starts making sense. It shouldn't be that way; especially given how easy this problem should have been, that's a sign that the code is dangerously complex.
But hey, if you're happy with it and it serves your purposes, more power to you. I'm just trying to share the benefit of my experience over the years. The short version of what I'm trying to say is:
You (or anybody developing their own scripting system, as I was a few years ago) will spend more time developing your home-grown, very likely to be inferior solution, than you would embedding a tested and supported 3rd-party scripting language, which would give you a considerably superior solution anyhow.
YMMV, of course. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Samson
USA (683 posts) Bio
|
| Date
| Reply #22 on Fri 12 Jan 2007 08:52 PM (UTC) |
| Message
| With all due respect, you aren't likely to find very many people in mudding who do know anything about compilers. Aside from "type make, then pray". I'm going to take a wild guess here and say Gohan probably is one of those who does not know enough about compilers to "do it right", so he's doing the best he can with what's available.
Mudprogs may be a foul hack, but they're a foul hack that works. I see nothing at all wrong with trying to turn it into less of a foul hack and more into something that works. Even if it's messy as hell, builders won't be digging around in the source code and marveling at the huge mess :P
I'm sure there would be plenty of people who would appreciate seeing something shiny, new, modern, and non-hackish. But the vast majority of folks I talk to, and myself included, are not up to the task of converting Smaug or any other codebase to use Lua instead of the prog system. I might be able to take an existing implementation and backport it to the C codebase because I'm familiar enough with how that stuff sticks together but I'm sure there's plenty of folks who can't even do that much because their C/C++ knowledge isn't that far along. | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #23 on Fri 12 Jan 2007 09:33 PM (UTC) |
| Message
| No, like I said, if it works, then great, but sometimes it is better (both in terms of time necessary and quality of end result) to start over than to work on top of a "foul hack". I am convinced that mudprog is one of those cases. That's why I started writing my own scripting system several years ago, but it never got anywhere because (a) I did not at the time have enough background to do it right, and I was lacking a lot of useful features like type checking, and (b) I realized (in part due to e.g. Nick's suggestions) how silly it was to reinvent the wheel when there were perfectly good scripting engines, such as Lua (or Python or Ruby or whatever) that had passed the test of time/usage and (more importantly) were actively maintained and bug-fixed by someone else.
Well, tell you what. I'll give serious thought to adding Lua to the SMAUGfuss codebase, or on my own codebase and hope that somebody can back-port it. I don't know if I'll have time, but I'll see what I can do. I've been thinking of doing it for my own codebase anyhow, and with any luck the bulk of it will be portable. It would probably do the community quite some good, I imagine. Of course, existing mudprogs would have to be rewritten somewhat, e.g. say hello there, how are you would have to become say "hello there, how are you". |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #24 on Fri 12 Jan 2007 10:30 PM (UTC) |
| Message
| | Samson, is SMAUGfuss 1.7 the most appropriate code for me to work on were I to submit a patch for this Lua stuff? |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Samson
USA (683 posts) Bio
|
| Date
| Reply #25 on Sat 13 Jan 2007 03:14 AM (UTC) |
| Message
| Yes, SmaugFUSS 1.7 is the most current. The download is kept up to date with the official bugfix posts, so don't let the file date in the downloads area fool you.
And I thank you ahead of time for at least looking into it. If you end up not having time to backport it yourself, you can feel free to offer what you can from your own codebase and I'm sure someone involved with FUSS will be able to help backport it if I end up not having time for that myself. | | Top |
|
| Posted by
| Metsuro
USA (389 posts) Bio
|
| Date
| Reply #26 on Mon 15 Jan 2007 08:37 PM (UTC) |
| Message
| | If you could add lua to smaugfuss, would it use the same editor or a new one? If it was the same the snippet to allow "/" to make multple lines to be treated as one, would have to be removed right? |
Everything turns around in the end | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #27 on Mon 15 Jan 2007 08:57 PM (UTC) |
| Message
| I was thinking of using the same editor, yes. One problem is that SMAUG uses twiddles to end strings, but Lua uses them for such things as the ~= test. They'd need to be escaped one way or the other.
Lua doesn't really care about line endings, though. So the question of treating several lines as one wouldn't really come up, because the Lua parser takes care of that for you.
One nifty feature would be for the Lua display to have syntax coloring...
As I think about this, I will add more posts discussing the various issues. The main issue I am thinking about is how, if at all, to manage coroutines. E.g., pausing a script while waiting for player input. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
| Posted by
| Metsuro
USA (389 posts) Bio
|
| Date
| Reply #28 on Mon 15 Jan 2007 09:10 PM (UTC) |
| Message
| | I though it was a tilde, heh. However you said say would become more like say "String" well in my mud if it went over multiple lines, using it the way it is, would give me say "Line one/ Line two" and that'd give us a nice pretty / in there. And into the Mpsleep thing, wouldn't following how Mpsleep worked work just as well, or I know I've seen Nick argue about this once or twice about the forum's talking about it'd freeze the entire mud or some such? |
Everything turns around in the end | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #29 on Mon 15 Jan 2007 09:31 PM (UTC) |
| Message
| Well, Lua doesn't allow multi-line strings with the "..." syntax; you need to use [[...]] to span multiple lines. So that would be one complication, yes.
As for mpsleep, the problem is that we need a way to pause the interpreter at that point in the script and resume it later on, while allowing other scripts to be run in the meantime, which means that you can't simple pause the entire interpreter. Lua's natural solution is to use co-routines, which implies that some kind of management is needed to keep track of which ones are running, and which ones need to be resumed, and so forth.
Of course, once you implement a coroutine manager like that, you are so close to having much, much more power available, namely letting users use coroutines to do really powerful stuff like pause until user input is received. The balance I am trying to strike is to support as many powerful features as possible, while at the same keeping the project manageable so that I can implement it in a small amount of time.
The issue of backwards compatibility is also, naturally, rather worrisome. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
122,315 views.
This is page 2, subject is 3 pages long:
1
2 3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top