Hi,
If you need to reuse mySel somewhere else in a species (or in your model), the best is to declare it as an attribute of global. Something like:
global {
…
list<cellPred> mySel;
…
init {
…
mySel<-cellPred overlapping(la_zone_fav);
…
}
….
}
Cheers
Alexis
Le 6 août 2014 à 15:05, Patrick Giraudoux <
patrick....@univ-fcomte.fr> a écrit :
> Hi,
>
> Following
https://groups.google.com/forum/#!topic/gama-platform/vEKH0wIFFWA, in the init section I have created a list of cells as following:
>
> create zoneFav from:zonefavorable;
> zoneFav la_zone_fav <- one_of(zoneFav);
> list<cellPred> mySel<-cellPred overlapping(la_zone_fav);
>
> I would like to use mySel elsewhere in species behaviour. For instance, I want to define the cell destination of each agent of the species pred in av reflex 'move1' as following:
>
> list<cellPred> dest1<-my_cellPred neighbours_at predMov where((each.nb_ater>my_cellPred.nb_ater) and empty(each.agents)); // list of cells with 'expected conditions'
> list<cellPred> dest2<-mySel inter dest1; //intersection between the list of cells overllaping zoneFav and the list of cells meeting the expected conditions
> cellPred dest <- one_of(dest2); // selection of one of those cells
>
> However, mySel although declared in init (hence global) looks like not being accessible from a reflex inside a species:"The variable mySel is not defined or accessible in this context. Check its name or declare it"
>
> Any hint?
>
> Thanks in advance,
>
> Patrick
>
>
> --
> You received this message because you are subscribed to the Google Groups "GAMA" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
gama-platfor...@googlegroups.com.
> To post to this group, send email to
gama-p...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/gama-platform.
> For more options, visit
https://groups.google.com/d/optout.
--
Senior Researcher, UMI UMMISCO 209, IRD & UPMC, France.
Invited Researcher, DREAM, Can Tho University, Viet Nam.
--
alexis....@gmail.com |
http://tiny.cc/liqemw
[Vietnam]
+84915088155 [France]
+33608698845
--
GAMA:
https://code.google.com/p/gama-platform/