Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-30-2009, 09:46 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
As far as I can tell, this works the same, but I don't understand "temp.p" and "temp.i", "temp.i.layer". I presume temp.i.layer is the same as changeimgvis, but what I don't understand is why the text being on layer 4 works, when I thought only 5 and up works for the screen instead of the playing field?
Layers 4+ are screen layers.

"temp.i" is a variable, which is pointing to the image object. When you use 'showtext' or 'showimg', it returns the actual image created (can also be obtained through findImg(index)).

Which means you could even do like (though it's not a good idea)

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.msg showtext(2003030"Arial""b""hi");
}
function 
changeText(text) {
  
this.msg.text text;

Kinda odd the way you're doing it. I would do it either like this:

PHP Code:
with (findimg(200)) {
  
500;
  
500;
  
  
text "Hello, world!";
  
  
font "Arial"// not sure if this is the variable name, use /scripthelp
  
fontface "b"// see above line
  
  
layer 4;
  
  
red 1;
  
blue .5;
  
green .5;
  
  
alpha 1;

or

PHP Code:
showtext(200500500 "Arial""b""Hello, world!");
changeimgvis(2004);
changeimgcolors(2001.5.51); 
Either works, but the top one is probably preferred (though I could be wrong; the top one seems to agree with GS2 standards whereas the bottom is for compatibility).
Quote:
This really confuses me as to why everyone says "GS2 is easier to understand" or "GS2 makes more sense" because GS1 makes sense to me, but looking at this stuff, I am like.. what?!
GS2 makes a lot more sense, and you'll understand it when you've been working with it longer.
Quote:
Originally Posted by Raelyn View Post
Ok, so if I take all my functions from my base system script, and make the classes all functions, I can just go through and replace all the functions listed in the script with:

PHP Code:
function onCreated() {
join("class_name");

Is that right? What is the echo? And will GS1 and GS2 mix? It seems like they mix, but only that GS2 doesn't work offline.. is that right?
GS1 and GS2 can mix, but it's strongly discouraged.

echo(message) simply outputs the message to NC (or RC if you have the server option enabled), and since he's echoing a function, it will echo whatever that function returns.

And yes, you can take all the functions you want to be in a shared class from the individual scripts and put them in a class, then join that class.


Edit (in response to designating clientside/serverside):
PHP Code:
join("class"); // serverside
//#CLIENTSIDE
function onCreated() {
  
classFunctionThatWillAlreadyWork();

or

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
join("class"); // clientside (not a good idea)
  
classFunctionThatWillNotWorkBecauseOfDelaysAndWillReportAnErrorToF2(); // ;)

__________________
Reply With Quote
  #2  
Old 04-30-2009, 10:27 PM
Raelyn Raelyn is offline
the Professional.
Raelyn's Avatar
Join Date: Sep 2003
Location: Zormite
Posts: 964
Raelyn will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
Layers 4+ are screen layers.

"temp.i" is a variable, which is pointing to the image object. When you use 'showtext' or 'showimg', it returns the actual image created (can also be obtained through findImg(index)).
This confuses the piss out of me, doesn't it just make more sense to reference the index directly than to try calling a variable pointing to the index?

Quote:
Originally Posted by cbk1994 View Post
Kinda odd the way you're doing it. I would do it either like this:
Heh, that was someone elses little snippet of code, like I said, I was trying to read/understand it, I actually did your suggestion below in MY script:

Quote:
Originally Posted by cbk1994 View Post
PHP Code:
showtext(200500500 "Arial""b""Hello, world!");
changeimgvis(2004);
changeimgcolors(2001.5.51); 
Quote:
Originally Posted by cbk1994 View Post
GS1 and GS2 can mix, but it's strongly discouraged.
Any specific reason? Functionally is bad? Or some "purist" idealism?


Quote:
Originally Posted by cbk1994 View Post
echo(message) simply outputs the message to NC (or RC if you have the server option enabled), and since he's echoing a function, it will echo whatever that function returns.
So basically, it's not needed to join a class?

Quote:
Originally Posted by cbk1994 View Post
Edit (in response to designating clientside/serverside):
PHP Code:
join("class"); // serverside
//#CLIENTSIDE
function onCreated() {
  
classFunctionThatWillAlreadyWork();

I thought anything behind // isn't read by the system, so how does tagging //serverside produce a difference in the code?
__________________
*Don't let the door hit you on the way out.*
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:05 AM.


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