tag:blogger.com,1999:blog-6917289499739796139.comments2018-04-16T11:17:43.848-07:00ZIL Crazy After All These YearsRoodyhttp://www.blogger.com/profile/09735423363908850213noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-6917289499739796139.post-68981943699505343262018-04-16T11:17:43.848-07:002018-04-16T11:17:43.848-07:00Hello! So this is just over two years ago now ......Hello! So this is just over two years ago now ... How goes the ZIL stuff?Adamhttps://www.blogger.com/profile/04550627217090322539noreply@blogger.comtag:blogger.com,1999:blog-6917289499739796139.post-20379350306936525822017-12-30T15:59:12.101-08:002017-12-30T15:59:12.101-08:00Hi there,
Are you still working on this, and stil...Hi there,<br /><br />Are you still working on this, and still using ZIL? We have a group on Facebook which you are welcome to join!<br />Thanks<br /><br />AdamAdamhttps://www.blogger.com/profile/04550627217090322539noreply@blogger.comtag:blogger.com,1999:blog-6917289499739796139.post-76164071757002749712016-10-23T14:54:58.265-07:002016-10-23T14:54:58.265-07:00Ah, gotcha, yeah, the ERR value wasn't resetti...Ah, gotcha, yeah, the ERR value wasn't resetting because HOOK-AFTER-PERFORM is part of the main game loop. Good to know.Roodyhttps://www.blogger.com/profile/09735423363908850213noreply@blogger.comtag:blogger.com,1999:blog-6917289499739796139.post-80850328759579258012016-10-23T14:31:02.714-07:002016-10-23T14:31:02.714-07:00Glad to see how this is coming along!
A couple cl...Glad to see how this is coming along!<br /><br />A couple clarifications:<br /><br /><i>"Not only that, but the BIND code can have its own local variables... and not only that, but you can also give those local variables starting values, something you can't do with "AUX" variables for your random routine."</i><br /><br />Actually, you can do it with "AUX" variables too. For example, from Advent's hints.zil:<br /> <br /><ROUTINE I-OFFER-HINT ("AUX" (MAX <GET ,HINT-PENALTY-TBL 0>) P C T)<br /><br />These are just like the default values for "OPT" variables, except they're always set at the beginning of the routine.<br /><br /><i>"I had thought BIND treated its variables as local variables if not given a starting value, but no, they act more like global variables (so, ERR, once set as 1, would always stay 1)."</i><br /><br />They are local variables, but they're local to the routine, not the BIND.<br /><br />HOOK-AFTER-PERFORM is a macro, so it returns code that is then inserted into the routine where the macro was called. That's what the single quote mark is for - it returns that BIND expression instead of evaluating it, and the MAIN-LOOP routine is compiled with your BIND in place of the call to HOOK-AFTER-PERFORM.<br /><br />And then BIND works by simply grabbing one of the routine's unused local variables and assigning a temporary name to it. The name ERR only exists inside the BIND, but the variable it refers to exists for the whole routine.<br /><br />If you don't give it an initial value, its value is undefined. When used inside a loop, it might still have its value from the last loop iteration. Or when you have multiple BINDs in a row, they might reuse the same variable:<br /><br /><BIND (A) ...><br /><BIND (B) ...><br /><br />Here A and B might actually be the same variable.<br /><br />I say "might" because this behavior is different between compiled (ZIL) and macro (MDL) code, so it's best not to count on it either way - if you need it to start out at 0, initialize it explicitly.Tarahttps://www.blogger.com/profile/06574235611152689251noreply@blogger.com