News:

Happy 20th, FFvT3R!

Main Menu

Determining if game is Rumble Room

Started by GogglesPizanno, March 14, 2009, 07:36:32 PM

Previous topic - Next topic

GogglesPizanno

So here's a weird question. Is there a way in code to know if a game being played is a rumble room session vs. a campaign or single mission? Is there a variable or something that get set?

M25

I think stumpy figured this out.  You can check to see if one of the functions in the sk.py file was loaded, which means that you are in the rumble room.


if 'OnGameTypeCheck' in dir(ff): return 1  #skirmish mode

stumpy

#2
Yes, and we also set a mission variable that you can check via the missionobjvar.isCampaign() function (which returns 1 for campaign missions and 0 for RR missions).

Keep in mind that, because of the order how the modules get loaded, it's not guaranteed accurate to check mission type until the modules have all loaded. That is, if this were for a mission script, the call is better left for OnPostInit() or later, rather than for a call at the zero indent level of the script. E.g.
import ff
from cshelper import *
import ffx
import missionobjvar
from ff import *
# etc

if missionobjvar.isCampaign():
    MissionStatusText("campaign mission")
else:
    MissionStatusText("rumble room mission")

def OnPostInit():
    # etc.

Would be safer written as

import ff
from cshelper import *
import ffx
import missionobjvar
from ff import *
# etc

def OnPostInit():
    if missionobjvar.isCampaign():
        MissionStatusText("campaign mission")
    else:
        MissionStatusText("rumble room mission")
    # etc.

If this is for an FFX attribute function, it should be fine by the time FFX attributes are initializing (since they are deliberately delayed).
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

GogglesPizanno

This is gonna (hopefully) be used in an FFX plugin, so I think it should be fine.
Thanks to both of you.