prompt help - must query for info - tele-arena

Post Reply
rick.plackter
Posts: 4
Joined: Thu Jul 01, 2010 6:10 pm

prompt help - must query for info - tele-arena

Post by rick.plackter »

I have searched around the forums for an answer on this, but I think my situation is a pretty unique. I use mudlet to play a pretty old online rpg, it is actually the bbs game Tele-Arena. I've given myself a crash course in regex and lua and have made some pretty helpful aliases and triggers to control the three characters that I play at the same time. One of the main differences between Tele-Arena and most modern muds is that you need to query the server to find out pretty much any information you could possibly need to know. There is no prompt displaying health, mana, exits, or any other player status. Before I get into the specifics of my question, there is a big caveat here...I have zero background in computer programming and only started messing around with lua and regex about three weeks ago. What I am trying to do might be way beyond my capabilities, if it is, please let me know. I also have not started to write any code, so I don't have anything to post here yet, I need help getting started on it.

I would like to write some kind of simple script that queries the server at regular intervals to get updated information on health, mana, experience, exits and whether the character is ready or resting. The commands to for these are, "he" for health and mana, "ep" for experience, "ex" for exits, and "gr" for ready/resting status.

Another option would be to extrapolate some of the other amazing scripts that have already been written to display this sort of information, and just add a part that shows the commands to retrieve the information and some sort of timer function so it is done at regular intervals so the information that is as updated as possible.

Has anyone run into anything like this? Am I over my head here given my lack of experience? I don't mind figuring it out on my own if someone can just point me in the right direction.

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: prompt help - must query for info - tele-arena

Post by Heiko »

It's fairly easy to do this - even without any scripting whatsoever. Just make a bunch of timers at an appropriate interval and let each timer send a clear text command to the MUD.

rick.plackter
Posts: 4
Joined: Thu Jul 01, 2010 6:10 pm

Re: prompt help - must query for info - tele-arena

Post by rick.plackter »

I didn't even think of that. And then can I create a prompt or some kind of gauge from the info that is refreshed from the timers? That doesn't seem too difficult at all. I will probably sit down one day this weekend and figure it out.

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: prompt help - must query for info - tele-arena

Post by Heiko »

Right, you set up triggers to parse the MUD output of the commands that you send via your timers and then make your own prompt. This is no problem - Lua scripting is really easy to learn.

Natenewb
Posts: 2
Joined: Thu Dec 19, 2013 5:22 am

Re: prompt help - must query for info - tele-arena

Post by Natenewb »

I have been trying to make a reroll script for this game, but can't figure out what code to use.. heres what the text looks like when you reroll.

reroll

Race: Elven
Class: Sorceror
Level: 1
Experience: 0
Rune: None

Intellect: 20
Knowledge: 15
Physique: 15
Stamina: 15
Agility: 12
Charisma: 17

Mana: 2 / 2
Vitality: 13 / 13
Status: Healthy
Armor Rating: 0

Weapon: Dagger
Armor: Cloak
Encumberance: 127 / 750

when you type reroll the stats change randomly... there are max stats of course, and scripts are nice cause they can run as you walk away... hopefully it will finish and you have the desired stats or within a desired range.

so first off I created triggers that looked for Intellect: 10-20 and upon finding that exact match it would send reroll, and stop once it hit 21.... then I tried making another 10 triggers that multi lined/trigger at Intellect 21 and Knowledge 11-21... but thats as far as I got... I know very bad way to go about it.. but I'm new to this.

So I figured out you could use Perl rex

so I coded

pattern
Intellect (.*)

code
Int = matches[2]
if int <20 send("reroll") else send("ah hah") end

This didn't work... could someone give me some advice or help ta.wroth.org 23 is the address if anyone needs a better example.

Natenewb
Posts: 2
Joined: Thu Dec 19, 2013 5:22 am

Re: prompt help - must query for info - tele-arena

Post by Natenewb »

I've been playing this game as well, and I'd like to know how to take an unknown(random) variable and check it against a desrired variable or desired variable range then send an input if it is false or check next random variable if true.


I'm trying to make a REROLL script for Tele-arena.

example.

you send reroll

and it rerolls all your stats

Intelligence: 18
Knowledge: 21
Physique: 8

and so on..

my goal is to find the random variables and check against a desired value... such as intellect 20 knowledge 22 and so on.

I want to walk away from the machine while it searches for the values I want. If you could help with this that would be awesome... and It will help me learn the code by seeing how you come up with the code.

psyberjocker
Posts: 2
Joined: Wed Sep 19, 2018 11:35 pm

Re: prompt help - must query for info - tele-arena

