The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom sysmessage function
Author Message
karma
Moderator
****

Posts: 178
Likes Given: 17
Likes Received: 32 in 29 posts
Joined: Jul 2012
Reputation: 3



Post: #3
Custom sysmessage function
Thanks darksun, that was exactly what i needed!

NTH EDIT: the newer version of this function is here: http://forum.spherecommunity.net/Thread-...h-function

Here's the function, maybe it will be useful to someone.
Code:
[FUNCTION UTEXT]
//sends unicode text packet to client and allows to specify useful data, which usually is automatic
//SYNTAX: UTEXT serial, talkmode, name, color, text

//serial: UID of the char speaking or receiving text (like sysmessage)
//name: who is speaking/sending text

//Packet structure:
//byte ID (AE)
//word Packet Size //length in bytes
//dword Serial
//word Graphic
//byte Mode (0x00 = say, 0x01 = system, 0x02 = emote, 0x06 = label, 0x07 = focus,
//  0x08 = whisper, 0x09 = yell, 0x10 = spell, 0x13 = guild, 0x14 = alliance, 0x15 =
//  GM, 0xC0 = encoded commands) (reported talkmodes may not be correct)
//word Text Color
//word Font
//char[4] Language
//char[30] Name
//uchar[*] Text  //no fixed dimension

IF (<ARGV> < 5)
    RETURN 0
ENDIF

LOCAL.SERIAL=0<ARGV[0]>
IF !(<LOCAL.SERIAL>)
    LOCAL.SERIAL=<UID>
ENDIF
LOCAL.TALKMODE=0<ARGV[1]>
LOCAL.NAME=<ARGV[2]>
IF (<ISNUM <LOCAL.NAME>>)
    IF !(<LOCAL.NAME>)
        LOCAL.NAME=<NAME>
    ENDIF
ENDIF
LOCAL.COLOR=0<ARGV[3]>
LOCAL._TEXT=<ARGV[4]>
LOCAL._TEXTLEN=<HVAL STRLEN(<LOCAL._TEXT>)>
LOCAL.GRAPHIC=01 090
LOCAL.FONT=00 03
LOCAL.LANGUAGE=00 00 00 00 //no localization
//LOCAL.LANGUAGE=045 04E 055 00 //ENU
LOCAL.NAME=<ASCPAD 30, <LOCAL.NAME>>
LOCAL._TEXT=<ASC <LOCAL._TEXT>>

LOCAL.TEXT=00 <STRARG <LOCAL._TEXT>>
LOCAL._TEXT=<STREAT <LOCAL._TEXT>>
FOR 2 <LOCAL._TEXTLEN>
    LOCAL.TEXT=<LOCAL.TEXT> 00 <STRARG <LOCAL._TEXT>>
    LOCAL._TEXT=<STREAT <LOCAL._TEXT>>
ENDFOR
LOCAL.TEXT=<LOCAL.TEXT> 00 00
LOCAL._TEXTLEN += 1
LOCAL.LEN=( (<LOCAL._TEXTLEN>*2)+1+2+4+2+1+2+2+4+30 )

SENDPACKET 0AE W(<LOCAL.LEN>) D(<LOCAL.SERIAL>) <LOCAL.GRAPHIC> B(<LOCAL.TALKMODE>) W(<LOCAL.COLOR>) <LOCAL.FONT> <LOCAL.LANGUAGE> <LOCAL.NAME> <LOCAL.TEXT>
RETURN 1

EDIT: if this function is used to make char SAY something, you may want to put SENDPACKET inside a FORCLIENTS 16, otherwise it will works as a MESSAGE, showing the text only to you
EDIT 2: lol, wrote ENDWHILE instead of ENDFOR
(This post was last modified: 05-04-2014 09:59 AM by karma.)
04-22-2014 10:02 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes karma's post
Post Reply 


Messages In This Thread
Custom sysmessage function - karma - 04-22-2014, 08:33 AM
RE: Custom sysmessage function - darksun84 - 04-22-2014, 08:52 AM
Custom sysmessage function - karma - 04-22-2014 10:02 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)