+Forest-Ghost Posted October 15, 2021 Posted October 15, 2021 I am creating a Wherigo where a player has an item "cell phone." I thought it would be fun if the Wherigo detected what type of device the player is using and then name the cell phone based upon the players device (Example Joe's Iphone, Dan's Android). Is there a general code I can use to check for all iOS, Android, or other devices? The problem I stumbled on to is Env.platform gives the specific iteration of the operating system (iOS 15.1 for example is the most current for iphone) so in order to set the variable, I would have to include every possible version of that operating system to account for every possible device. I was wondering if there was a way to simply check for just iOS, Android, or other operating platforms? Quote
+capoaira Posted October 15, 2021 Posted October 15, 2021 (edited) You can use Env.Platform with pattern matching or substring etc. I have an Example for a play anywhere WIG where I detect if the platform is an iOS, because iPhones doesn't show the border of a Zone: -- I use a local variable called platform, witch has the same value like Env.Platform if string.sub(platform, 1, 6) == "iPhone" or string.sub(plattform, 1, 3) == "iOS" then -- ... end On this (german) wiki you can see the different player and its Platform. For iOS you have to test iPhone and iOS because the new Wherigo App use iOS, the old one use iPhone. I think this code could be working (but I haven't test it): local phonename = "My Phone" if string.sub(Env.Platform, 1, 4) == "MIDP" then phonename = "My Andoid" elseif Env.Platform == "Vendor 1 ARM9" then -- Garmin has always the same value for Env.Platform phonename = "My Garmin" elseif string.sub(Env.Platform, 1, 6) == "iPhone" or string.sub(plattform, 1, 3) == "iOS" then phonename = "My iPhone" end Edited October 15, 2021 by capoaira 1 Quote
+Forest-Ghost Posted October 15, 2021 Author Posted October 15, 2021 Thank you so much! This works perfectly. I really appreciate your help. 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.