Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion Goto page Previous  1, 2
shaun.murray Posted: Tue May 13, 2008 4:19 pm
working with stringlist... (starting over)
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Wed May 14, 2008 7:20 pm   
 
Ok... I've added that, but it just kills the mobname. If there is more then one in the room, it needs to be putting the number. I was thinking...

Code:
#local $nextmob $newval;#loopdb @mob_list {#if (%val > 0) {$nextmob = %key;$newval = %val - 1;#addkey mob_list %key $newval;#break}};#if ($nextmob <> "") {kill %key"."$nextmob} {#show no more mobs}
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Wed May 14, 2008 7:29 pm   
 
Hmmmm... That gives me....

kill .<mobname>

Also try'n this. But it doesn't seem to be working either.

Code:
#variable bdetect 0;#local $nextmob $newval;#loopdb @mob_list {#if (%val > 0) {$nextmob = %key;$newval = %val - 1;#addkey mob_list %key $newval;#break}};#if ($nextmob <> "") {kill %concat(%key"."$nextmob)} {#show no more mobs}}
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed May 14, 2008 8:36 pm   
 
Ah, so you need to do, say: 'kill stallion.1'. In that case, you don't need to know the number of mobs, you can just do the first one. Once that one is dead, there will be a new first. So you only need ".1".

Try: kill %concat($nextmob,".1")
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed May 14, 2008 8:38 pm   
 
Also, you have this code within an alias or trigger, right? You aren't trying to type the above at the command line each time?
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Wed May 14, 2008 8:51 pm   
 
No. What needs to be done is: kill 2.stallion or kill 8.sow or kill 1.rooster (kill rooster works as well, but to keep it simplified, if there is only one, kill 1.rooster works as well) Thats why I'm looking to do kill %concat(%key,".",$nextmob) and I think i was missing the commas, hence it not working properly.

I've got it in the trigger for the pools. Capital letters being the first part. The second is that I have a variable @bkill, and if its not 1, it won't initiate combat. So... If I don't have a script loaded, it won't do anything, and when I initiate combat, I set that variable to 1, and when a mob dies, I reset it back to 1 so that it can move to the next mob (hence the need for it to loop thru in a controlled manner).

However... kill %concat(%key,".",$nextmob) is only sending kill .<mobname> to the mud. What happened to the %key?
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Wed May 14, 2008 9:32 pm   
 
Is there any particular reason you want to issue kill by number? Sorry I haven't read closely into every reply of this thread.

Or does your MUD disallow using "kill something" syntax and has to have it with "kill 1.something", "kill 2.something" when there's
mob's line in room and has a number attached to it?

Sorry again if I'm sounding confusing or something.


Prog
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Wed May 14, 2008 9:39 pm   
 
No... There is no issue with a 'kill sow' or anything. But if there are 4 of them in a room, you can identify each one, with a number dot preceding the mobname. So... In light of that, if you do 'kill sow' 4 times, its the same as doing 'kill 4.sow' 'kill 3.sow' 'kill 2.sow' 'kill 1.sow'... They both get the same effect competed.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu May 15, 2008 12:50 am   
 
I am confused here. If there are 4 mobs with the same keyword in the room and you do "kill mobname" 4 times, only the first mob should get the affects. I would think you'd have to identify each mob by a prefix to acquire a specific target. A mobname without a prefix is the same as 1.mobname.
_________________
Sic itur ad astra.
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Thu May 15, 2008 1:41 am   
 
Ok... LoL. Here goes. If you walk into a room, and there is 4 sheeps, 2 cows, and one pig. You would do either one of the following attack sequences...

1. kill sheep; kill sheep; kill sheep; kill sheep; kill cow; kill cow; kill pig
-or-
2. kill 4.sheep;kill 3.sheep;kill 2.sheep;kill 1.sheep;kill 2.cow;kill 1.cow;kill 1.pig

They both work. I'm not really caring right now which method gets used, as they both end up with the same results. (However, if I did have a choice, I'd rather have option 2 be it... So that as it goes thru the killing, I can see which mob number I'm on... But the end result, it matters not.) And yes. 1.pig is the same as just pig.

Quote:
If there are 4 mobs with the same keyword in the room and you do "kill mobname" 4 times, only the first mob should get the affects.


Well... When you do kill mobname, and it dies, then the 2.mobname would be replaced to 1.mobname, 3.mobname would move down to 2.mobname, and 4.mobname would move to 3.mobname. Make sense?
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu May 15, 2008 1:08 pm   
 
I don't really see any need to do 4.sow, 3.sow, 2.sow, 1.sow. If you want to see how many are left, you can just put a #show statement in there to tell you. If you really really feel the need to have the numbers, try this:
kill %concat(%val,".",$nextmob)
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Thu May 15, 2008 1:29 pm   
 
Huh... Ok, I haven't enabled the "when the mob dies, move to the next mob" trigger/variable in there. And I haven't quite totally ran thru that code to figure it out yet. So when it kills that mob, it moves to the next one on the list? If so.. Works for me! LoL! I will work on it manually here in a minute. Thanks again Rehab for ALL your help! =D
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu May 15, 2008 1:52 pm   
 
The code I've given just check what mob is next on the list to be killed. You still have to write something to tell when it is time to run this code, e.g. when you enter a new room and when the current mob dies. But figuring out how this works should help you a lot. Good luck!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net