Variables referring into functions/subs

sam psikoticsilver at gmail.com
Wed Dec 26 23:40:03 UTC 2012


Hello!  I'm working on some experiments for the lab in which I work.  I've 
run into some problems in the coding side, and I hoped I could find some 
help here.

I'm having some problems with variables.  I'll make up an example, where 
I'm attempting to pass a string into a function.  I want to use the 
contents of this string as a the name of any canvas I choose, so I can 
clear any canvas by sending it's name into this subroutine.

*****

'userscript
dim canvas as slide

Sub clearcanvas(namecnvs as string)
        Set namecnvs = Display.Canvas
        namecnvs.FillColor = CColor("white")
        namecnvs.TextColor = CColor("black")
        namecnvs.Clear
end sub


'inline
Set cnvs = Display.Canvas
cnvs.text Display.XRes, Display.YRes, "Hello, World!"

sleep(500)
Call clearcanvas("cnvs")

cnvs.text Display.XRes, Display.YRes, "Hello, Sam!"
sleep(500)

*****

Now obviously, I can't use "cnvs" like that, but it's a great way In this 
example, what I want to do is use the contents of the string namecnvs to 
represent the name of any canvas I desire, but I don't know how.  When 
using namecnvs as is, e-prime would treat it as another slide.  I can't 
find anything in e-prime that would allow me to either identify something 
as a variable (like a $ in bash) or use it's contents dynamically. I can do 
this in bash and matlab, and in C, but I can't figure out how to do this in 
E-Prime.  I could do some really neat things (I find scripting to be neat) 
if I could just nail this issue.

Thank you for your time, and happy holidays!

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/e-prime/-/GXs9qO4suS0J.
For more options, visit https://groups.google.com/groups/opt_out.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20121226/2b7b5dd3/attachment.htm>


More information about the Eprime mailing list