lua check item

  • #10, by sebastianSaturday, 31. October 2015, 22:57 5 years ago
    What do you think is better:
    Setting up commamd for every item and link a cursor to it
    Or
    Only setting up cursors and only change them + setitem action part

    Thread Captain

    2337 Posts


  • #11, by sebastianSunday, 01. November 2015, 01:09 5 years ago
    Oh damn. I came across a stupid obstacle.
    It seems that i cant simulate the "dropped any item" action with commands, because there is no "executed command; command: any" action.

    Any ideas how to solve this? (I try to use commands for each item right now). maybe i have to choose the way to only set item and change cursor via your script...

    Thread Captain

    2337 Posts

  • #12, by afrlmeSunday, 01. November 2015, 01:29 5 years ago
    Initially I was changing the cursors & setting the item, but I didn't like it & I couldn't set the cursors via Lua script. I can check & set the active command via Lua script & I don't have to worry about having to set the cursors anymore either.

    Personally I prefer creating items as commands, but it's entirely up to you as to which method is easier for you to sort out.

    ----

    Dropped any item? Hmm just use comment sets? I'm actually using a custom script / function to sort out invalid item drops. In our case we set a random value to determine if we should display a generic random invalid action text or a text relevant to the item we dropped on said scene object or character. This only occurs if the item is not listed in the scene object or character. Magic.

    Imperator

    6846 Posts

  • #13, by sebastianSunday, 01. November 2015, 01:37 5 years ago
    I know. I also created commands for each item which have the cursors linked and that works so far. The problem is now that i cant check if "any" item command is executed on an item.

    Thread Captain

    2337 Posts

  • #14, by afrlmeSunday, 01. November 2015, 11:38 5 years ago
    Quick note: you do know that VS has a comment set system already? In your mouse over actions you could check if the current command is one of your interaction commands & if so then call an action to change to x comment set else change to y comment set. If comment sets exist & the player tries to use a command / item on a object, character or item & it doesn't exist inside of said things actions list then it should automatically trigger a display text from the active comment set.

    Imperator

    6846 Posts

  • #15, by sebastianSunday, 01. November 2015, 11:58 5 years ago
    Im not sure if i get this right...
    Because i use a coin interface, the interaction commands get set after i release my left mouse button on the coin which opened when i left click and hold on an object.

    The original drop system works when you only left click on an item with the default command and drop it via left click on items or objects. Here you can choose on items or ovjects to trigger if "any" item was dropped to catch everything else.

    I dont see how command sets would help me here to do exactly that.

    Now about how i understood your idea:
    Creating 2 comment sets. One for the real commands which include stuff like "i cant use that" and a second set with a default comment for each item command.
    In an item or object how do i proceed now to trigger that comment? And where do i change the comment set in my said system...?

    Thread Captain

    2337 Posts

  • #16, by afrlmeSunday, 01. November 2015, 14:58 5 years ago
    There's an action part that lets you determine the active comment set. I'm not really sure how you would go about sorting out which to use with a coin interface though... I suppose you could have a Lua mouse event listener or loop to check for when the current command isn't one of your regular commands then update comment set based on that.

    I'm not actually using the comment set system myself though.

    Imperator

    6846 Posts

  • #17, by sebastianSunday, 01. November 2015, 16:25 5 years ago
    hmm... tricky, tricky. The best would be that the dev team would include some kind of active/inactive state for the dragged item in visionaire and make it able to activate an outline (+ choose color) when the dragged item is hovered above objects/items.

    For now im stuck because i dont want to build a weird system only to drop items correctly. "dropping any" doesn't work for the system where you have for each item a command because there is no action which catches these cases (executed command: any).

    The other solution was to use a "set item" when left clicking an item and via your lua script setting the cursor to its item representation.

    This works so far, but I come across two problems: It seems that "item dropped" action doesn't worked with that...I guess i have to use the normal "left click executed with item #item# " here (left click is my default comand).
    Second problem is that i cant check via "if current item is" stuff in visionaire because this if-condition doesnt exist either. I think i have to use some lua here, too to determine if a right click cancels the dragging or opens my inventory

    Lets see.....

    *Updated my post several times because of grammer and additions razz

    EDIT: i guess i stick with the second workaround:
    I used your script as a basis, so setting an item automagically changes the cursor.
    When no item is set the default cursor is used.
    Every Item gets its "called by another action " action which gets called by your lua script to change the cursor to its representation. the default cursor action is set inside my interface.

    executing "left click" with no item set on an item, sets the item
    executing "left click" with an item set on the same item, sets the cursor back to default
    executing "left click" with "any" item set shows a default phrase.

    when an item is set (defined via lua script) a condition is set. when right clicking, the cursor is set to default. When no item is set the inventory opens or closes.

    Every "item X dropped" action in the game has to be changed to a normal "left click executed with item X" action to make sure the pseudo dropping still works ("left click" is my default action).

    On doorways where i change the cursor to arrows should not change, when an item is set (like when used the normal dragging from visionaire). To achieve this i added a condition "used_item" which turns true / false inside your script when having an item or not.

    Every item has also a representation as a cursor with an inactive (normal item) and active (item with border) state.



    Thread Captain

    2337 Posts

  • #18, by afrlmeSunday, 01. November 2015, 17:36 5 years ago
    Ok, so you've managed to sort it all out then?

    Sometimes, VS is really not workflow friendly - actually said this to someone else yesterday - in regards to how we have to approach things, especially when we don't want to be confined to the available systems (items, dialogs, etc).

    Imperator

    6846 Posts

  • #19, by sebastianSunday, 01. November 2015, 17:51 5 years ago
    I guess its sorted out. Now im updating every action as said above. Hope everything works and im not coming across another obstacle...

    Thread Captain

    2337 Posts

  • #20, by afrlmeSunday, 01. November 2015, 18:10 5 years ago
    Either way... there's often a solution to any obstacle when it comes to sorting things out in VS.

    Imperator

    6846 Posts

Write post