SWBFGamers

Modding for the Original SWBF1 and SWBF2 => Requests => Topic started by: Kit Fisto on February 10, 2014, 01:08:15 PM

Title: [REQUEST] Select all maps button
Post by: Kit Fisto on February 10, 2014, 01:08:15 PM
Is there a way someone could create a "Select all maps and eras" button for the SWBFI instant action list? But keep the "play in random order" button?
Title: Re: [REQUEST] Select all maps button
Post by: Viathan on February 10, 2014, 01:35:39 PM
so that all maps and all "modes" are added to the session-list?
could be done with lua editing a sp.lua file (s.t. like ifs_sp_sessionlist.lua)
I'll try that the next days

Edit: could be the missionlist.lua (Shell script)
Title: Re: [REQUEST] Select all maps button
Post by: SleepKiller on February 10, 2014, 03:01:37 PM
Quote from: Kit Fisto on February 10, 2014, 01:08:15 PM
Is there a way someone could create a "Select all maps and eras" button for the SWBFI instant action list? But keep the "play in random order" button?
Yes and No. The button itself would be simple, but there is a cap on how many missions you can add to the list I think. Not sure what it is though.
Title: Re: [REQUEST] Select all maps button
Post by: Viathan on February 11, 2014, 05:58:47 AM
This what SK answered and modmaps would be the problem.
You have to find out what happens if you add a map to the list. To add these function to a new button would be makeable :)
But dont know what the limit is (maps in list) and how to add the modmaps into list
Title: Re: [REQUEST] Select all maps button
Post by: Led on February 11, 2014, 06:27:16 AM
You could probably just hard code all the stock maps to the button press.  No need to make it too complicated  ;)
Title: Re: [REQUEST] Select all maps button
Post by: Viathan on February 11, 2014, 07:40:52 AM
Yes, that was my idea. So modmaps are not supported by this way.
And the sessionlimit is rly nice, ~74 maps you can add!  :)
Title: Re: [REQUEST] Select all maps button
Post by: Viathan on February 11, 2014, 09:45:21 AM
Well, after few minutes Lua coding, I've added a new Button to sessionlist:
(https://www.swbfgamers.com/proxy.php?request=http%3A%2F%2Fdarkshapearts.de%2FSWBF%2FPics%2FNewBTN_AddAll.png&hash=0c6d442afa527301bf3619169d731c47e4d4adb5)

It has no function yet. (looks bit weird, it's in german  8)  )

For modders:
Add these lines to your ifs_missionselect.lua (Shell script)
atm I have no time to add a function, so feel free to use my button, maybe s.o. can finish it :cheers:

(Change the button name, text or whatever you want)
[spoiler=LuaCode->ifs_missionselect.lua]

this.AddAllButton = NewClickableIFButton {
ScreenRelativeX = 0.699, -- position X
ScreenRelativeY = 0.825, -- position Y
rotY = this.listboxL.rotY, -- rotation (3D-effect)
x = this.listboxL.x + 23,
--y = this.listboxL.height / 2 + 11, --> forgot x)
y = this.listboxL.y + 5,
btnw = this.listboxL.width, -- > listboxL => left  and  listboxR = right
btnh = ScriptCB_GetFontHeight("gamefont_small"),
font = "gamefont_small",
tag = "addall", -- internal btn name f.e. functions
string = "add all maps", -- text
}

Without comments:

this.AddAllButton = NewClickableIFButton {
ScreenRelativeX = 0.699,
ScreenRelativeY = 0.825,
rotY = this.listboxL.rotY,
x = this.listboxL.x + 23,
--y = this.listboxL.height / 2 + 11,
y = this.listboxL.y + 5,
btnw = this.listboxL.width,
btnh = ScriptCB_GetFontHeight("gamefont_small"),
font = "gamefont_small",
tag = "addall",
string = "add all maps",
}

[/spoiler]
Title: Re: [REQUEST] Select all maps button
Post by: Kit Fisto on February 12, 2014, 07:30:05 PM
Yay! Your close to getting it! Thanks for working on it, it means a lot to me. :)
Title: Re: [REQUEST] Select all maps button
Post by: Viathan on February 13, 2014, 12:41:20 AM
Quote from: Kit Fisto on February 12, 2014, 07:30:05 PM
Yay! Your close to getting it! Thanks for working on it, it means a lot to me. :)

