the SERVER scripting thread
Moderator: EUO Moderators
- LordMortiferus
- MACRO > me
- Posts: 872
- Joined: Tue Dec 01, 2009 10:23 pm
Re: the scripting thread
You are still limited to 250x250, or what ever the numbers are, tiles for a map. In fact to use the copy&paste script effectively you have set the size of the map you want to paste to prior. The script will not resize your map if the chunk is larger than the destination.
- Keighn
- Stop posting already --;
- Posts: 5509
- Joined: Sat Jun 26, 2004 10:13 am
- Location: Hey.... pssttt Back in Orgeon
Re: the scripting thread
Ah good to know. No mega mega 1kx1k maps. Someday perhaps.
- LordMortiferus
- MACRO > me
- Posts: 872
- Joined: Tue Dec 01, 2009 10:23 pm
Re: the scripting thread
@Egg, @Ched:
Can I use the following function as a delay/sleeptimer to create custom heartbeats of less than a second without causing havoc to the server?
Edit:
I tested the sleep function using a switch that moves the player several tiles with sleep in between. It does work, however any action done by the player is delayed until the end of the switch script.
Here is the raft script atm:
Can I use the following function as a delay/sleeptimer to create custom heartbeats of less than a second without causing havoc to the server?
Code: Select all
function sleep(n) -- seconds.milliseconds
local t0 = os.clock()
while os.clock() - t0 <= n do end
end
I tested the sleep function using a switch that moves the player several tiles with sleep in between. It does work, however any action done by the player is delayed until the end of the switch script.
Here is the raft script atm:
Code: Select all
function sleep(n) -- seconds.milliseconds
local t0 = os.clock()
while os.clock() - t0 <= n do end
end
function cc_waterslide(id,x,y,z)
p = get_sent_ptr(id)
map=get_map_ptr(z)
local_msg(p,"\29You grab one of the rotten rafts, lower it into the water and hop onto it before the current takes it away.")
local xys = {{9,61,0.5},{8,61,0.5},{7,61,0.5},{6,61,0.5},{5,61,0.5},{4,61,0.5},{3,61,0.5},{2,61,0.5},
{2,60,1},{2,59,1},{2,58,1},{2,57,1},{2,56,1},{2,55,1},{2,54,1},{2,53,1},{2,52,1},{2,51,1},{2,50,1},{2,49,1},{2,48,1},{2,47,1},{2,46,1},
{3,46,0.5},{4,46,0.5},{5,46,0.5},{6,46,0.5},{7,46,0.5},
{8,48,0.4},{9,48,0.4},{10,48,0.4},{11,48,0.4},{12,48,0.4},{13,48,0.4},
{12,52,0.3},{11,52,0.3},{10,52,0.3},{9,52,0.3},{8,52,0.3},{7,52,0.3},{6,52,0.3},
{7,55,0.2},
{8,57,0.2},{9,57,0.2},{10,57,0.2},{11,57,0.2},{12,57,0.2},{13,57,0.2},{14,57,0.2},{15,57,0.2},{16,57,0.2},{17,57,0.2},{18,57,0.2},
{17,61,0.2},{16,61,0.3},{15,61,0.3},{14,61,0.3},{13,61,0.4},{12,61,0.4}}
for i = 1,#xys do
set_and_send_new_tile(xys[i][1], xys[i][2],z, 40)
if i > 1 then
set_and_send_new_tile(xys[i-1][1], xys[i-1][2],z, 126)
end
send_player_to_xy(p.id, xys[i][1], xys[i][2])
if xys[i][1] == 12 and xys[i][2] == 52 then
local_msg(p,"\29There seens to be a good spot ahead to reach the south shore!")
elseif xys[i][1] == 12 and xys[i][2] == 61 then
local_msg(p,"\29There seens to be a good spot ahead to reach the south shore!")
sleep(0.2)
set_and_send_new_tile(xys[i][1], xys[i][2],z, 126)
local_msg(p,"\29The raft sinks! You better get on land quick!")
return
end
update_everyones_fov(x,y,z)
sleep(xys[i][3])
end
end
Re: the scripting thread
Yeah, this kind of sleep-functions use to freeze the whole program. Therefore GUI-kits use to offer different sleep-like functions (which keep the GUI intact). Perl/Tk, for example, offers the after()-method.LordMortiferus wrote:Can I use the following function as a delay/sleeptimer to create custom heartbeats of less than a second without causing havoc to the server?
....
Edit: I tested the sleep function using a switch that moves the player several tiles with sleep in between. It does work, however any action done by the player is delayed until the end of the switch script.
Now, EUO isn't written in Tk, but there should be something similar.
If I remember correctly, EUO keeps jumping into the script again and again. Maybe you could just set a global counter in the script. And return from the function unless the counter has reached a certain value.
Not sure, as I can't test anything here, of course.
- LordMortiferus
- MACRO > me
- Posts: 872
- Joined: Tue Dec 01, 2009 10:23 pm
Re: the scripting thread
Thanks for the info Cel. I am not totally sure what you mean though by jumping into the script again and again - If I am not mistaken that is only the case with a heartbeat function which is called every second. Other scripts are only executed once as far as I know. I wouldn't mind if the GUI locks up as long anything else, especially the server, is save.
You can use EftV to test scripts for EUO. Execute moasv.exe to open the debug window and then you can start EtfV to test stuff.
Edit: you can close moasv.exe with ctrl+c
You can use EftV to test scripts for EUO. Execute moasv.exe to open the debug window and then you can start EtfV to test stuff.
Edit: you can close moasv.exe with ctrl+c
Last edited by LordMortiferus on Thu May 21, 2015 5:45 am, edited 2 times in total.
- LordMortiferus
- MACRO > me
- Posts: 872
- Joined: Tue Dec 01, 2009 10:23 pm
Re: the scripting thread
I found this page on LUA sleep functions
So in my example I am using a "Busy Wait" which is not performance friendly. Would the following function be any better:
So in my example I am using a "Busy Wait" which is not performance friendly. Would the following function be any better:
Code: Select all
function sleep(n)
local ntime = os.clock() + n
repeat until os.clock() > ntime
end
- LordMortiferus
- MACRO > me
- Posts: 872
- Joined: Tue Dec 01, 2009 10:23 pm
Re: the scripting thread
Rock paper shotgun has an interview with the creator of Brogue (roguelike game) about random dungeon creation. I paste a link to the interview here in case someone is interested and I may return to it and read it myself when I have more time.
- LordMortiferus
- MACRO > me
- Posts: 872
- Joined: Tue Dec 01, 2009 10:23 pm
Re: the scripting thread
For those who are eager to learn some scripting basics, Kris from Ancient Dos Games / Pixelmusement made a crash course video on old QBasic:
- Keighn
- Stop posting already --;
- Posts: 5509
- Joined: Sat Jun 26, 2004 10:13 am
- Location: Hey.... pssttt Back in Orgeon
Re: the scripting thread
My brother in law was mentioning his interest in programming and he says he does it for fun. Oddly, the college he's attending has him run through the basics and math. Seems he was rusty enough to have to take the classes. I hadn't realized a lot of businesses will have various workers program while at home and send in the work. I guess contracting out in some degree.
I still read and look at it but just can't grasp the language. Couldn't even learn Spanish which is far simpler IMHO. Ah, if only gaming think tanking paid.
I still read and look at it but just can't grasp the language. Couldn't even learn Spanish which is far simpler IMHO. Ah, if only gaming think tanking paid.
- Keighn
- Stop posting already --;
- Posts: 5509
- Joined: Sat Jun 26, 2004 10:13 am
- Location: Hey.... pssttt Back in Orgeon
Re: LUA, server API, etc
I know the fontain script was posted at one time. I don't suppose it and all the search scripts for weekly could be posted?
I'm hoping that someday the other servers has a version of those as well but obviously not to the uber extent. Chances would have to be tweaked as well. Its something in games I always enjoyed along with puzzles and descriptions. Probably why I like a lot of Catherines maps is because she has some hidden stuff in there even though a lot of the quests aren't activated. There is some storyline plot in all the maps that could be even more awesome than the game already is.
I have the scripts to the uber mobs Rusty and Rush and a few others developed as well. I haven't seen the comparison to those and the PD anniversary edition ones. I believe they were a little less powerful so not to insta kill everyone on the PD server.
I'm hoping that someday the other servers has a version of those as well but obviously not to the uber extent. Chances would have to be tweaked as well. Its something in games I always enjoyed along with puzzles and descriptions. Probably why I like a lot of Catherines maps is because she has some hidden stuff in there even though a lot of the quests aren't activated. There is some storyline plot in all the maps that could be even more awesome than the game already is.
I have the scripts to the uber mobs Rusty and Rush and a few others developed as well. I haven't seen the comparison to those and the PD anniversary edition ones. I believe they were a little less powerful so not to insta kill everyone on the PD server.
Re: LUA, server API, etc
FIrst link in the first post is dead
An ascended monk.
http://euotopia.com/plyr.php?p=Nechtan&serv=PD
http://euotopia.com/plyr.php?p=Nechtan&serv=PD
Re: LUA, server API, etc
updated:
http://swut.net/files/eao.pkg.cpp
still the worst documented api in teh world
and in case anyone didn't realise, this is same api as for EftV single player version, in case you felt like hacking/modding it
http://swut.net/files/eao.pkg.cpp
still the worst documented api in teh world
and in case anyone didn't realise, this is same api as for EftV single player version, in case you felt like hacking/modding it
- LaughingCoyote
- egg has really fucked this game up :(
- Posts: 1090
- Joined: Fri Jan 02, 2004 10:30 pm
Re: LUA, server API, etc
Is there a complete item code list somewhere? Trying to find the item code for greater yellow potions in the euo>dat> .txt files and can't find it.
Hecate wrote: I feel even more evil than ever, milking cows before killing them.
eggmceye wrote:pretty cool having vigour put in the manual after 14 years
- LordMortiferus
- MACRO > me
- Posts: 872
- Joined: Tue Dec 01, 2009 10:23 pm
Re: LUA, server API, etc
LC you are on the right track looking through the dat folder.
As stated in other.txt 0x104 is the base item code for yellow pots. If I am not mistaken 0x3f0104 would be for greater pots
0x1f0104 improved
0x2f0104 refined
0x3f0104 greater
Same goes for blue pots (0x105), heck you can make any item greater adding 0x3f0.
As stated in other.txt 0x104 is the base item code for yellow pots. If I am not mistaken 0x3f0104 would be for greater pots
0x1f0104 improved
0x2f0104 refined
0x3f0104 greater
Same goes for blue pots (0x105), heck you can make any item greater adding 0x3f0.
- EmoMage
- Girls only want boyfriends who have great skills.
- Posts: 772
- Joined: Tue Aug 06, 2013 10:10 am
Re: LUA, server API, etc
that's neat
eggmceye wrote:ParadoxOfChoice wrote: Zombie using bow/sling probably shouldn't give disease.
the zombies are pulling the arrows out of their ass
- LordMortiferus
- MACRO > me
- Posts: 872
- Joined: Tue Dec 01, 2009 10:23 pm
Re: LUA, server API, etc
Max: do we have or could you add an API-function to play existing wavefile SFX via LUA?
Re: LUA, server API, etc
depends on the wav file
There is no existing mechanism for the server to make the client play a wav on it's own. What there is is the event system which could be exploited potentially without mods (I'll find out after writing this para). Events are either sound fx or visual fx and are non essential -ie if the client dropped all the event packets it wouldn't matter.
As far as the API goes, there are 2 funcs: send_event and simple_send_event. the latter uses less params and was written for lua in mind.
if your sound was used by one of the events in enum event_nums,
you could just use send_event to send that, eg
subtype is only used by magic (it is the spell#) and missiles and splats
if you wanted to play a spell sound then you would have to send the magic event, but that would also show the visual fx. If you wanted just the spell sound, which is a good idea, then I would have to come up with a mod for that to happen
There is no existing mechanism for the server to make the client play a wav on it's own. What there is is the event system which could be exploited potentially without mods (I'll find out after writing this para). Events are either sound fx or visual fx and are non essential -ie if the client dropped all the event packets it wouldn't matter.
As far as the API goes, there are 2 funcs: send_event and simple_send_event. the latter uses less params and was written for lua in mind.
if your sound was used by one of the events in enum event_nums,
Code: Select all
enum event_nums {
EVENT_STEP=0,
EVENT_MAGIC,
EVENT_HIT,
EVENT_MISS,
EVENT_QUAKE1,
EVENT_QUAKE2,
EVENT_MISSLE,
EVENT_TRAP,
EVENT_GUN,
EVENT_LASER,
EVENT_HIT2,
EVENT_WHIT,
EVENT_TELE,
EVENT_TELEFRAG,
EVENT_FDEATH,
EVENT_MDEATH,
EVENT_WDEATH,
EVENT_BLOCKED,
EVENT_PARRIED,
EVENT_RIPOSTE,
EVENT_PORTAL_UP,
EVENT_PORTAL_DOWN,
EVENT_STEAL,
EVENT_SHOOT, // not gun!
EVENT_THUNDERCLAP,
EVENT_CRITICAL,
};
Code: Select all
send_event(z, -1, x, y, EVENT_STEAL, 0) -- 0 at the end is the event subtype
if you wanted to play a spell sound then you would have to send the magic event, but that would also show the visual fx. If you wanted just the spell sound, which is a good idea, then I would have to come up with a mod for that to happen
- LordMortiferus
- MACRO > me
- Posts: 872
- Joined: Tue Dec 01, 2009 10:23 pm
Re: LUA, server API, etc
Thanks for the detailed informations.
EVENT_GUN should be what I was looking for.
EVENT_GUN should be what I was looking for.
send_event(z,-1,x,y,EVENT_MISSLE,MISSLE_BULLET,rx,ry)
send_event(z, -1, x, y, EVENT_GUN, 0)
- LordMortiferus
- MACRO > me
- Posts: 872
- Joined: Tue Dec 01, 2009 10:23 pm
Re: LUA, server API, etc
EVENT_GUN is for pistole/guns SFX
EVENT_SHOOT is for bows/crossbows SFX
What about slings and throwing axes SFX?
EVENT_SHOOT is for bows/crossbows SFX
What about slings and throwing axes SFX?
- LordMortiferus
- MACRO > me
- Posts: 872
- Joined: Tue Dec 01, 2009 10:23 pm
Re: the scripting thread
For my own reference:
Code: Select all
m.range =
0x00 -- no range attack
0x01 to 0x0f -- arrow attack with increasing range
0x11 to 0x1f -- rock attack with increasing range
0x21 to 0x2f -- fireball attack with increasing range
0x31 to 0x3f -- sling/gun attack with increasing range
0x41 to 0x4f -- laser attack with increasing range
0x51 to 0x5f -- axe attack with increasing range
If m.range is used with m:set_thaco(0) than the mobs will not use a range attack but will keep the distance to the player defined by m.range.