New server feature - Event command scripts

Forum Archive - from http://theuniversal.net
User avatar
morbydvisns
Posts: 1889
Joined: Sun Jan 30, 2005 12:51 am

Post by morbydvisns »

thats cool im not going anywhere Xd
User avatar
Malkiah
Posts: 397
Joined: Thu Nov 25, 2004 2:23 am
Location: Rock Island, IL, USA
Contact:

Post by Malkiah »

This is uber coolness, I think the best addition to the server ever.
User avatar
VDZ
Posts: 1205
Joined: Wed Apr 07, 2004 11:32 am
Location: Netherlands

Post by VDZ »

Not for three months? o.O
User avatar
Theros_12
Posts: 156
Joined: Mon Nov 13, 2006 4:53 am
Location: USA

Post by Theros_12 »

So do all the codes people have posted work or do only the ones mit posted work?
User avatar
VDZ
Posts: 1205
Joined: Wed Apr 07, 2004 11:32 am
Location: Netherlands

Post by VDZ »

The stuff Mit has confirmed will work.
As for the unconfirmed stuff, we don't know yet.
User avatar
VDZ
Posts: 1205
Joined: Wed Apr 07, 2004 11:32 am
Location: Netherlands

Post by VDZ »

NewBuilding works perfectly fine.
Same thing with UseItem.

*msg works as planned, but has one small problem: it does not show the user what he just typed, or even confirm that the command was used correctly.

Buildingpurchase just doesn't seem to work to me.

You can make comments without any prefix; however, in lines with command requiring arguments, the comments are used as arguments. This can be solved by putting // in front of your comments.

MonthDate, GameDate and Listen don't work. I haven't tried the others, but we can safely assume they weren't suddenly implemented without announcement.

You can try to use invalid events; the server program will just give an error in the log, then skip the invalid event.
User avatar
VDZ
Posts: 1205
Joined: Wed Apr 07, 2004 11:32 am
Location: Netherlands

Post by VDZ »

The Usable Items are named "Usable Item 1", "Usable Item 2", etc, until "Usable Item 32", and they work exactly like they should.

The script is very flexible. Identation and case sensitivity don't matter. For example, the following event works perfectly:

Code: Select all

Event(                   "uSeItEm",         "uSaBlE iTeM 1") {
*command=say It's alive! Alive!
OMG COMMENT }
However, *command=COMMANDNAME MUST be exactly like that; add even a single space, and it stops working.
User avatar
VDZ
Posts: 1205
Joined: Wed Apr 07, 2004 11:32 am
Location: Netherlands

Post by VDZ »

Sorry for posting four times in a row, but a summary of how event scripts work and stuff like that can be found at http://editthis.info/universalwiki/Event_command_script.
User avatar
morbydvisns
Posts: 1889
Joined: Sun Jan 30, 2005 12:51 am

Post by morbydvisns »

i use building purchase on ariya no prob... heres the script i use for when houses are purchesed (and theres one the same, for the 'newbuilding' event

Code: Select all

Event( "buildingpurchase","29" )
{
*command=say %Player% has bought itself a house! =)  
*command=msg %player% be sure and stock your house with plenty of food items.
*command=msg %player% return home when you leave you will auto-eat while offline to stay alive
*command=grantitem %player% 10 raw chicken
*command=grantitem %player% 10 cooking oil
*command=grantitem %player% 10 steak package
*command=grantitem %player% 10 power
*command=grantitem %player% 10 hemp tea
*command=msg %player% Here are a few helpful items to start with.
} 
Last edited by morbydvisns on Thu Apr 12, 2007 1:55 am, edited 2 times in total.
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post by Mit »

i feel ive struck a nerve here, vdz ;] Glad you seem to be enjoyin it :) and it seems to be working to the level i expected. Will try to get a few more of the events done soon.
User avatar
VDZ
Posts: 1205
Joined: Wed Apr 07, 2004 11:32 am
Location: Netherlands

Post by VDZ »

