Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-24-2010, 12:31 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Question about "autodetecting" variables.

okay, so i'm trying to set up my system to read a variable and use that variable to create the name of another variable to read from. say if i wanted a weapon to calculate damage from an unusual stat such as say, accuracy. i could just put something like damagebase=accuracy in the weapon file to make things easier.

in this example, we're just going to manually set the kind of damage the weapon would be using in client.weapon_damagebase.

with this line, i can get it to put together an existing variable name:
PHP Code:
this.damagebase "client.stats_" client.weapon_damagebase
so if i send this.damagebase through to the player's chat, they'll say "client.stats_accuracy"

now the actual problem is that although i've managed to make it put that together, i cant figure out how to tell it to read from that variable since my attempts have always made this.damagebase return "client.stats_accuracy". i think my problem is that it's treating what's stored, as a string, and not actually a variable. what would i use to tell it to read from the actual client.stats_accuracy variable in this manner?
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
 

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


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