Author Topic: Possible to execute statements in SAY block?  (Read 494 times)

Offline Bleepbloop

  • Planewalker
  • *****
  • Posts: 7
Possible to execute statements in SAY block?
« on: February 05, 2021, 05:35:26 AM »
I'd like to execute a DO statement (to set a global variable) whenever the game reaches a certain dialogue state. However, inserting a DO statement immediately before or after the SAY statement yields a syntax error.

Is there a way to do this?

Example (that doesn't compile) illustrating what I want to do:

IF ~~ THEN BEGIN SomeState
    SAY ~Something interesting.~
    DO ~SetGlobal("SomeGlobalVariable", "GLOBALS", 1)~
   
    // Transitions here
END

Offline Gwendolyne_FP

  • Planewalker
  • *****
  • Posts: 66
Re: Possible to execute statements in SAY block?
« Reply #1 on: February 05, 2021, 10:10:41 AM »
This way of coding only works with CHAIN

In your case:

 
Code: [Select]
IF ~~ THEN BEGIN SomeState
    SAY ~Something interesting.~
    IF ~condition~ REPLY ~blabla.~ DO ~SetGlobal("SomeGlobalVariable", "GLOBALS", 1)~ GOTO OtherState1
    IF ~condition~ REPLY ~bloblo.~ DO ~SetGlobal("SomeGlobalVariable", "GLOBALS", 1)~ GOTO OtherState2
    ...
END

Offline Bleepbloop

  • Planewalker
  • *****
  • Posts: 7
Re: Possible to execute statements in SAY block?
« Reply #2 on: February 08, 2021, 01:22:25 AM »
Thanks Gwendolyne_FP. :) I was hoping to avoid the redundancy, but it's no biggie.

Offline Gwendolyne_FP

  • Planewalker
  • *****
  • Posts: 66
Re: Possible to execute statements in SAY block?
« Reply #3 on: February 08, 2021, 01:29:51 AM »
Sorry, when copying-pasting your code, I did not notice your typo and reproduced it: "GLOBAL" without "S".

SetGlobal("Myvariable","GLOBAL",1) or SetGlobal("Myvariable","LOCALS",1)
« Last Edit: February 08, 2021, 01:32:10 AM by Gwendolyne_FP »

Offline Bleepbloop

  • Planewalker
  • *****
  • Posts: 7
Re: Possible to execute statements in SAY block?
« Reply #4 on: February 08, 2021, 05:30:31 AM »
Yeah, I was scratching my head over that one for a while.  :) Thanks!

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: