Jump to content

Dialoges and Globals


Guest Kip

Recommended Posts

When ever I setup a dialoge to set a global it doesn't want to work. The one that doesn't work look like this: SetGlobal("GlobalName","GLOBAL",X). I added an 's' to the end of 'GLOBAL' so it looks like SetGlobal("GlobalName","GLOBALS",X) but I am hesitant to try it because all the scripting I look at elsewhere does not have that 's'. Also, upon adding the 's' to the Set I also added an 's' to the global in IF section. What is wrong?

Link to comment

Post a dialogue that isn't working?

 

SetGlobal("Myglobal","GLOBAL",1) is correct, SetGlobal("Myglobal","GLOBALS",1) is not and won't work. Locals are different and SetGlobal("Myglobal","LOCALS",1) is correct (these are not case-sensitive, by the way).

Link to comment

You have to set globals one at a time.

 

If you wanted to set several, you'd do:

 

DO ~SetGlobal("GlobalVariable1","GLOBAL",#) SetGlobal("GlobalVariable2","GLOBAL",#) SetGlobal("GlobalVariable3","GLOBAL",#)~

 

if you were setting it in the dialogue.

Link to comment

They are not supposed to be case sensitive, but DyValiTool pops errors about not being able to find matches if you use it to troubleshoot for typos (just like Class is ok, but CLASS and class both return errors ;) ).

Link to comment

Here is the beginning of it, up to where the error was, I removed the actually dialoge to keep the size down. Yes I know there is atleast 5 typos

BEGIN ~BOOK~

IF ~~ THEN BEGIN 0
 SAY ~This os leather bound journal.~
 IF ~~ THEN REPLY ~Open the book and begin reading.~ GOTO 1
 IF ~Global("PageNumber","GLOBAL",2)~ THEN REPLY ~Open to the page you last read.~ GOTO 2
 IF ~Global("PageNumber","GLOBAL",3)~ THEN REPLY ~Open to the page you last read.~ GOTO 3
 IF ~Global("PageNumber","GLOBAL",4)~ THEN REPLY ~Open to the page you last read.~ GOTO 4
 IF ~Global("PageNumber","GLOBAL",5)~ THEN REPLY ~Open to the page you last read.~ GOTO 5
 IF ~Global("PageNumber","GLOBAL",6)~ THEN REPLY ~Open to the page you last read.~ GOTO 6
 IF ~Global("PageNumber","GLOBAL",7)~ THEN REPLY ~Open to the page you last read.~ GOTO 7
 IF ~Global("PageNumber","GLOBAL",8)~ THEN REPLY ~Open to the page you last read.~ GOTO 8
 IF ~Global("PageNumber","GLOBAL",9)~ THEN REPLY ~Open to the page you last read.~ GOTO 9
 IF ~Global("PageNumber","GLOBAL",10)~ THEN REPLY ~Open to the page you last read.~ GOTO 10
 IF ~Global("PageNumber","GLOBAL",11)~ THEN REPLY ~Open to the page you last read.~ GOTO 11
 IF ~Global("PageNumber","GLOBAL",12)~ THEN REPLY ~Open to the page you last read.~ GOTO 12
 IF ~Global("PageNumber","GLOBAL",13)~ THEN REPLY ~Open to the page you last read.~ GOTO 13
 IF ~Global("PageNumber","GLOBAL",14)~ THEN REPLY ~Open to the page you last read.~ GOTO 14
 IF ~Global("PageNumber","GLOBAL",15)~ THEN REPLY ~Open to the page you last read.~ GOTO 15
 IF ~Global("PageNumber","GLOBAL",16)~ THEN REPLY ~Open to the page you last read.~ GOTO 16
 IF ~Global("PageNumber","GLOBAL",17)~ THEN REPLY ~Open to the page you last read.~ GOTO 17
 IF ~Global("PageNumber","GLOBAL",18)~ THEN REPLY ~Open to the page you last read.~ GOTO 18
 IF ~Global("PageNumber","GLOBAL",19)~ THEN REPLY ~Open to the page you last read.~ GOTO 19
 IF ~~ THEN REPLY ~Place the book back in your pack.~ EXIT
END

IF ~~ THEN BEGIN 1
 SAY ~Entry 1