Mit wrote:i feel ive struck a nerve here, vdz ;]
Uh...is that a good thing or a bad thing? (I'm not English :P)
Anyways, yeah, I'm pretty interested in this stuff.
The real awesomeness comes when conditional operations are added, though.
User avatar
zaroba
World Owner
World Owner
Posts: 7257
Joined: Fri Oct 10, 2003 11:06 pm
Location: Hereford, PA
Contact:

Post by zaroba »

what about the ability to put the buildings name into the message?
maybe a %BUILDINGNAME% entry?

assuming that building number 13 is a town (it is on zoric and sab):

Code: Select all

Event( "NewBuilding", "13" ) 
{ 
*command=say %PLAYER% has established the town of %BUILDINGNAME% 
} 
User avatar
zaroba
World Owner
World Owner
Posts: 7257
Joined: Fri Oct 10, 2003 11:06 pm
Location: Hereford, PA
Contact:

Post by zaroba »

hmm..heres an odd one.

i'm a sysop on the world..scripts with granting aren't working
an account with owner powers is on the world (zaroba_owner using the server pc), scripts still aren't working.

they were working fine until the owner account got disconnected a few days ago and i didn't put it back on.
User avatar
zaroba
World Owner
World Owner
Posts: 7257
Joined: Fri Oct 10, 2003 11:06 pm
Location: Hereford, PA
Contact:

Post by zaroba »

damn multiple running of scripts...

script says:

Event("UseItem", "Lambchop Meal")
{
*command=grantitem %PLAYER% 1 Salad
*command=grantitem %PLAYER% 1 Lamb Chops
*command=grantitem %PLAYER% 1 Cola
*command=grantitem %PLAYER% 1 Ice Cream
}


ingame it runs it 3 times...

You gained 1 Salad
You were just granted 1 Salad
You gained 1 Pork Chops
You were just granted 1 Pork Chops
You gained 2 Cola
You were just granted 2 Cola
You gained 1 Ice cream
You were just granted 1 Ice Cream
You gained 1 Salad
You were just granted 1 Salad
You gained 1 Pork Chops
You were just granted 1 Pork Chops
You gained 2 Cola
You were just granted 2 Cola
You gained 1 Ice cream
You were just granted 1 Ice Cream
You gained 1 Salad
You were just granted 1 Salad
You gained 1 Pork Chops
You were just granted 1 Pork Chops
You gained 1 Cola
You were just granted 1 Cola
You gained 1 Ice cream
User avatar
morbydvisns
Posts: 1889
Joined: Sun Jan 30, 2005 12:51 am

Post by morbydvisns »

i had this prob when i was putting them in the gamescript.mts file and each time i refresh it would add another layer of scripting for somehow... when started using the servergamescript and only weaps in gamescript, all was well
User avatar
Archlord
Posts: 32
Joined: Sun Apr 22, 2007 2:10 am
Location: Deep in the darkest pits of hell...MONKEY HELL THAT IS!!

Post by Archlord »

so if I wanted a random player(s) house removed, money taken, Uterly humiluated I could use this 'event command' thingy to do it?

Would it take effect all at random or it a set time? Or both?
User avatar
VDZ
Posts: 1205
Joined: Wed Apr 07, 2004 11:32 am
Location: Netherlands

Post by VDZ »

Archlord wrote:so if I wanted a random player(s) house removed, money taken, Uterly humiluated I could use this 'event command' thingy to do it?
Nope. There's no randomness yet.
User avatar
Jayecifer
Posts: 475
Joined: Tue Apr 10, 2007 11:37 pm
Location: Ames, Iowa
Contact:

Post by Jayecifer »

There is no true random when it comes to programming. There is always a pattern.
User avatar
Archlord
Posts: 32
Joined: Sun Apr 22, 2007 2:10 am
Location: Deep in the darkest pits of hell...MONKEY HELL THAT IS!!

Post by Archlord »

Patterns, that'll take a little bit of work But it'll do.

THX 8)
User avatar
VDZ
Posts: 1205
Joined: Wed Apr 07, 2004 11:32 am
Location: Netherlands

Post by VDZ »

Jayecifer wrote:There is no true random when it comes to programming. There is always a pattern.
Alright, have it your way: There is no way to produce a seemingly random result yet.
Locked