[SOLVED]How Add The Feature "Exit To Windows" To The Escape Menu In MultiPlayer?

Started by Phobos, October 31, 2011, 02:58:03 PM

Previous topic - Next topic
Tutorial under construction.
Quote from:  Phobos DeveloperAnother idea would be to add escape menu option to endgame scores screen so that when dedi servers hang on 0 people don't have to use task manager to close game and restart.

Quote from: Phobos Developer on October 31, 2011, 02:58:03 PM
This a repost of a thread for an unanswered question. Off-topic posts will be instantly reported. Do not try to derail or spam this thread with the intention of getting it locked. It should remain open for discussion of the topic addressed here:

Ideas
I will be testing Bamdur's idea and post the results here.
You do know that when a thread gets locked you do not just go and start a new one right?

On Topic -  I'll tell you this one last time.
When you disconnect you are redirected to the main menu so the exit command will not be activated. And the exit command by itself will freeze your computer. You have to realise that a lot of things with modding a game are imposible. I've investagated this their is no work around, leave it at that now. If you want to do stuff a game was not designed to do you must build your own game.

Final Bottom Line - It is impossible get over it.

naw, let him experiment with it, until he gets what he wants. He won't listen to you, sotheres really no point in explaining it again  :D.

Wait, phobos, do you really know what you're doing here?
Current Projects:
Battlefront One and a Half Era Mod, v2.0. Making great progress (SWBF)

Quote from: jdee-barc on October 31, 2011, 03:54:31 PM
Wait, phobos, do you really know what you're doing here?
I'm 99% sure he does not.

Edit: Wait NapSeeker added the faekconsole buttot to MP? Then why would this topic with your replys in exsist http://www.swbfgamers.com/index.php?topic=3701.0

now now sleepkiller (condescending schoolteacher voice) don't get too hasty :P. let the man try his method
Current Projects:
Battlefront One and a Half Era Mod, v2.0. Making great progress (SWBF)

Quote from: jdee-barc on October 31, 2011, 06:21:14 PM
now now sleepkiller (condescending schoolteacher voice) don't get too hasty :P. let the man try his method
:rofl: (We are gonna here from him about these posts...)

But anyway this is the code I would use if I were persistant.

ScriptCB_QuitToShell(1);
ScriptCB_QuitToWindows(1);

But the problem is you see that it'll quit to shell straight away without giving the second command a single thought.

OK, guys, here's the deal.

It's essentially the four of us stranded on an island...well, maybe that's not quite it...but anyway, it's essentially the four of us here on SWBFgamers.com.   ;)

I don't want to lose anyone.  JDee, Sleepkiller, Phobos--you all know a lot about modding (Bamdur too, but he's not been as vocal as you other three).  Phobos asks a lot of questions to figure things out to make some new and creative things.  I'm still trying to ask decent questions, since I am an inexperienced modder, but I try to read everything, and contribute where I can. 

Sometimes personalities clash, sometimes ideas clash, etc.  Sleepkiller, I appreciate you answering a lot of the questions.  I might suggest that you answer it once, give the suspected outcome, and then let Phobos give it a try.  He's been forthcoming about what works and what doesn't work.  I know it can be frustrating when it appears that someone doesn't listen, but thanks again for hanging in there.

I often have to ask things a couple of different ways, try a few things, and read a bunch to understand things (I'm still working on understanding jdee's era mod, myself.)

Sometimes, in the process of finding out what doesn't work or going ahead with something that probably won't work anyway, something new might be learned.  And if its not new to the very experienced modders, just being new to me and anyone else that reads the forums is fine with me.

So, the bottom line is, thanks to all of you for being part of this small community, and let's try not to get frustrated with each other.

Oh, and since things seem to get more out of hand after I go to sleep, I've asked bamdur to help moderate.  :cheers:
Quote from: Abraham Lincoln. on November 04, 1971, 12:34:40 PM
Don't believe everything you read on the internet

Okay and I'm also feeling in a better mood then I was yesterday. So for the person who is very, very, very, persistant here is a script that controls the pause menu it is SWBFII but with editing it can be made fully fuctional in SWBFI.

--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- Ingame pause menu

