Hey all,
Perhaps someone with knowledge of Dorcan's stuff can help me out anyway. My last question was more of a general-forum question... since this is the technical one, I've decided to post some code.

What you see below is the first area of my global script. It's copied-and-pasted from Dorcan's stuff.
[code]//===================CONVERSATION=====================
int QstNbr=2; //NUMBER OF BASIC QUESTIONS.
int Player;
int PNView;
int TNView;
int PrevRoom;
int Px;int Py;
int Tx;int Ty;
int TalkTo=0;
int Change_Dialog=-1;
int Exit_Dialog=0;
int Replies[200];
function SetReply(int Char, int Reply, int Topic){
Replies[((QstNbr*Char)-QstNbr)+Reply]=Topic;
}
function InitReplies(){ //Set here wich topic must start when asking a basic question.
SetReply(KEV, 1, 1);
SetReply(KEV, 2, 2);
}
function StartDialog(int talkto){
GUIOn(3);
TalkTo=talkto;
Player=GetPlayerCharacter();
PrevRoom=character[Player].room;
Px=character[Player].x;character[Player].x=50;
Py=character[Player].y;character[Player].y=100;
PNView=character[Player].view+1;
ChangeCharacterView(Player,character[Player].talkview+1);
Tx=character[talkto].x;character[talkto].x=250;
Ty=character[talkto].y;character[talkto].y=170;
TNView=character[talkto].view+1;
ChangeCharacterView(talkto,character[talkto].talkview+1);
character[talkto].room=100;
NewRoom(100);
}
function Exit_Room_Dialog(){
GUIOff(3);
character[TalkTo].room=PrevRoom;
character[Player].room=PrevRoom;
ChangeCharacterView(Player,PNView);
character[Player].x=Px;
character[Player].y=Py;
ChangeCharacterView(TalkTo,TNView);
character[TalkTo].x=Tx;
character[TalkTo].y=Ty;
}
#sectionstart dialog_request // DO NOT EDIT OR REMOVE THIS LINE
function dialog_request (int xvalue) {
// your code here
if (xvalue==1) {
Exit_Dialog=1;
StopDialog();
} else
if (xvalue==100){
SetDialogOption(0,GetGlobalInt(100),1);
} else
if (xvalue<QstNbr+2) {
Change_Dialog=Replies[ ((QstNbr*TalkTo)-QstNbr)+(xvalue-1)];
StopDialog();
} else
if (xvalue==20) {
}
}
#sectionend dialog_request // DO NOT EDIT OR REMOVE THIS LINE
//===================EVENTS============================
#sectionstart game_start // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
game.speech_text_align=ALIGN_LEFT;
SetNormalFont(1);
SetSpeechFont(1);
GUIOff(3);
// called when the game starts, before the first room is loaded
}
#sectionend game_start // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart repeatedly_execute // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
// put anything you want to happen every game cycle here
if (Change_Dialog>-1) {
RunDialog(Change_Dialog);
Change_Dialog=-1;
} else
if (Exit_Dialog==1){
Exit_Dialog=0;
NewRoom(PrevRoom);
}
}
#sectionend repeatedly_execute // DO NOT EDIT OR REMOVE THIS LINE
[/code]
Now, it supposedly works like this:
I have a simple dialog now. With topics 0 to 2 filled. 0 is the opening topic when EGO talks to KEV.
Topic 0 has 3 options: Question 1, Question 2 and End Dialog. The last one has a run-script 1 to it. This triggers the Exit-Dialog stuff. And works perfectly. I've placed some custom change-view stuff in the room where KEV is, so my character doesn't remain one big talking head.
However, when I ask question 1 or question 2, it won't go on. Clicking either question immediately returns me to the topic-0 dialog. It should be this way that after question 1, topic 1 runs. Then if I ask question 2, topic 2 should run.
My dialog code for topic 0 is like this:
[code]
// dialog script file
@S // dialog startup entry point
return
@1 // option 1
EGO: "How're you doing?"
run-script 2
return
@2 // option 2
EGO: "What can you tell me about the Orchid murders?"
run-script 3
return
@3 // option 3
EGO: "Bye."
KEV: "See you."
run-script 1
stop
[/code]
Topic 1 is like this (same structure as Topic 2):
[code]
// dialog script file
@S // dialog startup entry point
KEV: Sure... I'm doing shit.
goto-dialog 0;
@1 // option 1
[/code]
---------
Now, I'm somewhat stumped with this. I've compared it with Dorcan's template quite a few times, but can't seem to figure out what I'm doing wrong.
Perhaps someone can? Or perhaps someone has used Dorcan's template as well, with perfect results? In that case, I'd gladly hear about it! :-)