# changing the value of player

Gustavo Glusman (bmgustav@bioinformatics.weizmann.ac.il)
Thu, 2 May 1996 23:30:29 PDT

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    >Is there some mechanism through which wizards can change the value of

    >'player' for the duration of the verb and all verbs it calls, as well
    as

    >all verbs they call?  I had been able to do that before, by simply

    >calling player=#xxx, but it seems to be acting very unreliably:

    That is exactly the method, but read further -

    >39:      argstr = argstr;

    >40:      dobj = dobj;

    >41:      dobjstr = dobjstr;

    >42:      iobj = iobj;

    >43:      iobjstr = iobjstr;

    >44:      prepstr = prepstr;

    Out of curiosity, what is the purpose of these lines I just quoted?

    >45:      player = user;

    >46:      #735.debugging && #735:notify(tostr("$http:get about to call

    >$http:",

    >parts[1], " : player=", player, " (", player.name, ")..."));

    --------->47:      set_task_perms(player);

    >48:      return this:(parts[1])(@parts[2] ? parts[2..length(parts)] |
    {});

    The Programmer's manual says:

    ...the named verb on the given object is called; the various built-in
    variables have the following initial values in the called verb:

    <<snip>

    player

    an object, the same value as it had initially in the calling verb or,
    if the calling verb is running with wizard permissions, the same as the
    current value in the calling verb.

    Notice that, after the set_task_perms(), the verb is probably not
    running wizperms anymore. The value of 'player' is then reset to the
    original one at the call.

    >The wierd part is that often this hack works, and often, like here, it

    >doesn't.  I can't find any difference between when it works and when
    it

    >doesn't work.

    I guess, then, that it 'works' when you are setting task perms to some
    (other) wizperms, and 'fails' when you set them to nonwiz.

    >Any idea why the value for 'player' is changing here?  Or

    >how to perminantly change 'player' if this isn't the standard way?

    Add an intermediary verb call, which is called with wizperms, and it
    just checks so, sets task perms to some suitable args, and calls your
    target verb.

    You might want to use something like -

    $wiz_utils:"call_verb_with_other_perms"   this none this   rx   #2

     1:  "Args are: perms to run with, object, verb, args to pass to it.";

     2:  set_task_perms(caller_perms());

     3:  set_task_perms(args[1]);

     4:  return args[2]:(args[3])(@args[4..length(args)]);

     5:  "Last modified Thu Apr 20 17:37:13 1995 IDT by Gustavo (#2).";

    -------------------------------------------------------------

    Gustavo Glusman               Founder/administrator of BioMOO

    -- Gustavo@bioinformatics.weizmann.ac.il

    -- http://bioinformatics.weizmann.ac.il/Gustavo

    -- BioMOO: telnet bioinformatics.weizmann.ac.il 8888

               WWW:   http://bioinfo.weizmann.ac.il/BioMOO