Author Topic: New Main hall (Big pic)  (Read 12099 times)

0 Members and 1 Guest are viewing this topic.

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New Main hall (Big pic)
Nope, it's in CVS so it should be in the next build.
-C

 
Re: New Main hall (Big pic)
For the getset, I'd say fetch or something like that, or just call it gs-ship-name(); or something like that.
just another newbie without any modding, FREDding or real programming experience

you haven't learned masochism until you've tried to read a Microsoft help file.  -- Goober5000
I've got 2 drug-addict syblings and one alcoholic whore. And I'm a ****ing sociopath --an0n
You cannot defeat Windows through strength alone. Only patience, a lot of good luck, and a sledgehammer will do the job. --StratComm

 

Offline Galemp

  • Actual father of Samus
  • 212
  • Ask me about GORT!
    • Steam
    • User page on the FreeSpace Wiki
Re: New Main hall (Big pic)
PSA: Don't worry about the FS1 main halls, they're done using the traditional mainhall codes and are currently being tested in the Freespace Port. There's a thread on it, in fact.
"Anyone can do any amount of work, provided it isn't the work he's supposed to be doing at that moment." -- Robert Benchley

Members I've personally met: RedStreblo, Goober5000, Sandwich, Splinter, Su-tehp, Hippo, CP5670, Terran Emperor, Karajorma, Dekker, McCall, Admiral Wolf, mxlm, RedSniper, Stealth, Black Wolf...

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: New Main hall (Big pic)
im still waiting for the most important feature of the scripting system to be implemented, a comprehensive manual.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New Main hall (Big pic)
http://lua-users.org/wiki/LuaTutorial

http://fs2source.warpcore.org/temp/scripting.html

If you take a closer look at the table you'll see this:
Code: [Select]
#State Hooks
$State: GS_STATE_MAIN_MENU
...
#End

What I've done is I've enabled you to link into any Freespace state (Read: room, like the techroom, or the ready room) and have it execute whatever's in the $Hook: variable rather than what's on the room.

Granted in that example I was a little unclear. In that example, I've just hooked into the Mainhall.

Code: [Select]
"GS_STATE_MAIN_MENU", // 1
"GS_STATE_GAME_PLAY",
"GS_STATE_GAME_PAUSED",
"GS_STATE_QUIT_GAME",
"GS_STATE_OPTIONS_MENU", // 5
"GS_STATE_BARRACKS_MENU",
"GS_STATE_TECH_MENU",
"GS_STATE_TRAINING_MENU",
"GS_STATE_LOAD_MISSION_MENU", // 10
"GS_STATE_BRIEFING",
"GS_STATE_SHIP_SELECT",
"GS_STATE_DEBUG_PAUSED",
"GS_STATE_HUD_CONFIG",
"GS_STATE_MULTI_JOIN_GAME", // 15
"GS_STATE_CONTROL_CONFIG",
"GS_STATE_WEAPON_SELECT",
"GS_STATE_MISSION_LOG_SCROLLBACK",
"GS_STATE_DEATH_DIED",
"GS_STATE_DEATH_BLEW_UP", // 20
"GS_STATE_SIMULATOR_ROOM",
"GS_STATE_CREDITS",
"GS_STATE_SHOW_GOALS",
"GS_STATE_HOTKEY_SCREEN",
"GS_STATE_VIEW_MEDALS", // 25
"GS_STATE_MULTI_HOST_SETUP",
"GS_STATE_MULTI_CLIENT_SETUP",
"GS_STATE_DEBRIEF",
"GS_STATE_VIEW_CUTSCENES",
"GS_STATE_MULTI_STD_WAIT", // 30
"GS_STATE_STANDALONE_MAIN",
"GS_STATE_MULTI_PAUSED",
"GS_STATE_TEAM_SELECT",
"GS_STATE_TRAINING_PAUSED",
"GS_STATE_INGAME_PRE_JOIN", // 35
"GS_STATE_EVENT_DEBUG",
"GS_STATE_STANDALONE_POSTGAME",
"GS_STATE_INITIAL_PLAYER_SELECT",
"GS_STATE_MULTI_MISSION_SYNC",
"GS_STATE_MULTI_START_GAME", // 40
"GS_STATE_MULTI_HOST_OPTIONS",
"GS_STATE_MULTI_DOGFIGHT_DEBRIEF",
"GS_STATE_CAMPAIGN_ROOM",
"GS_STATE_CMD_BRIEF",
"GS_STATE_RED_ALERT", // 45
"GS_STATE_END_OF_CAMPAIGN",
"GS_STATE_GAMEPLAY_HELP",
"GS_STATE_END_DEMO",
"GS_STATE_LOOP_BRIEF",
"GS_STATE_NET_CHAT", // 50
"GS_STATE_LAB",
"GS_STATE_STORYBOOK"


You can also use the setEvent() command to change to a different room/state.

