
mgodsell1973
United Kingdom
Asked
— Edited

Hi guys and galls,
I am writing a script for K9, that depending on which glyph he sees first determines what he does next. now I am taking this step by step to increase my learning of ez script, so the plan is as follows.
When asked to "patrol", he wanders off and looks for glyph 3, then moves on looking for glyph 4, then glyph 2, then back home to glyph 1, with actions at the stops.
Now I have written what I believe to be the code and uploaded to the cloud, but, I just want a sense check to see if this is the right direction, or is there a better way to do this.
Thanks in advance for your patience whilst I am learning :-)
Hi @Rich,
just a quick question, would the code you suggested about naming the "glyphs"
Glyph 1
Does that not mean that Glyph 1 = True, not naming it No 1?
i don't mean to pull apart what you have written for me, just to understand
:)
Pull it apart by all means, it shows me you are trying to learn for yourself so I really do not mind
basically just tells EZ-Script that the glyph it's found is #1. It's a label of sorts.
This can then be used with WaitForChange($glyph) or in IF statements etc.
You could use
if you wanted to. However the benefit of having
is you could use the < > or = operators in an if statement if looking for them in a specific order. Like if you were looking for glyph 2 or glyph 3 you could simply use
which would be the same as
It gives some flexibility which may be useful.
@mgodsell1973 in the code you posted above all it does is assign the value 1 to the variable $Glyph... When you talk in terms of true or false usually that's in the context of a type of comparison ... For example.... if $Glyph = "true" or 1 then do something, else do something different...
hi guys,
had a great session, left me feeling a bit worn out - learning is tough but so rewarding. i am slowly getting to grips with the "IF" statements and had a small victory (for me anyway) i got K9 to say something when shown Glyph 1. now i know that is a basic function however i was trying to do it in the Glyph script section and i failed, so i copied a small section of your large script over to the "script" (the clue is in the title) section and instead of it "saying" what you had written, it said what i had written in the Glyph script section?
anyway what i am trying to say really is that there are "script" sections for all of the different panels, and i am trying to work out how to link them together, from the soundboard track playing in the glyph recognition to the speech recognition when i ask K9 to go on patrol.
really i need to start at the beginning -
1 ask K9 to patrol, this i know starts with Forward and then the Ping sensor takes over and guides him around. 2 where does the code go that then pools the information from the camera, i have the variables Glyph = 1 - is the number used to identify the respective Glyph Glyph1seen - is identifying the fact that a glyph has or hasn't been seen
i am really sorry for troubling you guys, for what possibly is a daft question.
stress
Hi me again,
i can already hear the painful sighs, but tonight its good news (sort of).
i walked away from my problem the other night as i was getting frustrated and reading back my last post (which i should not have written) obviously i was not thinking clearly either blush
After some time away i have made a little headway and have decided to crawl before walking. now i have added a "script manager" in my file and am writing scripts in the "glyph" section - nicely linked together.
none of the above are groundbreaking - but the one thing i am having an issue with is the fact that the Variable state is set to 1 in the "Variable Watch" panel and remains unchanged (that i can see) despite altering the Variables in the Glyph script from = 1, = 0 or leaving a blank space, could this have something to do with the fact that the Glyph reader "remembers" the last seen Glyph and will not repeat it until is sees another Glyph?
so with that in mind i am unable to run the code as you suggested as the variable is sticking at 1?
however progress is being made. tired
Just a thought, could i use an if statement to say that says something like
?
Don;t have much time so haven't read it all but that If statement is invalid.
What is it you want it to do?
If it's to set $glyphpast to 0 if the seen glyph is 1 and has been seen then you need;
If it's to say to do something if $glyph = 1 and $glyph1seen = 1 or if $glyphpast = 0 then you need it to be
Also, don't forget variables need the $ preceding them.
Hello Again.
i have taken a good look around and thourght i had found a way to ensure that the variable "Glyph1" altered it's state as the last time i was on i found that i could not get the state to change.
Whilst i was playing around i noticed that the varaible "CameraIsTracking" changes its state from 1 - 0 depending on what it see's.
So i came up with what i believed to be an ingenious plan, which was that if i placed the Code below in to the Script editor on Glyph 1 then when "CameraIsTracking" spotted the Glyph, it would change its state and in turn then change the state of $Glyph1 to 1. but it failed..... why would that be.......?
thanks guys, i am trying not to be a pain blush