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 08-15-2007, 08:23 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
serverr flag array trouble

Okay, so I'm making an Events System, and I have the events setup like this:
Theres 4 different event types, each has it's own multidimensional array with the
event names and their data in it. What I'm stuck on is trying to make a list of each event in its category in serverr flags. Ex: serverr.events.contest=Musical Chairs, Emoticons

Now, to spare you with all the for loops and such, here's essentially what I'm trying to do:
PHP Code:
temp.testtype = {"race""spar"};
temp.elist.race = {{"Foot Race","bla"}, {"Bush Race","bla"}};
temp.elist.spar = {{"Spar","bla"}, {"Classic Spar","bla"};
serverr.events.(@ temp.testtype[0])[0] = temp.elist.(@ temp.testtype[0])[0][0];
serverr.events.(@ temp.testtype[0])[1] = temp.elist.(@ temp.testtype[0])[1][0];
serverr.events.(@ temp.testtype[0])[0] = temp.elist.(@ temp.testtype[1])[0][0];
serverr.events.(@ temp.testtype[0])[1] = temp.elist.(@ temp.testtype[1])[1][0]; 
My problem is that the serverr flags will not set.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #2  
Old 08-15-2007, 01:20 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
PHP Code:
temp.testtype = {"race""spar"};
temp.elist.race = {{"Foot Race","bla"}, {"Bush Race","bla"}};
temp.elist.spar = {{"Spar","bla"}, {"Classic Spar","bla"};

serverr.events.(@ temp.testtype[0]) = {};
serverr.events.(@ temp.testtype[0])[0] = temp.elist.(@ temp.testtype[0])[0][0];
serverr.events.(@ temp.testtype[0])[1] = temp.elist.(@ temp.testtype[0])[1][0];

serverr.events.(@ temp.testtype[1]) = {};
serverr.events.(@ temp.testtype[1])[0] = temp.elist.(@ temp.testtype[1])[0][0];
serverr.events.(@ temp.testtype[1])[1] = temp.elist.(@ temp.testtype[1])[1][0]; 
hmm?

I think you need to initialize the array first, for example with {} or new[1]
__________________
Reply With Quote
  #3  
Old 08-15-2007, 03:36 PM
dNeonb dNeonb is offline
OOB
dNeonb's Avatar
Join Date: Feb 2003
Location: Germany
Posts: 1,240
dNeonb is on a distinguished road
Send a message via ICQ to dNeonb Send a message via AIM to dNeonb Send a message via Yahoo to dNeonb
Not releated to the script but to the whole thing. If you make an event system it would be more useful to use a database npc to store all the event informations. If you have many events or long texts it might be a problem.
Yesterday I updated the serverflags on GK Debug because I wanted to add a new tool type. But I was not able to add it, the limit of variables in the serverflags was reached.

Think about it.
__________________

Forum PM
AIM GraalNeoN
ICQ 201894166
Reply With Quote
  #4  
Old 08-15-2007, 04:05 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
First of all, let me just tell you that Bjorn is right. Use a DB instead of serverr. strings. Now to answer your question..


Quote:
Originally Posted by Chompy View Post
I think you need to initialize the array first, for example with {} or new[1]
Indeed. You cant edit a part of an array that doesnt exist.

serverr.flag = new[5];
serverr.flag[2] = "lol";

Just an example on how to do it before you set the data.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #5  
Old 08-15-2007, 08:08 PM
Horrified Horrified is offline
Rediculously inactive
Join Date: Jul 2007
Posts: 961
Horrified is on a distinguished road
Send a message via ICQ to Horrified Send a message via AIM to Horrified Send a message via MSN to Horrified Send a message via Yahoo to Horrified
Quote:
Originally Posted by dNeonb View Post
But I was not able to add it, the limit of variables in the serverflags was reached.
Uh sorry but, do you know the exact limit?
Reply With Quote
  #6  
Old 08-15-2007, 08:48 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Horrified View Post
Uh sorry but, do you know the exact limit?
The limit is in the RC's editing window itself not the actual server flags. The limit is most likely 255 characters.
__________________
Reply With Quote
  #7  
Old 08-15-2007, 08:59 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Inverness View Post
The limit is in the RC's editing window itself not the actual server flags. The limit is most likely 255 characters.
Yep, and it should be removed as you stated in that other thread..
__________________
Reply With Quote
  #8  
Old 08-15-2007, 11:06 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by dNeonb View Post
Not releated to the script but to the whole thing. If you make an event system it would be more useful to use a database npc to store all the event informations. If you have many events or long texts it might be a problem.
Yesterday I updated the serverflags on GK Debug because I wanted to add a new tool type. But I was not able to add it, the limit of variables in the serverflags was reached.

Think about it.
...I am using a database npc. I'm trying to set serverr flags so that my event tool doesn't have to do 436263 triggers.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #9  
Old 08-16-2007, 01:15 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
I believe Database NPCs are a bit unsafe for information thats not set in the script since if its in flags only it could be cleared on reset.

For things like that I use TStaticVars that save to file.

By the way, there is a serveroption that limits you to only changing existing server flags rather than being able to create new ones, make sure thats not enabled?
Quote:
Originally Posted by coreys View Post
...I am using a database npc. I'm trying to set serverr flags so that my event tool doesn't have to do 436263 triggers.
Like Ziro said, the array has to be existing before you can edit an index of it, though it is possible to add to non-existant arrays since it will just create one if there isn't one existing.
PHP Code:
serverr.events.(@ temp.testtype[0]) = new [2];
serverr.events.(@ temp.testtype[0])[0] = temp.elist.(@ temp.testtype[0])[0][0];
serverr.events.(@ temp.testtype[0])[1] = temp.elist.(@ temp.testtype[0])[1][0];
//OR
serverr.events.(@ temp.testtype[0]) = {
  
temp.elist.(@ temp.testtype[0])[0][0],
  
temp.elist.(@ temp.testtype[0])[1][0]
}; 
Use the second one
Quote:
Originally Posted by Chompy View Post
I think you need to initialize the array first, for example with {} or new[1]
You still can't edit index 1 as you did in your code because it doesn't exist, only index 0.
__________________
Reply With Quote
  #10  
Old 08-16-2007, 01:53 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
I personally use database npcs that backup data to a file on update. This uses the least gserver usage (HD usage) in most cases where you don't need to update much.

About editing array members that do not yet exist, make your own function if you want that simply array.add()'s if the array.size() < the member you want to edit (or so).
__________________
Do it with a DON!
Reply With Quote
  #11  
Old 08-16-2007, 04:47 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Chompy helped me make it work. Just used new[]...although, for whatever reason new[] didn't work for me before, in the same exact script.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #12  
Old 08-16-2007, 12:13 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Inverness View Post
You still can't edit index 1 as you did in your code because it doesn't exist, only index 0.
I forgot new[] indexes start at 1 xD

But Vash, I would suggest what Inver told ya to do:

Quote:
Originally Posted by Inverness View Post
PHP Code:
serverr.events.(@ temp.testtype[0]) = {
  
temp.elist.(@ temp.testtype[0])[0][0],
  
temp.elist.(@ temp.testtype[0])[1][0]
}; 
But that's if you know the size ;o
__________________
Reply With Quote
  #13  
Old 08-17-2007, 08:37 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
new[i] is such where i is the count, not an index.

It's kind of like doing:
var.count() = i;

Of course the syntax for that is completely wrong and such a thing is impossible.
__________________
Do it with a DON!
Reply With Quote
  #14  
Old 08-17-2007, 06:21 PM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is a jewel in the roughMysticalDragon is a jewel in the rough
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
try databases serverr flags dont use arrays anyway
__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]



Reply With Quote
  #15  
Old 08-17-2007, 06:30 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 MysticalDragon View Post
try databases serverr flags dont use arrays anyway
You can use arrays in serverr. variables because the Graal engine treats arrays as specially delimited strings; they are not a distinctive datatype in terms of storage.
__________________
Skyld
Reply With Quote
  #16  
Old 08-17-2007, 07:49 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by Skyld View Post
You can use arrays in serverr. variables because the Graal engine treats arrays as specially delimited strings; they are not a distinctive datatype in terms of storage.
:o
inteereestiiinggggg

But I already knew arrays worked in serverr flags anyways, they have for as long as I can remember.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #17  
Old 08-17-2007, 10:49 PM
Relinquish Relinquish is offline
Banned
Join Date: Aug 2007
Posts: 7
Relinquish is on a distinguished road
serverr flags should not be used, at all, there are bugs in the communication of them from server -> client.
The server seems to randomly forget to send some clients the updated variable, or forgets to send the variable period, which leads to some massive problems.
Reply With Quote
  #18  
Old 08-17-2007, 10:52 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Relinquish View Post
serverr flags should not be used, at all, there are bugs in the communication of them from server -> client.
The server seems to randomly forget to send some clients the updated variable, or forgets to send the variable period, which leads to some massive problems.
What? What are you talking about? O.o
__________________
Reply With Quote
  #19  
Old 08-17-2007, 11:25 PM
Relinquish Relinquish is offline
Banned
Join Date: Aug 2007
Posts: 7
Relinquish is on a distinguished road
If you're on a populated server and change a serverr string a lot, and then have each player echo what they read it as each time it's changed, some of the players will eventually start echo'ing what an old string was, since the server didn't send them the updated string properly.
Reply With Quote
  #20  
Old 08-18-2007, 05:11 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by Relinquish View Post
If you're on a populated server and change a serverr string a lot, and then have each player echo what they read it as each time it's changed, some of the players will eventually start echo'ing what an old string was, since the server didn't send them the updated string properly.
Or whatever server you're doing this on is fsked, 'cause I've never had this problem o.0
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #21  
Old 08-18-2007, 05:37 AM
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
Quote:
Originally Posted by Relinquish View Post
If you're on a populated server and change a serverr string a lot, and then have each player echo what they read it as each time it's changed, some of the players will eventually start echo'ing what an old string was, since the server didn't send them the updated string properly.
I dont know about the problem you speak of, never encountered it on Zodiac or Maloria.
__________________
Follow my work on social media post-Graal:Updated august 2025.

Last edited by Skyld; 08-18-2007 at 01:27 PM.. Reason: Stop spamming my forums with useless stuff. If you have something to say to him, use forum PMs.
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:54 PM.


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