I've been able to get it sort of working. Problems now are down to a "type mismatch" on line 12 - which on the select verb is:
"thing:moveto(player)";
I commented it out to see if everything else works. Which it does!
@create $thing named drink_machine:drink_machine
@prop #253."stuff_in" {} rc
;;#253.("stuff_in") = {{"Pepsi", #232, 4}, {"Coke", #263, 5}, {"Fanta", #264, 5}}
@verb #253:"select" this none none rxd
@program #253:select
player:tell("For an icy cold drink - select from the following. Press 1 for Pepsi, 2 for Coke or 3 for Fanta");
n = toint($command_utils:read("your selection"));
"check to see if can is full, or if there are any cans left";
if ((#232.remaining < 100) || (this.stuff_in[n][3] <= 0))
player:tell("Sorry, you're out of luck. Someone hasn't filled the drink machine. Try a little later");
else
if (n == 1)
thing = $recycler:_create(this.stuff_in[n][2]);
"
thing.name = this.stuff_in[1][1]";
"thing.aliases = {
thing.name}";
player:tell("You've selected a Pepsi");
"thing:moveto(player)";
this.stuff_in[1][3] = this.stuff_in[1][3] - 1;
elseif (n == 2)
thing = $recycler:_create(this.stuff_in[n][2]);
"set all the props";
"
thing.name = this.stuff_in[2][1]";
"thing.aliases = {
thing.name}";
player:tell("You've selected a Coke");
"move to player";
"thing:moveto(player)";
elseif (n == 3)
thing = $recycler:_create(this.stuff_in[n][2]);
"
thing.name = this.stuff_in[3][1]";
"thing.aliases = {
thing.name}";
player:tell("You've selected a Fanta");
"thing:moveto(player)";
"check to see if he entered valid input";
else
player:tell("Sorry, that's not a choice!");
endif
endif
"Last modified Thu Dec 31 11:15:41 2009 EST by woger (#197).";
.
@verb #253:"test" this none none rxd
@program #253:test
player:tell(this.stuff_in[3][1]);
suspend(5);
player:tell(toliteral(this.stuff_in[1]));
"Last modified Mon Dec 21 15:22:58 2009 EST by woger (#197).";
.
@verb #253:"refill" this none none rxd
@program #253:refill
if (!(
player.name in this.wiz))
player:tell("You need to Wizard to perfrom this action!");
else
this.stuff_in = {{"Pepsi", #232, 5}, {"Coke", #263, 5}, {"Fanta", #264, 5}};
player:tell("The drink machine has been refilled ready to go again.");
endif
"Last modified Thu Dec 31 11:28:51 2009 EST by woger (#197).";
.