if statement on experiment type

4 views
Skip to first unread message

audrey etienne

unread,
Oct 2, 2025, 8:17:26 AMOct 2
to GAMA
Hello,

I would like to write a if statement so that "do pause" execute only if experiment if of type gui.

something like this but I don't know how to write the red part:

if(experiment type is gui){
do pause;
}

Thank you for your help :)
Audrey

Kevin Chapuis

unread,
Oct 2, 2025, 9:14:04 AMOct 2
to gama-p...@googlegroups.com
Hi Audrey,

From my POV, best is to define a global boolean variable set to false and turn it into true in the init block of your experiment. Following code is pausing simulation when in GUI, while let until facet stop simulation in batch mode: 

global {

bool isBATCH <- false;

reflex stopSim when:not(isBATCH) and cycle>100{

do pause;

}

}


experiment xp {

init { write sample(isBATCH);}

}


experiment batchxp type:batch repeat:5 until:cycle>105 {

init { isBATCH <- true; }

}


Best,
Kevin

--
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 view this discussion visit https://groups.google.com/d/msgid/gama-platform/71d27c61-773a-436c-981f-2ab822aec66cn%40googlegroups.com.


--
Chapuis Kevin
Fellow researcher at IRD
Computer modeling & simulation
--
Alt-Mail: kevin.chapuis@ird.fr

audrey etienne

unread,
Oct 3, 2025, 8:36:00 AMOct 3
to GAMA
Thanks Kevin, it works perfectly :)
Reply all
Reply to author
Forward
0 new messages