Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-22-2008, 02:53 AM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
Array problem...

Im trying to make a script that records if youve been in a room or not and only records the room when you open a chest with a key in it. Im detecting this using a client.visitedroom (It wont always be client. just for testing) array but I cant change it from the script. I tried using client.visitedkeys[2]=#L; but that wouldnt work.
Reply With Quote
  #2  
Old 06-22-2008, 02:58 AM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
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
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
DO NOT MIX GS1 WITH GS2, please!


Does client.visitedkeys exist? client.visitedkeys[2] should be client.visitedkeys[2] = player.level.name; though.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #3  
Old 06-22-2008, 03:03 AM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
yes it exists o_o
Reply With Quote
  #4  
Old 06-22-2008, 03:24 AM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
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
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Can you show us the script please?
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #5  
Old 06-22-2008, 03:24 AM
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
PHP Code:
function onPlayerTouchsMe()
{
  if ( 
clientr.chestsOpened.index( @ this.level.name ) == -)
  {
    
clientr.chestsOpened.addthis.level.name );
    
// Stuff to do e.g. add a weapon
  
}

There's your chest script. Just need to use "clientr.chestsOpened.index( @ level ) == -1" to make sure they haven't been in it.
__________________
Reply With Quote
  #6  
Old 06-22-2008, 03:37 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
That script would only work if there was a one chest limit per level. It needs to have coordinates as well.
Reply With Quote
  #7  
Old 06-22-2008, 05:43 AM
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:
Originally Posted by DustyPorViva View Post
That script would only work if there was a one chest limit per level. It needs to have coordinates as well.


PHP Code:
function onPlayerTouchsMe()
{
  if ( 
clientr.chestsOpened.index( @ this.level.name "_" this."_" this.) == -)
  {
    
clientr.chestsOpened.addthis.level.name "_" this."_" this.);
    
// Stuff to do e.g. add a weapon
  
}

__________________
Reply With Quote
  #8  
Old 06-22-2008, 01:17 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
Stuff like

PHP Code:
clientr.("chestopened_" level.name) = true
would be best, because such arrays can become quite huge and each modification of a client/clientr variable needs to be sent to the client.
Reply With Quote
  #9  
Old 06-22-2008, 02:28 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Stefan View Post
Stuff like

PHP Code:
clientr.("chestopened_" level.name) = true
would be best, because such arrays can become quite huge and each modification of a client/clientr variable needs to be sent to the client.
Textfiles for the win.
__________________
Reply With Quote
  #10  
Old 06-22-2008, 05:15 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
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
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Crow View Post
Textfiles for the win.
Loading data once per session/update ftw.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #11  
Old 06-22-2008, 08:02 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:
Originally Posted by Stefan View Post
Stuff like

PHP Code:
clientr.("chestopened_" level.name) = true
would be best, because such arrays can become quite huge and each modification of a client/clientr variable needs to be sent to the client.


PHP Code:
function onPlayerTouchsMe()
{
  if ( ! 
clientr.( @ "chestsOpened_" this.level.name "_" this."_" this.) )
  {
    
clientr.( @ "chestsOpened_" this.level.name "_" this."_" this.) = true;
    
// Stuff to do e.g. add a weapon
  
}

__________________
Reply With Quote
Reply


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 11:25 PM.


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