Referencing to atoms entering from a specific channel

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
giannis
Posts: 10
Joined: Wednesday 04 May, 2011 - 11:53

Referencing to atoms entering from a specific channel

Post by giannis »

Hellow

Iam new with 4DScript and I wanted to ask how is it possible to reference inscripts to atoms
entering form a specific channel. Especialy this would have been usefull in entry triggers.

For example how could I set a lable on entry to an atom entering but only from channel 2?
I've tried a script like this but it didn't work

Code: Select all

SetLabel([batch],2,first(in(2,c)))
or

Code: Select all

SetLabel([batch],2,in(2,i))
Or for example in some other case I wanted to to increase a counter when an atom enters from a specific channel
is there a function that returns the channel?


Thank you in advance
Ioannis Goniadis
User avatar
MatthijsJongboer
Posts: 200
Joined: Thursday 11 November, 2010 - 14:12

Re: Referencing to atoms entering from a specific channel

Post by MatthijsJongboer »

Hello Giannis,
There is a command to reference the inputchannel that triggered the event. it's IC.
In your case, you only want to set a label when entered through channel one. This can then be done using an if statement.
Something like this:

Code: Select all

if(ic(c)=2,
  Label([batch], i) := 1
)
In the help you have 4DScript categories grouped on functionality. Also, if you have acces to the 4DScript interact, you can testdrive your script.

Succes!
Post Reply