17 Sep, 2008, Fizban wrote in the 101st comment:
Votes: 0
Quote
m not sure if that extends to any command or just touch, but what I've expanded the alias snippet to do is allow us to attach a program to any possible input into the game that we want. If we want something different to open when someone tries to open a door, or when they try to scan, or when they do any number of things that aren't actual commands, we can make it fire off of that. I don't recall how all we've expanded it, I believe by default its limited to rooms and objects, with objects being the only target, but I know that we have it to where it works with room progs, obj progs, mob progs, and both objects and mobs can be the target, along with having no target at all, and some variations on the object part of it includes allowing any instance of it working, or limited to just objects you are carrying, wearing, have in your inventory, or that is in the room.


It can b any command. the arg list determines what command triggers the script. It does not have to be a real command, but if it is it will over-ride the actual command unless you add a return 0 to it, in such a case the script will fire, and then the command will be passed to the MUD (unless you add a return 0 near the top of the script and then wait a deci-second (or more) before the rest of the script continues to let the MUD do the normal command first. By using %arg% you can also make 'touch ball' and 'touch rug' do different things in the same room. The arg list can also be several words long like shown below (Example A) or be 100% open ended and trigger upon any command like shown in Example B.


Example A:
Name: 'Push Ball & Touch Stone'
Trigger Intended Assignment: Rooms
Trigger Type: Command , Numeric Arg: 100, Arg list: touch push <—– fire when the command touch or fire are typed.
Commands:
if %cmd% == push && 'ball /= '%arg%
*/= just does a substring check I added the ' to the start of both so push ba would trigger it but push all wouldn't
%send% %actor% You push the ball and reveal a hole in the ground underneath it leading into a cave.
*%actor% is always a unique identifier pointing to the character that triggered a script
%door% %self.vnum% north room 4500
*syntax: %door% <vnum of room A> <direction of exit being modified in room A> <several different fields that can be edited here, but room is the option to make a new exit> <vnum the exit should lead to>, so in
*essence there is now an exit leading down from the current
*room, %self.room% being the room the script is attached to, to room 4500
%echoaround% %actor% %actor.name% puts all of %actor.hisher% weight behind the ball and manages to move it.
*%actor.name% displays the name of the actor, %actor.hisher% puts his or her depending on the sex of the actor.
elseif %cmd% == touch && 'stone /= '%arg%
%send% %actor% You reach forward and touch the stone, but suddenly feel as if you shouldn't be here and are perhaps invading.
%load% mob 500
*load mob with vnum 500
%force% %self.people% mkill %actor%
*mobs can be forced to 'kill' not just mkill, but kill can fail if the mob is a far lower than the target much how low level aggro mobs won't attack a max level player, whereas mkill takes away that factor. Also kill is a
*command, as such it targets a name, mkill is a
*scripted command so it can target a reference to the player which is more accurate. ie. kill %actor.name% is synonymous with 'kill fizban' whereas mkill %actor% attacks the player that triggered it no matter if
*there might be a mob named Fizban in the room
else
*they did touch push or touch but whichever they typed wasn't followed by the correct argument.
%send% %actor% %cmd% what?!?
*%cmd% will be either push or touch depending what they used to trigger the script
end


Example B:
Name: 'Open ended Script'
Trigger Intended Assignment: Rooms
Trigger Type: Command , Numeric Arg: 100, Arg list: * (every command typed in the room will trigger the script)
set sendstring %send% %actor% Alas you try, but it's far to dark to do that here.
*create new variable to save the amount needed to type later on.
switch %cmd.mudcommand%
*mudcommand is a field only usable when dealing with 'real' commands, if you have a command named push checking %cmd.mudcommand% instead of %cmd% allowed anything that would be interpreted as the
*command to be interpreted as the %cmd% for the script so pu would work and not just push.
case look
%sendstring%
break
case examine
%sendstring%
break
case scan
%sendstring%
break
default
return 0
break
done
17 Sep, 2008, Sandi wrote in the 102nd comment:
Votes: 0
Heavens, that's ugly stuff. If you could read it, you wouldn't put comments in the middle of it. Why the second %?
17 Sep, 2008, David Haley wrote in the 103rd comment:
Votes: 0
Because it makes it look leeter. Sorry, !33t3R.

(Couldn't resist… sorry…)
17 Sep, 2008, Hades_Kane wrote in the 104th comment:
Votes: 0
Sandi said:
Heavens, that's ugly stuff. If you could read it, you wouldn't put comments in the middle of it. Why the second %?


I kind of have to second that :p

I'm not very familiar with DG Scripts, but the more and more I see of it, the more and more happy I am that when originally deciding on a codebase, we passed up Circle despite the insistence of one of our founding members.
17 Sep, 2008, David Haley wrote in the 105th comment:
Votes: 0
More seriously, I believe it's to make parsing easy for the lazy. It's a lot easier to say "everything in between two percent signs is a variable" than to say "everything in this class of identifier characters after a single percent sign is a variable, unless it ends in a period, in which case the period is not part of the name, etc." It's the kind of thing that might sound reasonable when you do it, and then everybody after you pays for it and curses your name for generations to come. :wink:


EDIT: and, uh, could we fix the code posts so that the page formatting doesn't go all whack?
17 Sep, 2008, Guest wrote in the 106th comment:
Votes: 0
DavidHaley said:
EDIT: and, uh, could we fix the code posts so that the page formatting doesn't go all whack?


That didn't used to happen. Looks like someone has been messing with the overflow settings in the skin.
17 Sep, 2008, Kayle wrote in the 107th comment:
Votes: 0
I was wondering wtf was up with this page. I have to scroll to the right because of those DG Scripts!
17 Sep, 2008, Fizban wrote in the 108th comment:
Votes: 0
Sandi said:
Heavens, that's ugly stuff. If you could read it, you wouldn't put comments in the middle of it. Why the second %?


What second %

you mean %load% and the things along those lines? There's three separate commands oload mload and wload but you can, and is usually suggested to, use %load% instead which is then parsed into one of the others based on what it is attached to.

And no, i don't usually post comments at all, I only did while writing those right now under the assumption that isn't something that everyone here has used and understands intuitively, which is mot likely the reason for the ugliness as well, or is the following just as ugly when un-commented?

Name: 'Push Ball & Touch Stone'
Trigger Intended Assignment: Rooms
Trigger Type: Command , Numeric Arg: 100, Arg list: touch push
Commands:
if %cmd% == push && 'ball /= '%arg%
%send% %actor% You push the ball and reveal a hole in the ground underneath it leading into a cave.
%door% %self.vnum% north room 4500
%echoaround% %actor% %actor.name% puts all of %actor.hisher% weight behind the ball and manages to move it.
elseif %cmd% == touch && 'stone /= '%arg%
%send% %actor% You reach forward and touch the stone, but suddenly feel as if you shouldn't be here and are perhaps invading.
%load% mob 500
%force% %self.people% mkill %actor%
else
%send% %actor% %cmd% what?!?
end
17 Sep, 2008, Zeno wrote in the 109th comment:
Votes: 0
I think they know it's parsed, but I assume they mean why not something like %var instead of %var% as the format
17 Sep, 2008, David Haley wrote in the 110th comment:
Votes: 0
Zeno, that's exactly what I was talking about: why the implementor might have chosen to use two instead of one…
17 Sep, 2008, Fizban wrote in the 111th comment:
Votes: 0
My only guess is so you could send the literal string '%var' without need of an escape character to tell it that it isn't a variable but the actual string that you want.
17 Sep, 2008, Zeno wrote in the 112th comment:
Votes: 0
Well that doesn't make any sense, what if you wanted to send '%var%'? :P I really don't see how it helps. It would seem like one would rarely want to send %var and thus they escape char method would be less often used, so if they stuck with using %var as a format it would ultimately save on # of characters used in a prog.
17 Sep, 2008, David Haley wrote in the 113th comment:
Votes: 0
I'm starting to feel a little ignored here. :tongue: Parsing is a lot easier when you have delimiters on either end of the identifier. So it wouldn't surprise me at all if somebody made the decision based on that alone – even though I think it was a bad decision to make.
17 Sep, 2008, Sandi wrote in the 114th comment:
Votes: 0
DavidHaley said:
I'm starting to feel a little ignored here. :tongue:


^ Look! It's David!! Right there! Look! Look! ^


Quote
Parsing is a lot easier when you have delimiters on either end of the identifier. So it wouldn't surprise me at all if somebody made the decision based on that alone – even though I think it was a bad decision to make.


Ah, now I'm curious. Why do you think it was a bad decision?
17 Sep, 2008, David Haley wrote in the 115th comment:
Votes: 0
Thanks Sandi :biggrin:

The reason I think it was a bad decision is that it adds all these extra sigils to the code for no real language-side gain, which it makes it uglier hence harder to read. If the reason really was to make it easier to parse (which is of course still just a hypothesis at this point) then saving a little time now and creating all this ugliness later just isn't really worth it.
17 Sep, 2008, Sandi wrote in the 116th comment:
Votes: 0
Fizban said:
And no, i don't usually post comments at all, I only did while writing those right now under the assumption that isn't something that everyone here has used and understands intuitively, which is mot likely the reason for the ugliness as well, or is the following just as ugly when un-commented?


No, that's quite readable. Thank you. I'm quite impressed. Still, I'd like reading it better without the trailing %s, and I'd hate writing them. Since I see no spaces between them, it seems the first would suffice.

I see David just posted, and yes, exactly. :wink:
18 Sep, 2008, papa wrote in the 117th comment:
Votes: 0
Was the Mud Magic client kyndig's show? Is it now lost along with Mud Magic/Rage until/unless kyndig returns? A pity since it was the best client for working with Unicode.
18 Sep, 2008, The_Fury wrote in the 118th comment:
Votes: 0
papa said:
Was the Mud Magic client kyndig's show? Is it now lost along with Mud Magic/Rage until/unless kyndig returns? A pity since it was the best client for working with Unicode.


I think it was open sourced and with that anyone should be able to fork it and keep the development going. Tho someone might like to correct me here if i am wrong.

OH and Welcome to the boards papa.
19 Sep, 2008, papa wrote in the 119th comment:
Votes: 0
Indeed it is: <http://sourceforge.net/projects/kyndig/>.

And thank you for the welcome.
19 Sep, 2008, Fizban wrote in the 120th comment:
Votes: 0
It was coded by Elanthis, Kyndig just 'used' it.
100.0/120