Author Topic: Scripts for C08302008  (Read 9826 times)

0 Members and 1 Guest are viewing this topic.

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: Scripts for C08302008
k. forgots :p
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: Scripts for C08302008
k. forgots :p

I was more asking Mobius than you.  Cause I'm pretty sure they are compatible right now with nightly builds, unless he just meant 3.6.9 by 'standard'.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: Scripts for C08302008
What are you talking about?  I've been using the latest version of this script with nightly builds and Wanderer branch builds (which have nothing to do with this script) for months.

How about INF builds? Will it work?
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: Scripts for C08302008
If they've been made with a recent sync with trunk (which as I've stated elsewhere, Karajorma's recent INF-multiplayer builds have been), then yes.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: Scripts for C08302008
Thanks for the info, chief. :)
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Scripts for C08302008
During an IRC conversation with Flaming_Sword today, we decided to update this script a little. Actually, most of the work was done by Flaming_Sword, I just sat on the sidelines cheering....
The major upgrade here was to enable access to the F3 room. You can get there by clicking on the little box in the top-left corner of the screen.

Code: [Select]
#Conditional Hooks
$Application: Freespace 2
$On Game Init: [
--Function to handle a section every frame
section = function(name, event, num)
--MENU COLOR
local xmargin = gr.getScreenWidth()/8
local ymargin = gr.getScreenHeight()/8

--Get corner coordinates for this box
local x1 = xmargin
local y1 = ymargin*num
local x2 = x1+159
local y2 = y1+35

--When the mouse is OVER this section...
if io.getMouseX() > x1 and io.getMouseX() < x2 and io.getMouseY() > y1 and io.getMouseY() < y2 then
--Draw the inside box
gr.setColor(0, 255, 0)
gr.drawRectangle(x1+5, y1+5, x2-5, y2-5, false, false)

--Draw the little target lines now
local x = x1+(x2-x1)/2
local y = y1-20

--Top target line
gr.drawLine(x, y, x, y+15)

--Bottom target line
y = y2+10
gr.drawLine(x, y, x, y+15)

--Left target line
x = x1-20
y = y1+17
gr.drawLine(x, y, x+15, y)

--Right target line
x = x2+5
gr.drawLine(x, y, x+15, y)

--Handle the button click
if io.isMouseButtonDown(MOUSE_LEFT_BUTTON) then
gr.drawRectangle(x1, y1, x2, y2, false, false)
if event == "GS_EVENT_NEW_CAMPAIGN" or event == "GS_EVENT_OPTIONS_MENU" then
mn.unloadMission()
g_missionLoaded = nil
g_splashScreen = nil
end
ba.postGameEvent(ba.GameEvents[event])
end
end

--Draw the outline
gr.setColor(255, 255, 255)
gr.drawRectangle(x1, y1, x2, y2, false, false)

--Draw the name
gr.drawString(name, x1 + ( (x2-x1) - gr.getStringWidth(name) ) / 2, y1+15)
end
--Function to handle a section every frame
section2 = function(name, event, num)
--MENU COLOR
local xmargin = gr.getScreenWidth()/256
local ymargin = gr.getScreenHeight()/256

--Get corner coordinates for this box
local x1 = xmargin
local y1 = ymargin*num
local x2 = x1+10
local y2 = y1+10

--When the mouse is OVER this section...
if io.getMouseX() > x1 and io.getMouseX() < x2 and io.getMouseY() > y1 and io.getMouseY() < y2 then
--Handle the button click
if io.isMouseButtonDown(MOUSE_LEFT_BUTTON) then
gr.drawRectangle(x1, y1, x2, y2, false, false)
if event == "GS_EVENT_NEW_CAMPAIGN" or event == "GS_EVENT_OPTIONS_MENU" then
mn.unloadMission()
g_missionLoaded = nil
g_splashScreen = nil
end
ba.postGameEvent(ba.GameEvents[event])
end
end

--Draw the outline
gr.setColor(255, 255, 255)
gr.drawRectangle(x1, y1, x2, y2, false, false)

--Draw the name
--gr.drawString(name, x1 + ( (x2-x1) - gr.getStringWidth(name) ) / 2, y1+15)
end
]

