Larian Banner
Previous Thread
Next Thread
Print Thread
Help me understand basic operations with variables #634464
29/10/17 11:23 AM
29/10/17 11:23 AM
Joined: Sep 2017
Posts: 49
D
Defoxx Offline OP
apprentice
Defoxx  Offline OP
apprentice
D

Joined: Sep 2017
Posts: 49
Suppose I need a script that appears only once when I enter the Trigger and will no longer appear. How can I do it?
I tried to do this with a flag, but I get an error.
Also I do not understand how to work with operations that start on DB_
Tried to consider the basic scripts but I do not understand the very essence.

My sample scripts:
With Flags
Quote
IF
CharacterEnteredTrigger(_Character, EventTrigger_000_c90f0a6b-1e3b-47df-8498-4751a6ba6cb1)
AND
CharacterIsPlayer(_Character, 1)
AND
ObjectGetFlag(_Character, "Once_Intro_Message", 0)
THEN
DisplayText(_Character, "Start")
ObjectSetFlag(_Character, "Once_Intro_Message", 1);



With DB_
INIT
Quote
DB_Once(1);

KB
Quote

IF
CharacterEnteredTrigger(_Character, EventTrigger_000_c90f0a6b-1e3b-47df-8498-4751a6ba6cb1)
AND
CharacterIsPlayer(_Character, 1)
AND
DB_Once(1);
THEN
DisplayText(_Character, "Start")
DB_Once(0);


And tell me What is this DB_? Is it a variable inside the script? Do you need to create it in advance? I did not find any information that describes the principle of work.

Last edited by Defoxx; 29/10/17 11:32 AM.
Re: Help me understand basic operations with variables [Re: Defoxx] #634465
29/10/17 11:51 AM
29/10/17 11:51 AM
Joined: Jun 2013
Posts: 655
Cromcrom Offline
addict
Cromcrom  Offline
addict

Joined: Jun 2013
Posts: 655
thoroughly check this if you haven't done already.
https://docs.larian.game/Osiris_Overview
Cheers

NB:
make sure everything after THEN ends with a ; . One is missing, and it might be the reason for you error.

Last edited by Cromcrom; 29/10/17 11:56 AM.

Un chemin de 1000 lieues commence par un premier pas.

Project:
Steam workshop Frontiere
Re: Help me understand basic operations with variables [Re: Defoxx] #634472
29/10/17 12:44 PM
29/10/17 12:44 PM
Joined: Dec 2013
Posts: 872
Windemere Offline

old hand
Windemere  Offline

old hand

Joined: Dec 2013
Posts: 872
Can you explain what the current behavior is with that code? Are you seeing the DisplayText action happen all the time or never? What is the 'error' you get when trying to use the flag approach?

A couple of bits of feedback:

With ObjectSetFlag, the third argument is a dialog instance, not a TRUE/FALSE parameter. The boolean direction is implied in the call itself. A dialog instance is a handle that can be used to catch a corresponding ObjectFlagSet set event. See the wiki entry on this call. While I don't think this should be a problem in your case, it's unnecessary so you could just leave that out and call with the two parameters.

As far as DB entries, it stands for database. There is a lot of information about Osiris on the wiki, you can start here. There is a section on databases under the "Osiris Overview" section, and there should be an entire video on it in the tutorial videos from DOS1.

I think your code looks okay. My guess is that the trigger GUID is not correct. Did you enter it by hand with copy/paste from the properties? I would expect the values to look something like:

TRIGGERGUID_EventTrigger_000_c90f0a6b-1e3b-47df-8498-4751a6ba6cb1

In other words, you are missing the TRIGGERGUID_ type indicator. If you used auto-complete (ctrl+shift after generating definitions) to get the trigger GUID that should have been included automatically.

*edit* - good catch by Cromcrom on the missing ';'

Last edited by Windemere; 29/10/17 12:46 PM.

DOS2 Mods: Happily Emmie After and The Noisy Crypt

Steam Workshop
Nexus Mods
Re: Help me understand basic operations with variables [Re: Defoxx] #634477
29/10/17 01:09 PM
29/10/17 01:09 PM
Joined: Sep 2017
Posts: 49
D
Defoxx Offline OP
apprentice
Defoxx  Offline OP
apprentice
D

Joined: Sep 2017
Posts: 49
Thanks for the advice.
The bug was really absent ";". I thought it should be put only one at the end of all the lines THEN.
Osiris understood a little. I understand this is a kind of database in which you can check the availability of certain variables and use them.

Thanks for the advice.
The bug was really absent; I thought it should be put only one at the end of all the lines.
Osiris understood a little. I understand this is a kind of database in which you can check the availability of certain variables and use them.

In the case of flags, there are so many different teams that you can get confused. In my case, I need to add a flag to the character, and if he already has that condition, then the condition is not met. Could you choose a more correct version of my script with the flags?


Moderated by  Larian_Koala 

Powered by UBB.threads™ PHP Forum Software 7.6.2