About items

  • #30, by afrlmeMonday, 27. November 2017, 21:27 6 years ago
    He's talking about the next command option in the set command action part, but it's only a valid solution if you only create typical use, take, examine, walk to commands because it cycles through all available commands.

    Yeah there will be a delay because of the 100ms you set. You can set to 20ms if you prefer, but it might mess up due to the script not executing fast enough. This is why I'd much rather Simon removed the static image option for items & replace it with active animation & inactive animation instead.

    Imperator

    7278 Posts


  • #31, by JorkzMonday, 27. November 2017, 23:15 6 years ago
    He's talking about the next command option in the set command action part, but it's only a valid solution if you only create typical use, take, examine, walk to commands because it cycles through all available commands.
    Yeah, I understood the meaning of this message later... but I don't  know how to do that: Thank you again for the time spent on my problem !... But your explanation without picture is very hard to understand. :/

    This is why I'd much rather Simon removed the static image option for items & replace it with active animation & inactive animation instead.

    So... In conclusion, is it finished ? Is it the only solution in VS ?

    Newbie

    90 Posts

  • #32, by sebastianMonday, 27. November 2017, 23:15 6 years ago
    There would also be a solution to not create for each item a command, but only specific cursors. This would make use of some lua script checking the dragged item and if something is dragged changing the cursor.
    The advantage would be using only one command and if an item is dragged used for interacting with objects, etc (use command with item on X). This would make the "next command" action valid again. This would be a classic sam&max interface with the individual item cursor combined

    But i guess you make more progress here following AFRLme's version because you already follow his instructions for this setup wink 

    Thread Captain

    2346 Posts

  • #33, by JorkzMonday, 27. November 2017, 23:27 6 years ago
    This would make use of some lua script checking the dragged item and if something is dragged changing the cursor.
    According to me it's not a problem (Indeed If you're still ok for help me smile ), I can test several methods at once because I save a lot of .ved
    But i guess you make more progress here following AFRLme's version because you already follow his instructions for this setup
    If at the end the solution is stable, It doesn't matter for me.
    However if it is finished, I would also like to know the intructions you've mentionned smile

    Newbie

    90 Posts

  • #34, by afrlmeTuesday, 28. November 2017, 01:11 6 years ago
    I actually started using a command based item system because there was no simple solution for checking if an item was currently being held without messing about with conditions & loops & so on.

    Since Simon added a bunch of new query based action parts to VS 5, you could actually use the regular commands & set an item to hand (not dragged), then just set a custom cursor. The reason I decided back in VS 4 to use commands is because I use the Broken Sword command interface (single command interface) which is left click to interact & right click to examine. Basically I had a single command & I'd set a specific mouse cursor (examine, take, talk, etc) on mouse over a scene object or character, but there was no query action part to check if the character was currently holding an item in their hand, which meant that on mouse over the cursor would change, but the character was still holding the item which meant when I interacted with the object/character that it dropped the item on the object/character still. Now it's possible to query if the character is holding an item, but I'm not sure if it's possible yet to set cursor with Lua script...

    Quick note: you could I suppose, depending on what your interface background looks like cover up the inventory slot the item is in with an image of the background by enabling a condition or value when you take the object. Alternatively you could use Lua script & my replace item scripts I shared on the wiki a couple years back to insert a transparent item in place of where the item you have taken was. You would have to save the slot number into a variable to replace it with the item when you place it back into the inventory or to delete it from the inventory if you discard the item. Technically an item doesn't have to be in your inventory to be able to set it to your hand. If you don't mind the item getting inserted to the end of the inventory list rather than being put back in the same slot it was already in then you could just remove the item from the inventory altogether, then add it again when you are done. You would likely need some scripting though to store the name of the item & re-insert it.

    Imperator

    7278 Posts

  • #35, by JorkzTuesday, 28. November 2017, 05:56 6 years ago
    there was no simple solution for checking if an item was currently being held without messing about with conditions & loops & so on.
    What is a loop ? Is it about animation ?
    Now it's possible to query if the character is holding an item, but I'm not sure if it's possible yet to set cursor with Lua script...
    Pease, where in VS is it possible to do that ?
    Personally I'm not against checking if it's working... as far as the result "worth" (previously you told me that)
    Alternatively you could use Lua script & my replace item scripts I shared on the wiki a couple years back to insert a transparent item in place of where the item you have taken was. You would have to save the slot number into a variable to replace it with the item when you place it back into the inventory or to delete it from the inventory if you discard the item.


    The problem is that I still don't know how to use the variables, especially this type of. Is there a solution on the VS forum ? Where is the wiki link you're taking about, please ?
    If you don't mind the item getting inserted to the end of the inventory list rather than being put back in the same slot it was already in then you could just remove the item from the inventory altogether, then add it again when you are done. You would likely need some scripting though to store the name of the item & re-insert it.
    That doesn't enchant me (the item at the end), but if there is a script for that, I would like to know it, sure !!

    However, I realize that I have to give up my initial idea, which seems very simple when you're playing to an adventure game: I would have liked a dynamic inventory, where the player choose the place to drag n drop his items.

    Newbie

    90 Posts

  • #36, by afrlmeTuesday, 28. November 2017, 12:58 6 years ago
    hmm, sorry... I was just speculating!

    replace item script -- removes the item you specify & inserts a new item in the same slot the item you removed was in.

    insert item script -- allows you to insert a new item before or after the item you specify.

    I wrote those functions a few years ago, but they should still work. Just read the instructions on the pages.

    Here's an example of how you could check if the character is holding an item inside of the global right click mouse actions. I've used Lua script. It's just a template mind; the names of the interface buttons need to be adjusted to suit. The script checks if the character is holding an item, if they are then it removes the item from hand & resets the command to the default command. If the character isn't holding an item then on right click should cycle through the available commands specified in the else part of the script.

    https://i.gyazo.com/411ecfb911bba442df4a7d63d4ab1e9b.png

    here's the code that you can see in the screenshot...
    if not game.UsedItem:isEmpty() then -- if character is holding item
     game:clearLink(VGameUsedItem) -- remove item
     game.ActiveCommand = Buttons["default"] -- set default command
    else -- character isn't holding an item, cycle through available commands
     if game.ActiveCommand:getName() == "default" then -- if current command is default
      game.ActiveCommand = Buttons["examine"] -- change command to examine
     elseif game.ActiveCommand:getName() == "examine" then -- if current command is examine
      game.ActiveCommand = Buttons["take"] -- change command to take
     elseif game.ActiveCommand:getName() == "take" then -- if current command is take
      game.ActiveCommand = Buttons["talk"] -- change command to talk
     elseif game.ActiveCommand:getName() == "talk" then -- if current command is talk
      game.ActiveCommand = Buttons["default"] -- change command back to default
     end
    end


    Maybe this will be enough to get you started? I even wrote comments at the side of each line of code explaining what it does.

    Imperator

    7278 Posts

  • #37, by JorkzTuesday, 28. November 2017, 14:43 6 years ago
    Yes !!! Thank you !!!

    Now there is no problem with the main interface with right clik to choose cursor&command !
    smile smile smile

    ...But now I'm struggling for replace my item to a transparent picture. roll
    Alternatively you could use Lua script & my replace item scripts I shared on the wiki a couple years back to insert a transparent item in place of where the item you have taken was. You would have to save the slot number into a variable to replace it with the item when you place it back into the inventory or to delete it from the inventory if you discard the item.
    Could anyone explain to me how to do that ?
    As I've already said, I have no idea where and how to do that in the soft.
    In the items' values ??

    Thank you again !!!

    Newbie

    90 Posts

  • #38, by afrlmeTuesday, 28. November 2017, 16:32 6 years ago
    Yes !!! Thank you !!!

    Now there is no problem with the main interface with right clik to choose cursor&command !
    smile smile smile

    ...But now I'm struggling for replace my item to a transparent picture. roll
    Alternatively you could use Lua script & my replace item scripts I shared on the wiki a couple years back to insert a transparent item in place of where the item you have taken was. You would have to save the slot number into a variable to replace it with the item when you place it back into the inventory or to delete it from the inventory if you discard the item.
    Could anyone explain to me how to do that ?
    As I've already said, I have no idea where and how to do that in the soft.
    In the items' values ??

    Thank you again !!!
    I linked you my scripts which contain tutorials. I'm guessing the bit that you are going to have the most trouble with is replacing the temporary transparent item with the actual item as there's 2-3 different things that could cause the item to no longer be held after execution...

    1. the player right clicks to drop the item back to inventory & reset back to the default command.

    2. you manually drop the item back to inventory & reset back to default command inside of the action block for the scene object, character or item you are currently interacting with.

    3. you have set activate standard command to always or only after successful execution on the main game properties section of the Visionaire editor.

    I think a loop might be needed here or at least a script inside of the animation for the temporary invisible item to listen out for when the character is no longer holding the item.

    https://i.gyazo.com/65c55eed8154fa427de5e7f4dd633d32.png

    https://i.gyazo.com/eb4c7821865620bd775096e2f3cac39d.png

    https://i.gyazo.com/6ff3a8e54b1b7fc7918aa1a9f8c05d28.png

    Untested, but in theory it should work. The animation when visible should check if item is no longer held & if not then it should replace the item in the inventory with the item you removed from hand & reset a Lua variable back to nil which you have stored the item name into.

    Imperator

    7278 Posts

  • #39, by JorkzTuesday, 28. November 2017, 18:51 6 years ago
    Ok. I will try this later, and I think that will be very useful, but at the moment I don't know to "save a slot number into a variable".
    I linked you my scripts which contain tutorials
    If you mentionned the little text in your link (before the main script) is it...
    To use this function you have to include both the names of the item you want to replace, & the item that that you will be replacing it with; item names are case & character sensitive.
    ...it is nowhere specified where to do it, and how ???

    Very sorry but i'm very very beginner roll
    The sentences after the -- in the script don't help me so
    I don't understand much about all this roll

    Newbie

    90 Posts

  • #40, by JorkzTuesday, 28. November 2017, 19:37 6 years ago
    So sorry but my computer crashed this afternoon... It disturb me and I don't know how I managed... but now my cursor "item" is blocked to this command when I take the item... I am obligated to quit the game for go back in VS. In think I will cry.

    Newbie

    90 Posts