# URScript Troubleshoot

**URL:** <https://forum.universal-robots.com/t/urscript-troubleshoot/22933>\
**Category:** Technical Questions\
**Created:** [July 27, 2022, 8:22am UTC](https://forum.universal-robots.com/t/urscript-troubleshoot/22933 "2022-07-27T08:22:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PMonforte](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@PMonforte](https://forum.universal-robots.com/u/PMonforte)\
**Post date:** [July 27, 2022, 8:22am UTC](https://forum.universal-robots.com/t/urscript-troubleshoot/22933/1 "2022-07-27T08:22:46Z")

</div>

Hi,  
I have the following script:  
string script = “def program():”;  
script += “\r\nglobal var = False”;  
script += “\r\nif(get\_digital\_in(2) == True):”;  
script += “var = True”;  
script += “sleep(1)”;  
script += “end”;  
script += “\r\nhalt\r\nend\r\n”;  
I’m writing this on C# but the URScript does not run. I think it is because of the var = True inside the if statement since if I remove it, the script does run  
Am I doing something wrong? Any help is appreciated

---

<div class="post-metadata">

**Author:** ![SynchMaster](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@SynchMaster](https://forum.universal-robots.com/u/SynchMaster)\
**Post date:** [July 27, 2022, 11:04am UTC](https://forum.universal-robots.com/t/urscript-troubleshoot/22933/2 "2022-07-27T11:04:00Z")

</div>

Maybe the missing \r\n is the problem?

---

<div class="post-metadata">

**Author:** ![eric.feldmann](https://avatars.discourse-cdn.com/v4/letter/e/94ad74/32.png) [@eric.feldmann](https://forum.universal-robots.com/u/eric.feldmann)\
**Post date:** [July 27, 2022, 2:05pm UTC](https://forum.universal-robots.com/t/urscript-troubleshoot/22933/3 "2022-07-27T14:05:30Z")

</div>

get\_digital\_in() has also been deprecated. Should use get\_standard\_digital\_in(), as the manual says the get\_digital\_in() command may be removed.
