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 :-)
Upgrade to ARC Pro
Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming
I'll have to get back to you...
you are definitely an asset the the forum as a friend and a source of knowledge
Each Glyph would begin with
This way, if unseen the script wouldn't run. Or use 0 not 1 and if it hasn't seen it run some code...
For glyph 2 it;s as simple as
If Glyph1 is unseen (i.e. 0 as set in the init script or script which starts this process) it doesn't do anything for Glyph 2. Use similar for Glyph 3 and 4...
With what Rich has here I think you can get a good start on what you want to accomplish....
Well, have to do some work...
once again, thanks @Richard R for your time and patience
i will revert with (hopefully) a video of K9 doing this thing of protecting the DR
If I am reading your examples right, the following should work
This can tgen be tailored and added as required, what
do you think. Am I on the right track.
Think logically and you'll get it working the way you want. IFs are pure logic and work the same way we think.
For instance, IF you are looking for the glyphs in order. You spot 1, you remember that (so you save it to a variable). You continue looking, you find glyph 3, you think "hmm, did I see glyph 2?), another IF. etc.
To find them in order...
Set the ground work first by adding in some script to the Glyph part of the camera control. Something as simple as;
Use of AND and OR in the IF will reduce the number of IFs needed as will correctly ordering them. The IF is read in order and once one IF or ELSEIF returns true it ignores any others below it.
I don't have the time right now to properly think about the best order or the best operators to use in the ifs but hopefully the above should be a start and possibly help you understand that IFs work the same way as we think.
For more than one AND or IF read the statement back and see if it makes sense.
for instance, IF($x < $y AND $y > 100 OR $y > 200)
that would only be true if $x was less than y and $y was more than 100 OR if $y was over 200. So if $y was 201 it would be true regardless of if $x was less than $y. If $y was 103 but $x was 104 it would be false.
Hope that's clear. If not, check my topics, I did write one on IFs and how to use them which may help you in your glyph hunt script.
the end concept is to have K9 leave the Tardis (Glyph 1) and then depending upon which of the remaining 3 glyph's he finds does a different routine.
i.e if he leaves the Tardis and locates glyph 4 first he will then attack the dalek and then check on the Dr (Glyph 3) and then return home, but if he spotted the Warning (glyph 2) then he would move on to attack the Dalek and then check on the Dr, returning back to the Tradis after checking on the Dr each time.
i understand that this is a massive programming challenge for me, but if you don't push yourself you don't learn, right.
i totally appreciate all your time a assistance in my journey
just a quick question, would the code you suggested about naming the "glyphs"
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
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.
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.
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*
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.
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*
i am making progress ( i know i keep saying it ).
but i have came a small stumbling block and need some guidance.
how do i semi permanently alter the value of a variance, i have managed to use the "$CameraIstracking" variable to alter the state of some home brewed variables, however i want certain ones to remain at "1" until i ask it to revert back.
currently the problem i have is that it is reverting back to "0", this will be a simple fix but have tried to work it out myself with no luck.
thanks once again for reading.
I presume you will need to use IF and ELSEIF with OR and AND in the conditions however with the brief, vague and confusing information provided it's difficult to answer.
First look at why it's reverting back to 0, you must be telling it to revert back to 0. Surround the commands that revert it back to 0 with an IF statement with the conditions that match when you want it to revert back to 0, if the conditions are not met then it wont run the code between the IF and EndIf
Happy new year to all
just a quick update to this thread, i have managed to write the code for what i wanted K9 to do. (it may not be the cleanest but it works)
Thanks to @Rich and @Richard R for your patience with my ambiguously worded questions.
the file has been uploaded "K9", please feel free to have a look and offer advice for any improvements that you think might work.
i will be uploading a video, but i am currently experiencing traction issues that i am working on.
thanks once again
P.S R.A.D has arrived and, family time - whats that LOL