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

Posted by Kelli on Sun 18 Dec 2005 05:56 PM — 7 posts, 29,381 views.

USA #0
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
Canada #1
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
USA #2
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
Australia Forum Administrator #3
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.
Amended on Wed 21 Dec 2005 03:41 AM by Nick Gammon
USA #4
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
USA #5
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
Australia Forum Administrator #6
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.