Code: [Select]
"GS_EVENT_MAIN_MENU",
"GS_EVENT_START_GAME",
"GS_EVENT_ENTER_GAME",
"GS_EVENT_START_GAME_QUICK",
"GS_EVENT_END_GAME",
"GS_EVENT_QUIT_GAME", // 5
"GS_EVENT_PAUSE_GAME",
"GS_EVENT_PREVIOUS_STATE",
"GS_EVENT_OPTIONS_MENU",
"GS_EVENT_BARRACKS_MENU",
"GS_EVENT_TRAINING_MENU", // 10
"GS_EVENT_TECH_MENU",
"GS_EVENT_LOAD_MISSION_MENU",
"GS_EVENT_SHIP_SELECTION",
"GS_EVENT_TOGGLE_FULLSCREEN",
"GS_EVENT_START_BRIEFING", // 15
"GS_EVENT_DEBUG_PAUSE_GAME",
"GS_EVENT_HUD_CONFIG",
"GS_EVENT_MULTI_JOIN_GAME",
"GS_EVENT_CONTROL_CONFIG",
"GS_EVENT_EVENT_DEBUG", // 20
"GS_EVENT_WEAPON_SELECTION",
"GS_EVENT_MISSION_LOG_SCROLLBACK",
"GS_EVENT_GAMEPLAY_HELP",
"GS_EVENT_DEATH_DIED",
"GS_EVENT_DEATH_BLEW_UP", // 25
"GS_EVENT_NEW_CAMPAIGN",
"GS_EVENT_CREDITS",
"GS_EVENT_SHOW_GOALS",
"GS_EVENT_HOTKEY_SCREEN",
"GS_EVENT_VIEW_MEDALS", // 30
"GS_EVENT_MULTI_HOST_SETUP",
"GS_EVENT_MULTI_CLIENT_SETUP",
"GS_EVENT_DEBRIEF",
"GS_EVENT_GOTO_VIEW_CUTSCENES_SCREEN",
"GS_EVENT_MULTI_STD_WAIT", // 35
"GS_EVENT_STANDALONE_MAIN",
"GS_EVENT_MULTI_PAUSE",
"GS_EVENT_TEAM_SELECT",
"GS_EVENT_TRAINING_PAUSE",
"GS_EVENT_INGAME_PRE_JOIN", // 40
"GS_EVENT_PLAYER_WARPOUT_START",
"GS_EVENT_PLAYER_WARPOUT_START_FORCED",
"GS_EVENT_PLAYER_WARPOUT_STOP",
"GS_EVENT_PLAYER_WARPOUT_DONE_STAGE1",
"GS_EVENT_PLAYER_WARPOUT_DONE_STAGE2", // 45
"GS_EVENT_PLAYER_WARPOUT_DONE",
"GS_EVENT_STANDALONE_POSTGAME",
"GS_EVENT_INITIAL_PLAYER_SELECT",
"GS_EVENT_GAME_INIT",
"GS_EVENT_MULTI_MISSION_SYNC", // 50
"GS_EVENT_MULTI_START_GAME",
"GS_EVENT_MULTI_HOST_OPTIONS",
"GS_EVENT_MULTI_DOGFIGHT_DEBRIEF",
"GS_EVENT_CAMPAIGN_ROOM",
"GS_EVENT_CMD_BRIEF", // 55
"GS_EVENT_TOGGLE_GLIDE",
"GS_EVENT_RED_ALERT",
"GS_EVENT_SIMULATOR_ROOM",
"GS_EVENT_EMD_CAMPAIGN",
"GS_EVENT_END_DEMO", // 60
"GS_EVENT_LOOP_BRIEF",
"GS_EVENT_CAMPAIGN_CHEAT",
"GS_EVENT_NET_CHAT",
"GS_EVENT_LAB",
"GS_EVENT_STORYBOOK" // 65
-C

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New Main hall (Big pic)


Replace:
Code: [Select]
--Draw stars background
gr.drawImage("starfield0001", 0, 0)

with

Code: [Select]
--Load the mission
if not load_mission then
load_mission_success = mn.loadMission("sm2-04.fs2")
load_mission = 1
end

--Make sure we actually loaded the mission
if load_mission_success then
mn.simulateFrame()
mn.renderFrame()
end

This build supports the mission loading stuff, but I've changed a few function names I used in the original example to clarify what they do, so you will probably get errors if you copy-paste:
http://fs2source.warpcore.org/exes/latest/C01142005.zip

I also updated this with the stuff I just put in CVS - http://fs2source.warpcore.org/temp/scripting.html
« Last Edit: January 16, 2006, 05:26:59 am by WMCoolmon »
-C

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Re: New Main hall (Big pic)
SO if I use the script for mod, I suppose it will work to ? Example, I load "battle_of_endor_mission" then I have the mission at screen right ?

 

Offline TrashMan

  • T-tower Avenger. srsly.
  • 213
  • God-Emperor of your kind!
    • Minecraft
    • FLAMES OF WAR
