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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
galldron
Novice


Joined: 08 Nov 2002
Posts: 34
Location: Elanthia

PostPosted: Sun Jun 01, 2003 9:58 am   

Dragonrealms Login Script (script edited)
 
Please excuse my severe inability to transfer what I want to get accross from my pea-brain to these documents. This is my first script so feel free to respond with complaints or ideas for improvement.
I don't like having multiple settings files for dragonrealms because so many of my macro's triggers and other settings are the same for multiple characters. My way around this was to set up a class folder for each of my characters and one for Common settings. Then I placed the appropriate settings in thier respective folders.

#CLASS {Login} {enable}
#TRIGGER {Welcome back!} {
inf
awaken
}
#TRIGGER {Name:*character2} {
exp
#class Characterfolder1 0
#class Characterfolder2 1
#class RestMode 0
#name character2
#class Login 0
}
#TRIGGER {Name:*character1} {
exp
#class Characterfolder1 1
#class Characterfolder2 0
#class RestMode 0
#name character1
#class Login 0
}
#CLASS 0

For each charater you will need to update with the appropriate Character. If you then set the login class to enable on connection it will run every time and then disable itself after doing the appropriate work.

My typing skills are second lowest only to my coding skills!
Reply with quote
RobMacAF
Apprentice


Joined: 09 Jun 2002
Posts: 186
Location: USA

PostPosted: Tue Dec 02, 2003 6:17 pm   
 
Ok, I have improved on this script, Well. Its an improvement in my book. I was having problems because by playing multiple characters when I signed it with another I would be at the location of where my last played character was on the map. So I did this...Oh yeah, this is for DRAGON REALMS


#CLASS {Login} {enable}
#TRIGGER {~[*~]} {inf}
#TRIGGER {Name: Brolt} {
#class Brolt 1
#name Brolt
#VAR LogonName Brolt
#TELEPORT @BroltRoom
#class Login 0
}
#TRIGGER {Name: *Vaunais} {
#class Vaunais 1
#name Vaunais
#VAR LogonName Vaunais
#TELEPORT @VaunaisRoom
#class Login 0
}
#CLASS 0
#ALIAS quit {#IF (@LogonName = "Brolt") {#VAR BroltRoom = %roomnum;#ECHO "Saved Room: " %roomnum;Exit};#IF (@LogonName = "Vaunais") {#VAR VaunaisRoom = %roomnum;#ECHO "Saved Room: " %roomnum;Exit}}

--------------------------------------------
This is an explaination of what each thing does

#CLASS {Login} {enable}
#TRIGGER {~[*~]} {info}
This types info when the first room is received. This is to get the players name

#TRIGGER {Name: *Brolt} {
This is the first trigger to see if I am playing Brolt. It is looking for his name from the info command above. The * before Brolt is incase I have a title on.

#class Brolt 1
This turns on the Brolt Class which is just a class in the main directory tree

#name Brolt
This sets the window name as Brolt so you know who you are playing

#VAR LogonName Brolt
This sets the LogonName as Brolt. This is needed to save the info of the last room this character was playing in

#TELEPORT @BroltRoom
This teleports you to the room last saved for Brolt in the variable @BroltRoom

#class Login 0
This turns off the Login Class so that it doesn't run again, We only want it to run once when iit starts up
}


#TRIGGER {Name: *Vaunais} {
#class Vaunais 1
#name Vaunais
#VAR LogonName Vaunais
#TELEPORT @VaunaisRoom
#class Login 0
}
#CLASS 0

This is the same thing as for brolt, but just for my second character, Vaunais.


#ALIAS quit {#IF (@LogonName = "Brolt") {#VAR BroltRoom = %roomnum;#ECHO "Saved Room: " %roomnum;Exit};#IF (@LogonName = "Vaunais") {#VAR VaunaisRoom = %roomnum;#ECHO "Saved Room: " %roomnum;Exit}}

Last but not least is this section. This is what saves the room you are in so it can teleport you to it when you log on. Just change the names so they are the ones of your characters, or add more by copying one of the #IF statements all the way to the first of the last }. Then just change the names accordingly



Hope you like this and that it helps all of you with multiple characters. If you have any questions just contact me

-RobMacAF
Reply with quote
Valint
Wanderer


Joined: 12 Nov 2003
Posts: 70
Location: USA

PostPosted: Wed Dec 03, 2003 6:20 am   
 
For Gemstone (and presumably Dragonrealms), the gsB code contains the character name and is sent on logon. (Well, it used to be sent on logon; GSIV now only sends it when you resync. This is likely a bug.)

Remember that you can use variables within variable names. That allows for a more generalized version of what you're trying to do, such as:

#TRIGGER {B} {#VAR LogonName %replace( %gsl( B), 0);#CLASS @LogonName 1;#NAME @LogonName;#TELEPORT @{@LogonName}Room} "Login" {gsl|case}

This presumes that DR still sends the gsB code when you logon. If not, you can always add #TEMP {~[*~]} {resync} to your atconnect alias to force the code to be sent.

Also, aliasing things to the quit command is probably a bad idea--if the session ends through other means (such as getting booted), that alias won't be called. Instead, add this command to the 'atdisconnect' alias (the alias called whenever you disconnect):

#VAR %expand(@charname)room %roomnum
#ECHO "Saved Room: " %roomnum
Reply with quote
RobMacAF
Apprentice


Joined: 09 Jun 2002
Posts: 186
Location: USA

PostPosted: Wed Dec 03, 2003 2:42 pm   
 
I know that you can inline variables unto variables, I have used it in alot of other scripts, I just wanted to make this easy to understand and use. Also by laying it the way that I did there is alot less room for error, usually the more fancy I make a script, the more likely it is to turnout results that I don't want. Also, if the game quit becuase you got booted then more then likely you will just relog right back on so the room usually doesn't matter, I konw that isn't always the case but I was just trying to keep things simple. Thanks for the suggestions though
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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