ifspausemenu_vbutton_layout = {
ySpacing = 5,
width = 260,
font = gMenuButtonFont,
buttonlist = {
{ tag = "resume", string = "common.resume", },
{ tag = "lobby", string = "game.pause.playerlist", },
{ tag = "friends", string = "ifs.onlinelobby.friendslist", },
{ tag = "freecam", string = "game.pause.freecam", },
{ tag = "console", string = "Fake Console", },
{ tag = "opts", string = "ifs.main.options", },
{ tag = "suicide", string = "game.pause.suicide", },
{ tag = "recent", string = "common.mp.recent", },
{ tag = "restart", string = "common.restart", },
{ tag = "quit", string = "common.quit", },
{ tag = "exit", string = "common.quit2windows", },
},
title = "game.pause.title",
}

-- Turns pieces on/off as requested
function ifs_pausemenu_fnSetPieceVis(this, bVis)
IFObj_fnSetVis(this.buttons,bVis)
end

-- Sets text for the camera entry to the right settings
function ifs_pausemenu_fnUpdateFreecamText(this)
if(this.buttons.freecam) then
if(this.bChaseCam) then
RoundIFButtonLabel_fnSetString(this.buttons.freecam,"game.pause.followcam")
else
RoundIFButtonLabel_fnSetString(this.buttons.freecam,"game.pause.freecam")
end
end
end

function ifs_pausemenu_fnGetActiveInstance()
local Active = ScriptCB_GetPausingViewport()
if (Active == 0) then
return ifs_pausemenu
elseif (Active == 1) then
return ifs_pausemenu2
elseif (Active == 2) then
return ifs_pausemenu3
elseif (Active == 3) then
return ifs_pausemenu4
end
end

-- Callback for when the "really quit?" popup is over.  If bResult is
-- true, user wanted to quit
function ifs_pausemenu_fnQuitPopupDone(bResult)
local this = ifs_pausemenu_fnGetActiveInstance()
SetCurButton("quit", this)
if((gPlatformStr == "PC") or (not bResult)) then -- fix for BF2 bug 5091, 5724
ifs_pausemenu_fnSetPieceVis(this,1) -- always restore screen
else
this.bNoInput = 1
end

if(bResult) then
ifelm_shellscreen_fnPlaySound(this.acceptSound)
ScriptCB_QuitToShell()
else
ifelm_shellscreen_fnPlaySound(this.cancelSound)
end
Popup_YesNo_Large.fnDone = nil
end

-- Callback for when the "really quit?" popup is over.  If bResult is
-- true, user wanted to quit
function ifs_pausemenu_fnExitPopupDone(bResult)
local this = ifs_pausemenu_fnGetActiveInstance()
SetCurButton("exit", this)
if((gPlatformStr == "PC") or (not bResult)) then -- fix for BF2 bug 5091, 5724
ifs_pausemenu_fnSetPieceVis(this,1) -- always restore screen
else
this.bNoInput = 1
end

if(bResult) then
ifelm_shellscreen_fnPlaySound(this.acceptSound)
ScriptCB_QuitToWindows()
else
ifelm_shellscreen_fnPlaySound(this.cancelSound)
end
Popup_YesNo_Large.fnDone = nil
end

-- Callback for when the "really quit?" popup is over.  If bResult is
-- true, user wanted to quit
function ifs_pausemenu_fnSuicidePopupDone(bResult)
local this = ifs_pausemenu_fnGetActiveInstance()
SetCurButton("suicide", this)
ifs_pausemenu_fnSetPieceVis(this,1) -- always restore screen

if(bResult) then
ifelm_shellscreen_fnPlaySound(this.acceptSound)
ScriptCB_PlayerSuicide(this.Viewport) -- top player
ScriptCB_Unpause(this.Viewport)
else
ifelm_shellscreen_fnPlaySound(this.cancelSound)
end

Popup_YesNo_Large.fnDone = nil
end

-- Callback for when the "really restart?" popup is over.  If bResult is
-- true, user wanted to restart
function ifs_pausemenu_fnRestartPopupDone(bResult)
local this = ifs_pausemenu_fnGetActiveInstance()
SetCurButton("restart", this)
if((gPlatformStr == "PC") or (not bResult)) then -- fix for BF2 bug 5091, 5724
ifs_pausemenu_fnSetPieceVis(this,1) -- always restore screen
else
this.bNoInput = 1
end

