Re: a couple of questions.

From: Fizal (amustapa@yahoo.com)
Date: 02/03/00


At 07:40 PM 3/2/2000 -0800, Adam Dobrinin <norrinr@juno.com> wrote:
>1.  How do I wait a specific amount of time (ex. 1 sec, 2 sec, etc.)?

Several ways, but it depends on what the waiting period is supposed to do:
a) Use WAIT_STATE macro. This is used to let the *next* command entered to
be executed after some amount of time. The amount of time often used with
WAIT_STATE is PULSE_VIOLENCE, which is equivalent to 2 secs. You can set
how long you want it to wait. Bare in mind that whatever command is issued
during this waiting period will not be parsed. Example: bash, which will
cause whatever you type not to be processed for the next 4 secs.
b) Some form of event system (eg: DG Event). You can set to waiting period
to before, during or after a command execution. The amount of time can be a
low as .2 sec to several hours. Unlike WAIT_STATE tho, whatever command
issued during this waiting period will still go thru for parsing. Example:
event system to shutdown the mud in 30mins which will countdown for you
automatically while you do other things.

>2.  How do I take input from a player?  (getchar() doesn't work.)

I'm not the right person to answer this, the functions in comm.c are the
ones that handle getting the inputs from players. Any input obtained will
be parsed thru aliases to check for similarities. Then it is parsed by
command_interpreter(). Anyway, giving further info on what you want to
achieve might let others who knows better than me help you.

>3.  Also, my houses are not working.  Players do not start where they are
>supposed to.  Where should I look to fix this?

2 things:
a) Did you assign the houses to the players?
b) Did the players quit in their houses?
If I remember correctly, these are the 2 conditions for starting back in
their houses. Even tho you assign the houses to them, but if they quit
somewhere else they will still be loaded back at the temple the next time
they login. If everything is okay, yet still can't load in their houses,
look at ACMD(do_quit) in act.other.c file.

>4.  How do I parse a line like 'say Level 1'?  Since 'Level 1' is one
>argument I want to put the '1' into a separate integer  variable so that
>I can use a switch() statement.

Again, several ways. You could use:
a) remainding_arg = one_argument(argument, first_arg)
    first_arg will get 'Level' while remainding_arg will get '1'
b) remainding_arg = two_argument(argument, first_arg, second_arg)
    first_arg will get 'Level', second_arg will get '1' while remainder_arg
will get NULL or blanks
c) half_chop(argument, first_arg, second_arg)
    first_arg will get 'Level' while second_arg will get '1'
After that, just use atoi() to change '1' to int.

Anyway, since you want to use say command, you'll need to put the all the
coding in ACMD(do_say). But you probably know about it already...

>5. Here is the screen:
>
>   BASH.EXE-2.01$ patch < obj_mail.diff
>   patching file `mail.c'
>   Hunk #1 FAILED at 212.
>   Hunk #2 succeeded at 297 (offset 64 lines).
>   Hunk #3 FAILED at 370.
>   Hunk #4 succeeded at 365 with fuzz 2 (offset -2 lines).
>   Hunk #5 succeeded at 553 with fuzz 2 (offset 111 lines).
>   Hunk #6 FAILED at 566.
>   Hunk #7 succeeded at 473 (offset -47 lines).
>   Hunk #8 succeeded at 651 (offset 111 lines).
>   3 out of 8 hunks FAILED -- saving rejects to mail.c.rej
>   patching file `mail.h'
>   patch: **** can't rename `C:\WINDOWS\TEMP/po001001' to `mail.h' : File
>exists
>   BASH.EXE-2.01$
>
>How do I fix this?

Uhmm... try: patch -u < obj_mail.diff     instead?
Anyway, the reject files (denoted as xxx.rej) are supposed to have codes
that can't be automatically patched in. You'll have to do that manually.
Read the FAQ under the root circle directory, there's a section on using
patch in it I believe. There's also a document on hand/manual patching in
developer.circlemud.org either at the front page or in the WTFAQ section.
No need for me to reiterate everything again.

G'luck!

---

Afizal Mustapa
Petaling Jaya, Selangor, Malaysia.
(amustapa@hotmail.com)

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT