Sphereserver / Source-X

Ultima Online server emulator
Apache License 2.0
60 stars 48 forks source link

Old fork of the sphere with features #1227

Open Steinny opened 8 months ago

Steinny commented 8 months ago

I have an old fork of the sphere, even before it became free. and there are a couple of interesting features there. I can even share the source code with you if it makes your task easier.

item1


"plocal" like "ref1" but with "nametag"

plocal.blabla = plocal.name = House plocal.bounce

item2


I don't use a LIST, but when working with tags Instead of;

if for i 0 <eval( - 1)> if strmatch("template_*","<tagat..key>")

    endif
endfor

endif

we have this;

fortags template_* say endfor

item3


trigger @SaveStart @SaveEnd on item and chars

item4


serv.addtimerd 0 f_function like timerf but work on serv. with timer 1/10 sec

[FUNCTION f_function] ref1 = ref1.try

item4


[ADIALOG dialogtype

DTYPE_NEW 01 // do not interfere with targets and dclick DTYPE_SINGLE 02 // allows only one such dialog on the screen DTYPE_SINGLE_OBJ 04 // allows only one such dialog on the object DTYPE_NOUPDATE 08 // with 02 and 04 - forbid updating the dialog on repeated call

item5


ADIALOGCLOSE type, arg1, arg2, buttonID

0x1 - arg1 = resource id of dialog (example "ad_dialog") - close the dialog with this ID 0x2 - arg2 = object uid - close the dialog on this object 0x4 - close all dialogs with these flags, otherwise the first one if type = 0 - arg1 = dialog uid (return like ) - close the dialog with this UID buttonID - The ID of the button that the dialog will close with (-1 - system close)

    On=@Equip
        src.tag.xz = <adialog ad_xz>

    On=@Unequip
        src.adialogclose 0,<src.tag.xz>,0,-1  - close the dialog with this UID

    On=@Equip
        adialog ad_xz

    On=@Unequip
        src.adialogclose 07,ad_xz,<uid>,-1 - close all dialog on this OBJ
xwerswoodx commented 8 months ago

I don't see any reason to be added as we already have them,

FOR loop or FORTAGS loops is not a big deal, can be added but I am not sure if it's necessary.

REF1 is a CUID reference so you can use .NAME .TYPE .BLABLA, so no need to add PLOCAL for it.

@SaveStart and @SaveEnd triggers for every item can be really expensive, I am not sure but it can be added after made some tests.

We don't need ADDTIMERD as we already have TIMERFMS for it.

For dialog close, we already have dialogclose command for any dialog but it may be improved.

cbnolok commented 7 months ago

1) Can you explain better PLOCAL? It looks like REFx. 2) I fear this will encourage using a lot of tags, polluting them, but per se it could be a good idea. 3) 100% sure it will be really too much expensive. 4, 5) I second what xwerswoodx said.

Steinny commented 7 months ago
  1. I'll finish you off we have also PTAG like tag+ref. ptag.item = ptag.item.name = blablba ptag.item.cont =

first of all, it is clear and readable

plocal.sys plocal.plr plocal.item plocal.npc

on the third page, I already forget what happened at the beginning.

well, for example, there is also comfort

for 1 2
    local.i = "<eval(<local._for>)>"
    doswitch <local.i> - 1
        begin
            plocal.npc_<local.i> = <f_newnpc c_enc_angel>
            plocal.npc_<local.i>.speechcolor 050
        end
        begin
            plocal.npc_<local.i> = <f_newnpc c_enc_daemon>
            plocal.npc_<local.i>.speechcolor 112
        end
    enddo
    plocal.npc_<local.i>.p = <args>
    doswitch <local.i> - 1
        plocal.npc_<local.i>.move 1 <eval {-1 1}>
        plocal.npc_<local.i>.move <eval {-1 1}> -1
    enddo
endfor
  1. Well, these are actually my seconds, why should you count them? I use BACKGROUND SAVE and it's almost unnoticeable

or you can do it so that it can be enabled and disabled from scripts. in principle, is this enough for statistics once a day?

cbnolok commented 2 months ago

So, i don't really see a use for @SaveStart and @SaveEnd, but i can change my mind if there are some interesting examples. FORTAGS could be useful, but i think it encourages bad scripting practices. DTYPE_SINGLE is solved by using SDIALOG, though the other flags aren't covered by the current features. Could you suggest some real-world uses of those flags with ADIALOG?

Steinny commented 2 months ago

@SaveStart @SaveEnd I create temporary quest or auction items that can be deleted after a month or a year without having to use a timer.

It is also used for daily or monthly statistics.