$Application: Freespace 2
$State: GS_STATE_MAIN_MENU
$On State Start: []
+Override: true
$On State End: [
if g_missionLoaded then
mn.unloadMission()
g_missionLoaded = nil
g_splashScreen = nil
end
]
+Override: true
$On Frame: [
if not g_splashScreen then
--Don't need cursor
io.setCursorHidden(true)

--Draw splash image
local tex = gr.loadTexture("2_PreLoad.dds")
if tex:isValid() then
gr.drawImage(tex, 0, 0, gr.getScreenWidth(), gr.getScreenHeight())
end

--Draw "Loading..."
gr.setColor(255, 255, 255)
gr.CurrentFont = gr.Fonts['font02']
local loadString = "Loading..."
local x = (gr.getScreenWidth()-gr.getStringWidth(loadString))/2
local y = (gr.getScreenHeight()-gr.CurrentFont.Height)/2
gr.drawString(loadString, x, y)

--Done with splash
gr.CurrentFont = gr.Fonts['font01']
g_splashScreen = true
elseif not g_missionLoaded then
mn.loadMission("mainhall.fs2")
io.setCursorHidden(false)
g_missionLoaded = true
end

if g_missionLoaded then
mn.simulateFrame()
mn.renderFrame()

if ts.isCurrentPlayerMulti()==true then
if ts.isPXOEnabled()==true then
section("Multiplayer", "GS_EVENT_PXO", 1)
else
section("Multiplayer", "GS_EVENT_MULTI_JOIN_GAME", 1)
end
else
section("Ready Room", "GS_EVENT_NEW_CAMPAIGN", 1)
end
section("Campaign Room", "GS_EVENT_CAMPAIGN_ROOM", 2)
section("Tech Room", "GS_EVENT_TECH_MENU", 3)
section("Barracks", "GS_EVENT_BARRACKS_MENU", 4)
section("Options", "GS_EVENT_OPTIONS_MENU", 5)
section("Exit", "GS_EVENT_QUIT_GAME", 6)
section2("F3", "GS_EVENT_LAB", 1)
end
]
+Override: true
#End
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: Scripts for C08302008
You started with my updated version of the script right?  It fixed a few issues in the original post.  Also, this script still has an unresolved issue of breaking multiplayer for some reason.  Somehow, when it's in use, you cannot see any games in the game viewer, nor can your games be seen by others I believe.  That alone has caused me to stop using it for the time being.  Still, cool addition.  Are there any other menus that can only be accessed via a keyboard shortcut?
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Scripts for C08302008
Yes, we started with your revision. Unfortunately, it still breaks Multi.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: Scripts for C08302008
I would imagine the multi-breaking is somehow being caused by the game 'thinking it's in a multi-game' when in the menu. Because the game works differently in multiplayer, maybe this script is duping the game into thinking it's in server mode (and thus preventing other multiplayer functionality from working)?

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: Scripts for C08302008
I added the multiplayer functionality to the script in the first place, and one way that worked was to adjust the state change calls.  I've compared the state changes when using the script to when not using it and can't find much of a difference, other than the order some resources seem to be getting loaded.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Scripts for C08302008
So, here are the results of my first foray into the FS2 code. I've changed the postGameEvent function so that the game is properly informed about what net protocol to use, which was missing before. Diff against 5367 is attached.

(What this means is that the script will not break multiplayer anymore.)

[attachment has decomposed]
« Last Edit: June 22, 2009, 01:14:32 pm by The E »
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: Scripts for C08302008
Have you tested it?

Edit: it looks like it's been committed anyway...

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Scripts for C08302008
Yes, it was tested, using both TBP (Inferno) and FS2. Nothing seemed to be obviously broken.

EDIT: Here's my latest version of the script:

Code: [Select]
#Conditional Hooks
$Application: Freespace 2
$On Game Init: [
--Function to handle a section every frame
section = function(name, event, num, hidden)
if hidden == false then
divsize = 8
xadd = 159
yadd = 35
else
divsize = 256
xadd = 10
yadd = 10
end

--MENU COLOR
local xmargin = gr.getScreenWidth()/divsize
local ymargin = gr.getScreenHeight()/divsize

--Get corner coordinates for this box
local x1 = xmargin
local y1 = ymargin*num
local x2 = x1+xadd
local y2 = y1+yadd

--When the mouse is OVER this section...
if io.getMouseX() > x1 and io.getMouseX() < x2 and io.getMouseY() > y1 and io.getMouseY() < y2 then
if hidden == false then
--Draw the inside box
gr.setColor(0, 255, 0)
gr.drawRectangle(x1+5, y1+5, x2-5, y2-5, false, false)

--Draw the little target lines now
local x = x1+(x2-x1)/2
local y = y1-20

--Top target line
gr.drawLine(x, y, x, y+15)

--Bottom target line
y = y2+10
gr.drawLine(x, y, x, y+15)

--Left target line
x = x1-20
y = y1+17
gr.drawLine(x, y, x+15, y)

--Right target line
x = x2+5
gr.drawLine(x, y, x+15, y)
end

--Handle the button click
if io.isMouseButtonDown(MOUSE_LEFT_BUTTON) then
gr.drawRectangle(x1, y1, x2, y2, false, false)
if event == "GS_EVENT_NEW_CAMPAIGN" or event == "GS_EVENT_OPTIONS_MENU" then
mn.unloadMission()
g_missionLoaded = nil
g_splashScreen = nil
end
ba.postGameEvent(ba.GameEvents[event])
end
end

--Draw the outline
gr.setColor(255, 255, 255)
gr.drawRectangle(x1, y1, x2, y2, false, false)

if hidden == false then
--Draw the name
gr.drawString(name, x1 + ( (x2-x1) - gr.getStringWidth(name) ) / 2, y1+15)
end
end
]

$Application: Freespace 2
$State: GS_STATE_MAIN_MENU
$On State Start: [
logolist = {"43_logo","1610_logo"}                --This is a list of logos. Basically the same Logo, only adapted for 4:3 aspect ratio displays and 16:10 ones
shiplist = {"EA Thunderbolt","EA Aurora","EA Badger","EA Tiger","PSI Command Ship","EA Hyperion","EA Omega","EA Warlock","EA Omega-X","Babylon 5 (S1)","MF Sharlin","NR G'Quan","CR Primus"} --Put your ship classes in quotes here
missionlist = {"Mainhall.fs2"}                    --List of missions to be used
backgroundlist = {"43_mainhall", "1610_mainhall"} --List of backgrounds. Again, divided into 4:3 and 16:10 ones
splashscreen = "2_PreLoad"                        --Splashscreen displayed while the mission loads
usemission = false                               --If false, the single- and multiplayer UI will use the same layout. If true, one of the missions defined in the missionlist will play in the background of the single player UI
rotConst = 7                                      --Modify this to make the ship turn faster to slower

screenWidth = gr.getScreenWidth()
screenHeight = gr.getScreenHeight()
aspectRatio = screenWidth/screenHeight

if aspectRatio == 1.6 then
logo = logolist[2]
background = backgroundlist[2]
else
logo = logolist[1]
background = backgroundlist[1]
end

imgWidth = gr.getImageWidth(logo)
imgHeight = gr.getImageHeight(logo)
renderX1 = 0 --screenWidth * 0.2
renderX2 = screenWidth --* 0.99
renderY1 = 0 --screenHeight * 0.1
renderY2 = screenHeight --* 0.9
rendermidX = (renderX1+renderX2)/2
imageX = 0 --(screenWidth*0.5)-imgWidth/2
imageY = screenHeight - imgHeight

if ts.isCurrentPlayerMulti()==true or usemission==false then
numChoices = table.getn(shiplist)
randomShip = tb.ShipClasses[shiplist[math.random(1,numChoices)]]
shipName = randomShip.Name
init = 42
end
]
+Override: true
$On State End: [
if g_missionLoaded then
mn.unloadMission()
g_missionLoaded = nil
g_splashScreen = nil
end
]
+Override: true
$On Frame: [
if ts.isCurrentPlayerMulti()==true or usemission==false then

--Draw background image
local tex = gr.loadTexture(background)
if tex:isValid() then
gr.drawImage(tex, 0, 0, gr.getScreenWidth(), gr.getScreenHeight())
end

if rotate_pct then
rotate_pct = rotate_pct + rotConst*ba.getFrametime()
if rotate_pct > 100 then
rotate_pct = rotate_pct - 100
end
else
rotate_pct = 40
end

randomShip:renderTechModel(renderX1, renderY1, renderX2, renderY2, rotate_pct)

gr.setColor(255,255,255)
gr.drawString(shipName,rendermidX-gr.getStringWidth(shipName)/2,renderY2)
else
if not g_splashScreen then
--Don't need cursor
io.setCursorHidden(true)

--Draw splash image
local tex = gr.loadTexture(splashscreen)
if tex:isValid() then
gr.drawImage(tex, 0, 0, gr.getScreenWidth(), gr.getScreenHeight())
end

--Draw "Loading..."
gr.setColor(255, 255, 255)
gr.CurrentFont = gr.Fonts['font02']
local loadString = "Loading..."
local x = (gr.getScreenWidth()-gr.getStringWidth(loadString))/2
local y = (gr.getScreenHeight()-gr.CurrentFont.Height)/2
gr.drawString(loadString, x, y)

--Done with splash
gr.CurrentFont = gr.Fonts['font01']
g_splashScreen = true
elseif not g_missionLoaded then
if init2 == nil then
missionName = missionlist[math.random(1,table.getn(missionlist))]
init2 = 42
end
mn.loadMission(missionName)
io.setCursorHidden(false)
g_missionLoaded = true
end
end

if g_missionLoaded then
mn.simulateFrame()
mn.renderFrame()
end

if g_missionLoaded or ts.isCurrentPlayerMulti()==true or usemission==false then
if ts.isCurrentPlayerMulti()==true then
if ts.isPXOEnabled()==true then
section("Multiplayer", "GS_EVENT_PXO", 1, false)
else
section("Multiplayer", "GS_EVENT_MULTI_JOIN_GAME", 1, false)
end
else
section("Ready Room", "GS_EVENT_NEW_CAMPAIGN", 1, false)
end
section("Campaign Room", "GS_EVENT_CAMPAIGN_ROOM", 2, false)
section("Tech Room", "GS_EVENT_TECH_MENU", 3, false)
section("Barracks", "GS_EVENT_BARRACKS_MENU", 4, false)
section("Options", "GS_EVENT_OPTIONS_MENU", 5, false)
section("Exit", "GS_EVENT_QUIT_GAME", 6, false)
section("F3", "GS_EVENT_LAB", 1, true)
end

gr.drawImage(logo, imageX, imageY, gr.getScreenWidth(), gr.getScreenHeight())
]
+Override: true
#End
« Last Edit: December 21, 2009, 07:03:20 am by The E »
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline shiv

  • Don't forget Poland!
  • 211
  • FRED me!
    • http://freespace.pl
