Re: Some Questions about Storing Information and Efficiency

From: Thomas Arp (t_arp@stofanet.dk)
Date: 07/09/02


From: "Mathew Earle Reuther" <graymere@zipcon.net>
> > I'm assuming this is for some kind of quest system. If you wish to keep
> > track for _every_ player if s/he has been in every room in the game,
this
> > method is not good. To do this would mean needing a lot of storage
space.
>
> Something similar to a quest system, but specialized in that I only need
> to make the players be in a room and do a command, then I need to be able
> to tell that they've done it.  So if they do the command in the room
> again, they get a result like "you already did that here" or somesuch.
> The basics of the system require that I increment a number in their pfile
> when they do the command, but they can only do it once in a room which
> allows the command.
>
This would be very easy to do with a (DG) script. Most of the scripts
outthere deal with this sort of input - a command is entered, and based
on previous info, the script responds or sends the command on to the
interpreter.

A small example - this is a COMMAND trigger called whenever someone does
a 'drop' in the room it's attached to:

if (%actor.varexists(littering_in_room_3001)%)
  eval littering_in_room_3001 %actor.littering_in_room_3001%+1
else
  set littering_in_room_3001 1
end

remote littering_in_room_3001 %actor.id%

%send% %actor% Nefheistos' priests are watching!
%send% %actor% Littering in front of their altar could get you killed!
wait 1

if (%actor.littering_in_room_3001%>3)
  set littering_in_room_3001 0
  remote littering_in_room_3001 %actor.id%
  %send% %actor% The priests no longer tolerate your littering.
  %send% %actor% They chant a a song to Nefheistos who strikes you down.
  %echoaround% %actor% %actor.name% has awakened the wrath of the
    priests who call down the anger of Nefheistos.
  %damage% %actor% 300
end

This small script checks to see if the offender has done it before,
and if so increments the counter, and stores it in the players'
var file (the 'remote' call). Eventually the offender is nuked by
the gods. This could also be done by casting a spell, instead of
just damaging the player.

> > I suggest you save a sorted list of room numbers. And I'd suggest you
> > use vnums and not rnums, since rnums can be changed if a new area is
> > added.
>
> I'm not clear on the differences, I'm not so good with the code as of yet.
> But if you say vnums is better, I'll believe you! :)
>
vnum -> the numbers _we_ use to handle the rooms - 1204, 3001 and so on.
        This is stored in the world files.
rnum -> the array index of the room in the world[] array.
        This is assigned on bootup. The rnums range from 0 to top_of_world.

> > The last line shows I've been talking to the gateguard a little while,
> > and his next response (or rather list of responses) should be number 4.
> > Of course this requires some in-game scripting.
>
> I don't mind the in-game scripting, I think part of the problem is I just
> have not looked at DGScripts enough yet to see how I can use it to achieve
> my goals.  I'm having a hard enough time getting used to the c, let alone
> exploiting the joys of a scripting language.
>
It's really not that difficult. Trust me. :P  [1]

> I do know that there's a CRODOQuest snippet for DG Scripts out there, but
> it requires quite a bit of tweaking to get it installed, and I'm not sure
> I need it, or if I can just manipulate DGScripts to do what I want.
>
Google didn't find anything for me to look at, so I can't help you there.

Welcor

[1] Interesting trivia: A google search on 'Trust me' finds 708.000 pages
    one of which is 'The Waiters Digest' - I didn't know we waiters had
    a stomach :P

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT