Coder Social home page Coder Social logo

Comments (20)

kwadroke avatar kwadroke commented on July 24, 2024

You could put conditions in your script. If they are met, you can load a new script.

For instance if you have completed the mission in the current "area" and you go thru a wormhole and are near an object in the new area, load the new script.

Another way to handle it is that you could just not spawn the wormhole (or have its exit point not go anywhere) until the current mission is complete.

from emptyepsilon.

Jhovall avatar Jhovall commented on July 24, 2024

Thanks for the reply, but I guess you do not entirely understand what I need. (Maybe it is not clear)
Sevcol is a larp, so GM influence is necessary, both in EE and out of EE. Also a 'completion of a mission' is not something you can or want to hardcode. If the players decide to leave without eliminating the enemy ship or the marines board and capture the enemy ship, instead of destroying the ship as expected, they should be allowed to.

I want the GM's to decide which new (mission) area should be loaded. This decision should be made in the previous area, unconnected the previous area or any actions players do.
If they don't decide, a random scenario/area will be loaded if the wormhole is entered by the players.

It is not an option not to spawn the wormhole, because that'd validate world-consistency.

from emptyepsilon.

kwadroke avatar kwadroke commented on July 24, 2024

Ok, I understand now. I don't believe there's a way to load a script from the GM screen yet. Of course daid can answer that better than I.

I am planning on doing a LARP of sorts (since basically EE and other bridgesim games are LARPs in the true-est sense) myself once I finished building my permanent bridge at home. It will be an all day mission (I hope) with mostly the same crew. I don't plan on running a GM screen as I want the script to load based off of events happening during the game with some randomness thrown in.

from emptyepsilon.

Jhovall avatar Jhovall commented on July 24, 2024

Hopefully Daid will read this and implement option then.

Well, If you want an idea how we do it, come to our larp :). Furthermore a GM with a GM-Screen is better, especially in a long game. Since a game gets more interesting if there is somebody who actually responds to the players actions. (And you actually have someone to talk to).

from emptyepsilon.

kwadroke avatar kwadroke commented on July 24, 2024

If it wasn't so far away, I'd consider it. I'm from the US so I can't exactly drive there :)

from emptyepsilon.

vslotman avatar vslotman commented on July 24, 2024

It would be ideal if we could let the GM-screen call a script-method at the press of a button, just like the update()-method is now called each game-update.
Maybe reserve the method-names scriptMethodA till scriptMethodX for this functionality. Mission-scripts can than implement one or more of these methods. The GM screen needs some more buttons, and shouldn't crash if a method isn't implemented.

Another option might be sharing some global game-variable, but you would have to read that in the update-method of the script and then reset it if read. But I think that would be rather ugly.

from emptyepsilon.

kwadroke avatar kwadroke commented on July 24, 2024

Perhaps the built-in web server could be modified and used for this. Create a local web page that submits a GET request for calling a function from the LUA script. That function could then load outside scripts.

from emptyepsilon.

kwadroke avatar kwadroke commented on July 24, 2024

Here's a hackish way that works now to do what I was talking about in the previous comment:

save as scenario_99_test.lua

-- Name: Test
-- Description: Test script


function init()
    player=PlayerSpaceship():setFaction("Human Navy"):setShipTemplate("Player Cruiser"):setRotation(200)
end

function runscript(delta)
  Script():run("test.lua")
end

function update(delta)
 if player:getDescription() == "test" then
  player:setDescription("") --Set to Blank to make sure it doesn't get run again
  runscript()
 end
    --No victory condition
end

save as test.lua:

victory("Ghosts")

Then from a browser go to this url:

http://localhost:8080/set.lua?setDescription("test")

It will run the function runscript which you then can run whatever you put in that function or run another lua script as in this example (change localhost to your server name/IP in the URL)

from emptyepsilon.

Jhovall avatar Jhovall commented on July 24, 2024

That... is a seriously ugly hack :). And possible if the other option will not be chosen.

To be honest I prefer Vincent's method :P.

from emptyepsilon.

daid avatar daid commented on July 24, 2024

I think the best solution, is to have the scenario define "GM functions" which call functions in the script. And add these functions as buttons on the GM screen.

On the script side, it can look like this:

function init()
    addGMFunction("Create something", function()
        SpaceStation():setTemplate('Small Station'):setFaction("Human Navy"):setPosition(500, 500)
    end)
    addGMFunction("Create more", otherFunction)
end

function otherFunction()
    SpaceStation():setTemplate('Small Station'):setFaction("Human Navy"):setPosition(500, 500)
end

The C++ code has "callback" functions from C++ code to scripts. But currently this is only supported on "game objects", not globally. And if you look at the SeriousProton/src/scriptInterfaceMagic.h "setcallbackFunction", you can see that there is quite some complexity in these bindings. So I'll have to think a bit on how to implement this.

from emptyepsilon.

Jhovall avatar Jhovall commented on July 24, 2024

Okay, Nice and thanks!
How to implement it in my Lua script? (I can also try at home, but asking it is easier than 30mins of trying).

from emptyepsilon.

daid avatar daid commented on July 24, 2024

The above proposal I gave should work.
I tested it with:

    addGMFunction("Test", function()
        CpuShip():setShipTemplate("Transport5x5"):setFaction("Human Navy"):setRotation(90):setPosition(2500, 4000):orderIdle():setCallSign("T-5-5"):setScanned(true)
    end)

At the end of the init of the empty scenario.

from emptyepsilon.

Jhovall avatar Jhovall commented on July 24, 2024

Awesome.

from emptyepsilon.

daid avatar daid commented on July 24, 2024

(You do need a new build, as the download on emptyepsilon.org isn't updated yet)

from emptyepsilon.

Jhovall avatar Jhovall commented on July 24, 2024

Hey,

Thanks, and now I have another idea. Could it also be possible that a keypress from a console could be determined in the script?

from emptyepsilon.

daid avatar daid commented on July 24, 2024

Nope, keypresses happen client side, while the script runs server side. I'm not going to send all key presses to the server.

from emptyepsilon.

Jhovall avatar Jhovall commented on July 24, 2024

That is too bad, (and why not, it is possible in artemis and a lot of other data is send towards the server, why not keypresses?).
It would lead to more possibilities for scenario's in which you can send data, add small-minigames to enter a wormhole, etc.

from emptyepsilon.

daid avatar daid commented on July 24, 2024

Because instead of keypresses, it would be better to have something less "low level". Like, script requests text input from a certain console, and then gets a call back when the text is entered.

from emptyepsilon.

Jhovall avatar Jhovall commented on July 24, 2024

Well, that is essentially for me the same, but I understand the difference.

from emptyepsilon.

Jhovall avatar Jhovall commented on July 24, 2024

I found a minor annoyance with the function.
When you select a NPC ship, the behavior overlays the GM buttons and you can not select the GM button anymore.

from emptyepsilon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.