Re: Scripts for C08302008
Question, is it possible to set music for this? (that will keep playing in barracks for example?)
http://www.sectorgame.com/vega
The Apocalypse Vega - Join the battle! A campaign for FreeSpace 2 Open

http://www.game-warden.com/earthdefence
Earth Defense project - Coming soon...

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Scripts for C08302008
In principle, yes. If you have TBP installed, you can check it out here: http://www.hard-light.net/forums/index.php/topic,63941.0.html

The music thing, however, depends on code that currently is only present in my builds (Will post that later tonight). There is a command to play music, but none to stop it playing again in trunk which is a bit silly.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline shiv

  • Don't forget Poland!
  • 211
  • FRED me!
    • http://freespace.pl
Re: Scripts for C08302008
I don't have TBP now :(
http://www.sectorgame.com/vega
The Apocalypse Vega - Join the battle! A campaign for FreeSpace 2 Open

http://www.game-warden.com/earthdefence
Earth Defense project - Coming soon...

 

Offline Krackers87

  • 158 crew
  • 29
Tried the mainhall script and i got attacked and killed by an offscreen enemy, then i lost the mission... >.>

I lost the mainhall :'(


I loled so hard.
Put this in your profile if you know someone who is fighting, has survived, or has died from an awp no scope.

just like seventies goofballs
he's waiting on last calls
well listen method man
'cause if you leave on the last line
don't leave on the ground kind
born just a little too slow

 

Offline origin

  • 27
I tried out the script and it is very cool.  I loaded up my own screen and tried to load some music but the play back was terrible.  I used  - mh_audiohandle = ad.playMusic(" ").  I tried a .wav and an .ogg file they both sounded the same - very distorted.  Is there a certain form the the file needs to be or am I just completely off base here?  My experience in scripting is very limited.

 

Offline origin

  • 27
Well I got the music to play perfectly with playMusic().  But I cannot stop the music; it plays continuously - and if I try to use StopMusic() I get an error because I suppose that function is not in the 3.6.10.  So any ideas on what I can do from here.  I think I am talking to myself here but at least I haven't started answering myself.....

 
maybe, i did not tryed the script yet, i'm gonne try in few minutes but, can't you load the music via de the mission itself (with fred) ?
$Formula: ( every-time
   ( has-time-elapsed "0" )
   ( Do-Nothing
   )
   ( send-message
      "#Dalek"
      "High"
      "Pro-crasti-nate"
   )
   )
)
+Name: Procratination
+Repeat Count: 99999999999
+Interval: 1