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 01-20-2011, 07:47 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Problem with simple script

PHP Code:
//#CLIENTSIDE
function onPlayerchats(){
  if(
player.level in serverr.socialzones){
    
client.exp += 1;
  }

the level I'm testing is in serverr.socialzones, I've tried both with and without quotes but no luck. when I try putting an else{player.chat = player.level SPC serverr.socialzones;} the results visibly match.


What's going on?
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #2  
Old 01-20-2011, 07:49 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
player.level.name in serverr.socialzones

Also try..

temp.socialzones = serverr.socialzones.tokenize(",");

in case your "array" isn't properly formatted.
__________________
Quote:
Reply With Quote
  #3  
Old 01-20-2011, 07:58 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by fowlplay4 View Post
player.level.name in serverr.socialzones

Also try..

temp.socialzones = serverr.socialzones.tokenize(",");

in case your "array" isn't properly formatted.
player.level.name fixed it, thanks. I must ask of course, what did .name do exactly? returning player.level and player.level.name though chat yield visually the same thing.
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #4  
Old 01-20-2011, 08:02 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Jiroxys7 View Post
player.level.name fixed it, thanks. I must ask of course, what did .name do exactly? returning player.level and player.level.name though chat yield visually the same thing.
Player.level is an object, not a string. Thus, you must access the 'name' variable of the object by appending '.name' to the end of 'player.level'.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #5  
Old 01-20-2011, 08:05 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by Tigairius View Post
Player.level is an object, not a string. Thus, you must access the 'name' variable of the object by appending '.name' to the end of 'player.level'.
ah, thank you.
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #6  
Old 01-20-2011, 08:14 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 Jiroxys7 View Post
player.level.name fixed it, thanks. I must ask of course, what did .name do exactly? returning player.level and player.level.name though chat yield visually the same thing.
As a part of the dynamic typing in GScript, if you try and represent an object as a string (which would have been what you did when you set player.chat = player.level;), then it automatically is showing the object name. However, this does not happen when you are working with the object itself because there is no such type conversion taking place, therefore you need to access the name attribute manually.
__________________
Skyld
Reply With Quote
  #7  
Old 01-22-2011, 12:07 AM
AlexanderK AlexanderK is offline
Registered User
AlexanderK's Avatar
Join Date: Mar 2006
Location: Germany
Posts: 79
AlexanderK is on a distinguished road
Send a message via MSN to AlexanderK
I'm new to this, but shouldn't the experience be stored in a clientr. variable so it is safe?
Reply With Quote
  #8  
Old 01-22-2011, 12:11 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by AlexanderK View Post
I'm new to this, but shouldn't the experience be stored in a clientr. variable so it is safe?
client would actually not be safe from trainer abusers and "hackers" I agree so.. really I'unno prolly not though.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #9  
Old 01-22-2011, 12:47 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 AlexanderK View Post
I'm new to this, but shouldn't the experience be stored in a clientr. variable so it is safe?
Yes (note that this would require triggering serverside to set it.)
__________________
Reply With Quote
  #10  
Old 01-22-2011, 01:08 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by AlexanderK View Post
I'm new to this, but shouldn't the experience be stored in a clientr. variable so it is safe?
Wordy yes.

Yes thats a perfectly fine way to do it, as long as it's being validated on the server-side.

Provided the EXP system is checking EXP on the server-side after it's added then there's no problem with trainers/CEs since they can only change the visible value to the client.

Unless they manipulate the client in such a way that it allows them to exploit a method to earn exp.
__________________
Quote:
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 09:31 AM.


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