Detecting ESB

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
kaypy
Artisan
Posts: 171
Joined: Sun Jan 19, 2014 7:11 am

Detecting ESB

Post by kaypy »

Since ESB doesn't load the full set of libraries and functions, it should* be possible to detect whether a dungeon is loading in ESB by checking the existence of those functions.

But that seems rather haphazard. Is there a 'proper' way to do this?

* haven't tested yet...
Friends don't let friends eat worm round
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Detecting ESB

Post by Sophia »

The method I use is to check for the existence of esb_typecheck. If it's defined, you're in ESB, if not, you're in DSB.

(This is, admittedly, very similar to the method you described! But it's based on a function that is never going to change, so it should be reliable)

Code: Select all

if (esb_typecheck) then
  do_esb_stuff()
else
  do_dsb_stuff()
end
Post Reply