what is it I'm missing?

Post » Wed Oct 17, 2012 11:16 am

Noobie question. I thought the following lines would accomplish copying the player's strength to the variable currentSTR.

float currentSTR

set (player->GetStrength) to currentSTR

Anyway, I thought that this would find player's strength and assign its value to the variable currentSTR. Instead, I'm getting two error messages when I try to save the script in the TESCS.

1. function reference object 'currentSTR' not found
2. syntax error could not find variable 'getstrength'

Can someone set me straight on why this isn't working like I thought it should?

By the way, are the script error messages generated in the TESCS logged somewhere for review after closing the Script editor?

Thanks.
User avatar
Brooks Hardison
 
Posts: 3410
Joined: Fri Sep 07, 2007 3:14 am

Post » Wed Oct 17, 2012 10:17 am

Allright, you've got this backwards a bit.

Here's a script that should run.

Begin (name of script)float currentSTRif player -> GetStrength = ##   set currentSTR to ##endifend

See what you did wrong?

No clue what you're doing with this script, but you may need to copy that if/endif bracket about 100 times or so.
User avatar
Taylah Illies
 
Posts: 3369
Joined: Fri Feb 09, 2007 7:13 am

Post » Wed Oct 17, 2012 12:54 pm

I'm sure I've got it backwards, just not sure how :smile:

I'm not trying to change my player's attributes. All I want to do at this step is to find out what my player's attribute level is and then display that in a message box on the screen. I've already got a working script to show a message and have tested same to display some things such as ^PCName..

What I thought the script would do is to get the value of player's strength and place that value into the variable currentSTR I declared earlier. Obviously, what I thought my script would do is wrong, but I still don't understand where my logic is going astray.

What I thought was that 'player->GetStrength' returns the current value of player's strength.

What I expected was that 'the function (?) "Set ... To" would take the value returned by '(player->GetStrength)' and copy it into the variable 'currentSTR'. The script errors generated show that my understanding is wrong.
User avatar
Sasha Brown
 
Posts: 3426
Joined: Sat Jan 20, 2007 4:46 pm

Post » Wed Oct 17, 2012 9:21 am

First off, you need to add spaces between "player" "->" and "GetStrength" for the command to be read.

Second, the script I provided is a baseline, of sorts. What it does is check the player's strength value, and then sets the currentSTR variable to it.

Breaking it down...
if player -> GetStrength = ##

Means if a player's strength score is ##...
set currentSTR to ##

Then the currentSTR variable is set to ## (same number.)

You can then do whatever you want with the script in regards to what the currentSTR variable is supposed to fire off. This help?
User avatar
latrina
 
Posts: 3440
Joined: Mon Aug 20, 2007 4:31 pm

Post » Wed Oct 17, 2012 9:37 am

http://www.gamesas.com/index.php?&app=forums&module=extras§ion=legends# Just remember that the correct syntax is set Variable to Value, not the other way around. So, you should write

float currentSTR
set currentSTR to player->GetStrength

And no, spaces around -> are not mandatory as long as they are continuous (that is, either both or none)

The construct with if/endif described above, besides being terribly ineffective and wasteful, just will not work, because the == comparison only works correctly for integer values. :down:
User avatar
jasminĪµ
 
Posts: 3511
Joined: Mon Jan 29, 2007 4:12 am

Post » Wed Oct 17, 2012 9:00 am

I think you're missing the point, Marrs: JH doesn't want to change the player's strength, merely find out what it is.

Begin GetPlayerStrengthshort currentSTRset currentSTR to ( player->GetStrength )MessageBox "Your strength is %currentSTR"End
User avatar
Kim Kay
 
Posts: 3427
Joined: Fri Oct 13, 2006 10:45 am


Return to III - Morrowind