Execution

Nathan Yospe yospe at hawaii.edu
Mon Mar 24 20:19:06 CET 1997


On Sun, 23 Mar 1997, Chris Gray wrote:

:[Nathan Y:]
:
:[C++ extract for dynamic execution deleted.]
:
:My C++ is sketchy, but I think I followed that. In the basics, it is
:pretty similar to mine, although my implementation looks a lot uglier.
:I think all schemes that allow mixing of native and interpreted code
:are going to have some basic similarities.
:
:I have some questions about your example script, however:
:
:- what is the difference between 'parent' and 'master'? I imagine 'master'
:    to be the PC who started it all with 'hunt', but what is 'parent'?
:    I imagine it to be the PC or the drone which caused this one to be
:    created, but if so, how does a message from a deep descendant get
:    back to the master? Hmm. I guess this was just meant as an example,
:    given that 'drone:parent()' is being used after it has already been
:    verified to be null. Ooops.

Huh? Can't find an example of a null drone:parent() that hasn't stopped
execution. Parent is, it would appear, the drone that spawned this one, if
any. 

Yeah, I guess so... I'm having a tough time with this myself... looks like
the semicompile scripting language from Physmud++ v.2... I'm not sure if I
still have a copy of that around. I've gotten into this habit of scrapping
functional codebases and starting over as my programming skills increase..
one hazard of a sharp learning curve. Um. Well, it looks like it was an
example... probably.

:- how does it stop? Does 'exits' return all of the exits of the room?
:    Is it something to do with the 'addlevel(-1)'?

No. The addlevel thing was probably a counter to restrict the size of a
search path. Umm. I wonder... I'll post up an example from my current
language at some point. My new version is OO... a nice improvement. It
also has inheritance, and much cleaner function definition. The exits()
thing was almost certainly a call to the room to get all of the exits.
Hmmm. OK, I'm starting to get this. Here you go:

:- are drones actual NPC's? If so, does 'terminate' delete the NPC or
:    just stop this execution of its script?

Drones seem to have been NPCs. Terminate stops execution.

:Anyway, thanks for the example - I always like to see snippets of other
:people's stuff, just to get the flavour of it.

I'll try to translate it. Its a little obsolete, but...

/*
> hunt           // the 'hunt' program

expect
  character ch   // acting character
  string input   // input string
  bool override  // override of 'instincts'
  short mode     // skill based failure mode
end expect

begin
*/

// The above is essentially equivalent to what is now:

void <area>:hunt(Character ch, String input, bool override, short mode){

// Where <area> is equivalent to a Java package, and all arguments are
// passed similarly to Java references. 

/*
                 // parse the string
string parseword = input:extract()
                 // search through all backpacks, etc for a drone
character drone = ch:getcharfromcontents("drone")
                                         ^^^
// This seems to be the only existant mistake. Should be "skills:drone".
*/

// this merely calls a method of the String class to get the first word
// off of the input String. The second line grabs the drone character,
// which the player should be carrying around....

/*
if(drone == null)
  // this will only happen if something goes wrong. There should be a
  // check for these drones in the skill that launches this command.
  ch:show("You don't have any hunting drones to deploy.\r\n")
  terminate
end if
*/

// If the drone doesn't exist (the skillcheck should have spotted this...)
// bail out.

/*
drone:moveto(ch:room())
ch:show("You deploy a hunting drone."\r\n)
*/

// extract the drone from inventory and deploy it. This part is patently
// impossible now. Instead, a call would have been made to the drone's
// location, using drone:exit(), which only works because there is only
// one exit, hopefully, from the location. Better would have been
// drone.exit(drone.local().exits());

/*
drone:execute(hunt2, parseword)
*/

// executes another homebrew program. Used for any program added to an
// already existant class.

/*
terminate
&
*/

// essentially translated - return; }

The other program is similar. There are still holdovers in my current
language. The new language is a bit easier to translate into C++ when the
code is stable... meaning I can have it autotranslated and added in as a
hardcoded feature next time around with no coding.

   __    _   __  _   _   ,  ,  , ,  
  /_  / / ) /_  /_) / ) /| /| / /\            First Light of a Nova Dawn
 /   / / \ /_  /_) / \ /-|/ |/ /_/            Final Night of a World Gone
Nathan F. Yospe - University of Hawaii Dept of Physics - yospe at hawaii.edu




More information about the mud-dev-archive mailing list