Newsgroups: rec.arts.int-fiction
Subject: Re: [TADS] Question About Switch
From: gdighton@geocities.com (Garth Dighton)
References: <131220001402164847%richpizor@home.com>
User-Agent: Xnews/03.04.11
X-no-productlinks: yes
NNTP-Posting-Host: goliath2
Message-ID: <3a380f88$1_5@goliath2.newsfeeds.com>
Date: 13 Dec 2000 18:08:40 -0600
Lines: 63
X-Authenticated-User: gdighton@geocities.com
X-Comments: This message was posted through Newsfeeds.com
X-Comments2: IMPORTANT: Newsfeeds.com does not condone, nor support,  spam or any illegal or copyrighted postings.
X-Comments3: IMPORTANT: Under NO circumstances will postings containing illegal or copyrighted material through this service be tolerated!!
X-Report: Please report illegal or inappropriate use to <abuse@newsfeeds.com> You may also use our online abuse reporting from: http://www.newsfeeds.com/abuseform.htm
X-Abuse-Info: Please be sure to forward a copy of ALL headers, INCLUDING the body (DO NOT SEND ATTACHMENTS)
Organization: Newsfeeds.com http://www.newsfeeds.com 73,000+ UNCENSORED Newsgroups.
Path: news.duke.edu!newsgate.duke.edu!nntp-out.monmouth.com!newspeer.monmouth.com!xfer13.netnews.com!netnews.com!local-out2.newsfeeds.com!newsfeeds.com!goliath2.newsfeeds.com!newsfeeds.com!g2!anonymous!g2
Xref: news.duke.edu rec.arts.int-fiction:81477

You need to say


doSearch(actor) =
{

   /* Your switch statement or other code */
}

All of the "direct-object" callbacks take the actor as a parameter - if you
don't allow your callback function to take the "actor" parameter, you'll
get the 1026 error.

You don't actually have to refer to the actor in your code.


richpizor@home.com (Rich Pizor) wrote in
<131220001402164847%richpizor@home.com>:

>One of the objects in the game I'm working on is a pile of junk. I want
>to code it such that when the player SEARCHes the pile, he gets one of
>several humorous messages at random, but nothing of significance
>otherwise happens. (The joke is that NPCs can get exactly what they
>want from the pile with ease, but we're not quite to that point yet. ;)
>
>However, I can't seem to get this to work. I set doSearch to the
>following:
>
>doSearch=
>{
>  switch(rand(5))
>  {
>    case 1:
>    "case 1. ";
>    break;
>    ...
>    case 5:
>    "case 5. ";
>    break;
>  }
>}
>
>This compiles fine, but when I run the game and SEARCH the pile, the
>runtime (2.4) returns
>
>[TADS-1026: wrong number of arguments to user function ""]
>
>However, copying and pasting the exact same code into ldesc instead of
>doSearch produces the desired effect when I EXAMINE the pile.  Okay, I
>said to myself, I'll just set doSearch to {self.ldesc} and be done with
>it.
>
>Same error message.
>
>Any insights?
>
>Rich



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----
