Quest Miniwindow for balzhur

Posted by Deckard on Tue 07 Apr 2020 05:32 PM — 12 posts, 41,357 views.

#0
Hi there!
I've tried to modify the plugin from here:
http://www.gammon.com.au/forum/?id=8814 in order to make it works on Balzhur. But... it's not working. So I came here to beg some help :)

In Balzhur, @questman can have four or five different names depending where you are. So, it's not possible to use a single @questor o @questman name...

I hope maybe if I use (name1|name2|name3|name4) should works... what do you thing?

This is what questman says to you when you ask for a quest (first and last phrase):

El reclutador te cuenta 'Gracias valiente Deckard!'

El reclutador te cuenta 'Que los dioses vayan contigo!'

I hope you can help me.
Thnx!
Best!
Australia Forum Administrator #1
@questor is a variable, not a name.

When the plugin sees:


match="You ask * for a quest."


Then that wildcard becomes the current quest giver (until it sees that another time).

So in your case your questor seems to be "El reclutador" (the recruiter) so your trigger would be:


* te cuenta 'Gracias valiente *!'


Now the variable "questor" becomes "El reclutador" and the other parts should work.

Of course, you need to translate the other triggers as well.
#2
Hi there!
Thnx Nick!

This is what I try:

https://github.com/DeckardCod/Mushclient/blob/master/Quest%20Tracker

And... this is what it shows :-s

https://prnt.sc/rv60ox

Sorry, i've tried to paste the code here but it seems be to long :-s
Australia Forum Administrator #3
Can you please copy and paste the MUD output here, don't take a screenshot of it.

If you paste it I can try out your plugin. I don't plan to retype dozens of lines from an image.
#4
Hi there!
Sure, here we are:

Pides a el reclutador un nuevo quest.

El reclutador te cuenta 'Gracias valiente Deckard!'


El reclutador te cuenta 'encontre un extranyo mapa'

El reclutador te cuenta 'Quiero que lo uses para llegar al lugar que indica'

El reclutador te cuenta 'investiga si esconde algun tesoro'
Encuentra el tesoro en el area Haon Dor, (reino de Calimhar).
El reclutador te cuenta 'El mapa es de Haon Dor, Reino de Calimhar, no pierdas mas tiempo!'
Tienes 28 minutos.
El reclutador te cuenta 'Tienes 28 minutos para realizar la mision'

El reclutador te cuenta 'Que los dioses te bendigan!'
Australia Forum Administrator #5
Your trigger here is not enabled:


 <trigger
   match="* te cuenta '*'"
   name="questor_line"
   script="questor_line"
   sequence="100"
   expand_variables="y"
  >


Therefore it won't notice you asking for a quest.
#6
Hi there!


Ok, the trigger has been enabled.
But still happen the same. Shows the info by half: the mini window shows several lines which it says: "el reclutador", as if only the text of the first * is loaded, it's seems like the second * it's ignored.




<!--  Triggers  -->

<triggers>

  <trigger
   enabled="y"
   match="* te cuenta '*'"
   name="questor_line"
   script="questor_line"
   sequence="100"
   expand_variables="y"
  >
  </trigger>
  
  <trigger
   enabled="y"
   match="Pides * un nuevo quest."
   script="start_questor_stuff"
   sequence="100"
  >
  </trigger>
  
  <trigger
   enabled="y"
   match="* te cuenta 'Tienes * minutos para realizar la mision'"
   name="questor_end"
   script="questor_end"
   sequence="10"
   expand_variables="y"
  >
  </trigger>
  
 <trigger
   enabled="y"
   match="Has completado tu QUEST!"
   sequence="100"
   script="quest_done"
  >
  </trigger>

 <trigger
   enabled="y"
   match="* dice 'Ve al Questman y muestrale mi gratitud por su generosa bondad'"
   sequence="100"
   script="quest_done"
  >
  </trigger>


 <trigger
   enabled="y"
   match="Le dices a * que ya has completado su quest."
   sequence="100"
   script="quest_handed_in"
  >
  </trigger>
  
 <trigger
   enabled="y"
   match="'Intentalo de nuevo dentro de * minutos'"
   sequence="100"
   script="quest_time_to_go"
  >
  </trigger>

 <trigger
   enabled="y"
   match="Ya puedes volver a pedir un quest."
   sequence="100"
   script="quest_available"
  >
  </trigger>

  <trigger
   enabled="y"
   match="You do not have to wait to go on another quest."
   sequence="100"
   script="quest_available"
  >
  </trigger>
     
</triggers>


I follow this steps:
1) enable the trigger.
2) re-install the plugin.

Best!
Amended on Thu 09 Apr 2020 05:13 AM by Deckard
Australia Forum Administrator #7
Around line 180, change:


function questor_line (name, line, wildcards)
  local text = wildcards [1]


to:


function questor_line (name, line, wildcards)
  local text = line


That fixes the issue with the short lines.

Or, maybe:


function questor_line (name, line, wildcards)
  local text = wildcards [2]





