some programming help.. options..

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
rambo66
Posts: 58
Joined: Fri Dec 17, 2010 6:51 am
Location: Germany

some programming help.. options..

#1 Post by rambo66 » Tue Mar 31, 2015 10:26 am

Hi,

i would like to invite someone in a group and i would also like to choose by a short list, how should i modify this:

for example i want to choose between "Mark", "Tom", "Lars"

here the extraction of the relevant code, what should i modify ? till now i have for each buddy another script, this sucks
for sure i also need autoinvite, i know ;)

Code: Select all

   <onLoad>
   
      PartyWith = "xxyy"

   </onLoad>

   <!-- #  1 --><waypoint x="123" z="123" y="123">  		
		
   sendMacro("InviteByName(\""..PartyWith.."\");");

   </waypoint>  

thanks
ram

edit: damn... i think i'm in the wrong folder again, sorry, please move upwards, thx

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: some programming help.. options..

#2 Post by rock5 » Tue Mar 31, 2015 10:42 am

How do you want it to choose?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

rambo66
Posts: 58
Joined: Fri Dec 17, 2010 6:51 am
Location: Germany

Re: some programming help.. options..

#3 Post by rambo66 » Tue Mar 31, 2015 10:51 am

I would like to have a short suggestion in the code, like:

"Mark", "Tom", "Lars"

i know there is also the "risk" that i may have a new char, but i also want to avoid to enter always the partner name

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: some programming help.. options..

#4 Post by rock5 » Tue Mar 31, 2015 12:16 pm

You mean like having a list and selecting from the list?

Code: Select all

PartyList = {"Mark", "Tom", "Lars"}
PartyWith = PartyList[1]
You would still need to modify the file every time you change.


You could make it bring up a list when running that you could choose from, like my invaders script.

Code: Select all

PartyList = {"Mark", "Tom", "Lars"}
repeat
	cprintf(cli.lightgreen,"\nChoose who to party with.\n")
	for i,name in pairs(PartyList) do
		printf("   [%d] %s\n",i,name)
	end
	printf("   [0] Other\n")
	cprintf(cli.yellow," Select> ")
	PartyWith = tonumber(io.stdin:read())
	if type(PartyWith) ~= "number" or 0 > PartyWith or PartyWith > #PartyList then
		cprintf(cli.yellow,"\nExpecting number from 0 to %d.\n",#PartyList)
		yrest(2000)
	else
		if PartyWith == 0 then
			printf("Enter name of player to party with> ")
			PartyWith = io.stdin:read()
		else
			PartyWith = PartyList[PartyWith]
		end
		break
	end
until false
Output.

Code: Select all

Choose who to party with.
   [1] Mark
   [2] Tom
   [3] Lars
   [0] Other
 Select> 2
To add names just add it to the table at the top. If you select 0 you can type whatever name you like.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

rambo66
Posts: 58
Joined: Fri Dec 17, 2010 6:51 am
Location: Germany

Re: some programming help.. options..

#5 Post by rambo66 » Tue Mar 31, 2015 12:44 pm

thanks rock, ;-) i will try that soon

rambo66
Posts: 58
Joined: Fri Dec 17, 2010 6:51 am
Location: Germany

Re: some programming help.. options..

#6 Post by rambo66 » Tue Mar 31, 2015 2:33 pm

it works, thank you Rock

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: some programming help.. options..

#7 Post by rock5 » Tue Mar 31, 2015 3:43 pm

That's good.

Hm... I've got the urge to make an input class for asking questions. Let me do a bit of brain storming.

I can think of 4 types of questions users might want to ask. They might want to ask for a string, number, select from an indexed list or select from a keyed list. For example

Code: Select all

Input number> _
Input String> _
Select indexed option
   [1] Up
   [2] Down
   [3] Left
   [4] Right
Choice> _
Select keyed option
   [W] Up
   [S] Down
   [A] Left
   [D] Right
Choice> _
You should be able to specify the start text, end text and options, maybe even specifying the colors. It might have to specify the type of question and maybe some options to limit the input, for instance limiting to numbers.

So if the class is called CQuestion, usage might look like this.

Code: Select all

-- Index list example
myquestion = CQuestion()
myquestion:SetStartText("Select one of the following")
myquestion:SetStartTextColor("lightgreen")
myquestion:SetOptions({"Up","Down","Left","Right"})
myquestion:SetEndText("Choice> ")
myquestion:SetEndTextColor("yellow")
I guess I could also use variables for the above instead of functions, eg.

Code: Select all

myquestion.StartText = "Select one of the following"
Then you would need to run it somehow.

Code: Select all

choice = myquestion:GetInput()
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

rambo66
Posts: 58
Joined: Fri Dec 17, 2010 6:51 am
Location: Germany

Re: some programming help.. options..

#8 Post by rambo66 » Sun Apr 05, 2015 7:50 am

Hi Rock,

to be honest, i've tried the first one.. it works fine for me ;-)

thanks and happy Easter to you

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest