Hey there,
I've created a simple and small code snipped for everyone who wants just join a server and not navigate thru the menus. ;)
This snipped adds a button to the startup screen: SERVER BROWSER
[spoiler=Screenshot](https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdarkshapearts.lima-city.de%2FSWBF%2FPics%2FServerBrowser%2FServerBrowserButton.png&hash=88cb71b62c519399e3112c8f230e69d067c223ad)[/spoiler]
By pressing this button you jump instant to the sessionlist where you can join a server.
I've reduced the code to a minimum and commented everything. You can simply rename the button if you want.
[spoiler=for modders]Shell.lvl script => ifs_main.lua
The Button (here you can rename the button. after string= is the button name, don't forget the ")
{ tag = "mpsb", string = "SERVER BROWSER", }, --V - add button to menu
The function [Line: around 360]
elseif (this.CurButton == "mpsb") then --V - serverbrowser button
ifs_sp.bForSplitScreen = nil --V - kill it with fire
ScriptCB_SetSplitscreen( nil ) --V - kill it with fire #2
ScriptCB_SetConnectType("wan") --V - set the ConnectType: not lan nor direct, it's internet!
ifelm_shellscreen_fnPlaySound(this.acceptSound) --V - play sound because we're cool
ifs_movietrans_PushScreen(ifs_mp_sessionlist) --V - skip everything and go straight to sessionlist
[/spoiler]
[spoiler=clean script with button added]
SWBF - StraightToSessionlist [@pastebin] (http://pastebin.com/jiPXjwsd)
[/spoiler]
Any bugs or mistakes in code or in my english? Let me know. :cheers:
(final clean script with just button and function added is attached)
Way cool mate. The script looks quite clean!
A little off topic, but the interface skin looks quite nice as well, is it a personal one, or can I download it somewhere?
edit- Never mind, found it: http://www.swbfgamers.com/index.php?topic=9286.0
--
So just some fun poking around the scripts, but following what you've done, you could per se set up a "Battlefront demo button" by just sticking another button in that does what some of the "ifs_main_demo.lua" script does in its
"ifs_main_demo_fnMissionsDone()" function.
Makes me want to get into some IO with making some sort of in-game map reloading silliness.. Or maybe even mini-mods.
Quote from: -RepubliqueCmdr- on June 16, 2015, 09:40:03 PM
Way cool mate. The script looks quite clean!
Thx :cheers:
Quote from: -RepubliqueCmdr- on June 16, 2015, 09:40:03 PM
A little off topic, but the interface skin looks quite nice as well, is it a personal one, or can I download it somewhere?
It's not Lum3n's common.lvl
It's my personal one. But I'll share it soon. :)
nice scripts :tu:
Hey there,
bufix#1The problemThere was a problem with the script. It didn't know if joining or hosting a server. (Please correct me if I'm wrong)
(I think that's what the part I've added does. Telling the script, that you're not a host)
The fix [Shell -> ifs_main.lua -> replace it with the old code or download the attachment of this post]
elseif (this.CurButton == "mpsb") then -- serverbrowser button
ScriptCB_SetAmHost(nil)-- [bug_fix_#1_-_17.June.2015] - We want to join, not host a server
ScriptCB_SetConnectType("wan") --V - set the ConnectType: not lan nor direct, it's internet!
ifelm_shellscreen_fnPlaySound(this.acceptSound) -- play sound because we're cool
ifs_movietrans_PushScreen(ifs_mp_sessionlist) -- skip everything and go straight to sessionlist
Quote from: Phobos on June 17, 2015, 11:41:47 AM
nice scripts :tu:
Thx much! But way not as nice as your scripts :cheers:
Fix is attached
Quote from: Viathan on June 17, 2015, 11:50:30 AM
Hey there,
bufix#1
The problem
There was a problem with the script. It didn't know if joining or hosting a server. (Please correct me if I'm wrong)
(I think that's what the part I've added does. Telling the script, that you're not a host)
The fix [Shell -> ifs_main.lua -> replace it with the old code or download the attachment of this post]
elseif (this.CurButton == "mpsb") then -- serverbrowser button
ScriptCB_SetAmHost(nil)-- [bug_fix_#1_-_17.June.2015] - We want to join, not host a server
ScriptCB_SetConnectType("wan") --V - set the ConnectType: not lan nor direct, it's internet!
ifelm_shellscreen_fnPlaySound(this.acceptSound) -- play sound because we're cool
ifs_movietrans_PushScreen(ifs_mp_sessionlist) -- skip everything and go straight to sessionlist
Thx much! But way not as nice as your scripts :cheers:
Fix is attached
thanks lol :tu: i wanted to add this to ifs_login so when you login to your profile it goes straight to sessionlist. also wanted to automate the login page since i only use one profile so as soon as you launch the game it instantly loads the sessionlist.
my SWBF launcher INI is using the other shortcut settings here
[CMD]
COMMAND_LINE=/nointro /nowait /nostartupmusic /nomovies /noframelock /ShowAllServers
It's possible (I think with /profile) to automatically login when the game starts.
But idk the exact syntax of this command so I coded into my ifs_login which profile it shall load and then log me in.
Right after I coded that, I saw the function that reads the commandline for a profile. :slap:
Just insert the nick of your profile in the variable and done :rofl:
I like movies in background and changed them to other cool movies :D
But I also removed all transition sequences, like when you click on options or singleplayer.
And soon there will be another bugfix for the ServerBrowser button.
Quote
can you show which code u used for the instant login mod?
ifs_login.luaSearch for: commandline -> Right below the comment is the declaration and initialization of several variables.
There's also the variable we need :
CmdNickStrThe next line is:
CmdNickStr = CmdNickStr or ""
You change it to:
--CmdNickStr = CmdNickStr or ""
And now you add a new line:
CmdNickStr = "YOUR_PROFILE_NAME"
That's it :)
Hi there :cheers:
OK, this bugfix took me hours.. But now it should work like expected :)
This update fixes:
- ServerBrowser connected you with your prev connection type (lan, direct...)
- Singleplayer was not possible when ServerBrowser was launched before
- Several small bugs like: exiting serverbrowser moves you to profile select.. or well, gamecrashes
The current version (v1.12)
- Once in mainmenu you can click on server browser button to get straight to sessionlist
- Fixed the prev connection bug
- Fixed the singleplayer bug
- Fixed the host and join bug
- Fixed gamecrashes and several small bugs
The Code [ifs_main.lua (shell script)]Note: It's not the best code you've every seen... But I tried to kept all the changes in one file! :cheers:
Code for singleplayer bugfix-- CLEAR MP RELATED THINGS when launching sp ---------------
ScriptCB_ClearPrevSessionId()-- kill old SID
ScriptCB_CloseNetShell(1)-- we're not in mp!
Main code for our serverbrowser button
elseif (this.CurButton == "mpsb") then -- serverbrowser button
ScriptCB_SetInNetGame(nil)-- Just to make sure everything is fresh :)
ScriptCB_ClearPrevSessionId()-- Clear prev Session ID (helps SetConnectType)
ScriptCB_SetConnectType("wan")-- set the ConnectType: not lan nor direct, it's internet!
ScriptCB_SetAmHost(nil)-- We want to join, not host a server
gOnlineServiceStr = ScriptCB_GetOnlineService()
if(gOnlineServiceStr == "GameSpy") then
ifelm_shellscreen_fnPlaySound(this.acceptSound) --play sound because we're cool
ifs_movietrans_PushScreen(ifs_mp_sessionlist)--get the OnlineService: not lan nor direct, it's internet!
end
--ifs_movietrans_PushScreen(ifs_mp_main) -- disabled - need to check/get onlineservice
Maybe it's easier for you downloading the current version and check what I've changed.
Changes are made..Line: 27 [Button added to menu]
Line: 340 - 343 [SinglePlayer bugfix]
Line: 373 - 387 [Button function + fixes]
Current version is attached
nice work, thanks for sharing :tu: ill add these improvements to my custom ifs_main.lua with skin changer and library mod.
also i have the splitscreen code here you can add
elseif (this.CurButton == "split") then
ifs_sp.bForSplitScreen = 1
ScriptCB_SetSplitscreen( 1 )
ifs_movietrans_PushScreen(ifs_split_main) -- Phobos, changed from (ifs_split_profile), test (ifs_split_map)
menus load instantly
----startdelay = random() * 0.5,
startdelay = random() * 0.0,
Edit 1
here is the code for straight buttons
ifs_main = NewIFShellScreen {
bNohelptext_backPC = 1,
buttons = NewIFContainer {
ScreenRelativeX = 0.5, -- center
ScreenRelativeY = 0.65, -- top
---- y = 30, -- offset slightly down
---- x = -30,
---- rotY = -30,
---- rotX = -20,
---- rotZ = 1,
custom background (also added to shell.req)
---- bg_texture = HackBGTextureOnPCOnly("fcmain"), ---- broken code
bg_texture = "fcmain",
Edit 2
I also have developed an instant campaign launch button for TWD directly from the main menu :D
{ tag = "campaignTWD", string = "THE WALKING DEAD CAMPAIGN", },
elseif (this.CurButton == "campaignTWD") then
ifs_sp.bForSplitScreen = nil
ScriptCB_SetSplitscreen( nil )
ScriptCB_SetInNetGame( nil )
ScriptCB_SetMetagameRulesOn(nil) -- for ingame
ScriptCB_SetHistoricalRulesOn(1) -- test 0 for AI suicide timer
ScriptCB_SetCanSwitchSides(nil)
if(gPlatformStr == "PC") then
ifs_sp_briefing.era = "twd"
ifs_movietrans_PushScreen(ifs_sp_briefing)
else
ifs_movietrans_PushScreen(ifs_sp_era)
end
Quotenice work, thanks for sharing :tu:
Np mate :cheers:
Thx for sharing your scripts. I'll try them :)
Correct me if I'm wrong;
Quote from: Phobos on June 19, 2015, 10:56:08 AM
menus load instantly
----startdelay = random() * 0.5,
startdelay = random() * 0.0,
The random() number function is obsolete now that you have it multiplying by an empty value.
You could save even more memory (not noticeable, but calling functions does have an overhead) using
startdelay = 0.0
Yes, you're right.
Actually you can just say: startdelay = nil
To erase this completely from memory (if this doesn't cause a crash)
But this is so minimal and there are many other things made by the developers that would be more necessary to clean :cheers:
Edit:
I like the most effects and designs the developers made. Even with my common and shell mods or my hacks etc I'm not gonna renew the interface. Just few design changes and utility stuff I like to have :)
thanks for the tip i'll add this to the minimalist scripts 8)
I dont suppose anyone has made a new ifs_screen before? I'm making a quick screen to experiment with.
Code as it stands:[spoiler=ifs_mods.lua]--Testing a new screen
function ifs_mods_fnBuildScreen(this)
local w,h = ScriptCB_GetSafeScreenInfo() -- of the usable screen
local aw,ah = ScriptCB_GetScreenInfo()
this.listbox = NewButtonWindow
{ ZPos = 200, x=0, y = 0,
ScreenRelativeX = 0.5, -- center
ScreenRelativeY = 0.5,
width = w/2,
height = h/2,
titleText = "Mod Manager",
--rotY = -35,
}
this.buttons = NewIFContainer {
ScreenRelativeX = 0.3, -- center
ScreenRelativeY = 0.5, -- center
y = 0,
--rotY =35
}
local TestButtonW = 100
local TestButtonH = 25
this.testbutton = NewIFContainer
{
ScreenRelativeX = 1.0, -- right
ScreenRelativeY = 1.0, -- bottom
y = -15, -- just above bottom
x = -TestButtonW + 25,
btn = NewClickableIFButton -- NewRoundIFButton
{
btnw = TestButtonW,
btnh = TestButtonH,
font = "gamefont_medium",
--bg_width = BackButtonW,
bg_xflipped = 1,
nocreatebackground = 1,
tag = "Test Button",
}, -- end of btn
}
--RoundIFButtonLabel_fnSetString(this.testbutton.btn,"Test Button")
end
ifs_mods_fnBuildScreen( ifs_mods )
ifs_mods_fnBuildScreen = nil
AddIFScreen(ifs_mods,"ifs_mods")
[/spoiler]
I already have the button in the main menu, but pushing to this screen on the event of it's click causes a crash does nothing (I fixed the crash)..
Try to add ScriptCB_DoFile("ifs_swbfadmin") into your menu.
Ofc you have to replace swbfadmin with your scriptname (and add it to the first line if possible)
Quote from: -RepubliqueCmdr- on June 19, 2015, 04:06:24 PM
I dont suppose anyone has made a new ifs_screen before? I'm making a quick screen to experiment with.
Code as it stands:[spoiler=ifs_mods.lua]--Testing a new screen
function ifs_mods_fnBuildScreen(this)
local w,h = ScriptCB_GetSafeScreenInfo() -- of the usable screen
local aw,ah = ScriptCB_GetScreenInfo()
this.listbox = NewButtonWindow
{ ZPos = 200, x=0, y = 0,
ScreenRelativeX = 0.5, -- center
ScreenRelativeY = 0.5,
width = w/2,
height = h/2,
titleText = "Mod Manager",
--rotY = -35,
}
this.buttons = NewIFContainer {
ScreenRelativeX = 0.3, -- center
ScreenRelativeY = 0.5, -- center
y = 0,
--rotY =35
}
local TestButtonW = 100
local TestButtonH = 25
this.testbutton = NewIFContainer
{
ScreenRelativeX = 1.0, -- right
ScreenRelativeY = 1.0, -- bottom
y = -15, -- just above bottom
x = -TestButtonW + 25,
btn = NewClickableIFButton -- NewRoundIFButton
{
btnw = TestButtonW,
btnh = TestButtonH,
font = "gamefont_medium",
--bg_width = BackButtonW,
bg_xflipped = 1,
nocreatebackground = 1,
tag = "Test Button",
}, -- end of btn
}
--RoundIFButtonLabel_fnSetString(this.testbutton.btn,"Test Button")
end
ifs_mods_fnBuildScreen( ifs_mods )
ifs_mods_fnBuildScreen = nil
AddIFScreen(ifs_mods,"ifs_mods")
[/spoiler]
I already have the button in the main menu, but pushing to this screen on the event of it's click causes a crash does nothing (I fixed the crash)..
Quote from: Viathan on June 20, 2015, 12:53:14 AM
Try to add ScriptCB_DoFile("ifs_swbfadmin") into your menu.
Ofc you have to replace swbfadmin with your scriptname (and add it to the first line if possible)
yes I have several new pages in my shell.lvl, it's best to add the ScriptCB_DoFile line directly to the
shell_interface.lua, as well as the
shell.req, and then call on it using pushscreen from your chosen menu.
example
-- unlockables
ScriptCB_DoFile("ifs_unlockables")
ScriptCB_DoFile("ifs_tutorials")
ScriptCB_DoFile("ifs_credits")
---- custom shell scripts by phobos
---- Load custom scripts into memory
ScriptCB_DoFile("shell_skin") ---- shell skin changer
ScriptCB_DoFile("ifs_jwc") ---- jet wars campaign credits
ScriptCB_DoFile("ifs_zom") ---- zombie conquest menu
Cool thanks.. Testing now.
I wish LUA had better binary functions, it would make format reading much easier.
edit- Still cant seem to get the code to take me to the page. At least it doesn't crash.
Sorry mate.
Can't fix your script, I'm not a pro in Lua. But maybe you try using a template from another script... :confused: