 |
Turnip Beginner
Joined: 22 Jan 2003 Posts: 11 Location: United Kingdom
|
Posted: Wed Jan 22, 2003 8:13 pm
Replacing text in a variable - help needed |
Hello everyone
I am having problems replacing text. I have a flee_mob variable and i can capture the fleeing mobile into it.I can also capture the flee_dir into a variable.
What I want to do is change the text of the variable before I send my reattack string, so If the mob is vampire(1), I want to send @flee_dir;k v1;kick v1 instead of @flee_dir;k vampire1;kick vampire1.
The text i recieve from the mud is:
*The (@FLEE_MOB) has dropped all his equipment and left by going (@FLEE_DIR). {I trigger on this to capture the variables}
*This fight is at an end!. {I trigger on this to reattack}
There are a lots of different mobs to kill I'd like to be able to replace all their names with the shortened form of their names followed by their number - newt7=n7, troll50=t50 etc but I can't just take the first letter of the mob as some of the mobs don't have shortnames to use or its the first AND second letter and so i'd need to be able to define what each mob is changed to.
So I think I need the %replace command and create a @flee_mob string list but I just don't know where to start :(
Also as fleeing mobs can run many rooms away very quickly it would be great if this could be as short and as quick a script as possible :)
So...anyone got any idea of the best way of scripting this?
Hope someone can help.
Turnip |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Jan 23, 2003 12:22 am |
Will the long names work? That is, will "k vampire1" do the same thing as "k v1"? If so, the "short and quick" way to do this is to just use the long name. You won't be the one typing it, and it will take zMUD far less time to send the additional 6 letters than it will to look up the short name (by any method I can think of).
Otherwise, the best I can think of is a database (or at least a database variable) and a complicated (slow) script to look up each and every mob that flees, find it's short name, and make the substitution (or notify you when it can't find the mob so you can decide what to call it).
LightBulb
Senior Member |
|
|
 |
Turnip Beginner
Joined: 22 Jan 2003 Posts: 11 Location: United Kingdom
|
Posted: Thu Jan 23, 2003 9:00 am |
Ok, thanks Lightbulb - I'll leave it as it is.
Turnip |
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|