Post by psyberjocker »

what ive done in this branch is using another script and modify it.
these stats:"21,23,15,15,18,15 were used to have a druid character rerolled as a test.
got 22,24,15,15,18,19!!!
here how it goes with the triggers. --> you need also to add the "multiline / AND trigger" box checked with "6" as line delta.
as perl regex so it catch it in the multimatch table.
^Intellect:\s*(\d+)$
^Knowledge:\s*(\d+)$
^Physique:\s*(\d+)$
^Stamina:\s*(\d+)$
^Agility:\s*(\d+)$
^Charisma:\s*(\d+)$

Da script:

if
tonumber(multimatches[1][2]) >= 21 and
tonumber(multimatches[2][2]) >= 23 and
tonumber(multimatches[3][2]) >= 15 and
tonumber(multimatches[4][2]) >= 15 and
tonumber(multimatches[5][2]) >= 18 and
tonumber(multimatches[6][2]) >= 15 then

showMultimatches()
tempTimer( 60, [[send("x")]])
else
tempTimer( .5, [[send("reroll")]])
end

as you see in the script i use "showMultimatches()" to see if the capture is really going on and doing what it is supposed to do.
also the timer at 60 sec with and "x" so i exited the game to prevent dying from starving or lack of water.
the second timer is at 0.5 sec but can be at faster pace....it will depends of the site tolerance over repeated commands.

enjoy the script!!!

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: prompt help - must query for info - tele-arena

Post by SlySven »

Of course, instead of comparing against a fixed target (21, 23, ... 15) value you could set a table up with whatever required minimums you desire and then test against those...! :geek:

Code: Select all

stats_minimums = stats_minimums or {}
stats_minimums.Intellect = stats_minimums.Intellect or 0
stats_minimums.Knowledge = stats_minimums.Knowledge or 0
stats_minimums.Physique = stats_minimums.Physique or 0
stats_minimums.Stamina = stats_minimums.Stamina or 0
stats_minimums.Agility = stats_minimums.Agility or 0
stats_minimums.Charisma = stats_minimums.Charisma or 0

if tonumber(multimatches[1][2]) >= stats_minimums.Intellect and
  tonumber(multimatches[2][2]) >= stats_minimums.Knowledge and
  tonumber(multimatches[3][2]) >= stats_minimums.Physique and
  tonumber(multimatches[4][2]) >= stats_minimums.Stamina and
  tonumber(multimatches[5][2]) >= stats_minimums.Agility and
  tonumber(multimatches[6][2]) >= stats_minimums.Charisma then

  showMultimatches()
  tempTimer( 60, [[send("x")]])
else
  tempTimer( .5, [[send("reroll")]])
end
Then all you need to do is set the minimums (and reset to 0 any you do not care about) elsewhere before using it - the first part of the new stuff is all about setting up and initialising the stats_minimums table if it has not already been done so - and using the existing values if they have...

That is weird I am seeing italic effects being applied to the [ code ]...[ /code ] wrapped stuff between '_' being used as a delimiter - that is not what I expect for the fora!

psyberjocker
Posts: 2
Joined: Wed Sep 19, 2018 11:35 pm

Re: prompt help - must query for info - tele-arena

Post by psyberjocker »

Thanks for the info.
That's interesting cause i was wondering how to avoid a nil value when trying to compare the entries.
I will try that soon. also rerolling is done in the beginning of the game so you know i found a simple way to acheive it.
I rerolled 7 characters just for fun.
btw i use an attack script which is also very simple maybe you have something more elaborate?
heres what i use:

the text in the room is:

You're in the arena.
There is a lizard woman, a hobgoblin, a skeleton warrior, and two huge rats
here.
Psyberjocker and Qbits are here.
There is nothing on the floor.


So the 2 regex(multiline):

^.*arena.$
^There\s\w{2,3}?\s(\w{1,5})?\s(\w{3}).*(\n)?.*$
*Edit here:
^There\s\w{2,3}?\s(\w{1,5})?\s(\w{3})?(.*)$ -Works better when the arena is full of mobs.


lua code:
Code: [show] | [select all] lua
send("attack " ..multimatches[2][3])
send("attack " ..multimatches[2][3])
send("attack " ..multimatches[2][3])
In the timers, i use a timer 15 second with the command so it can re-read the room details for the capture to be done:
Code: [show] | [select all] lua
send(" ")
so it can re-read the room details for the capture to be done.
i was thinking of a temptimer within the send("attack.... cant find a way to make it work.
i tried also the ingame group command so i can have the status info:
Your group currently consists of:
Psyberjocker (L) [HE:100% ST:Ready]

Post Reply