Register forum user name Search FAQ

Gammon Forum

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 ➜ first time scripting and I need help. spellup script for aardwolf

first time scripting and I need help. spellup script for aardwolf

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Kelli   USA  (7 posts)  Bio
Date Sun 18 Dec 2005 05:56 PM (UTC)
Message
Ok like I said I have never done any scripting before so I am new. I have asked others on Aardwolf (the game I play) for help and I have gotten limit unsuccessful help. here is what i want to do. Please be paitent as I know that this will be a long note. but hopefully I will have included on nessacery information. Plus what i have so far and the error that I got with it. If some one can tell me where i have gone wrong and how to fix it I will be greatly appreciative.

the script when commanded (spellup) will cast all known spells, Triggers will set varibles to remember which ones have been cast and which failed
when commanded (recast)will recast cast all known spells that failed the durning (spellup) and all spells that have worn off.
when commanded (remort) will set all spells to unknown

I know that i have to start by setting trigger that will set a variable in mush for each spell for cast = 1, failed/wore off = 2 , not known = 3.
there are differnt verbage that the world sends that will set the varible to 1 and 2. 3 will be set by the script when I type in "remort". that also has to be done by the script to correct and a trigger that fires the function? example:

"you are surrounded by a shield" trigger say function 'shieldu' that sets the variable to '1'
"your shield wears off" trigger say function 'sheildd' which sets the variable to '2'

is that part correct. coded in below but will be added to the rest of the code in the next section. (This part was wriiten at the time of the note)



function shieldu () {
world.SetVariable( "shield", 1 );
}
function shieldd () {
world.SetVariable( "shield", 2 );
}
function shieldf () {
world.SetVariable( "shield", 3 );
}



Now my problem is the cast/recast/remort part of the script. This is what i have so far:



function Spellup () {
if (world.GetVariable( "shield" ) == "1") {
World.send( "cast shield" ) };
}
function Recast () {
if (world.GetVarible( "sheild" ) == "2") {
World.send( "cast shield" ) };
}

function Remort () {
World.SetVariable ( "shield" ), "3");
}





I have put it in the plugins and I have gottin this error message. I have no clue as to what it is trying to tell me. I it as follows:

Line 3: Expected '<', got "f" (content not permitted here) (problem in this file)

this is for only one of the many spells in the game. I know that if i can get this one spell to work all the rest should work if i type the code in the same way replacing the spell name for "shield"


Ok I think that I have included every thing oh let me give aome system stat just in case they matter
windows xp
mushclint ver 3.65

I hope that is enough information. Any help will be gladly accepted. Please just remember that you are talking to a dumby though when it comes to this. thank you again for all your help

Enir
Top

Posted by RashinLord   Canada  (29 posts)  Bio
Date Reply #1 on Sun 18 Dec 2005 06:49 PM (UTC)
Message
I'm not entirely sure of your errors, but I'm sure Nick will get to you when he finds time.

However, if you don't need the script written in a specific language then maybe I can help you out by giving you the 'shell' of a script doing what you need.

Get back to me and I'll check this thread in a while.

-RL
Top

Posted by Kelli   USA  (7 posts)  Bio
Date Reply #2 on Sun 18 Dec 2005 07:16 PM (UTC)
Message
thank you for your quick reply... this is written in jscript as that is the only language that i know a little bit about. not enough to do anything but i have been learning java it self and i am seening many of the same syntax. I think a lot of it will tranfer over. but any help that you can give will be greatly appreciated.

Enir
Top

Posted by Nick Gammon   Australia  (23,162 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 21 Dec 2005 03:40 AM (UTC)

Amended on Wed 21 Dec 2005 03:41 AM (UTC) by Nick Gammon

Message
It is hard to know where to start here. Obviously you are doing this as a plugin, and you haven't included the code at line 3 of the plugin, where the error message is.

I would be doing it as a straight script until you get it working.

See "Introduction to scripting" page:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6030

This function has lots of problems:


function Recast () {
if (world.GetVarible( "sheild" ) == "2") {
World.send( "cast shield" ) };
}



  • It is "world", not "World".

  • It is "Send" not "send"

  • It is "shield" not "sheild"

  • It is "GetVariable" not "GetVarible"


Start small, get each function to work, one at a time. Don't code hundreds of lines and then start debugging.

You need a lot of attention to detail, that is 4 spelling mistakes in 4 lines.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kelli   USA  (7 posts)  Bio
Date Reply #4 on Wed 21 Dec 2005 03:45 AM (UTC)
Message
wow i did not see that.. I have looked at it over and over again. I am not good at my spelling so I wanted to make sure that was not the problem I will start it over again...
and read the page you have sent. thanks for the help
kelli
Top

Posted by Kelli   USA  (7 posts)  Bio
Date Reply #5 on Sun 08 Jan 2006 06:40 PM (UTC)
Message
just wanted to say thank you to every one that helped with this script. I have completed it and it is working great. Nick I did just do it as a stright scrip and not a plugin. I thank you for you patence and understandin...

I do have one question thought for a new project. Can a script use a wild card from an alias? and if so where would i get information on how to do that. example "spellup kelli" in which the wildcard would be kelli. this is so i can cast my spells on others.

Thanks again for allthe help
Kelli
Top

Posted by Nick Gammon   Australia  (23,162 posts)  Bio   Forum Administrator
Date Reply #6 on Sun 08 Jan 2006 10:49 PM (UTC)
Message
Yes you can, they wouldn't be much use otherwise. The exact method depends on whether you are doing "send to script" or calling a separate script function. There will be lots of examples on this forum.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


24,193 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.