Further down, change:


 local days = string.match (text, "(%d+) days?")
  if days then
    when_required = when_required + tonumber (days) * 60 * 60 * 24
  end -- some days left

  local hours = string.match (text, "(%d+) hours?")
  if hours then
    when_required = when_required + tonumber (hours) * 60 * 60
  end -- some days left

  local minutes = string.match (text, "(%d+) minutes?")
  if minutes then
    when_required = when_required + tonumber (minutes) * 60
  end -- some days left



... to match the Spanish. (eg. "minutos?" rather than "minutes?").




These are not proper Lua patterns:


  if string.match (text, "'*Gracias valiente *!'") then
    return
  end -- if

  if string.match (text, "'*Que los dioses vayan contigo!'") then
    return
  end -- if


You have used MUSHclient wildcards rather than Lua patterns. It should be:


  if string.match (text, "'Gracias valiente .*!'") then
    return
  end -- if

  if string.match (text, "'Que los dioses vayan contigo!'") then
    return
  end -- if
Amended on Thu 09 Apr 2020 09:18 PM by Nick Gammon
#8
Hi there


function questor_line (name, line, wildcards)
  local text = wildcards [1]


When I change this, some issues as appear with all other mobs. So I kept it the same way.

I fixed using this code:

    <trigger
   enabled="y"
   match="El reclutador te cuenta '*'"
   name="questor_line"
   script="questor_line"
   sequence="100"
   expand_variables="y"
  >
  </trigger>


I also changed the hours, minutes and senconds to spanish:

  local days = string.match (text, "(%d+) dias?")
  if days then
    when_required = when_required + tonumber (dias) * 60 * 60 * 24
  end -- some days left
  
  local hours = string.match (text, "(%d+) horas?")  
  if hours then
    when_required = when_required + tonumber (horas) * 60 * 60
  end -- some days left

  local minutes = string.match (text, "(%d+) minutos?")  
  if minutes then
    when_required = when_required + tonumber (minutos) * 60
  end -- some days left



But, now, the miniwindow shows all the text but open and close too quickly... :-s like a blink :(
Australia Forum Administrator #9

 local days = string.match (text, "(%d+) dias?")
  if days then
    when_required = when_required + tonumber (dias) * 60 * 60 * 24
  end -- some days left


You haven't been consistent with your variable names.


local days = ...
      ^^^^

... tonumber (dias) ...
              ^^^^


These are variables, you don't need to translate them. But if you do, you need to be consistent. eg.


  local dias = string.match (text, "(%d+) dias?")
  if dias then
    when_required = when_required + tonumber (dias) * 60 * 60 * 24
  end -- some days left
#10
Hi there!

Changed! but is not working :(



function questor_end (name, line, wildcards)

  local text = wildcards [1]
  
   -- work out when quest ends
  
  when_required = os.time ()
  
  local dias = string.match (text, "(%d+) dias?")
  if dias then
    when_required = when_required + tonumber (dias) * 60 * 60 * 24
  end -- some days left
  
  local horas = string.match (text, "(%d+) horas?")  
  if horas then
    when_required = when_required + tonumber (horas) * 60 * 60
  end -- some days left

  local minutos = string.match (text, "(%d+) minutos?")  
  if minutos then
    when_required = when_required + tonumber (minutos) * 60
  end -- some days left
 
  check (EnableTrigger ("questor_line", false))
  check (EnableTrigger ("questor_end", false))
  show_quest_text ()
end -- questor_end


function show_quest_text ()

  if #quest_info == 0 and 
    next_quest_time then
    show_when_quest_available ()
    return
  end -- one available now/soon
                 
  -- do nothing if no quest
  if #quest_info == 0 or when_required == nil then
    return
  end -- if

  -- recreate the window the correct size
  WindowCreate (win, 
               0, 0,   -- left, top (auto-positions)
               max_width + 10,     -- width
               (#quest_info + 2) * font_height + 5,  -- height
               8,       -- auto-position: top middle
               0,  -- flags
               0xE7FFFF) 

  -- heading
  local text = "Current quest."
  Display_Line (1, text, font_id, heading_colour)

  -- list of mobs
  for i, v in ipairs (quest_info) do
    Display_Line (i + 1, v, font_id, text_colour)
  end -- for
  
  -- how long to go
  local time_to_go = when_required - os.time ()
  
  if time_to_go < 0 then
    return
  end -- if
  
  text = string.format ("Time to go: %s", convert_time (time_to_go))
  Display_Line (#quest_info + 2, text, font_id, time_colour)
    
  WindowShow (win, true)
    
end -- show_quest_text


  <trigger
   enabled="y"
   match="El reclutador te cuenta 'Tienes * minutos para realizar la mision'"
   name="questor_end"
   script="questor_end"
   sequence="10"
   expand_variables="y"
  >
  </trigger>


Best
Australia Forum Administrator #11
What do you mean "not working"? Can you be specific? What did you expect to happen, and what actually happened?