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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Freddybob
Newbie


Joined: 04 Feb 2012
Posts: 3

PostPosted: Sat Feb 04, 2012 10:08 pm   

Database record help
 
Hi im new in this forum so sry for posting wrong or something Smile
Im trying to make a script to summon my pets in a specific order. My database record looks something like this.

Phoenix | 1
Air | 3
Water | 2

untill here everything works fine.. but now i want zmud to send "cast (pet to summon first)" to my mud.. this is where i get stuck. Anyone got a good solution for this? sry if my explaination sux Rolling Eyes
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4686
Location: Pensacola, FL, USA

PostPosted: Sat Feb 04, 2012 11:20 pm   
 
Might work, untested.

#LOOP %numitems(@var) {#FORALL %dbkeys(@var) {#IF (@var.%j=%i) {cast %j}}}
_________________
Discord: Shalimarwildcat
Reply with quote
Freddybob
Newbie


Joined: 04 Feb 2012
Posts: 3

PostPosted: Sun Feb 05, 2012 5:20 pm   
 
damn! worked like a charm! thx alot!
now if i can ask another thing..
is there a simple way to change the order from an alias?
for example
"petorder Phoenix 3"
then phoenix canges place with Air?
managed to make a long ass trigger but i then my computer crashed and i lost it. Can remake it but im just looking if there is a simple way to do it rather that my 50 diffrent #if triggers :P
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4686
Location: Pensacola, FL, USA

PostPosted: Sun Feb 05, 2012 5:31 pm   
 
you can change the value of a givin pet via

#ADDKEY var Phoenix 3

But it would be up to you to maintain a unique value for each... if two items are both at 3, there is no guaranteeing which is cast first.
_________________
Discord: Shalimarwildcat
Reply with quote
Freddybob
Newbie


Joined: 04 Feb 2012
Posts: 3

PostPosted: Sun Feb 05, 2012 5:40 pm   
 
well since im like superlazy when i mud i want everything to be as automated as i can make it:) so i want the script to switch places so no pets get the same number!
guess i have to make my super long and overcomplex trigger then :) thx anyways!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4686
Location: Pensacola, FL, USA

PostPosted: Sun Feb 05, 2012 5:54 pm   
 
#ALIAS petswapper {
temp=@var.%1
#ADDKEY var %1 @var.%2
#ADDKEY var %2 @temp
}

just pass it the two pet names
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
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