Re: New Main hall (Big pic)
All fine and dand,y but how do you control the camera view in the into screen?
Nobody dies as a virgin - the life ****s us all!

You're a wrongularity from which no right can escape!

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New Main hall (Big pic)
You should be able to use SEXPs as you would normally, so set-camera-position is your best bet. :nod:
-C

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Re: New Main hall (Big pic)
It didn't work. I have an error message about attempt to call method 'getCampaign' (a nil value).
And if I use the table for my Star Wars mod, Fs2 crash immediatly without proposing me to choose a pilot.


 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New Main hall (Big pic)
Quote
This build supports the mission loading stuff, but I've changed a few function names I used in the original example to clarify what they do, so you will probably get errors if you copy-paste:

"getCampaign" is now "getCampaignName"  :)
-C

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: New Main hall (Big pic)
Basically getting exactly the same problem. I got the same error the first times I ran it when I did the cut and paste replace from the top of this page it wouldn't even let me choose a pilot.

The older build you posted appears to work just fine though.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline MetalDestroyer

  • Starwars reborn!
  • 210
Re: New Main hall (Big pic)
I love it ^^. I'm wondering if it's possible in the current state to add a fix camera to one ship take randomly ?
Oh, I made a little demo


 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New Main hall (Big pic)
Kara: "getCampaign" needs to be "getCampaignName", I made the change because the function gives the name, rather than a campaign handle.
-C

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: New Main hall (Big pic)
Well it works now. It's hideously crippled by the amount of time it takes to load and parse the mission unfortunately though.

It also crashes whenever I go back to the main screen from the techroom.

Does look pretty cool though :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New Main hall (Big pic)
I finally sat down and wrote a guide in the wiki. I'm not nearly as happy with it as I am with my C article, but I figured I might as well post it anyways as a rough draft.

Problem: The article is based on what is in CVS, so almost none of the examples will work. Actually, since the stuff in CVS is broken atm, the examples won't work anyway. :p

I'm also still debating how to do some things - like switching the default stuff on and off - so the article doesn't mention it. Plus, I've never really sat down and gone through and learned Lua. The syntax has been incredibly easy and I've been able to understand stuff almost as soon as I see it, so there hasn't been any real need. OF course the Lua interface to embed stuff in programs is absolutely wreteched :ick: It's been a constant battle to keep things simple, and yet still working.

So, read through, offer comments/complaints/questions etc and I'll try to revise what's in there to fit what comes up.
-C

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: New Main hall (Big pic)
Seems fairly clear.

What I don't see in there is any form of SEXP/Scripting integration. How can I call a script from a SEXP? Conversely how can I get a return value from a script and use it in a SEXP/store it in a mission variable?

Couple of other things.

a) Why is the scripting.tbl so called? Surely it's a script not a table and should be named to reflect that.
b) Can we have a seperate folder for scripts rather than cluttering up the tables folder?
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New Main hall (Big pic)
a) It actually is a table, just with special variables. As it is, I've got a basic 'hook' thing set up, meaning that it's a matter of two C++ function calls to add in a hook. Hooks can be added anywhere one wants, be it ships.tbl or scripting.tbl. I just have everything in scripting.tbl because it's faster & easier to test stuff on the main screen than to load a mission and wait for a ship to warp in or out.

b) Done, this was something half-bugging me during documentation anyways. Next CVS build (scripting is fixed in it, btw) you'll be able to do something like this:
Code: [Select]
#State Hooks
$State: GS_STATE_MAIN_MENU
$Hook: [[mainhall.lua]]
+Override: YES
#End

Where mainhall.lua is a scripting file with the luascript. If you feel inclined you can compile it by running luac on it, this should help load times for extremely long scripts.



SEXP/Scripting integration is an interesting situation. The easiest way is probably making two SEXPs, script-eval-number and script-eval-string, which return a number and string respectively. This probably won't be so bad, since I can hide the "return" part so you'd just have to write in "Ship.Species.Name" or whatnot.

It's easy enough to deal with variables from scripting, but what I'd like to do is have it be possible with an array. IE:
Code: [Select]
mn.Variables["High scorer"] = high_scorer_ship.Namewould set the SEXP variable "High scorer". Unfortunately I'm having some problems with Lua behaving properly when I try to do something like that.

gr.drawText will be gr.drawString in the next CVS build
« Last Edit: January 16, 2006, 08:33:18 pm by WMCoolmon »
-C

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New Main hall (Big pic)
How are people with library names being only two letters, by the way? I've been doing it that way to reduce clutter, but if it makes the learning curve too steep I can easily change them to "Graphics" "Mouse" and so on relatively easily.
-C

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: New Main hall (Big pic)
While I'm at it a post on Game Warden raised an interesting question. Can we use this to finally get rid of the need to bundle the engine with the (copywrited) :v: interface art?
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]