Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Interaction Script (https://forums.graalonline.com/forums/showthread.php?t=72137)

Rapidwolve 02-12-2007 04:40 AM

Interaction Script
 
I'm scripting an NPC interaction script. For example, once you first start the script the npc asks a question, and there are 2-3 answers that you can respond to, when you answer that question, there are another set of answers you can do. I'm stuck on the second set of answers. I have no idea how to get to the third dimension -_-. Help Please? PS: The last option always ends the script so I dont add into the array for the last option, and the size of the replymsg's and replyopt's must equal to the size of 'this.options'

PHP Code:

// In this example the NPC asks how are you?
this.options = {"Good","Alright","Leave me alone"};
this.replymsg = {{"Thats good to hear, I've got some business to handle ill talk to you later"},{"Only alright? Why is that?"}};
this.replyopt = {{"","","Alright then, bye."},{"I need some help","Forget it","I'm leaving"},{"Nice","","Bye"},}; 


Chandler 02-12-2007 09:38 AM

PHP Code:

this.replymsg[0][0] = "Thats good to hear...."
this.replymsg[0][1] = "Only alright? Why is that...." 

You could do a loop too, which I think is better
HTML Code:

for (temp.curMessage: this.replymsg[0])
{
  chat @= temp.curMessage;
}


Skyld 02-12-2007 10:23 AM

Quote:

Originally Posted by Chandler (Post 1276580)
PHP Code:

this.replymsg[0][0] = "Thats good to hear...."
this.replymsg[0][1] = "Only alright? Why is that...." 

You could do a loop too, which I think is better
HTML Code:

for (temp.curMessage: this.replymsg[0])
{
  chat @= temp.curMessage;
}


I am not sure that is at all helpful.

Rapidwolve 02-14-2007 05:22 PM

I figured out a solution for my old problem. Now my problem is that, when the NPC message gets to more than 6 lines (im using tokenize). I want it to create a new page, and keep creating new pages for every 6 lines until theres no more lines. This part completely boggles me

JkWhoSaysNi 02-14-2007 06:29 PM

what do you mean by 'page'?

Rapidwolve 02-14-2007 08:00 PM

Quote:

Originally Posted by JkWhoSaysNi (Post 1277284)
what do you mean by 'page'?

Like, it shows the first 6 lines thens stops, and move ot the next page it moves on to the next 6 lines and hides the old 6 lines

6 lines = 1 page

Kristi 02-14-2007 09:45 PM

That statement still seems very vague... are you displaying 6 lines and then want to display the next six?

Rapidwolve 02-14-2007 10:07 PM

Quote:

Originally Posted by Kristi (Post 1277436)
That statement still seems very vague... are you displaying 6 lines and then want to display the next six?

Just never mind...ill figure it out -_-
your really slow

Rapidwolve 02-15-2007 04:47 AM

Ok, I figured out how to seperate each page by 6 lines

PHP Code:

this.page 0;
this.linesperpage 7;
for (
this.0this.tokens.size(); this.i++){
this.pages int(this.this.linesperpage);
if (
this.page this.linesperpage => this.i){
showText(300+this.i,this.mainpos[0],this.mainpos[1]-135+(this.i*15),this.stylethis.fonttokens[this.page this.linesperpage this.i]);
changeimgvis(300+this.i,8);
changeimgzoom(300+this.i,.59);


It adds a line to the current page from the page thats supposed to be the next page onto the bottom of the current page...confusing...i think it has to do with the math can anyone help fix?
}

Kristi 02-15-2007 04:54 AM

Quote:

Originally Posted by Rapidwolve (Post 1277731)
Ok, I figured out how to seperate each page by 6 lines

PHP Code:

this.page 0;
this.linesperpage 7;
for (
this.0this.tokens.size(); this.i++){
this.pages int(this.this.linesperpage);
if (
this.page this.linesperpage => this.i){
showText(300+this.i,this.mainpos[0],this.mainpos[1]-135+(this.i*15),this.stylethis.fonttokens[this.page this.linesperpage this.i]);
changeimgvis(300+this.i,8);
changeimgzoom(300+this.i,.59);


It adds a line to the current page from the page thats supposed to be the next page onto the bottom of the current page...confusing...i think it has to do with the math can anyone help fix?
}

since i do not know what you are tokenizing, I am not sure if I can answer this!

Rapidwolve 02-15-2007 05:07 AM

PHP Code:

tokens wraptext2(111this.fontsize" "this.font "@" this.style "@" obj[0]);

obj[0is
TEST TEST TEST TEST
TEST TEST TEST TEST
TEST TEST TEST TEST
TEST TEST TEST TEST
TEST TEST TEST TEST 
TEST TEST TEST TEST 
TEST TEST TEST TEST
TEST TEST TEST TEST
TEST TEST TEST newb


Never mind I fixed it with
if (this.linesperpage - 1 => this.i)

xXziroXx 02-15-2007 04:25 PM

Just something.. dude, please work on your styling. Its horrible and its very hard to read for us others if you ever need help.

Rapidwolve 02-15-2007 10:34 PM

Oh, thats not the actual script. I just typed it up


All times are GMT +2. The time now is 07:11 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.