Poll: Best naming for new Messaging macro API
[Show Results]
Note: This is a public poll, other users will be able to see what you voted for.
Post Reply 
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String variables in Macros?
08-15-2018, 06:19 AM (This post was last modified: 08-20-2018 09:48 PM by MegaNo0body.)
Post: #1
String variables in Macros?
Just wondering... Let's suppose...
What if we could use string in macros?
What if we had even a simple API, like the following one?
Could it make possible to bring new features to BBot? (yey Cassino, AutoResponder..., some NPC quest? maybe POI with fucking bureaucrats?)

Quote:Comment(String Assignation)

Str.Set(A, Hello)
Str.Set(B, World)
Str.Set(C, hello)
Str.Set(Message, !A !B)

Comment(String Comparision)

Str.Equals(A, B)==:False
Str.Equals(A, C)==:True
Str.EqualsSensitive(A, C)==:False

Comment(String Manipulation)


Comment(String Regex Pattern Matching)

Str.Set(Text, You have 12345 gold pieces.)
Str.Set(MoneyPattern, You have (\d+) gold pieces.)
Str.Regex(MoneyPattern, Text)==:True
Str.Equals(Str.Match.1, 12345)

Str.Set(NoMatch, What the hell)
Str.Regex(MoneyPattern, NoMatch)==:False

Comment(LOOL BBot has String support in macros)
Comment(This is actual API and this is a valid macro hehe)

had we have this simple STR API.. we could extend some functionalities like "Event/Listener/When/Handlers":

Quote:Comment(NOTICE the following API is not final and may change before the final release)
Comment(Message Handling with When handlers)
Messages.whenAny(whenLabel, messageRegexPatternString)
Messages.whenSystem(whenServerSave, "Server will shutdown.*")
Messages.whenAny(whenLow, "low")
Messages.whenAny(whenHigh, "high")
Messages.whenSay(whenDeposit, "deposit (\d+)")
Messages.whenSpell(whenExori, "exori")
Messages.whenSpell(whenSio, "exura sio")
Messages.whenSpell(whenSummon, "utevo res")

Self.Say(Someone said LOW)

Self.Say(Someone said HIGH)

Self.Say(!Message.Sender.Name said DEPOSIT with !Message.Group.0)

Comment(Combo SIO!)
Self.Say(exura sio "!Message.Spell.Param)

Comment(Additional Variables)
!Message.IsSystem :true | :false
!Message.IsPositional :true | :false
!Message.IsSpell :true | :false
!Message.Kind :system | :positional | :creature | :say | :spell




Regex Group


Now that we also could have a 'When' event system using macros, we could extend it to other advanced features:

Quote:CreatureData = !Creature.ID, !Creature.Name
ContainerData = !Container.ID

Creatures.whenEnterScreen(LabelName) -> CreatureData
Creatures.whenLeaveScreen(LabelName) -> CreatureData
Creatures.whenSkull(LabelName) -> CreatureData
Creatures.whenParty(LabelName) -> CreatureData
Creatures.whenWalk(LabelName) -> CreatureData

Containers.whenOpen(LabelName) -> ContainerData
Containers.whenClosed(LabelName) -> ContainerData

String Handling? Why not... packet handling? Big Grin
Str.ToHex(MsgAsHex, Hello World)
Misc.SendPacket(0x12 0xF2 !Self.Equip.LeftHand.ID 1 !MsgAsHex)

By the way, what is the best name for Messages handling macros?
  • Messages.handleSay
  • Messages.onSay
  • Messages.whenSay

Leave your vote!
Give Reputation to this user

Visit this user's website Find all posts by this user
Quote this message in a reply
08-15-2018, 06:54 AM
Post: #2
RE: String variables in Macros?
Casino with auto inviter Wink
Give Reputation to this user
Find all posts by this user
Quote this message in a reply
08-15-2018, 08:16 AM
Post: #3
RE: String variables in Macros?
WhenSay will be better understood imo
Give Reputation to this user

Before you PM me, READ THIS [Image: KHCf9l2.png]

[Image: naLmyGH.png]

My Scripts, Macros and Tutorials
Find all posts by this user
Quote this message in a reply
Post Reply 

Forum Jump:

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