Poll: Best naming for new Messaging macro API
You do not have permission to vote in this poll.
Messages.handleSay
12.50%
1 12.50%
Messages.onSay
25.00%
2 25.00%
Messages.whenSay
62.50%
5 62.50%
Total 8 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String variables in Macros?
#1
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)

Str.Upper(A)
Str.Lower(A)

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.MatchSucced==:True
!Str.MatchFailed==:False
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")
Exit()

{whenLow}
Self.Say(Someone said LOW)
Exit()

{whenHigh}
Self.Say(Someone said HIGH)
Exit()

{whenDeposit}
Self.Say(!Message.Sender.Name said DEPOSIT with !Message.Group.0)
Exit()

{whenSio}
Comment(Combo SIO!)
Self.Say(exura sio "!Message.Spell.Param)
Exit()

Comment(Additional Variables)
!Message.IsSystem :true | :false
!Message.IsPositional :true | :false
!Message.IsSpell :true | :false
!Message.Kind Confusedystem | :positional | :creature | Confuseday | Confusedpell

!Message.Sender.Name
!Message.Sender.ID

!Message.Text

!Message.Spell.Name
!Message.Spell.Param

Regex Group
!Message.Group.0
!Message.Group.1
!Message.Group.2
!Message.Group.3
!Message.Group.4

!Message.Pos.X
!Message.Pos.Y

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!
Reply
#2
Casino with auto inviter Wink
Reply
#3
WhenSay will be better understood imo
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)