if(bResult) then
ifelm_shellscreen_fnPlaySound(this.acceptSound)
ScriptCB_RestartMission()
else
ifelm_shellscreen_fnPlaySound(this.cancelSound)
end

Popup_YesNo_Large.fnDone = nil
end

function ifs_pausemenu_fnDoExit()
Popup_YesNo_Large.CurButton = "no" -- default
Popup_YesNo_Large.fnDone = ifs_pausemenu_fnExitPopupDone
ifs_pausemenu_fnSetPieceVis(ifs_pausemenu, nil)
Popup_YesNo_Large:fnActivate(1)
gPopup_fnSetTitleStr(Popup_YesNo_Large, "ifs.main.askquit")
end

function ifs_pausemenu_fnJustExit()
ifs_pausemenu_fnExitPopupDone(true)
end

function ifs_pausemenu_fnSaveProfileCancel()
-- print("ifs_pausemenu_fnSaveProfileCancel")

-- back to the "its dirty, save?" prompt when we enter
--ifs_pausemenu.TryToBackup = 1
-- pop ifs_saveop, return to ifs_pausemenu
ScriptCB_PopScreen()
end


function ifs_pausemenu_fnSaveDirtyAcceptQuit(fRet)
Popup_LoadSave2.fnAccept = nil
Popup_LoadSave2:fnActivate(nil)

ifs_pausemenu.do_save = nil
if(fRet < 1.5) then
-- print("ifs_pausemenu_SaveDirtyAccept(A - Save)")
ifs_pausemenu.do_save = 1
ifs_saveop.doOp = "SaveProfile"
ifs_saveop.OnSuccess = ifs_pausemenu_fnJustExit --ifs_pausemenu_fnDoExit
ifs_saveop.OnCancel = ifs_pausemenu_fnSaveProfileCancel
local iProfileIdx = 1 + ScriptCB_GetPrimaryController()
ifs_saveop.saveName = ScriptCB_GetProfileName(iProfileIdx)
ifs_saveop.saveProfileNum = iProfileIdx
ifs_saveop.NoPromptSave = 1
ifs_movietrans_PushScreen(ifs_saveop)
elseif(fRet < 2.5) then
-- print("ifs_pausemenu_fnSaveDirtyAccept(B - Exit without saving)")
--ifs_pausemenu_fnDoExit()
ifs_pausemenu_fnJustExit()
else
-- print("ifs_pausemenu_fnSaveDirtyAccept(C - Cancel)")
-- show this screen
IFObj_fnSetVis(ifs_pausemenu.buttons,1)
end
end


-- Function shared by instances: enter
function ifs_pausemenu_fnEnter(this, bFwd, iInstance)
if(this.buttons and this.buttons.FriendIcon) then
local IconIdx = ScriptCB_GetFriendListIcon()
local UVs = gXLFriendsEnum2UVs[IconIdx+1] -- lua counts from 1
IFImage_fnSetUVs(this.buttons.FriendIcon,UVs.u,UVs.v,UVs.u+0.25,UVs.v+0.25)
end

-- Default fnEnter doesn't know about the multi-viewport active buttons. So,
-- clear out varbs it uses to keep from bouncing multiple buttons at once
-- NM 8/6/05
gCurScreenTable = this
SetCurButton(nil, this)
this.CurButton = nil

gIFShellScreenTemplate_fnEnter(this, bFwd)

-- if we're returning from the below, bail right back to the game
if((not bFwd) and this.PopAfterPlayerList) then
this.PopAfterPlayerList = nil
ScriptCB_ResetSkipToPlayerList()
ScriptCB_Unpause(this.Viewport)
return
end
-- if we're in a net game and the user hits 'tab', jump right to the player list
if(bFwd and ScriptCB_SkipToPlayerList() and ScriptCB_InNetGame()) then
this.PopAfterPlayerList = 1
ifs_movietrans_PushScreen(ifs_mp_lobby)
return
end
this.PopAfterPlayerList = nil
ScriptCB_ResetSkipToPlayerList()

ifs_pausemenu_fnUpdateFreecamText(this)
if(this.CurButton) then
IFButton_fnSelect(this.buttons[this.CurButton],nil) -- Deactivate old button
end

-- Refresh which buttons are shown
this.buttons.lobby.hidden = gDemoBuild or (not ScriptCB_InNetGame())

if(ScriptCB_GetGameRules() == "metagame") then
this.buttons.restart.hidden = 1
else
this.buttons.restart.hidden = ScriptCB_InNetGame()
end

this.buttons.exit.hidden = (gPlatformStr ~= "PC" or ScriptCB_InNetGame())
this.buttons.freecam.hidden = gFinalBuild

local bShowFriends
if(gPlatformStr == "XBox") then
-- XBox has to worry about which viewport(s) have signed-in users
-- BF2 bug 9214 - NM 8/15/05
local iJoystick = ScriptCB_GetPausingJoystick()
bShowFriends = ScriptCB_XL_IsLoggedIn(nil, iJoystick + 1) -- only visible if successfully signed in
else
-- GS has only one viewport to worry about
bShowFriends = ScriptCB_IsLoggedIn()
end
this.buttons.friends.hidden = not bShowFriends
this.bIsLoggedIn = bShowFriends

if(this.buttons.recent) then
this.buttons.recent.hidden = not ((ScriptCB_InNetGame()) and (gOnlineServiceStr == "XLive"))
end
this.buttons.console.hidden = gFinalBuild

if(ScriptCB_IsDedicated()) then
this.buttons.freecam.hidden = 1
-- this.buttons.lobby.hidden = 1 -- Disabled NM 7/22/04 - I think we need to show this
this.buttons.opts.hidden = 1
this.buttons.suicide.hidden = 1
elseif (ScriptCB_IsSplitscreen()) then
-- this.buttons.lobby.hidden    = 1
this.buttons.exit.hidden     = 1
end

-- Hide ability to go to lua screens that are deleted by PS2 when the
-- stats screens opens up. Do NOT modify these without also looking into
-- other ways to free up Lua memory on the PS2 - NM 5/25/05
if(ScriptCB_IsGameOver()) then
this.buttons.lobby.hidden = 1
this.buttons.opts.hidden = 1
this.buttons.suicide.hidden = 1
end

-- Function test added NM 6/14/05. Remove after about a week.
if(ScriptCB_IsGuest and ScriptCB_IsGuest()) then
this.buttons.lobby.hidden = 1
this.buttons.friends.hidden = 1
this.buttons.recent.hidden = 1
this.bIsGuest = 1
bShowFriends = nil -- have code below hide it.
else
this.bIsGuest = nil
end

this.CurButton = ShowHideVerticalButtons(this.buttons,ifspausemenu_vbutton_layout)

if (bFwd) then
ifelm_shellscreen_fnPlaySound(this.acceptSound)
end

SetCurButton(this.CurButton, this)

-- Move friends icon if appropriate
if(bShowFriends) then
local fLeft, fTop, fRight, fBot = IFText_fnGetDisplayRect(this.buttons.friends.label)
local TextW = fRight - fLeft
local XPos = fRight + 20
local YPos = this.buttons.friends.y - 15
IFObj_fnSetPos(this.buttons.FriendIcon,XPos,YPos)
else
IFObj_fnSetVis(this.buttons.FriendIcon, nil) -- just hide it.
end
end

-- Function shared by instances: Update
function ifs_pausemenu_fnUpdate(this, fDt)
-- Call default base class's update function (make button bounce)
gIFShellScreenTemplate_fnUpdate(this,fDt)

-- Periodically, see if we're still logged in. As we show 'friends' in
-- the Syslink UI, we need to immediately hide that if the XLive login
-- goes sour.
this.fFriendCheck = this.fFriendCheck - fDt
if((gPlatformStr == "XBox") and (not this.bIsGuest) and (this.fFriendCheck < 0)) then
this.fFriendCheck = 0.2
local iJoystick = ScriptCB_GetPausingJoystick()
local bIsLoggedIn = ScriptCB_XL_IsLoggedIn(nil, iJoystick + 1)
if(this.bIsLoggedIn ~= bIsLoggedIn) then
this.bIsLoggedIn = bIsLoggedIn
this.buttons.friends.hidden = not this.bIsLoggedIn
IFObj_fnSetVis(this.buttons.FriendIcon, this.bIsLoggedIn)
ShowHideVerticalButtons(this.buttons,ifspausemenu_vbutton_layout) -- refresh buttons
if (this.CurButton == "friends") then
this:Input_GeneralUp() -- move off now-disabled option
end
end
end
end

