Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-03-2005, 03:42 AM
Torankusu_2002 Torankusu_2002 is offline
'been round.
Torankusu_2002's Avatar
Join Date: Nov 2001
Posts: 1,246
Torankusu_2002 is on a distinguished road
Loriel's Message System -> GS2

So, In my attempts to learn GS2 better, I figured I'd take a relatively simple script (Loriel's Message System), and convert it to use in GS2. I think I have most of it formatted, but there are things I am sure I am missing, because it doesn't display the message. Other than that, I get no errors in the script compiler for RC, but.....It still won't show the message?

NPC Code:


Code for the Test-String setter I am using.
// NPC made by Torankusu
//#CLIENTSIDE

function onCreated() {
setshape(1,32,32);

}
function onPlayerTouchsMe() {
client.addmessage = "This is a test";
}




Here's my version of Loriel's script.
NPC Code:


//#CLIENTSIDE


//Displaying the system messages
function onCreated(){
for (msgcount=0; strlen(makevar("this.msg" @ msgcount))>0; msgcount++){
this.msg(msgcount) =" ";
}
this.msg0 = "Welcome";
setTimer(0.05);
}

function onTimeout(){



//Get New Messages
len = client.addmessage.size();
for (i=0; i<len && msgcount<50; i++) {
// Never show more than 50 messages
if (strlen(getstring(client.addmessage)[i])>0) {
makevar("this.msg" @ msgcount),this.r,"getstring(client.addmessage)[i]";
msgcount ++;
}
}

if (i>0) client.addmessage = " ";
ydist = 20;
for (i=msgcount-1; i>=0; i--) {
size = cos((this.r-getstring(this.msg(i))[0])/10)*0.75;
si = 200+(msgcount-i)*3;
if (size>0.2) {
for (m=0; m<2; m++) {
showtext(si+m,screenwidth-20*size+m,screenheight-ydist+m,"Arial","r",makevar("this.msg" @ i));
changeimgzoom(si+m,size);
changeimgvis(si+m,14-m);
}
//screenwidth-24*size-(1-size)*16, Wtf do these do?
//screenheight-ydist-(1-size)*16; Wtf do these do?
changeimgvis(si+2,14);
changeimgzoom(si+2,size);
changeimgmode(si+2,1);
changeimgcolors(si,1,1,0.5,1);
changeimgcolors(si+1,0.7,0.4,0,1);
changeimgcolors(si+2,0.5,0.7,1,0.9);
ydist += size*20;
} else {
for (m=0; m<3; m++) hideimg(si+m);
for (j=i; j<msgcount; j++)
makevar("this.msg" @ j) = makevar("this.msg" @ j+1);

}
}
this.r += 0.05;
setTimer(0.05);
}




please point out any errors and their gs2 fixes. Like I said, I'm trying to learn to use the format better.


Also, attached is the original script. (maybe not original, but it's the working GS1 script I was using and converted.)
Attached Files
File Type: txt msgsys.txt (2.0 KB, 220 views)
__________________
torankusu's

Last edited by Torankusu_2002; 10-03-2005 at 04:51 AM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:39 PM.


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