Blah Blah De Blah.~
 IF ~~ THEN REPLY ~Go on to the next page.~ GOTO 2
 IF ~~ THEN REPLY ~Close the book and return it to your pack.~ EXIT
END

IF ~~ THEN BEGIN 2
 SAY ~Day 2
Blah Blah De Blah. Oh and Blah Da.~
 IF ~~ THEN REPLY ~Go to the previous page.~ GOTO 1
 IF ~~ THEN REPLY ~Go on to the next page.~ GOTO 3
 IF ~~ THEN REPLY ~Close the book and return it to your pack.~ Do ~SetGlobal("PageNumber","GLOBAL",2)~ EXIT
END
Link to comment

I'm guessing the only reply option you see is "Put the book back in your pack."

 

You need to set the globals before you can call on them.

 

You would do something like

 

IF ~CONDITIONS~ THEN BEGIN book

SAY ~This is a leather-bound book.~

IF ~Global("PageOne","GLOBAL"0)~ THEN REPLY ~Turn to the first page.~ DO ~SetGlobal("PageOne","GLOBAL",1)~ GOTO page1

IF ~Global("PageTwo","GLOBAL",0)~ THEN REPLY ~Turn to the second page.~ DO ~SetGlobal("PageTwo","GLOBAL",1)~ GOTO page2

//etc

END

 

IF ~~ THEN BEGIN page1

SAY ~This is the first page. This book is probably talking to you now.~

IF ~~ THEN EXIT

END

 

//ETC

 

Or maybe I'm misunderstanding you. You seem to be creating a talking item that will let the pc read a page at a time of a book, once, and only once.

Link to comment

How is this dialog called? You don't seem to have any top-level conditions in dialog states, so the only way to use it is to call one of the states directly from another dialog, with EXTERN.

 

Note that all dialog actions are executed by something or someone, usually by a creature which has this dialog assigned. If you're spawning an invisible CRE with something like

StartDialog("BOOK",Player1) DestroySelf()

in its script, then the "SetGlobal" actions will probably be just appended to its action queue - so it destroys self before performing them.

Link to comment
Guest Guest

Bere got it right with the talking book thing but I tried to set it up so that after each time your read a page it sets global to the page number you are on and when you converse or read the book there is a different reply that when you select goes to the page that you last read. To trigger the global change you select the close book reply. That should work right? Well in theory atleast...

Link to comment
Guest Guest

Looking at what Bere also said about the whole set globals before calling on them would that mean if I made IF ~~ THEN BEGIN 0 into IF ~Global("PageNumber","GLOBAL",0)~ THEN BEGIN 0 that would work right?

Link to comment

IF ~~ THEN BEGIN 0 into IF ~Global("PageNumber","GLOBAL",0)~ THEN BEGIN 0

 

Only till your Global switches. If that's the only dialogue with the book, try

IF ~True()~ THEN BEGIN StateName

Link to comment

There might be an easier way to do this by using an item as a model. You want to read what is in the book, and you want it to change pages. You could use that book you find in Perth the Adept's house as a model.

 

Talking items work best for one-shot deals. They talk, they go away. They are actually invisible creatures, so you can't exactly have them following you from area to area anyway.

 

*If* you wanted to have a steadily advancing variable, I might be tempted to just keep incrementing the same one.

 

IF ~Global("Page","GLOBAL",1)~ THEN REPLY ~Read page one.~ DO ~IncrementGlobal("Page","GLOBAL",1)~ GOTO page1

IF ~Global("Page","GLOBAL",2)~ THEN REPLY ~Read page two.~ DO ~IncrementGlobal("Page","GLOBAL",1)~ GOTO page2

 

etc

 

but that doesn't work really well with a talking item.

 

Maybe we might be able to help you better if you told us what you were trying to create. It might be that there is a simpler way to do it.

 

Edit: what Domi said ;)

Link to comment

Lilacor is probably the best example, because he is summoned/unsummoned for the dialogues iirc. What Berelinde said about Increment. I like Incrementing. I would also go a bit fancier and create a page in the PC's inventory every time you've read one IF the information is important. Or copy it to the journal. In case the PC wants to verify it. Or, I'd just have all 20 options always opened.

 

But then again, as Berelinde said, we don't know what you are trying to make. If it's not informative, then you can have pages closing on the player.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...