+Ah! Posted January 9, 2020 Posted January 9, 2020 Anyone know how many Earwigo "If - else" functions can be nested ? Quote
Ranger Fox Posted January 14, 2020 Posted January 14, 2020 Theoretically, the only limit might be in performance. I believe the cartridge would experience slowness before you have server problems. I hope you’d be able to avoid such a structure by being smart about what you’re testing and grouping similar arguments together. Quote
+Ah! Posted January 15, 2020 Author Posted January 15, 2020 (edited) 15 hours ago, Ranger Fox said: Theoretically, the only limit might be in performance. I believe the cartridge would experience slowness before you have server problems. I hope you’d be able to avoid such a structure by being smart about what you’re testing and grouping similar arguments together. Thanks for your reply. Unfortunately, despite my name - Alan Smart - being smart is my biggest problem. My other problem, at the moment, is I have 30+ images and I wish to change the media of a zone depending on the value of a variable. That is, if the variable =1 the zone has image A, if variable = 2 the zone has image B etc. It looks like it should be simple but I can't do it. In the change media option the choice is from the list of media only so I created expressions to compare media name (or visible is the only choice) to the value of a variable. I then created an IF ELSE function to go through and find the matching media to the variable. I gave the media numerical names to match the variable range. I think this might be trying to compare a string with a number. Any suggestions? Edited January 15, 2020 by Ah! Forgot something Quote
+Tungstène Posted January 15, 2020 Posted January 15, 2020 7 hours ago, Ah! said: I have 30+ images and I wish to change the media of a zone depending on the value of a variable. That is, if the variable =1 the zone has image A, if variable = 2 the zone has image B etc. How does this variable get its new values? Wouldn't it be possible to assign the media its new resource at the same time? If not, maybe you could use a table where each item would be a media. Then the zone media would be assigned by a LUA statement like this one: zmediaMyZone = myTableOfZmedia[myVariable] Quote
+Ah! Posted January 15, 2020 Author Posted January 15, 2020 1 hour ago, Tungstène said: How does this variable get its new values? Wouldn't it be possible to assign the media its new resource at the same time? If not, maybe you could use a table where each item would be a media. Then the zone media would be assigned by a LUA statement like this one: zmediaMyZone = myTableOfZmedia[myVariable] Thanks for your reply. The variable gets it value from the actions of the player when in a zone. I have now solved this problem. Although I'm not very familiar with Lua I did some searching and found the function "tostring(v)" . Referring to my above reply, I used "tostring(v)" to change the numerical variable to a string before comparing it to the name of the media variables. This was all I had to do to make everything I had written work OK. Thanks again to all. Quote
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.