Jump to content

Using Env.DeviceID system variable


Tydirium

Recommended Posts

I know topics have been brought up about how to "detect" emulator usage. Until recently it seemed most people were discussing checking altitude or accuracy as a way of figuring out whether someone was playing a cartridge in the emulator. Until THIS POST I had never heard of the Env.DeviceID system variable. It returns "Desktop" if in the emulator and it returns a long alphanumberic string (such as "00047821003819513800-0050BF3F5173") for PPC (and Colorado I presume). Because there is a lack of solid documentation of system/environment variables I'd love to get some official word on this. If this variable is always set to "Desktop" when running in the emulator and to some thing else when running on an actual PPC or Colorado, then all that need be done is a simple check of this variable to determine emulator usage. It would make life soooooo much easier on us Wherigo creators if we knew we could rely on this variable to determine emulator usage.

 

Any feedback would be great.

 

Thanks again,

 

Tydrium

Link to comment

Hi:

Enjoyed talking to you at the meet Yesterday. You mentioned putting a function in the code in the userdefined functions part but I didn't write it down. Also did you work out how a user defined function might be called in the main logic?

Regards, Tom Birchmire tbirchmire@usa.net know sometimes as Bugsy of Blu Eyz and Bugsy

Link to comment

Hi:

Enjoyed talking to you at the meet Yesterday. You mentioned putting a function in the code in the userdefined functions part but I didn't write it down. Also did you work out how a user defined function might be called in the main logic?

Regards, Tom Birchmire tbirchmire@usa.net know sometimes as Bugsy of Blu Eyz and Bugsy

 

Tom,

 

Hey it was nice meeting you too. Wish I could've spent more time talking to you about Wherigo, but things were a little hectic. I'll send you an email about user functions and how to use them in a cartridge. Just give me a day or two and I'll send you some sample code to take a look at.

Edited by Tydirium
Link to comment

I know topics have been brought up about how to "detect" emulator usage. Until recently it seemed most people were discussing checking altitude or accuracy as a way of figuring out whether someone was playing a cartridge in the emulator. Until THIS POST I had never heard of the Env.DeviceID system variable. It returns "Desktop" if in the emulator and it returns a long alphanumberic string (such as "00047821003819513800-0050BF3F5173") for PPC (and Colorado I presume). Because there is a lack of solid documentation of system/environment variables I'd love to get some official word on this. If this variable is always set to "Desktop" when running in the emulator and to some thing else when running on an actual PPC or Colorado, then all that need be done is a simple check of this variable to determine emulator usage. It would make life soooooo much easier on us Wherigo creators if we knew we could rely on this variable to determine emulator usage.

 

Any feedback would be great.

 

Thanks again,

 

Tydrium

 

I have recently used this method on my cartridges, and it appears to work fine. I have tested it on the emulator and it stops the user as it should, then I have also tested it on a Colorado and it allowed the user to continue. Also I know that at least one PPC user was able to use the cartridges. So I think it works, and to me seems like the best approach for a quick check. It by no means will stop anyone from "cheating" but if you want to simply not let them easily use the emulator it works fine.

 

Kevan

Link to comment

Hi All,

 

There is a difference between the DeviceID strings for a real PocketPC and for one running in the Microsoft Virtual Environment.

 

From the gwl log files I see the following values returned for a virtual PPC and an HP iPaq 5550 PPC:

 

Virtual:

 

50006F0063006B0065007400500043000000-444556494345454D00

 

iPaq:

 

E50000FF12AF722178000050BF1977E0-

 

So...

At least on my hardware, the real PPC has nothing after the dash.

 

Much more testing to see if this is true across the board.

 

- T of TandS

Link to comment

Yes the Env.DeviceID works fine for detecting emulator play

Taking the good advice from Tydrium, I added the following function.

 

-- #Author Functions Go Here# --

function devicetest()

deviceid = Env.DeviceID

return deviceid

end

I'm sure return could have been return Env.DeviceID as well

 

I added the following code to test things

 

function cartneedhamtest:OnStart()

-- #GroupDescription=Script --

-- #Comment=Script Comment --

environment = devicetest()

if Wherigo.NoCaseEquals(environment,"desktop") then

Wherigo.MessageBox{Text=[[This cartridge cannot be played in the emulator ENVIRONMENT=]]..environment..[[ but must be played in the field.]],Media=zmediaghosticon,Callback=cartneedhamtest.MsgBoxCBFuncs.MsgBoxCB4}

else

zoneNeedhamZone.Active = true

end

end

 

It all works as intended but you have to leave it out of the builder or the .lua code will be rewritten in ways you won't like. If you compile on line, and download the .gwc file, both the emulator and Colorado work as intended.

Regards, Tom Birchmire

Link to comment

It all works as intended but you have to leave it out of the builder or the .lua code will be rewritten in ways you won't like. If you compile on line, and download the .gwc file, both the emulator and Colorado work as intended.

Regards, Tom Birchmire

 

I've used the builder and also edited the lua file with similar code, but I was able to go back and forth between the builder and the code without losing anything. So I'm not sure what the differences are, but it is possible to use this system check and still work and compile in the builder.

 

I have used a simple code like this:

 

DeviceID = Env.DeviceID

If yes ... Message to the player

If no ... Let them continue

 

-Kevan

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...