:happy:
I have some ideas about that, I will test them from time to time
Title: Re: [REQUEST] Select all maps button
Post by: Ltin on February 14, 2014, 07:42:29 AM
I like ur button.
me gusta n' all that stuf'
Title: Re: [REQUEST] Select all maps button
Post by: Viathan on February 14, 2014, 07:44:45 AM
Quote from: Ltin on February 14, 2014, 07:42:29 AM
I like ur button.
me gusta n' all that stuf'
8)
I think next week or next weekend I get first results  :)
Title: Re: [REQUEST] Select all maps button
Post by: Kit Fisto on February 23, 2014, 03:29:39 PM
How's the progress on this mini mod going?
Title: Re: [REQUEST] Select all maps button
Post by: Viathan on March 03, 2014, 04:19:29 AM
Ok, sry for the long waiting time.

The function to add one map to the list:
Code (lua) Select

-- Adds the currently selected map to the maplist.
function ifs_missionselect_fnAddMap(this)
local Selection = missionselect_listbox_contents[missionselect_name_listboxL_layout.SelectedIdx]


So I think we have to write a completely new function to add all maps.
So it could be also possible to add all maps and modmaps if we can access the index of maps.

Im not as good as phobos or sleepkiller at lua, I'll post the scripts on pastebin so that we can develop together if you want.

ifs_missionselect.lua @ pastebin (http://pastebin.com/ec4j8YUS#)
Title: Re: [REQUEST] Select all maps button
Post by: Dark_Phantom on March 03, 2014, 05:21:19 AM
This may help in your travels too.  I edit this one a lot in Mando Wars.
Code (lua) Select

498.function ifs_missionselect_fnSetMapAndTeam(this,Selection,Team1Str,Team2Str)
499.        local SelectedMap = Selection.mapluafile .. this.AttackerChar
500.        local Side = 1 -- 1 or 2
501.        local SideChar = this.CurButton -- 'a' 'c' 'i' or 'r'
502.
Title: Re: [REQUEST] Select all maps button
Post by: Viathan on March 03, 2014, 05:47:40 AM
Quote from: Dark_Phantom on March 03, 2014, 05:21:19 AM
This may help in your travels too.  I edit this one a lot in Mando Wars.
Code (lua) Select

498.function ifs_missionselect_fnSetMapAndTeam(this,Selection,Team1Str,Team2Str)
499.        local SelectedMap = Selection.mapluafile .. this.AttackerChar
500.        local Side = 1 -- 1 or 2
501.        local SideChar = this.CurButton -- 'a' 'c' 'i' or 'r'
502.


Seems helpful, thx for posting  :cheers:
Title: Re: [REQUEST] Select all maps button
Post by: Dark_Phantom on March 03, 2014, 07:09:01 AM
Here's actually what I did to it (see in action in Mando Wars Beta here (http://www.swbfgamers.com/index.php?action=downloads;sa=view;down=1045)

Section of code...
Code (lua) Select

----Hack by Phantom.  Forces new era to call on a universal lua file that is flexible enough to read different levels.
----Works by taking stock letters and puts them down as normal. All others call on Mandalorian level.
----For extra era to work, set the "this.CurButton" value and set your era in it.  Mandalorian Wars
----is set up this way due to it being a three era mod, not any more (for now).  Just figured this way was much
----simpler for just 1 extra era.
----9/5/13 ----Changed to accommodate new buttons later.

    if ((this.CurButton == "a") or (this.CurButton == "c") or (this.CurButton == "i") or (this.CurButton == "r")) then
        ---- SelectedMap = Selection.mapluafile .. this.CurButton ----this.AttackerChar, fix because the game wasn't registering Clone Wars
        SelectedMap = Selection.mapluafile .. this.CurButton
    elseif (this.CurButton == "mando") then
        SelectedMap = "UNIVmando"
    else
        SelectedMap = "Debug" ---- need this to see if Mando Wars works without falling back on "mando"
    end
   
----This next part defines selection as "q", making it easier to declare and then put in the text file.
----The mapluafile is pulled from the past command, and the way I set it up kept the Selection.mapluafile
----intact, while making it LOOK like it isn't used anymore.  Tricked ya, didn't I?

local q = Selection.mapluafile

----MOVED TO A BETTER LOCATION ---- 7/6/2013 ifs_main
----writeto("Data\\_LVL_PC\\UNIV\\values.txt")

if(SelectedMap == "UNIVmando") then
appendto("Data\\_LVL_PC\\UNIV\\values.txt")   
write(q)
write("\n")
end


I'm in the process of making this more efficient (at some point), but this is what my amateur programming mind could do.  If you want to see the rest of it sometime, just ask.
EhPortal 1.34 © 2025, WebDev