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 - strangeDetective

#21
Quote from: Snarky on Sun 06/11/2016 06:59:28
Yeah, that shouldn't be too hard, at least if the animation is blocking, which I assume it is. Let's just add another method to the SpellHandler module:

Code: ags
static bool SpellHandler::ChantIncantation()
{
  // if(SpellHandler.GetSpell() == eSpellInvalid) return false; // If you uncomment this line, only successful spells will be chanted
  int i=0;
  while(i<incantation.Length)
  {
    if(incantation.Chars[i] == SIGIL_SUN)
    {
       // TODO: Play the audio for this sigil syllable
       // TODO: Play the animation for this sigil gesture, blocking
    }
    else if(incantation.Chars[i] == SIGIL_AIR)
    {
       // TODO: Play the audio for this sigil syllable
       // TODO: Play the animation for this sigil gesture, blocking
    }
    // ... and so on
    i++;
  }
  return (SpellHandler.GetSpell() != eSpellInvalid);
}


You also need to add an import statement to the header; if you compare the other methods, I'm sure you can see how to do that.

And now you just call this method when the player clicks on the "Invoke" button!

I'm just now getting a chance to experiment with this, and I'm not sure how to add the import statement or where exactly it goes. My best guess was this:

    struct SpellHandler {
      import static void ClickSigil(GUIControl* bSigil,  MouseButton button);
      import static void ClearIncantation();
      import static Spell GetSpell();
      import static void ChantIncantation ();
    };

Then I added the code into not the header script section, but the module section of the SpellBook you wrote. When I run the game I get this error which I don't understand:

Spell Book.asc(67): Error (line 67): Size of identifier does not match prototype

Maybe dumb question or I am missing something totally obvious to others, but wondering if there's a specific place in header/module and specific syntax I have to use in order to integrate this last chanting the incantations bit into the SpellBook module?
#22
Quote from: slasher on Sat 10/12/2016 11:33:47
Also whether the walking around the circle is a blocking function or not..

If it is then its easy peasy using a walkable area, destinations x y, 2 regions, player's loop is 1 for correct way, a variable and Labels (nod)

It would of course be easier if we saw the background.

Here is a crude mock version:

Hope this helps...

Hey thanks, I would like to see the video demo but it says its set to private and cannot be viewed? If you could check that when you get a chance I'd like to take a look.
#23
Thanks everyone for the tips, I'm still trying to work it out the scene I'm trying to implement it in is just a single room where you walk around a central object placed in the center, it's not a building or anything so using multiple screens wouldn't work in this case--but that actually gave me a great idea and I may use that in another part of the game. I'll see what I can do.
#24
Well I'm trying to figure out a way to implement a puzzle and I actually can't even guess what term's to search on to see if anyone else has tried to do this, so hoping somebody might be able to help or nudge me in the right direction.

Basically, I want to figure out a way that if the player walks around in a circle three times, going counter-clockwise, then a variable in the game gets set which will then enable another possible interaction.

I'm wondering how you would make the game recognize that you completed walking around in a circle completing the entire cycle 3x without deviating?

You've probably heard the idea in fairy tales about the boy who chases his little sister around a Church counter-clockwise, and they're both magically transported to Elfland. Well that's similar to what I'm trying to do but not quite sure how to even start. If anyone had any ideas or suggestions to get me going much appreciated!
#25
Quote from: Snarky on Sun 06/11/2016 06:59:28
Yeah, that shouldn't be too hard, at least if the animation is blocking, which I assume it is. Let's just add another method to the SpellHandler module:

You also need to add an import statement to the header; if you compare the other methods, I'm sure you can see how to do that.

And now you just call this method when the player clicks on the "Invoke" button!

This is fantastic, thank you again!! I haven't got a chance to try it out yet but am going to try to get to it tonight.
#26
Quote from: Snarky on Sat 05/11/2016 21:41:49
All right, we're getting somewhere!

Great thanks, I'll start on your parts of the code and get it worked in to try out.

Okay it appears to be working after implementing your code, I'll have to play around with it for a bit -- there is one other thing you may know a trick of doing, but after the player hits "cast", before AGS checks to see if the spell succeeds/or fails I wanted to animate the player...I know switching views, etc...but each button will have a sound attached to it (a word/vowel, actually) and I want to animate the player and play back each sound that is assigned to each different button.

So it shows the player repeating the incantation, according to the sequence of buttons they pushed in the spell book. Pretty much same as LOOM. Then AGS checks to see if the spell succeeded/failed on the object.

If you had any thoughts about how to do that would be a great help. Thanks!
#27
Quote from: Snarky on Sat 05/11/2016 20:36:46
Hmmm... but it only happens after you press three buttons?

Try removing the "spell = 0;" line in Sigils_OnClick(). I think what's happening is that the RunInteraction() call gets queued until the function finishes, and by that time the spell value has already been reset to 0. If that works, we just need to find a better way to reset the value.

Okay thanks, that makes it take a 3 number input -- but the buttons are all mapped wrong, when I input 1,2,3, I get "spell 345 fizzles"...and similar mixed up variations with different numbers...but as far as I know the buttons are all named correctly, e.g. btnSigil0 = 0 on the SpellBook GUI, that's what I named it when I created it.

My buttons don't have IDs that match 0-8, the ID of Button 0 is ID 1. Is that messing it up?

For example, if I press 0,0,0 it returns 2,2,2...but  don't understand the math logic/code enough to figure out how its being processed.

But it only works once, it will not 'clear' or take any 3 digit input after the first try--I have to quit the game and start it over again.
#28
Quote from: Snarky on Sat 05/11/2016 14:42:16
Khris's code relies on the IDs of the GUI buttons. If they weren't created in the expected order, or don't start from 0, it's not going to match what you expect. Try checking what number you're actually entering:

Thanks again, yeah I checked the number and it returns "0" with the 'spell fizzles' message. So looks like only 0 is being counted when I enter 1, 2, 3. All the buttons are mapped from 0-8 and given the same name as example in Khris' code, so not sure why it's not registering the input. Maybe I can try deleting all the buttons and create them again, if I made some kind of spelling mistake creating them and that's not overwritten when you fix it.

#29

I'm stumped, after multiple attempts and do-overs, I'm not sure what I've done wrong in entering Khris's code but I can't seem to work:

Code: ags



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // the following above on_mouse_click
    int locationType, locationID;
     
    void StoreLocation() {
      int mx = mouse.x, my = mouse.y; // make sure we use the same coordinates in all following calls
      locationType = GetLocationType(mx, my);
      if (locationType == eLocationHotspot) {//
        Hotspot *h = Hotspot.GetAtScreenXY(mx, my);
        locationID = h.ID;
      }
      if (locationType == eLocationObject) {
        Object *o = Object.GetAtScreenXY(mx, my);
        locationID = o.ID;
      }
      if (locationType == eLocationCharacter) {
        Character *c = Character.GetAtScreenXY(mx, my);
        locationID = c.ID;
      }
      lblSpellTarget.Text = Game.GetLocationName(mx, my); // this will also clear the label
    }

