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
➜ mud progs
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Gohan_TheDragonball
USA (183 posts) Bio
|
Date
| Thu 14 Sep 2006 12:08 AM (UTC) |
Message
| I recently completely redid the script system in smaug, and I was implementing a new mining script when I realized that programs didn't run exactly as I thought they did, and I need to change them.
Basically as it is, progz are stored in the mob_index_data structure, I would like to move them into the char_data structure. This way each mob would have its own instance of the program in its data structure, and if something is modified like a variable on the prog it would only affect the programs on that mob, and not the whole base set. I would just like to see if anyone else has done this or attempted this, and if they know of or see any potential problems with redoing the system this way.
Why I want to do this, in this example, I have mobs that are miners, and the scripts control what action they are currently doing. A variable in the program structure controls what script is running in a particular group, for this instance lets say the script that governs the mining of ore is running. The system currently would have EVERY miner of the specific mob vnum doing that action at the same time.
Any info or insight would be appreciated. | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 14 Sep 2006 12:47 AM (UTC) |
Message
| Personally I would convert the mob progs to Lua, but perhaps that is going too far? ;)
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #3 on Thu 14 Sep 2006 02:00 AM (UTC) |
Message
| A few years ago, I wrote my own scripting language for my MUD that is basically a (simple) fully-featured language with full control flow, functions, etc. to replace MUD script. I solved the variable problem by storing a separate instance of the symbol table (that maps variable names to variable values) on each instance of a thing that has a script on it, as soon as the values become different. This helps save memory, by not needlessly duplicating symbol tables.
Similarly, all instances shared the script itself with their prototypes, unless an instance had the script changed.
Of course, if I were to redo this, I would without a doubt use Lua instead. Lua is incredibly easy to embed in an application, and all the work that would go into exposing functions to a home-grown language would be basically the same for exposing functions to Lua. |
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 #4 on Fri 15 Sep 2006 02:49 AM (UTC) |
Message
| well i already introduced a variable system into my mud progs, some snippet i found for smaug that i redid to suit my needs. i also developed a small way to make/call functions:
$f.rand(20,40)
setvar $n 1 <string>
if str($n) == $n.var1
if str($n) == $f.rand(20,40)
stuff like that
of course the system is slightly limited, but it works for my current needs.
if you want to see the system i redid as well as the redid version of the prog variables stuff i uploaded it to mudbytes.net not too long ago. i would love some comments/insight on it.
http://www.mudbytes.net/index.php?a=files&s=viewfile&fid=740 | 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.
16,972 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top