Cancel
Showing results for 
Search instead for 
Did you mean: 

User defined method issue

Valued Contributor
Valued Contributor

Hi community mates,

I'm having an issue with a method. It worked before but as I complicated a bit the model it does not work anymore.

 

I put the following method at the end of a singleproc:

 

is
cln:integer;
row:integer;
i:integer;
prod:object;
do
for i:=1 to self.~.people loop -- sets the type of pizza per each person in the group

self.~.random.rolldice;


if self.~.random <= 1 then 
elseif self.~.random <= 2 then 
self.~.wants[2,1]:= .mus.B; 
elseif self.~.random <= 3 then 
self.~.wants[2,1] := .mus.C;
elseif self.~.random <= 4 then
self.~.wants[2,1] := .mus.D;
elseif self.~.random <= 5 then
self.~.wants[2,1] := .mus.E;
elseif self.~.random <= 6 then
self.~.wants[2,1] := .mus.F;
end;
print self.~.wants[2,1];

--send order
prod:=self.~.wants[2,1];
prod.create(buff_test_orders);
buff_test_orders.cont.customer:=obj_to_str(self.~);
buff_test_orders.cont.givepizza:=@.location;
buff_test_orders.cont.move;

next;

end;

the problem is that the variable "prod" is VOID. I cannot understand where the problem is because

- i is equal to 1

- randon is equal to 0.9

but the wants[2,1] is VOID. 

Also, on another singleproc I do not have this issue.

I attach my model, it will stop and will give you the error because "prod" is VOID.

 

I hope someone can understand what happens

 

Alessandro

2 REPLIES

Re: User defined method issue

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

there is no action for the case:

if self.~.random <= 1 then

 

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: User defined method issue

Valued Contributor
Valued Contributor
Great! I didn't notice it.
Many thanks Steffen