Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-19-2006, 09:58 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
variable values in string names

Why won't this work? The trigger and parameter is being received fine, it's just not writing it in to the player's strings right:
PHP Code:
for(this.i=0;this.i<26;this.i++)
      {
        if(
client.varr_@this.i==|| this.i==25)
        {
          
client.varr_@this.i=params[2];
        } 
      } 
Reply With Quote
  #2  
Old 05-19-2006, 10:31 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Must be
client.("varr_" @ this.i)

See http://wiki.graal.net/index.php/Crea...ring_variables
Reply With Quote
  #3  
Old 05-19-2006, 11:39 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
And also, you might want to improve your styling..
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #4  
Old 05-20-2006, 02:51 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Also is it possible to add strings, like in C++ client.string1 may be 'hel' and client.string2 is 'lo' and client.string1+client.string2='hello'?
Reply With Quote
  #5  
Old 05-20-2006, 03:18 AM
Luigi203 Luigi203 is offline
Hamma Time
Luigi203's Avatar
Join Date: Mar 2003
Location: North East PA
Posts: 285
Luigi203 is on a distinguished road
Send a message via AIM to Luigi203
client.string1 = "hel";
client.string2 = "lo";
player.chat = client.string1 @ client.string2;

Thats what @ is. It appends two strings together.
__________________


CAUTION
Reply With Quote
  #6  
Old 05-20-2006, 03:33 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Well, I'm trying this, Shouldn't this work?
PHP Code:
      client.e_mail_messages=(client.e_mail_messages " Message: " client.("e_mail_" this.i)); 
Reply With Quote
  #7  
Old 05-20-2006, 04:44 AM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
You don't need parenthasis on the outside of the value.

NPC Code:
client.e_mail_messages = client.e_mail_messages @ " Message: " @ client.("e_mail_" @ this.i);



that would work.
Reply With Quote
  #8  
Old 05-20-2006, 03:41 PM
Luigi203 Luigi203 is offline
Hamma Time
Luigi203's Avatar
Join Date: Mar 2003
Location: North East PA
Posts: 285
Luigi203 is on a distinguished road
Send a message via AIM to Luigi203
What the hell, Hachi? It doesnt matter if he has 100 parentheses as long as he closes them up on the other side.

client.e_mail_messages=(((((client.e_mail_messages @ " Message: " @ client.("e_mail_" @ this.i))))));

would do the same thing as


client.e_mail_messages=client.e_mail_messages @ " Message: " @ client.("e_mail_" @ this.i);

To the author, what exactly are you trying to do? if client.e_mail_messages is a string list and you want to add to it use

client.e_mail_messages.add(" Message: " @ client.("e_mail_" @ this.i));

so, it will add to the actual list rather than appending to the end of the last thing in the list.
__________________


CAUTION
Reply With Quote
  #9  
Old 05-20-2006, 03:57 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by excaliber7388
Why won't this work? The trigger and parameter is being received fine, it's just not writing it in to the player's strings right:
As Stefan said:
PHP Code:
this.index 3;
client.("foo_" this.index) = 4
... would be the same as doing:
PHP Code:
client.foo_3 4
Also.
PHP Code:
this.index 3;
client.("foo_" this.index).bar.baz 4
... would be the same as doing:
PHP Code:
client.foo_3.bar.baz 4
__________________
Skyld
Reply With Quote
  #10  
Old 05-21-2006, 06:06 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Well, currently, I have a few problems. First, the quotes around all the variables, second word wrap isn't working, and finally, the "none" string for an empty message space isn't being read.
Test for none:
for(this.i=0;this.i<26;this.i++)
{
if(!client.("email_"@this.i)=="none")
{
client.email_messages.add(" Message: " @ client.("email_" @ this.i));
}
}
Screen shot of problem is below:
Attached Thumbnails
Click image for larger version

Name:	messages.gif
Views:	143
Size:	4.4 KB
ID:	36467  
Reply With Quote
  #11  
Old 05-21-2006, 06:11 PM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
Quote:
Originally Posted by Bl0nkt
You don't need parenthasis on the outside of the value.
@ Mag (Luigi203) >:{
Reply With Quote
  #12  
Old 05-21-2006, 06:15 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
XD Still, the "" confuse me, since they seem to be comming out of no where, ad not all the strings have extra ""
Reply With Quote
  #13  
Old 05-21-2006, 07:23 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by excaliber7388
XD Still, the "" confuse me, since they seem to be comming out of no where, ad not all the strings have extra ""
The new engine, during array to string conversion, makes arrays take on an old engine "string list" appearance, i.e.
PHP Code:
this.foo = {"bar", {"baz""rtr"}}; 
... is essentially:
PHP Code:
setstring this.foo,"bar,"baz,rtr""
__________________
Skyld
Reply With Quote
  #14  
Old 05-21-2006, 07:39 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Is it possible to inturupt this list to make it a vertical list?
ex:
Message: "hey",
Message "whatever",
etc
Reply With Quote
  #15  
Old 05-21-2006, 08:06 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Uh..

NPC Code:

this.var = {"message1", "message2"};
for (i = 0; i < this.var.size(); i ++) {
chat = this.var[i];
sleep(3);
}




I dont really get what you need help with..
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #16  
Old 05-21-2006, 08:15 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
it's for displaying the string in the gui, I want it to seperate, so that each new message is on a sepperate line
Reply With Quote
  #17  
Old 05-21-2006, 08:18 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
If you use a GuiMLTextCtrl you can do:


NPC Code:

new GuiWindowCtrl( "window" )
{
new GuiMLTextCtrl( "text1" ) {
x = 10, y = 10;
width = 150, height = 150;

text = "";
}
}



and to add text..

NPC Code:

text1.addtext( "text here", 0);

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #18  
Old 05-21-2006, 08:56 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by xXziroXx
If you use a GuiMLTextCtrl you can do:


NPC Code:

new GuiWindowCtrl( "window" )
{
new GuiMLTextCtrl( "text1" ) {
x = 10, y = 10;
width = 150, height = 150;

text = "";
}
}



and to add text..

NPC Code:

text1.addtext( "text here", 0);

And will that work serverside, this is also for a chat window for an ingame DR chat, and every player will need to see what is changed.

Last edited by excaliber7388; 05-21-2006 at 10:02 PM..
Reply With Quote
  #19  
Old 05-22-2006, 07:11 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
To add to an array
obj.add("lols");

to delete
obj.remove("lols"); <--Must be inside the array

to display
message( format("%s is the first index of the array", obj[0]) );

normally, you get left over "" for some reason, it's best to trim the obj
temp.trimmedaccount = player.account.trim();
obj.add( temp.trimmedaccount );


Infact, read this
http://wiki.graal.net/index.php/Crea...ject_functions

Last edited by xAndrewx; 05-22-2006 at 09:08 PM..
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 12:31 PM.


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