Something like this? Move the slider and each time it hits 4 it will increment the Count label?
<Cabbage>
form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginID("def1")
rslider bounds(232, 20, 100, 100), channel("gain"), range(0, 10, 0, 1, 1)
label bounds(36, 19, 177, 19), text("Number"), identchannel("label1")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
; Initialize the global variables.
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
instr 1
kCounter init 0
if changed:k(chnget:k("gain")) == 1 then
if chnget:k("gain")==4 then
kCounter+=1
printks "Hello", 1
SLabelText sprintfk "text(\"Count:%d\")", kCounter
chnset SLabelText, "label1"
endif
endif
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 [60*60*24*7]
</CsScore>
</CsoundSynthesizer>