SRL Archive - OSR Help

a type with subtypes in subtypes


g0tp0t

2010-04-28 18:43:06

i am making a qc autochat script. i am recording all of the QC options and i want to store them in their own type, since i cant think of any other way to organise them. i want to be able to type something like: qc.general.hello.Hello! and it will have he value 'Hello!'

if ther is any other way to organise the qc menu, i would love to hear it. lol.

EDIT: i just thought of using arrays in arrays instead, i think it would work, still love sugestions though

Frement

2010-04-28 18:44:58

Make the last an array, like qc.general.hello[1]

g0tp0t

2010-04-28 18:56:50

i was thinking of that before, lol, but then i would have to do that for every submenu, and ther is like just as many submenus as messages :P. so still wouldnt work. i dont think so at least

Boreas

2010-04-28 22:37:57

You could go arrays all the way down:

var
QC: array of array of array of string;
begin
QC[0][0][0] := 'Hi';
or even

var
QC: array of array of array of string;
const
General = 0;
Hello = 0;
begin
QC[General][Hello][0] := 'Hi';
......
writeln(QC[General][Hello][random(length(QC[General][Hello]))]);

i luffs yeww

2010-04-28 22:44:40

Or you could make them vars and inc them, I think.

g0tp0t

2010-04-29 00:17:36

cant inc text :S

the best way i have thought of is using numbers instead of text, but that will make rhe script more confusing. for me AND others

Quickmarch

2010-04-29 02:18:19

From: g0tp0t
cant inc text :S

the best way i have thought of is using numbers instead of text, but that will make rhe script more confusing. for me AND others


Constants…?

mastaraymond

2010-04-29 05:41:59

program new;
type
SubType2 = record
Hello : string;
end;
Subtype1 = record
Hello : subtype2;
end;
Holder = record
General : subtype1;
end;
var
QC : Holder;
begin
QC.General.Hello.Hello := 'Hello';
Writeln(QC.General.Hello.Hello);
end.

g0tp0t

2010-04-29 07:56:27

ur a freaking genius!!! luv u!! lol, omfg u figured it out, this is EXACTLY what i wanted, i thought it might be available only in plugins. guess not. :P. k, ill get working on it. oh and i also have had a change of mind, im going form QC chatbot to speaking AI, once i get it written so it is easiy updated with new messages and replies i will upload it, and let the community start making the database. much faster

Gu3st...

2010-04-29 12:16:13

I would suggest you to read a basic tutorial on scripting before attempting this :)

g0tp0t

2010-04-29 12:17:37

…umm, i have, like 3 years ago, what makes u think i need, i have never seen any ref of holders…

Frement

2010-04-29 12:48:30

From: g0tp0t
…umm, i have, like 3 years ago, what makes u think i need, i have never seen any ref of holders…


Holders?

g0tp0t

2010-04-29 12:53:59

nevermind, im an idiot, i hadnt really looked a thee codeextnsivly since im in school, ofcusing on other things, lol, so its just a type in a type in a type which i didnt think you could do.

NCDS

2010-04-29 14:18:44

From: g0tp0t
nevermind, im an idiot, i hadnt really looked a thee codeextnsivly since im in school, ofcusing on other things, lol, so its just a type in a type in a type which i didnt think you could do.


No, they are 3 different types. They just call upon each other, creating the effect that you wanted.

g0tp0t

2010-04-29 14:21:35

lol, i dont think that matters but thaanks 4 the insight ^.^

marpis

2010-04-29 16:55:09

From: Boreas
You could go arrays all the way down:

var
QC: array of array of array of string;
begin
QC[0][0][0] := 'Hi';
or even

var
QC: array of array of array of string;
const
General = 0;
Hello = 0;
begin
QC[General][Hello][0] := 'Hi';
......
writeln(QC[General][Hello][random(length(QC[General][Hello]))]);


From: g0tp0t
lol, i dont think that matters but thaanks 4 the insight ^.^


