Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Jscript
➜ Question about variables
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Shaun Biggs
USA (644 posts) Bio
|
| Date
| Tue 31 Jul 2001 08:59 PM (UTC) |
| Message
| I'm trying to have a script check flags to see if I have already cast certain spells. Every time I try to assign or compare the variables I get error messages about type mismatches or not being able to assign data into that variable type.
I have been trying one of these two methods:
world.getVariable( "zSpellAff_armor" ) = "true";
if ( world.getVariable( "zSpellAff_armor" ).isEqual( "true" ) )...
world.getVariable( "zSpellAff_armor" ) = 1;
if ( world.getVariable( "zSpellAff_armor" ) == 1 )...
What am I doing wrong with both of these, and how can I fix it? |
It is much easier to fight for one's ideals than to live up to them. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,169 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Tue 31 Jul 2001 10:48 PM (UTC) Amended on Tue 31 Jul 2001 10:49 PM (UTC) by Nick Gammon
|
| Message
| I presume that the first line in each example is supposed to set the variable, not get it? I also presume you are using JScript here? They should read:
world.setVariable( "zSpellAff_armor", "true" );
if ( world.getVariable( "zSpellAff_armor" ) == "true" ) ...
In the first line, the value to set must be inside the function call. In the second line, you simply test for '== "true"' - you don't have to use IsEqual.
world.setVariable( "zSpellAff_armor", 1);
if ( world.getVariable( "zSpellAff_armor" ) == 1 ) ...
My earlier remarks apply to line 1 above, the second line was fine.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Shaun Biggs
USA (644 posts) Bio
|
| Date
| Reply #2 on Fri 03 Aug 2001 03:44 AM (UTC) |
| Message
| | Didn't notice the SetVariable command. Thank you very much for helping me out. Since you seem to know just about everything, do you know how I can get this Michael Jackson song out of my head? |
It is much easier to fight for one's ideals than to live up to them. | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
10,254 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top