Tbh I feel silly to ask such basic question, but I can't figure out how to swap values for A, B.
If additional parametes are created it's easy to change their values based on constant A, B. Though how to do it when with help of 2 parameters only? preferably main A, B.
Solved! Go to Solution.
@A_ Smith You need to clarify a bit more about where you are changing the values e.g. param-o or in a GDL script? In gdl you will need to create swap values e.g. a1 & b1 if you don’t want to loose the originals. You could also do a similar thing with Find & Replace.
In parameter script I planned to swap A, B - at least for now (when "bSwap" is true), without saving original values. Kinda temp=A, A=B, B=temp
Originally I wanted to swap values each! time "bSwap" is changed... Just in order to find out why that doesn't work, decided to make it simpler.
Well, I know it without deleting that row - it doesn't work as expected. I see that values don't change. Just to be sure, I removed it - all remais the same.
Unfortunatelly trying to help without actually checking it, doesn't do the job. Because, it's so simle lines of code (strange to say it though) that can't be wrong. Nevertheless they do not obey.
!PARAMETER SCRIPT !Create values for bSwap (boolean) and A1 & B1 (real) in the parameters A1 = A B1 = B PARAMETERS A1 = A1, B1 = B1 IF GLOB_MODPAR_NAME = "bSwap" THEN IF bSwap = 1 THEN A = B1 B = A1 ZZYZX = A1 ELSE A = A1 B = B1 ZZYZX = B1 ENDIF PARAMETERS A = A, B = B, ZZYZX = ZZYZX ENDIF
If I change the script to following it works for me:
temp_A = A temp_B = B IF GLOB_MODPAR_NAME = "bSwap" then IF bswap = 1 THEN A = temp_B B = temp_A PARAMETERS A = A PARAMETERS B = B PARAMETERS bSwap = 0 ENDIF endIF