-- Function shared by instances: Input_Accept
function ifs_pausemenu_fnInput_Accept(this)
if(this.bNoInput) then
return
end

-- If base class handled this work, then we're done
if(gShellScreen_fnDefaultInputAccept(this)) then
return
end

ifelm_shellscreen_fnPlaySound(this.acceptSound)

if(this.CurButton == "resume") then
ScriptCB_Unpause(this.Viewport)
elseif (this.CurButton == "quit") then
-- this hack
ScriptCB_SetQuitPlayer(1)

Popup_YesNo_Large.CurButton = "no" -- default
Popup_YesNo_Large.fnDone = ifs_pausemenu_fnQuitPopupDone
Popup_YesNo_Large:fnActivate(1)
if (ScriptCB_GetAmHost()) then
if (ScriptCB_GetGameRules() == "metagame") then
gPopup_fnSetTitleStr(Popup_YesNo_Large, "ifs.pause.warn_quit_meta")
else
gPopup_fnSetTitleStr(Popup_YesNo_Large, "ifs.pause.warn_host_quit")
end
elseif (ScriptCB_GetGameRules() == "metagame") then
gPopup_fnSetTitleStr(Popup_YesNo_Large, "ifs.pause.warn_quit_meta")
else
gPopup_fnSetTitleStr(Popup_YesNo_Large, "ifs.pause.warn_quit")
end
ifs_pausemenu_fnSetPieceVis(this, nil)

elseif (this.CurButton == "freecam") then
this.bChaseCam = not this.bChaseCam
ScriptCB_Freecamera()
ifs_pausemenu_fnUpdateFreecamText(this)
elseif (this.CurButton == "exit") then

-- is the current profile dirty?
if(ScriptCB_IsCurProfileDirty(1)) then
-- print("profile dirty, prompting save")

-- hide this screen
IFObj_fnSetVis(ifs_pausemenu.buttons,nil)

-- set the button text
IFText_fnSetString(Popup_LoadSave2.buttons.A.label,ifs_saveop.PlatformBaseStr .. ".saveandexit")
IFText_fnSetString(Popup_LoadSave2.buttons.B.label,ifs_saveop.PlatformBaseStr .. ".exitnosave")
IFText_fnSetString(Popup_LoadSave2.buttons.C.label,ifs_saveop.PlatformBaseStr .. ".cancel")
-- set the button visibility
Popup_LoadSave2:fnActivate(1)
-- set the load/save title text
IFObj_fnSetVis(Popup_LoadSave2.buttons.A.label,1)
IFObj_fnSetVis(Popup_LoadSave2.buttons.B.label,1)
IFObj_fnSetVis(Popup_LoadSave2.buttons.C.label,1)
gPopup_fnSetTitleStr(Popup_LoadSave2, ifs_saveop.PlatformBaseStr .. ".save24")
Popup_LoadSave2_SelectButton(1)
IFObj_fnSetVis(Popup_LoadSave2, not ScriptCB_IsErrorBoxOpen())
Popup_LoadSave2_ResizeButtons()
Popup_LoadSave2.fnAccept = ifs_pausemenu_fnSaveDirtyAcceptQuit
return
end

ifs_pausemenu_fnDoExit()

