Anfängerfrage zu combined commands

  • #1, by gunniWednesday, 06. March, 01:45 6 months ago
    Hallo,
    ich habe eine Frage zu den kombinierten Kommmandos.
    Ist es möglich, die Option nur bedingt zu nutzen?
    Beispielsweise kann man bei IJ4-FoA “benutze LKW“, aber auch “benutze Kaugummi mit Kohlerutsche“ nutzen, sprich, je nach Gegenstand ist es ein kombiniertes Kommando oder eben nicht.
    Theoretisch würde ich eine Variable bei allen Gegenstände setzen, diese bei Bedarf evaluieren und je nachdem (vermutlich via Lua?) den Befehl “Benutze“ eigenständig benutzen oder in Kombination mit einem anderen Gegenstand (also kombiniert).
    Bevor ich mich verrenne mit einer Idee, die überhaupt nicht umsetzbar ist, die Fragen: ist mein Ansatz korrekt? Ist das überhaupt machbar in VS?

    Beste Grüße und Danke im Voraus.  

    Newbie

    6 Posts


  • #2, by AFRLmeWednesday, 06. March, 02:02 6 months ago
    Visionaire has multiple methods for managing item/object usage.

    1. drag & drop item system.

    2. set item (manually set item as held item - with this one you can also check what the current active command is)

    3. command based item system (requires work, but my preferred method as it's more flexible)

    You don't need to use Lua script at all - it's entirely optional.

    Imperator

    6591 Posts

  • #3, by esmeraldaWednesday, 06. March, 17:02 6 months ago
    Wenn mich nicht alles täuscht, funktioniert das combined command so, dass das Bindewort, also das "mit" erst erscheint, wenn du einen Inventargegenstand in der Hand hältst.

    Wenn du also mit deinem "benutze"-Befehl auf eine Szenenobjekt oder einenen Inventargegenstand klickst, erscheint erstmal nur "benutze". Wenn du aber einen Gegenstand in der Hand hältst (drag and drop) oder zuerst ausgewählt hast und dann die Maus über einen anderen Gegenstand fährt, dann kommt erst das "benutze" Gegenstand "mit" Objekt.
    Sollte also von Hause aus genau das sein, was du willst. (es sei denn, ich habe dich falsch verstanden)

    (@AFRLme the question was about action text when using combined command. How to control when the conjunction word should appear)

    Great Poster

    349 Posts

  • #4, by gunniThursday, 22. August, 11:37 3 weeks ago
    Hallo @esmeralda & @AFRLme,
    vielen Dank für Eure Antworten! (Hi, thanks for your replies, sorry, but I wasn't notified about your answers - I checked my thread the first days and b/c there were no answers I thought my problem was to trivial and so I gave it up (the thread)).
    Everything works - I also managed to handle the [use ItemX with ItemX]-thingy.

    One more question:

    * Is there a way to rename items / objects? (the displayed object/item-text: e.g. "full cup" to "half-full cup" a.s.o.? I couldn't find an option in the action-set.)

    Best regards

    Newbie

    6 Posts

  • #5, by AFRLmeThursday, 22. August, 13:27 3 weeks ago
    Yes, it's possible, but not simple. The best solution is probably to create a value under the values tab of the object you want to rename, then inside of a mouse enters action part you use Lua to rename the object/item/character to the string inside of the value. You can edit the string part of the value with Lua script.

    ok here's a script I wrote for someone recently...

    function changeName(txt)

    local obj = game.CurrentObject.Name.TextLanguages
    -- + --
    for i = 1, #obj do
    obj[i].text = txt
    end
    -- + --
    game.CurrentObject.Name.TextLanguages = obj

    end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11

    add that to the script section of your project. leave as default script type (definition). now to use it, create a value inside of the object/item/character you want to rename & set the default name in the string section - name the value as "name". Now create an on mouse enters action part & add an execute a script action part & then add a line of code like so...

    changeName( "hello world" )
    1


    or alternatively if you want to generate names for a multi-language game, then do something like this instead of the single line code (above).

    local t = {
    English = "hello world",
    German = "hallo welt"
    }

    changeName( t[ game.StandardLanguage:getName() ] )
    1
    2
    3
    4
    5
    6


    the language names need to be exactly the same as what you have created in your project otherwise it won't work.

    the reason we are using values is because name changes are not stored in the save game file data, but integer & string data of values are. oh, almost forgot... here's how to update the string part of a value.

    game.CurrentScene.Objects["example"].Values["name"].String = "hello world"
    1


    something along the lines of that.

    Imperator

    6591 Posts

  • #6, by AFRLmeThursday, 22. August, 14:23 3 weeks ago
    Forgot... another solution would be to create a value for each of the different languages (value names have to be exactly the same as your game language names) you have in your game inside of any objects, characters, or items you plan on renaming, then you update those values as needed & then add this inside of an execute a script action part inside of a mouse enters action block...

    changeName( t[ game.StandardLanguage:getName() ] )
    1

    You would still use the same function I shared with you in the post above. I also forgot to mention that you might want to wrap the execute a script in the mouse enters action block with an if query to only have it update the name from the default names you have written if a condition is met.

    Imperator

    6591 Posts

  • #7, by esmeraldaThursday, 22. August, 16:32 3 weeks ago
    Or - if you don't want to use Lua - you could create a second object, name that differently and switch between the objects by using a condition or value.

    Great Poster

    349 Posts

  • #8, by gunniThursday, 22. August, 16:43 3 weeks ago
    Yeah, cool, I'll try it. I already tried it with a second item, but if I "replace" it manually (remove "full cup" from inventory - add "half-full cup" to inventory) the new item is being added at the end of the inventory.

    PS: I still don't get a notification about answers in a thread - is it a setting here somewhere? Gotta find out it now.
    edit: all options checked in the forum settings - nothing in the spam folder - I guess it's just broken (for me)

    Thanks to both of you!

    Newbie

    6 Posts

  • #9, by AFRLmeThursday, 22. August, 22:35 3 weeks ago
    oh, I have a function I wrote the other year that lets you replace/swap out items.


    Both should still be valid. Replace item removes the current item & inserts the item you specify into the same item slot that the old one occupied. Insert item inserts a new item you specify before or after the specified item.

    Imperator

    6591 Posts

  • #10, by gunniFriday, 23. August, 10:50 3 weeks ago
    Thank you very very much for the provided links / code. It's a great way to learn VS's scripting language.

    Newbie

    6 Posts

  • #11, by AFRLmeFriday, 23. August, 13:26 3 weeks ago
    Thank you very very much for the provided links / code. It's a great way to learn VS's scripting language.
    I wrote them a long time ago, so they aren't up to date with the current shorthand, but the old longhand scripting method is still valid. & yes you are correct, combing over existing scripts is a good way to learn. wink

    Imperator

    6591 Posts

Write post