This is the best way to do it. Easiest and able to be applied to loops if needed. With this method you can also do what Boreas said:
writeln(QC[General][Hello][random(length(QC[General][Hello]))]);
Which will pick a random message from the "General >> Hello" section.

i luffs yeww

2010-04-29 21:41:18

^ I concur. And what I was saying about incrementing them is that if you set QC[General] to "Hi." or something (which would be QC[0], really), you could increment General and then QC[General] would then be "Hello." or whatever QC[1] would be. ;)

g0tp0t

2010-04-29 21:56:12

when i said you cant inc text, i hadnt seen the const. lol:rolleyes:

that is a good idea, but i think i have a different aproach now, since it will be an ai sort of thing.

Basically, i will have like 60 general keywords, and another 1k that are specific to runescape. depending on the mix of what is said, alond with a check for words like 'not' and 'awesome' and others that could greatly change meaning / context of what was said. ill open it up when im mem :tongue:

EDIT: this message was sitting in quick reply box since shortly after that explanation. im slow :P

i luffs yeww

2010-04-29 22:03:35

I have a few computers I've nothing to do with. I was gonna have them just run a bunch of accounts in different worlds at popular areas where it'll just record what people say. I could set that up relatively quickly if you'd like to. It could be useful for that AI responder. To have a library of virtually everything that people say (I could constantly update it) would help. :p

g0tp0t

2010-04-30 12:20:20

okay, this is DEFINITELY the most awesome post i have ever seen, lets make a script that automatically uploads to a database i make online?? i could do it, except i have no experience interacting with databases :[. someone could help a little??

Drakan

2010-04-30 18:05:16

That seems like a really neat idea guys. I would love to see how that turns out… Let me know if you get that script done and I'll run it a bit.

Frement

2010-04-30 18:05:57

From: drags111
That seems like a really neat idea guys. I would love to see how that turns out… Let me know if you get that script done and I'll run it a bit.


Im good with php+mysql :)

g0tp0t

2010-05-03 11:56:27

OK, i definitely need frements help then, and when i'm a member this will become an open source project. the only reason it isn't open right now, is that i don't want jagex going through it and creating a detector that will find people responding the same way this script will. it could completely compromise the script. i might just be really paranoid :P

i luffs yeww

2010-05-03 21:51:34

Well I have no idea what you're talking about, but I already have things worked out with Frement, and he has the PHP done as far as I know. I've ran my script to get what people say. Returns names and what people say. I'll have the honor to go through it manually to detect responses and what not, until I figure out how to completely automate it. Frement and I were thinking about just going to a place where a couple people were talking and use that to find general ways that people respond.

Should be figured out relatively soon, and I have a few computers to run the script on virtually nonstop, as long as Frement has enough space to hold all of that information. ;)

Frement

2010-05-04 06:58:25

From: i luffs yeww
Well I have no idea what you're talking about, but I already have things worked out with Frement, and he has the PHP done as far as I know. I've ran my script to get what people say. Returns names and what people say. I'll have the honor to go through it manually to detect responses and what not, until I figure out how to completely automate it. Frement and I were thinking about just going to a place where a couple people were talking and use that to find general ways that people respond.

Should be figured out relatively soon, and I have a few computers to run the script on virtually nonstop, as long as Frement has enough space to hold all of that information. ;)


40GB should be enough :) And I will be tweaking the database viewer also when I get some more time.

g0tp0t

2010-05-04 09:58:36

aww, i wrote a script that took down everything in chat except what u put in a skip array. my laptop died though. lost it :[. ubuntu sucks that way. sometimes doesnt tell me power is low till 10 seconds b4 it dies. ty though

i luffs yeww

2010-05-04 16:56:36

Protip: Always keep it plugged in if you're working on something important, and save often. I made four versions of this that are virtually one line different each, just because I didn't want to lose my work.

Also, Frement, no need to reply to this really, but I won't be home for another few hours since I'll be at a girl's house, so just PM me/message me to tell me if I can or can't run the script to add it to the database tonight. :) Thanks.