PDA

View Full Version : Scripting Help



senorgordoburro
10-10-2007, 02:19 AM
I'm just starting to learn how to script and my first one will be a script that will keep my wizard and rogue permanently hasted, and would cast ewave when the wizard is either tapped or whispered to by the rogue. I plan on using lich/wizard and any pointers would be greatly appreciated. Also if there are any websites where I could read up on more in depth scripting would be helpful as well.

-Matt

Edited to add: Also will use psinet possible, but I have never used it before and will possible be starting to use this but will not know much about it.

Dwarven Empath
10-10-2007, 05:22 AM
start:

put look
match filter1 rogue's name grins at you
match filter2 rogue's name nods at you
match filter3 rogue's name smiles at you
matchwait



filter1:
put prep 506
waitfor You
put cast rogue's name
pause 3
goto start

filter2:
put prep 410
waitfor You
put cast
pause 3
goto start

filter3:
put prep 908
waitfor You
put cast at critter
pause 3
goto start


Something like that?

Medi...

Anebriated
10-10-2007, 09:44 AM
With PsiNet you could just shorten it up to:

filter1:
put 506 name
pause 3
goto start

Sthrockmorton
10-10-2007, 10:13 AM
If you really wanted to get crazy, you could also put variables into it, so that you can make the script adjustable to work with any person or creature. I think it'd look something like this:

>.hastehunting

start:

put look
match filter1 %1 grins at you
match filter2 %1 nods at you
match filter3 %1 smiles at you
matchwait



filter1:
put prep 506
waitfor You
put cast %1
pause 3
goto start

filter2:
put prep 410
waitfor You
put cast %2
pause 3
goto start

filter3:
put prep 908
waitfor You
put cast %2
pause 3
goto start


and now you would just start the script with ".hastehunting XXXX(char name) XXXX(creature name)"

Izzy
10-10-2007, 10:57 AM
If you really wanted to get crazy, you could also put variables into it, so that you can make the script adjustable to work with any person or creature. I think it'd look something like this:

>.hastehunting

start:

put look
match filter1 %1 grins at you
match filter2 %1 nods at you
match filter3 %1 smiles at you
matchwait



filter1:
put prep 506
waitfor You
put cast %1
pause 3
goto start

filter2:
put prep 410
waitfor You
put cast %2
pause 3
goto start

filter3:
put prep 908
waitfor You
put cast %2
pause 3
goto start


and now you would just start the script with ".hastehunting XXXX(char name) XXXX(creature name)"

You could also include a match like:
<filter1 %1 returns to normal speed>
in the start block to automate haste after the first grin.

Furthermore, using a %2 variable for the wizards targets limits him to 1 critter hunting zones. Using incant instead of cast %2 will be much more effective, just include a target random before. ie:

<filter3:
put target random
put incant 908
pause 3
goto start>

Also, you could use the %2 variable for the good mana leach targets in the area, and create a filter for that.

senorgordoburro
10-10-2007, 03:40 PM
Ok, I got some great tips from Gib as well, and kinda combined what he was saying with what you all are saying........
Let me know if you think this would work, and let me know where I dicked up please. Also, I cannot play right now due to my deployment so I can't test this for a few more weeks, but if any of you get bored, have at it.
Thanks


.haste wizard rogue


if_2 goto START2:
echo *********** SPECIFY A TARGET ************
exit
START2:
put prep 506
put cast %1%
goto NEXT2

NEXT2:
pause 4
put prep 506
put cast %2%
goto WAIT2

FILTER1:
put incant 410
pause 3
goto WAIT2

WAIT2:
match START2 things have returned to their normal speed
match NEXT2 %2% returns to normal speed
match FILTER1 %2% grins at you
matchwait

senorgordoburro
10-10-2007, 03:41 PM
Also, if someone could give me some pointers on how to put in mana checks it would be very helpful.

Thanks again

Donquix
10-10-2007, 04:16 PM
filter3:
match nomana Remaining: -
match nomana Remaining: 0
match nomana Remaining: 1
match nomana Remaining: 2
match nomana Remaining: 3
match nomana Remaining: 4
match nomana Remaining: 5
match nomana Remaining: 6
match nomana Remaining: 7
match filter3ok Mana Points
put mana
matchwait
filter3ok:
put prep 908
waitfor You
put cast at critter
pause 3
goto start

nomana:
echo YOU DO NOT HAVE ENOUGH MANA TO CAST THIS SPELL
goto start

senorgordoburro
10-10-2007, 04:34 PM
So something along the lines of this...


if_2 goto START2:
echo *********** SPECIFY A TARGET ************
exit
START2:
match nomana Remaining: -
match nomana Remaining: 0
match nomana Remaining: 1
match nomana Remaining: 2
match nomana Remaining: 3
match nomana Remaining: 4
match nomana Remaining: 5
match START2ok Mana Points
put mana
matchwait
START2ok:
put prep 506
put cast %1%
goto NEXT2

NEXT2:
pause 4
match nomana Remaining: -
match nomana Remaining: 0
match nomana Remaining: 1
match nomana Remaining: 2
match nomana Remaining: 3
match nomana Remaining: 4
match nomana Remaining: 5
match NEXT2ok Mana Points
put mana
matchwait
NEXT2ok:
put prep 506
put cast %2%
goto WAIT2

FILTER1:
match nomana Remaining: -
match nomana Remaining: 0
match nomana Remaining: 1
match nomana Remaining: 2
match nomana Remaining: 3
match nomana Remaining: 4
match nomana Remaining: 5
match nomana Remaining: 6
match nomana Remaining: 7
match nomana Remaining: 8
match nomana Remaining: 9
match FILTER1ok Mana Points
put mana
matchwait
FILTER1ok:
put incant 410
pause 3
goto WAIT2

WAIT2:
match START2 things have returned to their normal speed
match NEXT2 %2% returns to normal speed
match FILTER1 %2% grins at you
matchwait

nomana:
echo YOU DO NOT HAVE ENOUGH MANA TO CAST THIS SPELL
goto WAIT2

Shaelun
10-11-2007, 04:50 PM
It's a lot easier to take advantage of the difference in messaging when you try to transfer mana to someone. It's been forever since I wrote a Wizard script, but if you send 50 SomeGuyNotHere (or is it "send someguy 50" -- whatever) and you have 50 mana, it says that person isn't here. If you don't have 50 mana, it says you don't have that much.

AestheticDeath
10-11-2007, 05:10 PM
Shaelun, if I wrote a wizard script with more than 32 matchs, would it work being run through lich?

Donquix
10-11-2007, 05:36 PM
It's a lot easier to take advantage of the difference in messaging when you try to transfer mana to someone. It's been forever since I wrote a Wizard script, but if you send 50 SomeGuyNotHere (or is it "send someguy 50" -- whatever) and you have 50 mana, it says that person isn't here. If you don't have 50 mana, it says you don't have that much.

I never really did mana checks in my scripts, but you are right. That is much easier.

R>send 2 asklfjlaksjdk
I could not find what you were referring to.
>send 5 dfklgdlgj
You don't have that many points to transfer!
>mana
Mana Points: 3 Remaining: 3

match filter3ok I could not find
match nomana You don't have that many
send 8 thisnamedoesnotexist
matchwait

Shaelun
10-11-2007, 05:47 PM
Shaelun, if I wrote a wizard script with more than 32 matchs, would it work being run through lich?


Yes, it would. You can use as many MATCH lines with a Wizard-formatted script you have Lich run as you please. Hundreds or thousands, if you really want -- the only limit is the amount of RAM you have and how fast your processor is. You can also use SF script features if you want without using SF (Lich will run both scripts -- note though that for some reason that I never investigated fully, SBC doesn't work in Lich, even though the derivative script MTP does).

Personally I find it much faster and easier to write scripts that aren't in Wizard format, but if you don't have fun playing around with scripts and just want to get the job done with the least amount of hassle (as in without having to learn anything you don't already know), using something like 200 match lines is perfectly feasible.

AestheticDeath
10-11-2007, 05:51 PM
I guess I just never figured on ruby being easier than wizard.

I had at one point thought about looking at the scripts that come with lich to figure out how it works. But thats the time I was having trouble getting the repository to work.

Is there a way to list the script you have already downloaded with lich, in game?

Donquix
10-11-2007, 06:00 PM
ruby has a steeper learning curve obviously, it's a more robust language, but not prohibitively so.

Then once you learn it, it makes things a lot easier since you have so many more tools at your disposal.

Shaelun
10-11-2007, 06:11 PM
I'm not sure what's wrong with just looking in your "C:\Program Files\Lich\scripts" directory (like Wizard, Lich scripts are all individual files), but since you ask...

I can't remember if the "which.lic" script comes with the installer or not. It lists all scripts that match your input (if you give it none, all scripts are listed). That'd be the easiest way.

Once you get past the initial "wtf does that line mean...?", Lich scripts (Ruby language scripts) are so much easier than Wizard scripts it's almost comical. Just for fun to see how compact I could make it, I wrote a script (empheal.lic) that fully heals an empath of all wounds and scars (and only the ones currently afflicting the empath); it's 23 lines of code. Since Lich tracks things like the current state of your character, you can get what seems like a really complicated task done surprisingly easily.

For some people, basic programming concepts like loops and variables and stuff come naturally and are fun (the way a puzzle like Sudoku is fun). For other people, it's both horribly boring and hard. If you don't have any programming experience or have never written any sort of script except a Wizard script, getting the job done with a Wizard script will be faster and easier.

If you don't find it amusing to play with scripts, then there's really nothing to be gained by trying to learn how to write crazy Lich scripts -- you'll end up spending more time learning how to program than you'll be saving by not having to write tedious Wizard scripts.

AestheticDeath
10-11-2007, 06:17 PM
Right, the reason I ask, is because sometimes I forget what scripts I have, and I don't want to go through a bunch of folders outside the game to figure out which ones I have.

I don't recall how many wiz scripts I have, but I have easily over 50, and only having that many I can forget what exactly something is called.

So like the wiz has a pull down menu where you can get a list of all the scripts in your script folder... helps me a lot when I am trying to recall a script name..

As far as just opening a script in wordpad or something to look at it, yeah I have been using the folders like that.

AestheticDeath
10-11-2007, 06:24 PM
actually seems, the repository still isnt working for me

Shaelun
10-11-2007, 06:32 PM
actually seems, the repository still isnt working for me

I just don't know what to tell you about that. If you're absolutely positive that you're using a version of the script that came with v3.50 or v3.51, have tried deleting the "C:\Program Files\Lich\data\repository.sav" file -- then restarting the program (just incase... I'm pretty sure file changes go live the second the file changes, but I may be remembering wrong) -- I have to assume that the problem is elsewhere.

The server program is both active and working fine for me, as well as a few other people I've spoken to in the past week. If you really, really wanna get it working: exit the game (i.e. make sure the program is closed), just straight-up delete the "C:\Program Files\Lich" folder, and then run the "installer.exe" program again. No need to uninstall or anything, basically all you'd be doing is erasing all configuration data and then unzipping the program back to its brand-new defaults.

If you care enough and don't have anything you really don't wanna lose, that'll fix the problem if you're working off of a recent version.

AestheticDeath
10-11-2007, 06:38 PM
using 3.50 atm

ill try that in a bit