LoginLogin

Detecting the current slot

Root / FAQs / [.]

12Me21Created:
PRGNAME$() returns the name of the program in the current slot by default, and you can compare the result with PRGNAME$(SlotNumber).
DEF CURRENTSLOT()
 VAR NAME$=PRGNAME$()
 VAR SLOT%
 FOR SLOT%=0 TO 3
  IF NAME$==PRGNAME$(SLOT%) THEN RETURN I%
 NEXT
 RETURN -1
END
EDIT: there's a possibly better way using BACKTRACE and CHKCHR

12me using suffixes??? Lol anyway this is pretty clever. I was thinking about how someone would do this recently. Only problem I can imagine is if two slots have the same name for whatever reason.

I only use high quality suffixes