elseif (this.CurButton == "lobby") then
ifs_movietrans_PushScreen(ifs_mp_lobby)
elseif (this.CurButton == "opts") then
if(gPlatformStr == "PC") then
ifs_movietrans_PushScreen(ifs_opt_general)
else
ifs_movietrans_PushScreen(ifs_opt_top)
end
elseif (this.CurButton == "friends") then
if(ScriptCB_GetOnlineService() == "XLive") then
ifs_mpxl_friends.bRecentMode = nil
ifs_movietrans_PushScreen(ifs_mpxl_friends)
else
ifs_movietrans_PushScreen(ifs_mpgs_friends)
end
elseif (this.CurButton == "recent") then
ifelm_shellscreen_fnPlaySound("shell_menu_accept")   
ifs_mpxl_friends.bRecentMode = 1
ifs_movietrans_PushScreen(ifs_mpxl_friends)
elseif (this.CurButton == "stats") then
ifs_movietrans_PushScreen(ifs_teamstats)
elseif (this.CurButton == "console") then
ifs_movietrans_PushScreen(ifs_fakeconsole)
elseif (this.CurButton == "restart") then
Popup_YesNo_Large.CurButton = "no" -- default
Popup_YesNo_Large.fnDone = ifs_pausemenu_fnRestartPopupDone
ifs_pausemenu_fnSetPieceVis(this, nil)
Popup_YesNo_Large:fnActivate(1)
gPopup_fnSetTitleStr(Popup_YesNo_Large, "ifs.pause.warn_restart")
elseif (this.CurButton == "suicide") then
Popup_YesNo_Large.CurButton = "no" -- default
Popup_YesNo_Large.fnDone = ifs_pausemenu_fnSuicidePopupDone
ifs_pausemenu_fnSetPieceVis(this, nil)
Popup_YesNo_Large:fnActivate(1)
gPopup_fnSetTitleStr(Popup_YesNo_Large, "game.pause.suicide_prompt")
end
end

ifs_pausemenu = NewIFShellScreen {
nologo = 1,
bAcceptIsSelect = 1,
movieIntro      = nil, -- played before the screen is displayed
movieBackground = nil, -- played while the screen is displayed
bFriendsIcon = 1,
bDimBackdrop = 1,
bNohelptext_backPC = 1,

buttons = NewIFContainer {
ScreenRelativeX = 0.5, -- center
ScreenRelativeY = 0.5, -- center
},

Enter = function(this, bFwd)
ifs_pausemenu_fnEnter(this,bFwd, 1) -- Call function shared between instances
end,

Exit = function(this, bFwd)
SetCurButton(nil, this) -- clear out button highlight
this.CurButton = nil
end,

fFriendCheck = 0.1,
Update = function(this, fDt)
ifs_pausemenu_fnUpdate(this, fDt)
end,

Input_Accept = function(this)
ifs_pausemenu_fnInput_Accept(this) -- Call function shared between instances
end,

-- Override default behavior
Input_Back = function(this)
if(this.bNoInput) then
return
end
ifelm_shellscreen_fnPlaySound(this.exitSound)
ScriptCB_Unpause(this.Viewport)
end,
}

ifs_pausemenu2 = NewIFShellScreen2 {
nologo = 1,
bFriendsIcon = 1,
bAcceptIsSelect = 1,
bDimBackdrop = 1,
bNohelptext_backPC = 1,

buttons = NewIFContainer {
ScreenRelativeX = 0.5, -- center
ScreenRelativeY = 0.5, -- center
},

Enter = function(this, bFwd)
ifs_pausemenu_fnEnter(this, bFwd, 2) -- Call function shared between instances
end,

Exit = function(this, bFwd)
SetCurButton(nil, this) -- clear out button highlight
this.CurButton = nil
end,

fFriendCheck = 0.1,
Update = function(this, fDt)
ifs_pausemenu_fnUpdate(this, fDt)
end,

Input_Accept = function(this)
ifs_pausemenu_fnInput_Accept(this) -- Call function shared between instances
end,

-- Override default behavior
Input_Back = function(this)
if(this.bNoInput) then
return
end
ifelm_shellscreen_fnPlaySound(this.exitSound)
ScriptCB_Unpause(1)
end,

Input_GeneralUp = function(this)
-- If base class handled this work, then we're done
if(gShellScreen_fnDefaultInputUp(this)) then
return
end

if(this.buttons) then
this.CurButton = FollowButtonLink(this.buttons,this.CurButton,"link_up")
SetCurButton(this.CurButton, this)
end
end,

Input_GeneralDown = function(this)
-- If base class handled this work, then we're done
if(gShellScreen_fnDefaultInputUp(this)) then
return
end

if(this.buttons) then
this.CurButton = FollowButtonLink(this.buttons,this.CurButton,"link_down")
SetCurButton(this.CurButton, this)
end
end,
}

