This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

credit script?

Old posts that have not been replied to for several years.
Locked
User avatar
subtlepoint
Voice
Posts: 12
Joined: Sat Dec 11, 2004 4:25 pm

credit script?

Post by subtlepoint »

Can anyone tell me if there is a script that will give the eggdrops users credit for doing certain things... winning games, chan-idling, most words spoken.. etc.... I am really looking for something to protect certain public triggers from being used unless the user is willing to spend the required amount of credit to use the trigger. I imagine some of these attributes are probably used in rpg bots, but I am personally unfamiliar with them, so any help would be greatly appreciated!

thanks :D
subtlepoint
User avatar
subtlepoint
Voice
Posts: 12
Joined: Sat Dec 11, 2004 4:25 pm

bump

Post by subtlepoint »

if something like this does not already exist... can it be done? and if so would someone be so kind as to give me a few good coding references.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

anything can be done, once you have defined what your requirements are - namely, credit awarding criteria and triggers that need to be controlled
User avatar
subtlepoint
Voice
Posts: 12
Joined: Sat Dec 11, 2004 4:25 pm

thanks!

Post by subtlepoint »

you're right when you break it down like that it does seem easier. I guess the only real questions i have left is where would be the ideal place to store the credit that the users accrue, and how would i access that data from all of the scripts?

i.e: if i create a function to control the running of a script via public trigger (how would i access the users credit)? and if i were to create a function to reward users for winning games, chan-idel... etc... (where would be the best place to store the credit? userfile perhaps???)
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

userfile is the obvious and convenient choice (if you don't expect to have too many users to maintain credit of; otherwise, you may need to resort to external files or database)
User avatar
subtlepoint
Voice
Posts: 12
Joined: Sat Dec 11, 2004 4:25 pm

hrmm...

Post by subtlepoint »

thanks for all your help thus far :) is there a way to add a new entry-type to a user record in the userfile? I have looked a reference on how to manipulate user records, but have been only able to find a short list of commands, are there any better (more in depth) resources on this?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

all you need is in tcl-commands.doc

use the XTRA field of user record to store custom data (beware that its length is limited)
User avatar
subtlepoint
Voice
Posts: 12
Joined: Sat Dec 11, 2004 4:25 pm

Post by subtlepoint »

exactly what i was looking for... i have been looking at that document for the last 3 hours and somehow missed it. if it was a snake it would have bit me.

Thanks a ton
User avatar
subtlepoint
Voice
Posts: 12
Joined: Sat Dec 11, 2004 4:25 pm

Post by subtlepoint »

okay, i have most of my script done :mrgreen: .. i just have one more question. i would like to initialize the credit variable in the userfile when a new user signs up... just to give them a base amount of credit to start out with.. what would be the best way to go about this?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

bind join and initialize their credit upon creation of the user record
User avatar
subtlepoint
Voice
Posts: 12
Joined: Sat Dec 11, 2004 4:25 pm

hrm...

Post by subtlepoint »

i see what your saying... however my eggy is currently set up to learn users only when they register with it via the hello command. I can check if they are a valid user on join, but would not be able to change a variable in the user record until they actually went thru the process. Is there a way i can call a procedure upon creation of the user record?
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

something like this?

Post by user »

Code: Select all

bind msg - hello msg:hello
proc msg:hello {n u h a} {
	*msg:hello $n $u $h $a
	if {![validuser $h]&&[validuser [finduser $n!$u]]} {
		# created...do what ever you need to do
	}
}
Have you ever read "The Manual"?
User avatar
subtlepoint
Voice
Posts: 12
Joined: Sat Dec 11, 2004 4:25 pm

Post by subtlepoint »

awesome! thanks a lot folks :D
Locked