Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Function Libraries

  1. #1
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default Function Libraries

    The past two days, I've re-written the string functions and tested them thoroughly. I've originally written it for my own projects, but with a few small modifications I suppose it should meet the reborn framework standards.
    I'm not sure actually; many ideas where tossed around but I don't know what (if anything) was decided on. At the moment, it's also standalone, meaning I haven't written a 'reborn/framework.scr' script or edited the
    'reborn_loader.scr' script to initialize the functions.

    I don't believe that anyone should feel the need to write his/her own functions when they have access to a whopping 46 functions, covering the entire spectrum of what one would need to process strings with.
    Here's a list and I think the function names are be self-explanatory:
    Code:
    	SplitStr
    	InStr
    	SearchStr
    	RemoveStr
    	ReplaceStr
    	ConcatenateStr
    	CompareStr
    	ToUpper
    	ToLower
    	ValidateFormat
    	Left
    	Right
    	CutLeft
    	CutRight
    	LeftOf
    	RightOf
    	CutLeftOf
    	CutRightOf
    	CutRange
    	SubString
    	CutStr
    	SubStr
    	IsWhat
    	Remove
    	Replace
    	ToTitle
    	ReverseStr
    	TrimStr
    	TrimLeft
    	TrimRight
    	CharToInt
    	IntToChar
    	CutterStr
    	MakeLn
    	StripLn
    	AddDblQuotes
    	CommentStr
    	UncommentStr
    	AddTabs
    	DelTabs
    	IsCharDataSafe
    	MakeCharDataSafe
    	
    	//Internal functions, but they are available for those who need them:
    	IsString
    	IsStringType
    	ConvertPosToChar 
    	ConvertCharToPos
    I don't believe I have an account or access to the GIT Razo set up so I can't see what's already there.

    There are two perks you will notice while glancing over the script. One, I've added the option to register functions without most of the error-checking for faster results if you know what you're doing
    and there will be ASCII-support in all functions that compare strings/characters. I'll just copy-&-paste the entire library to a new file and edit the functions there directly, so it doesn't get too messy or bloated.

    Next up are array.func and file.func libraries, followed by the admin spectator mode and an updated version of the admin variables.
    Last edited by Sor; November 12th, 2012 at 08:57 AM. Reason: attachment got lost

  2. #2
    Über Prodigy & Developer Razo[R]apiD's Avatar
    Join Date
    May 2010
    Location
    Poland, Lublin
    Posts
    3,257

    Default

    https://github.com/razorapid/Reborn-...s/strings.slib

    You can check it and compare.

    Give me your proper login so I can add you.

  3. #3
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Hm, I see, I have to add the library info thread and some renaming.. Is this format and approach agreed upon or is there room for suggestions?

    Username is SXor on github... 'Sor' was already taken
    Last edited by Sor; October 29th, 2012 at 06:14 PM.

  4. #4
    Über Prodigy & Developer Razo[R]apiD's Avatar
    Join Date
    May 2010
    Location
    Poland, Lublin
    Posts
    3,257

    Default

    There is a room for suggestions, but I decided that internal functions and variables will start with __ (double underscore, it was a single underscore but I changed it and have to commit the changes). Internal functions and variables are like private ones and should not be accessed from outside of the library.

    I've added you to repo.

  5. #5
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Razo, may I write the framework for the pk3? I mean it's ironic that I'm a developer and not actually really developing anything. :P

    It would be a much more coherent whole if it were written in the same manner rather than connecting a series of scripts.
    Scripting's going smoothly and I've thought of some good, practical ideas.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  6. #6

    Default

    Sor, if you want to develop something I have some existing mods laying around that could use some polishing
    Some of them half functioning, others need TDM/FFA functionality and better death-detecting logic.

    It's a bit over my head, but should be a piece of cake for an experienced modder/developer

  7. #7
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Midnight, a great man once said "thou cannot have thy cake and eat it too". :-P

    By the way, a death-detecting logic? Why would that still be necessary?
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  8. #8

    Default

    Lol, sorry Sor. I used the wrong syntax.
    I didn't mean death-detecting logic but radius damage.

    One of the mods I talked about is the Guided Missile mod. It was originally written for TDM gametypes but I'm trying to make it so that it
    can be used for FFA gametype also.
    So I'm adding getcvar's, IF/ELSE statements for TDM/FFA and Teamdamage on or off and trying to make it all work together (with -these- hands, imagine that lolol)

    Actually I think I'm making some progress there, and it's also good for my scripting learning curve so I don't have to keep bothering others
    Another thing with the Guided Missles mod is that the missiles also kill you when standing behind a wall or door.
    That's where the radius damage comes in. It uses vectors and other complicated stuff and it's waaaayyyy over my head.

    Believe me Sor, I'm really trying to learn myself to script but it's a slow process. Maybe some day I'll surprise you but
    today is not that day, lol.


    ****EDIT
    Sorry about hijacking this thread. Obviously my lamentations don't have anything to do with Function Libraries...
    Last edited by Midnight1138; November 8th, 2012 at 03:27 PM.

  9. #9
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Radius is radius regardless of geometry, if obstacles are a problem, you should use sighttrace.
    Show me the radius damage script; because technically that is a function, which should be in a library, so it all adds up.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  10. #10

    Default

    you can also use cansee with fov 360 like if(local.missile cansee local.player 360 400)
    (400 is the radius), but you can use sighttrace too, especially if you want to pass through entities, but then you will need to calculate the radius
    Last edited by Ley0k; November 8th, 2012 at 04:25 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •