Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ZiggyZaggston

#1
Quote from: Crimson Wizard on Tue 20/12/2016 18:54:42
There was a discussion in response to similar question, where people gave several methods to solve this trouble:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=54124.0
Thanks, that was very helpful, I've tried a similar thing as they did in this thread, but i've been doing it wrong all this time


Quote from: Snarky on Tue 20/12/2016 19:07:45
That describes ways of moving it out of GlobalScript, but I'm not sure there is a way to make the code actually any shorter. Because you do have to define what happens in every possible combination of items, unless you want to just fall back on some default response.

If you always want "Use X with Y" to give the same response as "Use Y with X", it might be possible to save a few lines, but I can't see a way to do it without adding some complexity up front, and with only six or seven items it might not be worth it.

i was mostly concerned with the length of code in GlobalScript, so moving it out is just fine for me, even if it increases the amount of actual code i write
#2
Hello
I am planning on a game with a lot of item interactions, i want items to have interactions with most other items, even if all they produce is a quip from the player

normally i would do something like this:

Code: ags

function iItemA_UseInv()
{
  if (cEgo.ActiveInventory==iItemB) {
    cEgo.LoseInventory(iItemA);
    cEgo.LoseInventory(iItemB);
    cEgo.AddInventory(iItemC);
  }
else if (player.ActiveInventory == iItemD)
  {
    cEgo.Say("bla bla bla ");
  }
}


now if i were to do that, and if i had 6 or 7 items that can all interact with each other, then i would already end up with with a ridiculously big GlobalScript

So are there more efficient ways to do this, or just ways to keep my code shorter?
SMF spam blocked by CleanTalk