ifs_pausemenu3 = NewIFShellScreen2 {
nologo = 1,
bFriendsIcon = 1,
bAcceptIsSelect = 1,
bDimBackdrop = 1,
bNohelptext_backPC = 1,

buttons = NewIFContainer {
ScreenRelativeX = 0.5, -- center
ScreenRelativeY = 0.5, -- center
y = -30,
},

Enter = function(this, bFwd)
ifs_pausemenu_fnEnter(this, bFwd, 3) -- Call function shared between instances
end,

Exit = function(this, bFwd)
SetCurButton(nil, this) -- clear out button highlight
this.CurButton = nil
end,

fFriendCheck = 0.1,
Update = function(this, fDt)
ifs_pausemenu_fnUpdate(this, fDt)
end,

Input_Accept = function(this)
ifs_pausemenu_fnInput_Accept(this) -- Call function shared between instances
end,

-- Override default behavior
Input_Back = function(this)
if(this.bNoInput) then
return
end
ifelm_shellscreen_fnPlaySound(this.exitSound)
ScriptCB_Unpause(2)
end,

Input_GeneralUp = function(this)
-- If base class handled this work, then we're done
if(gShellScreen_fnDefaultInputUp(this)) then
return
end

if(this.buttons) then
this.CurButton = FollowButtonLink(this.buttons,this.CurButton,"link_up")
SetCurButton(this.CurButton, this)
end
end,

Input_GeneralDown = function(this)
-- If base class handled this work, then we're done
if(gShellScreen_fnDefaultInputUp(this)) then
return
end

if(this.buttons) then
this.CurButton = FollowButtonLink(this.buttons,this.CurButton,"link_down")
SetCurButton(this.CurButton, this)
end
end,
}

ifs_pausemenu4 = NewIFShellScreen2 {
nologo = 1,
bFriendsIcon = 1,
bAcceptIsSelect = 1,
bDimBackdrop = 1,
bNohelptext_backPC = 1,

buttons = NewIFContainer {
ScreenRelativeX = 0.5, -- center
ScreenRelativeY = 0.5, -- center
y = -30,
},

Enter = function(this, bFwd)
ifs_pausemenu_fnEnter(this, bFwd, 4) -- Call function shared between instances
end,

Exit = function(this, bFwd)
SetCurButton(nil, this) -- clear out button highlight
this.CurButton = nil
end,

fFriendCheck = 0.1,
Update = function(this, fDt)
ifs_pausemenu_fnUpdate(this, fDt)
end,

Input_Accept = function(this)
ifs_pausemenu_fnInput_Accept(this) -- Call function shared between instances
end,

-- Override default behavior
Input_Back = function(this)
if(this.bNoInput) then
return
end
ifelm_shellscreen_fnPlaySound(this.exitSound)
ScriptCB_Unpause(3)
end,

Input_GeneralUp = function(this)
-- If base class handled this work, then we're done
if(gShellScreen_fnDefaultInputUp(this)) then
return
end

if(this.buttons) then
this.CurButton = FollowButtonLink(this.buttons,this.CurButton,"link_up")
SetCurButton(this.CurButton, this)
end
end,

Input_GeneralDown = function(this)
-- If base class handled this work, then we're done
if(gShellScreen_fnDefaultInputUp(this)) then
return
end

if(this.buttons) then
this.CurButton = FollowButtonLink(this.buttons,this.CurButton,"link_down")
SetCurButton(this.CurButton, this)
end
end,

}

if(not ScriptCB_IsSplitscreen()) then
ifs_pausemenu.Viewport = 0
ifs_pausemenu.CurButton = AddVerticalButtons(ifs_pausemenu.buttons,ifspausemenu_vbutton_layout)
AddIFScreen(ifs_pausemenu, "ifs_pausemenu", 1)

ifs_pausemenu2 = nil -- flush from memory
ifs_pausemenu3 = nil -- flush from memory
ifs_pausemenu4 = nil -- flush from memory
else
-- is splitscreen. Rearrange things
ifspausemenu_vbutton_layout.font = "gamefont_small"

