Questions 1. I created the Pepsi from the tutorial, and made it
fertile. My Coke and Fanta now have Pepsi as theire parent (#211). How
do I change their names - for example in Pepsi - it will say something
like "You need to be holding the pepsi to drink it!". Obviously that
needs to change in each of the children. How do I do that?
Question 2. I read about $recycler:_create using help, but couldn't
find it in the manual. Here's what I came up with - not complete just
trying to make sure first bit is right
The errors I get are -
#63:_recreate, line 5: Type mismatch which
is actually 5: val = this:_recreate(@args);
... called from #63:_create, line 5
which is actually 4. thing = $recycler:_create(this.stuff_in[n][1]);
... called from #253:select, line 4
(End of traceback)
I don't have much of a clue about the syntax of the recycler - which
is probably obvious.
@create $thing named drink_machine:drink_machine
@prop #253."stuff_in" {} rc
;;#253.("stuff_in") = {"{{\"Pepsi\",#211,10}", "{\"Coke\",#251,10}",
"{\"Fanta\",#252,10}}"}
;;#253.("aliases") = {"drink_machine"}
@verb #253:"select" this none none rxd
1: player:tell("For an icy cold drink - select from the following.
Press 1 for Pepsi, 2 for Coke or 3 for Fanta");
2: n = toint($command_utils:read("your selection"));
3: if (n = 1)
4: thing = $recycler:_create(this.stuff_in[n][1]);
5: player:tell("You've selected a Pepsi");
6: else
7: if (n = 2)
8: thing = $recycler:_create(this.stuff_in[n][2]);
9: player:tell("You've selected a Coke");
10: else
11: if (n = 3)
12: thing = $recycler:_create(this.stuff_in[n][3]);
13: player:tell("You've selected a Fanta");
14: endif
15: endif
16: endif
17: "Last modified Sat Dec 19 13:55:52 2009 EST by woger (#197).";
> Http://ai5hf.mtgames.org/http://moo.mtgames.org/
> "A world that contained something as amazing as that bumblebee was a world
> in which he wanted to live." -- Christopher Paolini, Brisingr
> "The songs of the dead are the lamentations of the living." -- Christopher
> Paolini, Eldest
> skype: lilmike2
> msn: ai...@hotmail.com
> gmail: ai5hf.lilm...@gmail.com
>
> pc details:
> Intel quad core q6700-2.66 GHz; 4 gb ddr2 duel channel ram; 500 gb
> harddrive; windows xp pro.
>
> --------------------------------------------------
> From: "basil60" <prayner.ba...@gmail.com>
That would mean you'd need to put an if: if(this.stuff_in[toint(n)][3] <= 0)
player:tell("There's not enough of that!");
Question 1:
What I would do is make it say player:tell("You need to be holding ",
this.name, " to drink it!");
Instead of player:tell("You need to be holding the pepsi to drink it!");
This way you can make it extendable to any type of drink, just name it
something like milk and it will say "You need to be holding the milk to
drink it!
The corrected code:
1: player:tell("For an icy cold drink - select from the following. Press 1
for Pepsi, 2 for Coke or 3 for Fanta");
2: n = toint($command_utils:read("your selection"));
"Changed = to ==, so it isn't always 1";
3: if (n == 1)
4: thing = $recycler:_create(this.stuff_in[n][2]);
"Now we must set the aliases and name";
thing.name=this.stuff_in[n][1];
thing.aliases={thing.name};
5: player:tell("You've selected a Pepsi");
"Now move it to the player";
thing:moveto(player);
"changed else if to elseif, to save space, also changed = to ==";
6: elseif(n == 2)
8: thing = $recycler:_create(this.stuff_in[n][2]);
"set all the props";
thing.name=this.stuff_in[n][1];
thing.aliases={thing.name};
9: player:tell("You've selected a Coke");
"Move to player";
thing:moveto(player);
"another elseif";
10: elseif(n == 3)
12: thing = $recycler:_create(this.stuff_in[n][2]);
thing.name=this.stuff_in[n][1];
thing.aliases={thing.name};
13: player:tell("You've selected a Fanta");
thing:moveto(player);
"Check if he entered invalid input";
else
player:tell("Sorry, that's not a choice!");
14: endif
"removed all the endifs, as they're no longer needed";
"Note that I'm setting the aliases to the names, because that's the only way
I can think of to make them accessible with aliases.";
"Ideally, you would have a :alias verb on #1, but you don't, so yeah.";
"Also note that this.stuff_in[n] takes care of which drink, then you just
have to do [2] for the parent, or [1] for the name";
"You might want to add code for checking if there are more drinks, like
this:";
"if(this.stuff_in[n][3] <= 0)";
"player:tell("There are none of that drink available");";
"return;";
"Note that return; makes the verb end, even if it is not done, thereby not
letting it create a drink";
"gosh, another note: You might do one thing like player:tell("You have
selected a ", thing.name, "."); to make it more flexible";
Hope that helped,
-Michael
AI5HF
http://moo.mtgames.org/
"A world that contained something as amazing as that bumblebee was a world
in which he wanted to live." -- Christopher Paolini, Brisingr
"The songs of the dead are the lamentations of the living." -- Christopher
Paolini, Eldest
skype: lilmike2
msn: ai...@hotmail.com
gmail: ai5hf....@gmail.com
pc details:
Intel quad core q6700-2.66 GHz; 4 gb ddr2 duel channel ram; 500 gb
harddrive; windows xp pro.
--------------------------------------------------
From: "basil60" <prayne...@gmail.com>
Sent: Friday, December 18, 2009 10:25 PM
To: "MOO Talk" <MOO-...@googlegroups.com>
Subject: [MOO-talk] Re: Algorithm Help
> Hi
> --
>
> You received this message because you are subscribed to the Google Groups
> "MOO Talk" group.
> To post to this group, send email to MOO-...@googlegroups.com.
> To unsubscribe from this group, send email to
> MOO-talk+u...@googlegroups.com.
> For more options, visit this group at
Are you trying to use @edit for your property? That will only work for a list
of strings. For this, you will need to use eval to modify the property.
eval #253.stuff_in = {}
eval #253.stuff_in = {@#253.stuff_in, {"Pepsi", #211, 10}}
eval #253.stuff_in = {@#253.stuff_in, {"Coke", #251, 10}}
eval #253.stuff_in = {@#253.stuff_in, {"Fanta", #252, 10}}
-Michael
AI5HF
Http://ai5hf.mtgames.org/
http://moo.mtgames.org/
"A world that contained something as amazing as that bumblebee was a world
in which he wanted to live." -- Christopher Paolini, Brisingr
"The songs of the dead are the lamentations of the living." -- Christopher
Paolini, Eldest
skype: lilmike2
msn: ai...@hotmail.com
gmail: ai5hf....@gmail.com
pc details:
Intel quad core q6700-2.66 GHz; 4 gb ddr2 duel channel ram; 500 gb
harddrive; windows xp pro.
--------------------------------------------------
From: "Luke-Jr" <lu...@dashjr.org>
Sent: Saturday, December 19, 2009 12:51 PM
To: <moo-...@googlegroups.com>
Subject: Re: [MOO-talk] Re: Algorithm Help
> On Saturday 19 December 2009 03:39:12 am Paul Rayner wrote:
>> > MOO-talk+u...@googlegroups.com<MOO-talk%2Bunsu...@googlegroups.com>
>> .
>> > For more options, visit this group at
>> > http://groups.google.com/group/MOO-talk?hl=en.
>> >
>> >
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "MOO Talk" group.
>> To post to this group, send email to MOO-...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> MOO-talk+u...@googlegroups.com<MOO-talk%2Bunsu...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/MOO-talk?hl=en.
>>
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups "MOO Talk"
> group.
> To post to this group, send email to MOO-...@googlegroups.com.
> To unsubscribe from this group, send email to MOO-talk+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/MOO-talk?hl=en.
>
>
>
--
Matthew Walker
Kydance Hosting & Consulting, Inc. - http://www.kydance.net/
PHP, Perl, and Web Development - Linux Server Administration
Oh... my...
drop me in bin
But don't do that.
Wow. Yeah. You'd want to check that dobj was a descendant of your generic can. Which is
now recycled. Ouch. You had the code backed up, right?
--