+Delta68 Posted June 23, 2021 Share Posted June 23, 2021 I have a zone called targetzone I can display its name in a message box OK but if I try and use a function I get an error The function is just: function test() return targetzone.Name end Thanks Quote Link to comment
+capoaira Posted June 23, 2021 Share Posted June 23, 2021 Do you have named the targetzone? There is a special field for naming zones, variables,... under the description. This name is the name for the luacode Quote Link to comment
+Delta68 Posted June 23, 2021 Author Share Posted June 23, 2021 50 minutes ago, capoaira said: Do you have named the targetzone? There is a special field for naming zones, variables,... under the description. This name is the name for the luacode Yes, the zone is named 'targetzone' Quote Link to comment
+capoaira Posted June 23, 2021 Share Posted June 23, 2021 oh my explanation was bad, sorry For using zones, variables, ... in lua Code you have to Set the identifier. If this is "automatic" urwigo give the zone a random name... Quote Link to comment
+Delta68 Posted June 23, 2021 Author Share Posted June 23, 2021 1 minute ago, capoaira said: oh my explanation was bad, sorry For using zones, variables, ... in lua Code you have to Set the identifier. If this is "automatic" urwigo give the zone a random name... Yay! Setting 'Identifier" to 'targetzone' as well fixed it! Thanks Quote Link to comment
Darwin473 Posted June 23, 2021 Share Posted June 23, 2021 6 hours ago, capoaira said: urwigo give the zone a random name Wait, so you can't give zones a specific name, like "lobby" or "church"? Doesn't that get confusing? Or am I missing something? Apologies if I'm barking down the wrong river, I saw the post and had flashbacks to my old programming classes and the importance of good variable names for code documentation. Quote Link to comment
+capoaira Posted June 23, 2021 Share Posted June 23, 2021 (edited) The Name is the displayed Name. You can use the spaces or special chars. The identifier is for programming so you cannot use chars like a space. If you don't give an identifier, URWIGO has to use an random identifier for the source code. Edited June 23, 2021 by capoaira Quote Link to comment
+Delta68 Posted June 25, 2021 Author Share Posted June 25, 2021 On 6/23/2021 at 9:17 PM, Unit473L said: Wait, so you can't give zones a specific name, like "lobby" or "church"? Doesn't that get confusing? Or am I missing something? Apologies if I'm barking down the wrong river, I saw the post and had flashbacks to my old programming classes and the importance of good variable names for code documentation. I suspect it's to make it harder for the code to be read if it is decompiled. Quote Link to comment
Ranger Fox Posted June 28, 2021 Share Posted June 28, 2021 On 6/25/2021 at 2:20 AM, Delta68 said: I suspect it's to make it harder for the code to be read if it is decompiled. I believe that is the case. A little deterrent is fine. After all, no one can prevent the easiest method of circumvention: word of mouth sharing of the final location. So, instead, I advocate for making cartridges an enjoyable, not overlong experience, so people who do skip the cartridge are only depriving themselves of the best part. Quote Link to comment
The Royles Posted July 11, 2021 Share Posted July 11, 2021 A neater way of doing it is: add a value to your function and use that as your object - function test(val) return val.Name end your lua user expression then should be - test (self) That way you do not need to name the object, and the code is then reusable across all objects. This is K1CKAHA posting on my old family account Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.