if(ScriptCB_GetNumCameras() > 2) then
local w,h = ScriptCB_GetSafeScreenInfo() -- of the usable screen
ifspausemenu_vbutton_layout.HardWidthMax = w * 0.42
end

-- No gaps between items; we need to compress for space.
ifspausemenu_vbutton_layout.bNoDefaultSizing = 1

ifs_pausemenu.CurButton = AddVerticalButtons(ifs_pausemenu.buttons,ifspausemenu_vbutton_layout)
ifs_pausemenu.Viewport = 0
AddIFScreen(ifs_pausemenu,"ifs_pausemenu")

ifs_pausemenu2.CurButton = AddVerticalButtons(ifs_pausemenu2.buttons,ifspausemenu_vbutton_layout)
ifs_pausemenu2.Viewport = 1
AddIFScreen(ifs_pausemenu2,"ifs_pausemenu2")
ifs_pausemenu2 = DoPostDelete(ifs_pausemenu2)

if(gPlatformStr == "XBox") then
ifs_pausemenu3.CurButton = AddVerticalButtons(ifs_pausemenu3.buttons,ifspausemenu_vbutton_layout)
ifs_pausemenu3.Viewport = 2
AddIFScreen(ifs_pausemenu3,"ifs_pausemenu3")
ifs_pausemenu3 = DoPostDelete(ifs_pausemenu3)

ifs_pausemenu4.CurButton = AddVerticalButtons(ifs_pausemenu4.buttons,ifspausemenu_vbutton_layout)
ifs_pausemenu4.Viewport = 3
AddIFScreen(ifs_pausemenu4,"ifs_pausemenu4")
ifs_pausemenu4 = DoPostDelete(ifs_pausemenu4)
end
end

ifs_pausemenu = DoPostDelete(ifs_pausemenu)



It is very fragile so be careful what you alter about it.

@buckler: gotcha.

@sleepkiller. explain how this works. i don't understand a word of it
Current Projects:
Battlefront One and a Half Era Mod, v2.0. Making great progress (SWBF)

Quote from: jdee-barc on October 31, 2011, 06:48:06 PM
@buckler: gotcha.

@sleepkiller. explain how this works. i don't understand a word of it
Yeah its comfusing I'm selftaught learn from my mistakes so I can not help you much just try things out see what happens. the name of the script is ifs_pausemenu.

if you dont understand the lua, i sugget you learn a bit about object orriented programming, just a cuple minutes reading about the languages that follow it, you might be able to understand it afterwards. ill make a tutorial explaining how advanced lua works later

I understand most LUA its just I really don't care about this enough to go through the script and comment each line about what it does.

Seriously dude, I said that I could add the button but It will crash your game in multiplayer the code to disconnect will just send you back to the main menu and your command to exit will not activate.

{ tag = "exit", string = "common.quit2windows", } im pretty sure this is for localization, not for adding anything. and sleepkiller try exiting to windows in multiplayer while in windowed mode

Quote from: Bamdur on October 31, 2011, 10:45:09 PM
{ tag = "exit", string = "common.quit2windows", } im pretty sure this is for localization, not for adding anything. and sleepkiller try exiting to windows in multiplayer while in windowed mode
Okay I'll explain it to you this
ifspausemenu_vbutton_layout = { ySpacing = 5, width = 260, font = gMenuButtonFont, buttonlist = { { tag = "resume", string = "common.resume", }, { tag = "lobby", string = "game.pause.playerlist", }, { tag = "friends", string = "ifs.onlinelobby.friendslist", }, { tag = "freecam", string = "game.pause.freecam", }, { tag = "console", string = "Fake Console", }, { tag = "opts", string = "ifs.main.options", }, { tag = "suicide", string = "game.pause.suicide", }, { tag = "recent", string = "common.mp.recent", }, { tag = "restart", string = "common.restart", }, { tag = "quit", string = "common.quit", }, { tag = "exit", string = "common.quit2windows", }, }, title = "game.pause.title",}
Is the menus main layout code. the tag that is being  defined is what the button does when it is clicked so search for "exit" in the script and you will find the fuctions that are excuted when the button is pressed. you should also find the "if" question that hides the button in multiplayer.