the SERVER scripting thread

"eventually EUO will get to the point its (sic) unplayable" - Dudle

Moderator: EUO Moderators

Re: the scripting thread

Postby LordMortiferus » Sun Nov 02, 2014 5:33 am

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.
User avatar
LordMortiferus
MACRO > me
 
Posts: 818
Joined: Tue Dec 01, 2009 10:23 pm

Re: the scripting thread

Postby Keighn » Sun Nov 02, 2014 7:01 am

Ah good to know. No mega mega 1kx1k maps. Someday perhaps.
User avatar
Keighn
Stop posting already --;
 
Posts: 4965
Joined: Sat Jun 26, 2004 10:13 am
Location: Exiled fucking again.... Georgia ATM!!!

Re: the scripting thread

Postby LordMortiferus » Sun May 17, 2015 9:59 pm

@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?
Code: Select all
function sleep(n)  -- seconds.milliseconds
  local t0 = os.clock()
  while os.clock() - t0 <= n do end
end


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:
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
User avatar
LordMortiferus
MACRO > me
 
Posts: 818
Joined: Tue Dec 01, 2009 10:23 pm

Re: the scripting thread

Postby Celerion » Wed May 20, 2015 9:34 am

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.

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.
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.
Celerion
I'll be going back to Tibia next week.
 
Posts: 49
Joined: Sat Dec 15, 2012 6:29 am

Re: the scripting thread

Postby LordMortiferus » Thu May 21, 2015 2:12 am

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
Last edited by LordMortiferus on Thu May 21, 2015 5:45 am, edited 2 times in total.
User avatar
LordMortiferus
MACRO > me
 
Posts: 818
Joined: Tue Dec 01, 2009 10:23 pm

Re: the scripting thread

Postby LordMortiferus » Thu May 21, 2015 5:20 am

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:
Code: Select all
function sleep(n)
  local ntime = os.clock() + n
  repeat until os.clock() > ntime
end
User avatar
LordMortiferus
MACRO > me
 
Posts: 818
Joined: Tue Dec 01, 2009 10:23 pm

Re: the scripting thread

Postby LordMortiferus » Wed Jul 29, 2015 4:08 am

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.
User avatar
LordMortiferus
MACRO > me
 
Posts: 818
Joined: Tue Dec 01, 2009 10:23 pm

Re: the scripting thread

Postby LordMortiferus » Sat Feb 20, 2016 9:50 pm

For those who are eager to learn some scripting basics, Kris from Ancient Dos Games / Pixelmusement made a crash course video on old QBasic:
User avatar
LordMortiferus
MACRO > me
 
Posts: 818
Joined: Tue Dec 01, 2009 10:23 pm

Re: the scripting thread

Postby Keighn » Sun Feb 21, 2016 9:47 am

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.
User avatar
Keighn
Stop posting already --;
 
Posts: 4965
Joined: Sat Jun 26, 2004 10:13 am
Location: Exiled fucking again.... Georgia ATM!!!

Re: LUA, server API, etc

Postby Keighn » Wed Sep 07, 2016 10:51 pm

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.
User avatar
Keighn
Stop posting already --;
 
Posts: 4965
Joined: Sat Jun 26, 2004 10:13 am
Location: Exiled fucking again.... Georgia ATM!!!

Re: LUA, server API, etc

Postby Rumper » Mon Oct 30, 2017 8:50 am

FIrst link in the first post is dead :(
User avatar
Rumper
Post in swahili or SHUT THE FUCK UP!
 
Posts: 207
Joined: Sun Jan 25, 2015 11:49 pm

Re: LUA, server API, etc

Postby eggmceye » Wed Nov 01, 2017 9:16 pm

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
User avatar
eggmceye
hello
 
Posts: 10103
Joined: Mon Mar 11, 2002 3:55 pm
Location: Sydney, Australia

Re: LUA, server API, etc

Postby LaughingCoyote » Mon Jan 29, 2018 8:58 am

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 X-D
User avatar
LaughingCoyote
My monkey's still learning the basics of e-mail.
 
Posts: 903
Joined: Fri Jan 02, 2004 10:30 pm

Re: LUA, server API, etc

Postby LordMortiferus » Mon Jan 29, 2018 5:16 pm

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.
User avatar
LordMortiferus
MACRO > me
 
Posts: 818
Joined: Tue Dec 01, 2009 10:23 pm

Re: LUA, server API, etc

Postby EmoMage » Mon Jan 29, 2018 6:12 pm

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
User avatar
EmoMage
Girls only want boyfriends who have great skills.
 
Posts: 763
Joined: Tue Aug 06, 2013 10:10 am

Re: LUA, server API, etc

Postby LordMortiferus » Sat Feb 10, 2018 10:35 pm

Max: do we have or could you add an API-function to play existing wavefile SFX via LUA?
User avatar
LordMortiferus
MACRO > me
 
Posts: 818
Joined: Tue Dec 01, 2009 10:23 pm

Re: LUA, server API, etc

Postby eggmceye » Sun Feb 11, 2018 11:36 am

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,
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,
};


you could just use send_event to send that, eg
Code: Select all
send_event(z, -1, x, y, EVENT_STEAL, 0) -- 0 at the end is the event subtype

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
User avatar
eggmceye
hello
 
Posts: 10103
Joined: Mon Mar 11, 2002 3:55 pm
Location: Sydney, Australia

Re: LUA, server API, etc

Postby LordMortiferus » Sun Feb 11, 2018 4:35 pm

Thanks for the detailed informations.
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)
User avatar
LordMortiferus
MACRO > me
 
Posts: 818
Joined: Tue Dec 01, 2009 10:23 pm

Re: LUA, server API, etc

Postby LordMortiferus » Sun Feb 11, 2018 5:38 pm

EVENT_GUN is for pistole/guns SFX
EVENT_SHOOT is for bows/crossbows SFX

What about slings and throwing axes SFX?
User avatar
LordMortiferus
MACRO > me
 
Posts: 818
Joined: Tue Dec 01, 2009 10:23 pm

Re: the scripting thread

Postby LordMortiferus » Fri Mar 02, 2018 4:21 am

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.
User avatar
LordMortiferus
MACRO > me
 
Posts: 818
Joined: Tue Dec 01, 2009 10:23 pm

PreviousNext

Return to EUO Development

Who is online

Users browsing this forum: Bing [Bot] and 2 guests