// SPELL BOOK ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  
  // SPELL BOOK
  
         if (gSpellBook.Visible) {
          StoreLocation();
          return; // no further action yet
        }
  
  else if (button == eMouseLeft) {
    Room.ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }
  else if (button == eMouseRight || button == eMouseWheelSouth){
    // right-click our mouse-wheel down, so cycle cursor
    mouse.SelectNextMode();



Here is the next block of code entered at the end of Global Script:

Code: ags




// SPELL BOOK


function Button4_OnClick(GUIControl *control, MouseButton button)
{
gSpellBook.Visible = true;

}

function Button3_OnClick(GUIControl *control, MouseButton button)
{
gSpellBook.Visible = false;

}

    function Sigils_OnClick(GUIControl *control, MouseButton button) {
     
     if (button != eMouseLeft) return;
     
           int sigil = control.ID + 1; // digit 1 - 9 if sigil buttons have IDs 0 - 8
      spell = (spell * 10 + sigil) % 1000; // compose spell by appending digit, spell length = 3
      if (spell > 99 && locationType != eLocationNothing) {
        if (locationType == eLocationHotspot) hotspot[locationID].RunInteraction(eModeUsermode2);
        if (locationType == eLocationObject) object[locationID].RunInteraction(eModeUsermode2);
        if (locationType == eLocationCharacter) character[locationID].RunInteraction(eModeUsermode2);
        spell = 0;
        locationType = eLocationNothing;
      }
     
     
    }
    
    
    
    



And here's the object (skull) was trying to test it on:

Code: ags



function oSkull_Mode9()
{

    if (spell == 123) {
    cWitch.Say ("The closet dodges your unlock spell. Some powerful magic is protecting it.");
  }
  else Display("The spell fizzles.");




}



When I run the game, I open the SpellBook GUI, click on the skull, but then when I enter 1,2,3 I just get the message "The spell fizzles".

I don't understand why it's not working, or what I've done wrong entering the code...
#30
Quote from: Snarky on Fri 04/11/2016 19:34:05
Sorry, I wrote my code independent of Khris, so there are some inconsistencies and things that are a bit tricky to merge.

Yeah, gSpells is the spellbook GUI. It's the same thing that is called gSpellbook in Khris's code.

Most of Khris's code still applies. In fact, I think it's only the "click on sigils button handler" function (which appears in Khris's code first as btnSpell1_onClick() and then renamed to Sigils_onClick(), and in my code as bSigil_OnClick()) that needs to be changed, plus that I have the Clear/Cast buttons and associated handlers (while Khris assumes a constant spell length of three sigils).

Oh, and I don't think either of us actually included the bit where you bring up the spellbook, which should go something like:

Code: ags
  gSpells.Visible = true; // or gSpellBook, or whatever your gui is called
  SpellHandler.ClearIncantation();


That bit of code you quoted is from me, and you can put it anywhere in the global script. It's usually helpful to keep it organized so that all the button handlers for one GUI are together, but it doesn't really matter to AGS.

I also wonder if this is really the best interaction flow. I find it a little weird that you bring up the spellbook first, and THEN choose a target, while also selecting the sigils at the same time. I think it will be confusing particularly if a player enters some sigils, then changes their mind about the target, chooses a different target, and then enters more sigils. Like, do the initial sigils still count, or are they cleared when the target changes?

I think you should either pick a target before you open the spellbook, or complete an incantation first and only then pick a target. Doing it at the same time is just confusing.

Quote from: Snarky on Fri 04/11/2016 19:34:05
Sorry, I wrote my code independent of Khris, so there are some inconsistencies and things that are a bit tricky to merge.

Thanks Snarky, I tried the code Khris wrote but it didn't work, I might have put something in the wrong place. It seemed to run, and sometimes I could select an object to cast a spell on it, but when I entered buttons 1,2,3 nothing would happen.

I'm not sure if your script will work without merging it with portions of Khis's code, I haven't tried it yet because merging the two versions looked more complicated than trying to get one to work independently on its own.

Is there a way to use your code that I can try out, without having to merge it with the other code sections that Khris wrote?

Ideally, I was thinking it would play out this way:

1. The spell book is an icon located on the icon bar that appears when your mouse moves to the top of the screen (Sierra style GUI).

2. Player clicks on Spell Book icon, and the Spell Book GUI appears on screen.

3. Player's cursor mode changes to eUserMode9 (special spell target pointer) and player is prompted to select hotspot/object/character on screen that they wish to cast a spell on.

4. Player selects spell target, which is then reflected on Spell Book GUI as the hotspot/object/character's text label.

5. Player pushes Sigil combo buttons to cast spell on target, then hit's "cast spell" when finished.

[If player messes up entering sigil buttons, they can push "clear" and start over.]

6. Spell succeeds or fails on target, and runs corresponding if/else script. (e.g. Prince turns into frog--or not).

7. After casting spell, player closes Spell Book GUI and normal game interactions return.

I could see both of the scripts emulating this idea, but just haven't figured out how to make them work, or whether there's something missing that's causing it to go wonky.



#31
Quote from: Snarky on Fri 04/11/2016 10:45:54
Hmmm... Khris has gone with a slightly different approach than I would use.


Hmm...I'm not sure how to combine your and Khris' scripts in order to make it work. I keep getting this error when I try to run:


Does gSpells in your code refer to the GUI of the SpellBook? Or something else? Was assuming it referred to the SpellBook GUI.

Spell Book.asc(104): Error (line 104): Undefined token 'gSpells'

Also, I have got an error which refers to parts of Khris code, but not sure how to merge/mix these two examples together so they work.

Spell Book.asc(106): Error (line 106): undefined symbol 'locationType'

I'm confused. How much of Khris' script should I use when attempting to merge these together. I'm also unsure of where to place these portions of Khris' script in the Global Section.





//----------------------------------------------------------------------------------------------------
    // gSpells
    //----------------------------------------------------------------------------------------------------
     
    // Use this handler for ALL the sigil buttons
    function bSigil_OnClick(GUIControl *control, MouseButton button)
    {
      SpellHandler.ClickSigil(control, button);
    }
     
    // Use for Clear button
    function bClear_OnClick(GUIControl *control, MouseButton button)
    {
      SpellHandler.ClearIncantation();
    }
     
    // Use for Cast button
    function bCast_OnClick(GUIControl *control, MouseButton button)
    {
      spell = SpellHandler.GetSpell();  // figure out which spell the incantation matches (if any)
      //gSpells.Visible = false;
      gSpellBook.Visible = false;
      // And then Khris's code
      if (locationType != eLocationNothing)
      {
        if (locationType == eLocationHotspot) hotspot[locationID].RunInteraction(eModeUsermode2);
        if (locationType == eLocationObject) object[locationID].RunInteraction(eModeUsermode2);
        if (locationType == eLocationCharacter) character[locationID].RunInteraction(eModeUsermode2);
        spell = 0;
        locationType = eLocationNothing;
      }
    }
#32
Quote from: Snarky on Fri 04/11/2016 09:04:53
Sounds like a cool system! ;-D

Thank you Snarky and Khris! I'm going to use this concept in two different games I'm making, which have magical-operation systems. One of the things I always liked about LOOM was how the interface encouraged the player to explore the environment, through learning new spells and trying them out on different things to see what happens. I'm making a small demo where you have to learn a magical ritual and perform it correctly to help escape from a dungeon.

The LOOM system was constrained by the limits of technology of its day, so I'm trying to re-work the basic concept here where the player will have to do some preparatory spell-crafting work, to put objects (or characters) into certain states before attempting to invoke something or cast a spell. So that might entail gathering and assembling the proper items in order to perform a ritual, for example, or waiting for a character to fall asleep before attempting to cast a spell on them.

The magic-system in LOOM reminded me a little bit of that old memory game "Simon Says," with the way you had to memorize and input spells as musical notes, I'm almost sure Brian Moriarty was probably inspired by Simon Says when he was designing LOOM:

[1978 Milton Bradley Simon Says game]
https://www.youtube.com/watch?v=vLi1qnRmpe4

So this will be similar but more elaborate than the magic-system used in LOOM. In most magic-systems something horrible happens to the spell caster if they mess up attempting to fool around with the occult, so that might factor into the system in some way.

I'm going to try to start implementing this in a experimental tech demo using the examples you guys gave me, I'll see how far I can get ;) --



#33
Very new to scripting and GUIs and I don't even know where to begin with implementing this idea for a GUI. I'm using the very latest version of AGS, I thought there might be a "dialing telephone" module or "door pass-code" module I could experiment with, but the one's I found seem to be over 10 years old.

Posting this on the chance that maybe someone can help.

Basically, the concept is the player would have a "spell book" that could be called up on screen, and on the pages would be 'sigils' which represent 9 word/vowel sounds.

Think of it as a telephone GUI with nine digits (sigils). At the start of the game, only three digits/sigils are available to the player. All the rest are disabled. Additional digits/sigils are enabled to appear in the Spell Book after completing certain tasks during the game.

Player needs to be able to open the Spell Book, select an object/hot spot/character on screen, and then input a sequence of digits/sigils to cast a spell on whatever object or character is currently selected.

This would be very similar to the GUI in LOOM, where you learn and play musical notes to cast certain spells on objects. Only the Spell Book GUI would cause the player to utter incantations, which would have a corresponding effect on an object or character if the correct words/vowels in the Spell Book were spoken in a proper sequence.

A GUI like this might be even more laborious and complex than I can imagine, but as I can't even fathom how to begin building such a thing, I thought I'd take a shot and post.

[If this seems like too enormous a task to ask for help with, I'll move it to the Recruitment section as a (paid) offer to help design. PM me.]


#34
Quote from: Khris on Wed 02/11/2016 23:48:01
Try changing line 3 to
Code: ags
  if (mouse.Mode == eModeUseinv) return; // do nothing


Thanks, works now!
#35

I tried to download this module but they're all dead links. I'm trying to find a module where I can implement a password/combo lock/dial phone type puzzle using the latest version of AGS. Was hoping to find a module I could try to adapt, rather than code one from scratch, as I'm not that familiar with the intricacies of scripting yet.

Ideally, I'd like a GUI with buttons to pop up, player enters a sequence of correct letters/numbers and it runs a script. I looked for a telephone module and/or a combo-lock passcode module and this link was all I could find. Does anyone know of a place where I can download this, and will it work in the latest version of AGS?
#36
Quote from: Khris on Wed 02/11/2016 11:26:03
This question is easily in the top five of "most asked beginner's questions of all time".

Edit: Thanks dayowlron, refactoring fixed :)

Thank you much appreciated.

Update: This works great until I realized that once I use an inventory item in the game, everything defaults back to the manual scrolling cursor.

The inventory item stays in the GUI window as "active" so this script gets canceled out. I'm not sure how to "de-activate" an inventory item after you've used it somewhere, so the cursor continues to change modes. :( I am missing something but not sure how to fix...
#37
Quote from: Snarky on Thu 29/01/2015 00:16:13
So the simple answer to your question (as monkey said while I was writing) is to put in a test for the current mouse mode, and only do it if it's not in inventory-object mode.

Code: ags

function hHallway_MouseMove()
{
    if(mouse.Mode != eModeUseinv)
    {
        mouse.SaveCursorUntilItLeaves();
        mouse.Mode = eModeInteract;
    }
}


... However, the solution you describe sounds like you're a bit on the wrong track. You definitely don't want to be writing almost identical versions of this method for every object and hotspot on every screen: it's a lot of work, it's easy to miss something somewhere, and if you need to change something it's a total pain.

What you should do instead is to write one method that can change the cursor for whatever it is you're hovering over, and just store a flag for each hotspot/object/character about which cursor to use. You can do this in the global script repeatedly_execute_always() using Hotspot/Object/Character.GetAtScreenXY() and GetLocationType(). To store the cursor for that thing, you can use a custom property.

Alternatively, there are modules that provide a Broken Sword-style UI.

I'm fairly new to AGS and I want to use the standard Sierra interface, but I would also like the cursor to auto change modes while over a hot spot/object, ect. to eliminate the scrolling through icons. I get how to do it for each hot spot individually, but is there an example (or another thread somewhere) of how you would write a single script that would handle this throughout the entire game--and where would you put it?
#38

A view of Arkham from the Miskatonic River circa. 1940's.

Update:

Demo (Episode One) almost ready for beta-release testing.

Rooms: 10.
Sound FX: None yet.
Voice: None yet.
Music: Jazz musical score.
Puzzles & Interactions: Fully working (I think...)
Animations: Partially implemented, mostly place-holders but functional.
Rating: Mature (for language, some sexual imagery)
Interface GUI: Mostly functional, standard Sierra-style. Will re-vamp later.

It's not ready to release yet, but what I've got so far is a few weeks work, and has given me a rough idea of how long it will take to finish the game, which is about five episodes altogether.

I have yet to polish all of the animations, add voice and sound FX, implement a few things with the interface and GUIs, also add some atmospheric effects.

I think by the end of next week I can have a beta demo if anyone wants to help test it and offer any advice or feedback. The file size is rather huge I was surprised, 1GB, but there's a ton of assets packed in that I haven't used in the demo but are part of the game. I'll look into that later...

If anyone wants to help test it message me I'll let you know when I have it ready.
#39
Quote from: SilverSpook on Fri 14/10/2016 04:59:31
Fascinating stuff.  I like, 'Game designer sanity in question' headline.  This is constantly in the news cycle scrolling on the ticker inside my forehead. :)

Yeah I think you have to be a "little mad" [as Norman Bates would say] to be a game designer and start on one of these projects in the first place. (laugh) But madness/insanity is something that's been explored in the fictional and non-fictional universe of poets/writers/artists, etc. of all types so it's something I wanted to explore in this Lovecraftian game, except the character's a game designer in the 1930's instead of the usual poet or artist.
#40
Quote from: selmiak on Fri 14/10/2016 01:56:59
now I'm confused and go to bed! :-D So are these fake newspaper articles also printed out and pinned there or are they photoshoped in?

I made them with photoshop but yeah they're all printed out, all the props are real, but I designed them myself and aged them to make them look old. Goes back to role-playing days, when we used to make player hand outs for Call of Cthulhu RPG campaigns, something that connected the players to the game's world. I'll be making some especially for this game at some point. One thing I miss about computer games today is you usually don't get any cool game items with them (maps, letters, old journals), nor even a box; that's one thing I miss besides the games themselves. Part of the fun of getting the game was the packaging itself, and all stuff that came with it, it gave you a deeper connection to the game's story/world. You had something real you could hold in your hand, that was also part of the game's world. Like the old Infocom text adventures, they had beautiful games and cool items that came boxed up with them. I understand its expensive to produce stuff like that now and not practical to do, where most games are just delivered digitally or in a slip-case.

But a lot of those old games still fetch unbelievably high prices on eBay today, because I guess a lot of other people miss that too. I've seen game boxes/items from popular games dating back to the 80s/90s selling for hundreds of bucks online to collectors.
SMF spam blocked by CleanTalk