mIRC Homepage

3 large questions. Please help. (Dialogs)

Posted By: Skylax

3 large questions. Please help. (Dialogs) - 02/12/06 01:33 AM

First of all, I've read a good portion of the mIRC help file and another intro on Dialoging that I found elsewhere on the internet before coming here to actually ask for help. I'm making a huge bot for my roleplay that has bot commands and sections for both In-character and Out-of-character....universes. (These include game scripts, countdown timers, and thesaurus/dictionary scripts ect.. Then pretty much the rest are just on join/part/text/action/input response scripts) I have a lot of questions and theres no doubt I'm going to forget to ask at least one of them. I'm not exactly asking anybody to actually put in time and effort to write me any scripts (although that would probably take less than helping me to actually understand). Then I don't learn anything, so i'd never be able write my own scripts. I'll get on with my questions before I forget them:

First question: Is there any way you can create one txt file with sections in it that can be taken and read for each script as "help". I thought mIRC had a N through N option in the $read command. For example $read(responses.txt,1-12) would read lines 1 through 12 of 'responses.txt.'.

Second Question: I'm making a huge dialog that keeps information almost in the exact same way as the built-in Address Book dialog, but has extra options such as 'Lock' buttons, which take the text youve entered into the editboxes for each part of info and turns it into Dialog text (no editbox) and centers it in the box it is in. I've tried to do a google search and yahoo search to find the actual dialog script for the actual original Address Book to figure out how to make each edited page able to be added under the specified nick in the drop-down combo box. (so that when you click on it in the combo box, the page with all the info is filled with the information inputted for that nick, exactly like the Address book.) The major difference between the mirc address book and this 'info center', is that there will be either a button or a push checkbox right next to the a button that says 'Add' (for adding nicks to the combo box). This button says 'View by: Nick' (indicating you are the individual nicknames added in the combo box), but when clicked on, the text on the button changes to 'View By:Rank'(and the entries in the combo box change to a list of each rank of our roleplay's ranks/hierachy). Im thinking about making another editbox that organizes the Ranks by each group we have. So if you selected a certain group, the entries of 'View by:Nicks' would only show the nicks of that group and most importantly the combo box entries of 'View by:Ranks' would store the nicks in each rank of the selected group. There would be two tabs, so two sets of information under the complicated combo box and 'View' button associated with it. One tab would be IC (In character) Information, and the other OOC (Out of Character) Info. They have pictures and everything. The setting of your picture on each would be the same as the mirc address book; You click/double-click in that picture space and it pulls up a browze dialog for you to set your pic. I need a way to store all this information without having all the stored data for it (that is, if it's possible -_-) to be always loaded into mirc while it's open (ex. Variable-based). I think you might be able to do this through hash files but I have no clue how to organize it all.

Third Question: ...and lastly, this would probably be the most useful. I need a script (dialog but much simpler) that would make writing 'on join/text/action/part' scripts much easier and faster. It is much simpler than the one described in question 2 so don't worry. It would have an editbox for the keyword and these would operate much the same way a google advanced search would. Checks like "Only this phrase" "Anywhere in ___" "Starting with" "Any of these words" and so on. Unlike the one above, I haven't organized this dialog visually. (In the #2 question dialog, I already have the /dialog Info{ } visual stuff pretty much down.) It'll be able to select what file in the loaded mirc remotes to write the code into, maybe in the menubar. If it can't write the scripts directly as I enter it into the dialog, I'd like it just to write it, and then I could copy and paste it into the actual remote files (Maybe there'd be a 'Script it.' Button that becomes avalible when all search criteria is entered into the editboxes. If you clicked it, it'd write the code into an editbox with scrollbars thats used to copying code from.)


If you guys have any questions at all about what I've described above, or if you want the code that i do have posted, let me know and I'll try to describe it as best I can. I understand this will take allot of patience to help me with this (I'm doubtful some of it is even possible) and I am very thankful for your help. I came here as a last resort because I'm sure you guys get bothered enough. This post doesn't include all my questions, just the important ones. Besides, i think this post is long enough. Again, thankyou so much for your help.( I'll be on nightstar.com under the nick Skylax most of the time, just incase anybody needs to help me through stuff directly or something.)
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 02/12/06 02:08 AM

Answers to your questions (to the best of my knowledge)
1) You'd have to use a loop for that, similar to this
Code:
 var %a = 1
while %a <= 12 {
.timer 1 %a msg $chan $read(responses.txt,%a)
inc %a
}
 

The . in front of the timer command makes it silent, so there would be no display showing the activation of the timer.
The timer command was added to reduce the chances of flooding the channel. It limits the display of the information to about one line per second (note this is not an exact timing)

2) Whew!!! You've got quite a project there. I'm not sure how much of the dialog you currently have completed (if any), however there's nothing that you asked for that can't be done.

mIRC dialogs do have Tab (Page) control option so that you can have different tabs (pages). The information to be entered can be set using an on text event, and then added to the dialog at that time (I would recommend running the dialog in a minimized format if that's what you want to do).
I'd be more than happy to help you with your dialog (and I've used dialogs quite a bit) either by writing it myself, or (since you obviously would like to do this yourself) looking over and dialog code that you currently have and then making modifications/suggestions to your code.

If you haven't started the dialog yet, I would like to recommend that you think about getting a copy of Dialog Studio (you can click the link to go to a location for it)

While it doesn't have all of the most up-to-date features that mIRC has available for dialogs, it does have most of the basics and I find it very handy for tyring to figure out how a dialog should look. Note; It does not write the dialog for you, but it will create the code for the dialog display.

I would recommend that you use hash tables to store the information from the dialog, or when entered, as it is the fastest way to store and retrieve information. Again, if you need more assistance with using hash tables, I'd be more than happy to review & make suggestions to any code you already have.

3) I regret to say that a dialog like that would not be the easiest, and may even not be possible. If it is possible, it would actually be more difficult than what you're asking for in question 2.

I am more than willing to stand corrected on anything that I have posted, if it can be shown that I am incorrect.

Additional information: When you do post your codes (and it would help a lot if you did so, as it would give us an idea as to what level of complexity your scripting is at), please remember to use the Code Tags around your code.
Posted By: Mardeg

Re: 3 large questions. Please help. (Dialogs) - 02/12/06 02:14 AM

for 1) You can format the text file for sections, see http://www.mircscripts.com/cgi-bin/file.php?id=311 for an example
Posted By: Riamus2

Re: 3 large questions. Please help. (Dialogs) - 02/12/06 05:35 AM

Another way for the first one is to use /play's "help" feature...

Quote:
The -t switch forces mIRC to look up the specified topic in the file and play all lines under that topic. For example:

/play -thelp1 help.txt

In the help.txt file you would have:

[help1]
line1
line2
line3
[help2]
...

mIRC will play everything after [help1] and stop when it reaches the next topic header or the end of the file.
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 03/12/06 05:47 AM

I have t say I am suprized to see 3 posts already after one day, you guys are great. grin

Thankyou so much for doing this, I didn't think anybody would put so much time into this. The code that I have for dialog two is below, what I have so far, anyway:
Code:
dialog Info {
  title "Wolf Roleplay IC/OOC Info Center"
  size -1 -1 600 629
  option pixels
  tab "IC Information (Roleplay Character)", 44, 4 90 512 307
  tab "OOC Information (Real Life)", 1
  box "IC Info (Character-Based)", 42, 16 116 468 236, tab 44
  box "OOC Info (Real-Life)", 22, 16 116 459 236, tab 1
  box "View", 2, 10 10 331 72
  combo 3, 189 24 135 70, drop
  text "Name:", 5, 44 148 32 16, tab 44 right
  text "Age:", 6, 266 146 24 18, tab 44 right
  text "Desc:", 7, 46 210 30 18, tab 44 right
  text "History:", 8, 36 258 40 18, tab 44 right
  text "Pack:", 9, 48 168 28 18, tab 44 right
  text "Rank:", 10, 46 190 30 16, tab 44 right
  edit "", 11, 76 146 186 20, tab 44
  edit "", 12, 290 146 28 20, tab 44
  edit "", 13, 76 256 242 74, tab 44 autovs multi
  edit "", 14, 76 208 242 48, tab 44 autovs multi
  edit "", 15, 76 166 242 20, tab 44
  edit "", 16, 76 188 242 20, tab 44
  text "Address:", 17, 20 188 46 16, tab 1 right
  text "Name:", 18, 34 168 32 16, tab 1 right
  text "Age:", 19, 196 146 26 16, tab 1 right
  text "Email:", 20, 36 210 30 16, tab 1 right
  text "Notes:", 21, 32 232 34 16, tab 1 right
  icon 24, 332 146 135 183, tab 44, 0 tab 44
  text "Nick:", 23, 42 146 24 16, tab 1 right
  edit "", 25, 66 144 126 20, tab 1 autohs
  edit "", 26, 66 166 182 20, tab 1 autohs
  edit "", 27, 66 186 182 20, tab 1 autohs
  edit "", 28, 66 208 182 20, tab 1 autohs
  edit "", 29, 222 144 26 20, tab 1
  edit "", 30, 66 230 242 84, tab 1 autovs multi
  icon 31, 320 144 140 172, C:\Downloads\Ryan\mefordialog.jpg, 0 tab 1
  button "Whois", 32, 250 144 58 20, tab 1
  button "Button", 33, 250 166 58 20, tab 1
  button "Chat", 34, 250 186 58 20, tab 1
  button "Email", 35, 250 208 58 20, tab 1
  button "Ok", 36, 381 396 64 26, ok
  button "Cancel", 37, 445 396 64 26, cancel
  radio "Female", 38, 393 322 54 18, tab 1
  radio "Male", 39, 331 323 54 16, tab 1
  text "85x134", 40, 344 126 38 14, tab 1
  button "Save", 41, 106 358 292 24
  button "Add", 4, 124 22 64 24
  button "View", 43, 58 22 66 24
  edit "Edit", 46, 66 319 242 20, tab 1
  text "URL:", 45, 41 320 25 17, tab 1 right
}


Ok apparently there is a problem with the dialog. I'd tried to preview it, which didn't work, so I posted the code into mirc and tried to run it. Came up with this error message:
* /dialog: 'address' error loading icon 'tab 44'

Thats the first tab, and like I said, it's not finished. I still need to put a few buttons on and organize/align things. Once we have that done, we can work on the 'brain' of the dialog. I have no idea how to do it. The reason I mentioned hash tables was because I see them in most dialogs. I've been thinking about how you could change the actual visual code with a /did command. (using the /did command to make words on the actual dialog change. Those words of course being the View by: Rank/Nick/Pack) The first thing I'd like to get working is the hard part, the View by: part and combo box modes. Basically get it to work like an empty Address book.

On Response to Question #3:
Serious?! Not possible? Eh I guess we'll cross that bridge when we get there.

On Responses to Question #1:
Thanks guys, I'll keep all the codes in a notepad file but the third one worked great, my bot-command help files are up and running. grin There is a problem, however with some of the scripts i made help files for. One of them is a simple 8-ball script for entertainment. It's just being retarded. I've gotten really frustrated with it, because it's so simple and I still can't get it to work! The codes are short (there are two different versions and they both don't work):
Code:
;Script 1
ON *:TEXT:.8ball*:#: { 
  /play $chan -r Games\ball.txt 1000
}
;Script 2
ON 1:TEXT:!8ball*:#: {
  /msg $chan 9,1 $read(Games\ball.txt)
}


The filepath is correct, I checked it. frown
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 03/12/06 07:45 AM

Regarding your 8 Ball scripts, the first one would give all of the answers in the file, at a rate of one per second. I don't think that's what you're wanting. With the second one, the only thing that I can think of is that the path is being misinterpreted.

Having a stated path of Games, and presuming you've used the default mIRC installation directory, the actual path would be something like C:\Program Files\mIRC\Games

The Games directory would be off of the installation directory for mIRC

Regarding your dialog error, you don't have a filename specified for that icon. Compare these two lines that are copied from your dialog:

Quote:
icon 24, 332 146 135 183, tab 44, 0 tab 44
icon 31, 320 144 140 172, C:\Downloads\Ryan\mefordialog.jpg, 0 tab 1


Just a suggestion, on the first radio button, use the group parameter, that way it'll be impossible for both radio buttons to be selected at the same time
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 03/12/06 07:31 PM

Good, it worked. The 8-ball script works now. Didn't know you had to put the full file directory....; didn't think it mattered. Any the dialog works now, just put a file path in and it launched.
Ok, lets get started on the coding of the View by: buttons and the combobox storage so that the dialog can store information. I'll try to do as much coding as I can without help, but it won't be much. If you have any questions at all, now's the time to ask. because I don't want to do a bunch of coding for it to not work like I wanted. So....yeah. Ask away. I want to get a good part of this done.
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 03/12/06 08:36 PM

The full path is is only required if the file or the sub-path isn't directly off of the mIRC directory. Your dialog is quite well laid out. Pay attention to the dialog commands and their formats as specified in the help file, as they are picky about getting it just right.
I suggest that you just do it a little bit at a time and get each part working, then we worry about combining everything.

If you want to use hash tables for the storage, I strongly recommend that you read up on them before starting to try to code with them.

If you're already familiar with using text files or ini files for storage, you can start doing it that way, then I can show you how you cna use hash tables with the files that you've already started.
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 03/12/06 11:17 PM

So what would you recommend I use for each part? What commands i should use to get the combo box (the first thing I want to script) to store nicks when added to the combo-editbox, like the mirc address book.... but be able to switch to a different list in the combo box with the click of a button. What commands could i use for that. and most important, how would I store that information in the hash (and retreive it for later use)?
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 04/12/06 12:44 AM

To store information in a hash table, you would use the /hadd command.

To retrieve information from a hash table, you get it, which is why the identifier for that is $hget

I didn't write this up for you, since you said you wanted to learn how to do it yourself. As I said earlier, if you want to use hash tables (and I would recommend it for this), read up on hash tables in the help file /help hash table and maybe check out a tutorial (I think there's a couple in the tutorial section of mIRC.net )
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 06/12/06 12:56 AM

Heres the code Ive typed up when Ive had time, changed the layout some and started on the brain of the dialog. What kind of stuff should I enter into the hash tables to return information into an editbox?

Code:
dialog InfoCenter {
  title "Wolf Roleplay IC/OOC Info Center"
  size -1 -1 493 409
  option pixels
  tab "IC Information (Roleplay Character)", 44, 4 90 483 277
  tab "OOC Information (Real Life)", 1
  box "", 41, 313 363 175 41
  box "Navigation", 2, 4 4 336 76
  box "", 40, 103 13 229 44
  box "IC Info (Character-Based)", 42, 16 118 458 230, tab 44
  box "OOC Info (Real-Life)", 22, 16 118 458 230, tab 1
  combo 3, 172 26 152 58, edit drop
  text "Name:", 5, 34 141 32 16, tab 44 right
  text "Age:", 6, 262 141 24 16, tab 44 right
  text "Desc:", 7, 36 204 30 16, tab 44 right
  text "History:", 8, 26 253 40 16, tab 44 right
  text "Pack:", 9, 38 162 28 16, tab 44 right
  text "Rank:", 10, 36 183 30 16, tab 44 right
  edit "", 11, 66 139 194 20, tab 44
  edit "", 12, 286 139 24 20, tab 44 limit 2
  edit "", 13, 66 249 244 73, tab 44 autovs multi
  edit "", 14, 66 202 244 46, tab 44 autovs multi
  edit "", 15, 66 160 244 20, tab 44
  edit "", 16, 66 181 244 20, tab 44
  text "Address:", 17, 20 183 46 16, tab 1 right
  text "Name:", 18, 32 162 34 16, tab 1 right
  text "Age:", 19, 198 141 26 16, tab 1 right
  text "Email:", 20, 36 204 30 16, tab 1 right
  text "Notes:", 21, 33 225 34 16, tab 1 right
  icon 24, 320 139 140 166, C:\Downloads\Ryan\skylaxdialogtest.jpg, 0 tab 44
  text "Nick:", 23, 42 141 24 16, tab 1 right
  edit "", 25, 66 139 130 20, tab 1 autohs
  edit "", 26, 66 160 182 20, tab 1 autohs
  edit "", 27, 66 181 182 20, tab 1 autohs
  edit "", 28, 66 202 182 20, tab 1 autohs
  edit "", 29, 224 139 24 20, tab 1
  edit "", 30, 66 223 244 84, tab 1 autovs multi
  icon 31, 320 139 140 166, C:\Downloads\Ryan\mefordialog.jpg, 0 tab 1
  button "Whois", 32, 248 139 62 20, tab 1
  button "Button", 33, 248 160 62 20, tab 1
  button "Chat", 34, 248 181 62 20, tab 1
  button "Email", 35, 248 202 62 20, tab 1
  button "Ok", 36, 324 374 76 22, ok
  button "Cancel", 37, 400 374 76 22, cancel
  radio "Female", 38, 390 309 58 16, tab 1
  radio "Male", 39, 340 309 46 16, tab 1
  button "Del", 4, 140 26 32 20
  button "View by: Hierarchy", 43, 20 19 81 38, multi default %Combomode
  edit "", 46, 66 308 244 20, tab 1
  text "URL:", 45, 40 310 26 16, tab 1 right
  radio "Male", 61, 340 309 46 16, tab 44
  radio "Female", 62, 390 309 58 16, tab 44
  button "Add", 68, 108 26 32 20
  box "", 69, 315 127 150 214, tab 44
  box "", 70, 315 127 151 214, tab 1
  button "", 71, 340 9 14 72, flat default
  text "''Pack Information Center'' -- Part of Helion Script [Dialogs] Dialog constructed and coded by Zephyr LeMarr.(Skylax)", 72, 17 371 279 30, center
  box "", 73, 4 360 304 45
  menu "File", 47
  item "Update Data", 52, 47
  item "Save and Close", 53, 47
  item "Exit w/o Save", 54, 47
  menu "Edit", 48
  menu "IC", 55, 48
  item "Choose Icon Picture...", 63, 55
  menu "OOC", 56, 48
  item "Choose Icon Picture...", 64, 56
  menu "View", 49
  menu "Editable Lists", 57, 49
  item "...of Ranks", 65, 57
  item "...of Packs", 66, 57
  item "...of Nicks", 67, 57
  menu "Other", 50
  item "Extras", 58, 50
  menu "Help", 51
  item "About", 59, 51
  item "Credits", 60, 51
}
;----------------------------------------
alias SetDefault {

  ComboNick
}
alias ComboNick {
  ;$hget(Combonicks,)
}
alias ComboPack {
  ;$hget()
}
alias ComboRank {
  did -a InfoCenter 3 Alpha
  did -a InfoCenter 3 Beta
  did -a InfoCenter 3 Elder
  did -a InfoCenter 3 Gamma
  did -a InfoCenter 3 Sentinal
  did -a InfoCenter 3 Hunter/Scout
  did -a InfoCenter 3 Caretaker
  did -a InfoCenter 3 Packmates
  did -a InfoCenter 3 Pups
  did -a InfoCenter 3 Omega
}
alias ComboChar {

}
alias Hidepop {
  did 
}
;-----------------------------------------
ON *:DIALOG:InfoCenter:INIT: {
  SetDefault
  Hidepop
}
ON *:DIALOG:InfoCenter:sclick:43: {
  if ( %Combomode == View by: Hierarchy ) { did -ra $dname 43 View by: Nicknames | set %Combomode View by: Nicknames | Combonick | goto end }
  elseif ( %Combomode == View by: Nicknames ) { did -ra $dname 43 View by: Characters | set %Combomode View by: Characters | ComboChar | goto end }
  elseif ( %Combomode == View by: Characters ) { did -ra $dname 43 View by: Wolfpacks | set %Combomode View by: Wolfpacks | Combopack | goto end }
  elseif ( %Combomode == View by: Wolfpacks ) { did -ra $dname 43 View by: Hierarchy | set %Combomode View by: Hierarchy | ComboRank }
  :end
}
ON *:DIALOG:InfoCenter:sclick:71: {
  did -h $dname 2
}
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 06/12/06 01:40 AM

The hash table will store what you tell it to.
Based on your code shown, it would make sense to me to store everything that is entered into an edit box.
Example:
Code:
on *:dialog:InfoCenter:sclick:36:{
.hadd -m $dname Name $did(26)
}

That would store the text from the edit box 26 into the hash table InfoCenter using Name as a reference. Please note that as above, when entering the data for a 2nd person, the information for the first person would be over-written (I'm quite sure you don't want that), so you'll need to track the number of entries made. There are a number of ways of doing this.

I also noted a mistake and some items that are just bad coding.
The mistake I found, is the missing ID parameter for the INIT event. You can use 0 or an * (wildcard) for this event.

As far as bad coding is concerned, you have multiple buttons marked as default, when you should only have one, since that one is going to be the item that is activated if the user presses the Enter/Return key on their keyboard. Usually either the OK or Cancel buttons are set for default, Cancel if you want to automatically ignore the changes, OK if you want the changes saved by default (which is part of the reason it's called default)

Below is your code with a few other changes that I made, and I think you'll like
Code:
dialog InfoCenter {
  title "Wolf Roleplay IC/OOC Info Center"
  size -1 -1 493 409
  option pixels
  tab "IC Information (Roleplay Character)", 44, 4 90 483 277
  tab "OOC Information (Real Life)", 1
  box "", 41, 313 363 175 41
  box "Navigation", 2, 4 4 336 76
  box "", 40, 103 13 229 44
  box "IC Info (Character-Based)", 42, 16 118 458 230, tab 44
  box "OOC Info (Real-Life)", 22, 16 118 458 230, tab 1
  combo 3, 172 26 152 58, edit drop
  text "Name:", 5, 34 141 32 16, tab 44 right
  text "Age:", 6, 262 141 24 16, tab 44 right
  text "Desc:", 7, 36 204 30 16, tab 44 right
  text "History:", 8, 26 253 40 16, tab 44 right
  text "Pack:", 9, 38 162 28 16, tab 44 right
  text "Rank:", 10, 36 183 30 16, tab 44 right
  edit "", 11, 66 139 194 20, tab 44
  edit "", 12, 286 139 24 20, tab 44 limit 2
  edit "", 13, 66 249 244 73, tab 44 autovs multi
  edit "", 14, 66 202 244 46, tab 44 autovs multi
  edit "", 15, 66 160 244 20, tab 44
  edit "", 16, 66 181 244 20, tab 44
  text "Address:", 17, 20 183 46 16, tab 1 right
  text "Name:", 18, 32 162 34 16, tab 1 right
  text "Age:", 19, 198 141 26 16, tab 1 right
  text "Email:", 20, 36 204 30 16, tab 1 right
  text "Notes:", 21, 33 225 34 16, tab 1 right
  icon 24, 320 139 140 166, C:\Downloads\Ryan\skylaxdialogtest.jpg, 0 tab 44
  text "Nick:", 23, 42 141 24 16, tab 1 right
  edit "", 25, 66 139 130 20, tab 1 autohs
  edit "", 26, 66 160 182 20, tab 1 autohs
  edit "", 27, 66 181 182 20, tab 1 autohs
  edit "", 28, 66 202 182 20, tab 1 autohs
  edit "", 29, 224 139 24 20, tab 1
  edit "", 30, 66 223 244 84, tab 1 autovs multi
  icon 31, 320 139 140 166, C:\Downloads\Ryan\mefordialog.jpg, 0 tab 1
  button "Whois", 32, 248 139 62 20, tab 1
  button "Button", 33, 248 160 62 20, tab 1
  button "Chat", 34, 248 181 62 20, tab 1
  button "Email", 35, 248 202 62 20, tab 1
  button "Ok", 36, 324 374 76 22, ok
  button "Cancel", 37, 400 374 76 22, cancel
  radio "Female", 38, 390 309 58 16, tab 1
  radio "Male", 39, 340 309 46 16, tab 1
  button "Del", 4, 140 26 32 20
  button "View by: Hierarchy", 43, 20 19 81 38, multi default %Combomode
  edit "", 46, 66 308 244 20, tab 1
  text "URL:", 45, 40 310 26 16, tab 1 right
  radio "Male", 61, 340 309 46 16, tab 44
  radio "Female", 62, 390 309 58 16, tab 44
  button "Add", 68, 108 26 32 20
  box "", 69, 315 127 150 214, tab 44
  box "", 70, 315 127 151 214, tab 1
  button "", 71, 340 9 14 72, flat default
  text "''Pack Information Center'' -- Part of Helion Script [Dialogs] Dialog constructed and coded by Zephyr LeMarr.(Skylax)", 72, 17 371 279 30, center
  box "", 73, 4 360 304 45
  menu "File", 47
  item "Update Data", 52, 47
  item "Save and Close", 53, 47
  item "Exit w/o Save", 54, 47
  menu "Edit", 48
  menu "IC", 55, 48
  item "Choose Icon Picture...", 63, 55
  menu "OOC", 56, 48
  item "Choose Icon Picture...", 64, 56
  menu "View", 49
  menu "Editable Lists", 57, 49
  item "...of Ranks", 65, 57
  item "...of Packs", 66, 57
  item "...of Nicks", 67, 57
  menu "Other", 50
  item "Extras", 58, 50
  menu "Help", 51
  item "About", 59, 51
  item "Credits", 60, 51
}
;----------------------------------------
menu * {
  InfoCenter : dialog $iif(!$dialog(InfoCenter),-md,-ev) InfoCenter InfoCenter
}
;-----------------------------------------
ON *:DIALOG:InfoCenter:INIT:0 {
  didtok $dname 3 32 Alpha Beta Elder Gamma Sentinal Hunter/Scout Caretaker Packmates Pups Omega
}
ON *:DIALOG:InfoCenter:sclick:43: {
  set %combomode $did(43)
  if ( %Combomode == View by: Hierarchy ) {    did -ra $dname 43 View by: Nicknames  }
  elseif ( %Combomode == View by: Nicknames ) { did -ra $dname 43 View by: Characters }
  elseif ( %Combomode == View by: Characters ) { did -ra $dname 43 View by: Wolfpacks }
  elseif ( %Combomode == View by: Wolfpacks ) { did -ra $dname 43 View by: Hierarchy }
}


There's still a lot of work to go on this, and I'll do some more later on, and post an update before I head to bed in (probably) about 8 hours.
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 06/12/06 03:40 AM

so if i use $hget to say, get the list of nicknames to list and it's editable (remember it should operate like the address book) how should i use it for that? ...and how would i use hash to store the information on the editboxes and such when you click on the name in the combo box.
I have an idea of how it might work... lets say i use /hadd to add a hash table named after the combo editbox entry <nickname> and the item on that hash table would be the info that we typed in on the editboxes where all the info goes. would that work? Im not saying you cant write any code, I'm just saying that if you do, Explain it thoroughly so that I end up being able to do it on my own. Just 'Translate it into english'. Thankyou for the code edit.
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 06/12/06 04:33 AM

If that's how you want it, I'm going to suggest that you make some changes to your dialog, for example, instead of using an edit box for the nicknames, use an editable drop-down list. That way all of the names can be stored in the drop-down list and it will still be editable for the purposes of changing, adding or deleting nicks.

I should be able to have a start for you before I go to bed tonight, or a complete version (with explanations) in 2 - 4 days.
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 06/12/06 05:50 AM

Is there any way to make it pull up a "browze" dialog? Just so i can get the rest of the menu bar done. a "Browze" or "Select File" dialog.
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 06/12/06 08:04 AM

For a select file dialog, look under /help $sfile
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 08/12/06 11:19 PM

Ok I can make it pop up in the command line by typing out the command with the parimeters and pressing tab, how do I make it launch in the script under the On Dialog event? And you can go ahead and write an example of the code that makes the added nicknames become listed in the combo box (like it works in the address book) because I've tried and fail plenty of times, I don't want to waste anymore time. -_-
Posted By: Sais

Re: 3 large questions. Please help. (Dialogs) - 11/12/06 09:25 PM

While I'm sure you're frustrated, I doubt anyone is going to want to help someone who commands them to write a script for them.
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 11/12/06 11:04 PM

To make it come up in a dialog, I would recommend using a button in the dialog (I know you already know how to do that), and then use the on dialog event, something like this
Code:
on *:dialog:<dialog_name>:sclick:<ID>:{
set %file $$sfile($mircdir,*)
}

That will pop-up the select file dialog, when the button <ID> is pressed, and then the name of the selected file (with the full path) will be stored in the variable %file when the OK button is pressed. If the Cancel button is pressed, then %file will become $null (or empty).

Regarding the rest of your query, I am working on it, but it's taking longer than I thought it would. I will post the code here as soon as I can, but I don't want to give a time frame again, just in case.
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 11/12/06 11:06 PM

I've been working with the original poster regarding the problems that he's encountering, but at no point do I see anything that indicates that he's commanding that a script be written for him, in fact, if anything, almost the opposite is true.

Reference post dated: Dec. 1 2006 @ 8:33 pm EST
Quote:
I'm not exactly asking anybody to actually put in time and effort to write me any scripts (although that would probably take less than helping me to actually understand). Then I don't learn anything, so i'd never be able write my own scripts.


and post dated: Dec. 5 2006 @ 10:40 pm EST
Quote:
Im not saying you cant write any code, I'm just saying that if you do, Explain it thoroughly so that I end up being able to do it on my own. Just 'Translate it into english'.
Posted By: Sais

Re: 3 large questions. Please help. (Dialogs) - 12/12/06 11:30 AM

I saw "And you can go ahead and write an example of the code..." which just made me stop reading any further back, and hence the comment. Perhaps I misread - or maybe it was too easy to misinterpret what was meant...apologies if that is the case.
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 13/12/06 12:13 AM

An understandable misunderstanding. The keyword, from what you quoted, in this case is "example". He's basically saying that while a full code would be nice, an example (aka pseudocode) would be acceptable (or possibly better), since that way he can learn.
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 16/12/06 12:29 AM

Yeah that's probably the best idea. I'll use the On:dialog event to trigger by clicking in the icon box area like it would on the address book. Take your time with that code, theres no rush.
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 18/01/07 01:07 AM

Done yet Russel? I kindof thought it would be done by now. ^^ Just wanted to make sure you knew I was still here. :P I need to script more...
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 18/01/07 01:36 AM

LOL...Sorry, too many projects overlapping, I honestly forgot all about this, and since you said you wanted to write it yourself, I didn't put it on my list of projects to complete. However, I will do so now, and will post as soon as I get it done (based on the rate I'm currently going through that list, about another week or two)...By all means give it a shot yourself while waiting.
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 27/01/07 01:16 AM

Yeah. Good thing I posted then. I've started on hash tables, finally. I could get the hang of it if I could just tell it to return at least something on every error message. This isn't exactly FOR the dialog, but the dialog will be able to pull from the same script. Revise as much as you like:
Code:
ON *:TEXT:+wolf*:#: { 
  if ( $2 != $null ) { 
    var %name = $2
    /hmake %name 10
    hadd -m %name Charname %name
    hadd %name Pack --
    hadd %name Rank --
    hadd %name Hist --
    hadd %name Desc --
    hadd %name Health 10
    hadd %name Hunger 10
    hadd %name Exp 0
    /msg $chan $2 added to directory.
  }
  elseif ( $2 == $null ) {
    /msg $chan Insufficient parameters: Please specify a nick to add.
  }
  else { /say $2 is already listed in the archive! }
}
On *:TEXT:-wolf*:#: {
  if ( $2 != $null ) {
    /hfree $2 
    /msg $chan $2 has been erased from the directory.
  }
  elseif ( $2 == $null ) {
    /msg $chan Insufficient parameters: Please specify a nick to wipe.
  }
}

;------------------------Bio
On *:TEXT:.bio*:#: {
  if ( $2 != $null ) { /msg $chan $hget( [ $$2 ], Hist ) }
  elseif ( $2 == $null ) { 
  } 
  /msg $chan $hget( [ $nick ], Hist ) 
}
else { /msg $chan I don't have a bio set for that wolf. }
}
On *:TEXT:+bio*:#: {
if ( $3 != $null ) { /hadd $nick $$3 | /msg $chan Your character's history has been set. Type .bio to view it. }
if ( $3 == $null ) { /msg $chan Insufficient parameters: Type in your bio!! }
}

;------------------------Description
On *:TEXT:.desc*:#: {
if ( $2 != $null ) { /msg $chan $hget( [ $$2 ], Desc ) }
elseif ( $2 == $null ) {
}
/msg $chan $hget( [ $nick ], Desc ) 
}
else { /msg $chan I don't have a description set for that wolf. }
}
On *:TEXT:+desc*:#: {
if ( $3 != $null ) { /hadd $nick Desc $$3 | /msg $chan Your character's description has been set. Type .desc to view it. }
if ( $3 == $null ) { /msg $chan Insufficient parameters: Type in your description!! }
}

;------------------------Greet


;------------------------Pack

;------------------------Rank


When you try to add something that is already there, I don't know how to make it check to see if its already there and return something like "Blah is already in the directory!!"
Posted By: DJ_Sol

Re: 3 large questions. Please help. (Dialogs) - 27/01/07 03:20 AM

Im not totally sure what you are looking for.

if ($hget(%name,Pack)) <pack is already entered.
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 01/02/07 02:01 AM

Is there anything I can use to make the script return something if a hash table or item that I need isnt found? for example, ( if == hashdoesntexist ) { msg $chan Info not found!! } ( know this isnt a real if-then-else statement.
Posted By: Riamus2

Re: 3 large questions. Please help. (Dialogs) - 01/02/07 02:08 AM

Here are multiple ways you can do it.

Code:
if (!$hget(Table,Item)) { do this }


Code:
if ($hget(Table,Item) == $null) { do this }


Code:
if ($hfind(Table,*Wildcarded item to find*,0,w) == 0) { do this }


Code:
if ($hfind(Table,*Wildcarded data to find*,0,w).data == 0) { do this }
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 16/02/07 12:46 AM

Thanks, that worked. I'm going to post my script again. I just got some of it working. The book is created, it adds a wolf at specified keyword. Like this:
[Nick]
Name=(character's name)
Hist=(character's history)
ect...

The Hash table info looks like that, right after it is saved. I've spent around two (gradual) months on this script. There is one huge problem, it seems.

Whenever I close it out, I lose all of my info in the hash tables. So I studied the help file a bt more and found that you have use hload and hsave. Though with hload you can't load it as described above, with a separate hash table for each character, you can only load items!! If I misread this, please let me know that it's not true because I sure as heck am not going to totally re-script two months' hard work unless I absolutely have to. If there is any way I can fix this without wiping the whole thing clean then please let me know.

If I did, I assume that I'd have to start using $hfind ALLOT. instead of the format above I'd use something like this:
[CharInfo]
nick.name=(character's name)
nick.hist=(character's history)
ect..

Then I'd have to use hfind to search for the name and piece of information.
Anyway's here is my script. Not much for 2 months.

Code:
ON 100:TEXT:+wolf*:#: { 
  if ( $2 != $null ) {
    if ($hget([ $2 ], status)) { msg $chan Error: $2 is already listed in the archive! }
    if ($hget([ $2 ], status) == $null ) {
      var %name = $2
      hmake %name 12
      hadd %name Status exists
      hadd %name Charname  
      hadd %name Greet      
      hadd %name Pack  
      hadd %name Rank  
      hadd %name Hist  
      hadd %name Desc  
      hadd %name Health 10
      hadd %name Hunger 10
      hadd %name Exp 0
      hadd %name Level
      msg $chan %name added to directory.
      halt
      :error
      msg $chan $2 is already listed in the directory!
    }
  }
  if ( $2 == $null ) { msg $chan Insufficient parameters: Please specify a nick to add. }
}
On 100:TEXT:-wolf*:#: {
  if ( $2 != $null ) { 
    if (!$hget([ $2 ], status)) { msg $chan Error: Wolf does not exist. } 
    if ($hget([ $2 ], status)) { hfree $2 | msg $chan $2 has been erased from the directory. }
  }
  elseif ( $2 == $null ) { msg $chan Insufficient parameters: Please specify a nick to wipe. }
}

;------------------------Bio
On *:TEXT:.bio*:#: {
  if ( $2 != $null ) { 
    if ($hget([ $$2 ], Hist )) { /msg $chan $hget( [ $$2 ], Hist ) }
    if (!$hget([ $$2 ], Hist )) { /msg $chan No biography found. }
  }
  elseif ( $2 == $null ) { 
    if ($hget( [ $nick ], Hist ) != $null ) { /msg $chan $hget( [ $nick ], Hist ) }
    if (!$hget( [ $nick ], Hist )) { /msg $chan No biography found. }
  }
  else { /msg $chan I don't have a bio set for that wolf. }
}
On *:TEXT:+bio*:#: {
  if ( $3 != $null ) { 
    if ($hget([ $2 ], status)) { hadd $2 Hist $$3- | msg $chan Your character's history has been set. Type .bio to view it. }
    if (!$hget([ $2 ], status)) { msg $chan Error: Wolf not found. }
  }
  if ( $3 == $null ) { 
    if ( $2 == $null ) { /msg $chan Insufficient parameters: Type your nick and then your character's description. ( +bio <nick> <history> ) }
    if ( $2 != $null ) { /msg $chan Insufficient parameters: Type in your character's History!! }
  }
}

;------------------------Description
On *:TEXT:.desc*:#: {
  if ( $2 != $null ) { 
    if ( $hget( [ $$2 ], Desc ) != $null ) { msg $chan $hget( [ $$2 ], Desc ) }
    if (!$hget( [ $$2 ], Desc )) && ($hget( [ $$2 ], status)) { /msg $chan I don't have a description set for that wolf. | /halt }
    if (!$hget([ $$2 ], status)) { msg $chan Error: Wolf not found. }
  }
  elseif ( $2 == $null ) {
    if ( $hget( [ $nick ], Desc ) != $null ) { msg $chan $hget( [ $nick ], Desc ) }
    if ( $hget( [ $nick ], Desc ) == $null ) { /msg $chan You have not set your character's description!! }
  }
}
On *:TEXT:+desc*:#: {
  if ( $3 != $null ) { 
    if ($hget([ $2 ], status)) { hadd $2 Desc $$3- | msg $chan Your character's description has been set. Type .desc to view it. }
    if (!$hget([ $2 ], status)) { msg $chan Error: Wolf not found. }
  }
  if ( $3 == $null ) { 
    if ( $2 == $null ) { /msg $chan Insufficient parameters: Type your nick and your character's description. ( +desc <nick> $&
      <description> ) Note: If it is too long it will cut. }
    if ( $2 != $null ) { /msg $chan Insufficient parameters: Type in your description!! }
  }
}
;-------------------------Name
On *:TEXT:+name*:[%channel.SB.OOC]: {
  if ( $3 != $null ) { 
    if ( [$hget([ $nick ], status)]) { hadd $nick $3-6 | msg $chan You set your character's name to $ }
    if ([!$hget([ $nick ], status)]) { msg $chan Error: Wolf not found. }  
  } 
  if ( $3 == $null ) {
    if ( $2 == $null ) { msg $chan Insufficient parameters: Type your nick and your character's (full) name. ( +greet <nick> <name> ) }
    if ( $2 != $null ) { msg $chan Insufficient parameters: Type in your character's full name. }
  }
}

;------------------------Greet
;[%channel.SB.OOC]
On *:TEXT:+greet*:#Moonhaven: {
  if ( $3 != $null ) { 
    if ( [$hget([$$2], status)] != $null ) { hadd $$2 Greet $$3- | msg $chan Your greet has been set. It will play each time you enter the main channel. }
    if ([!$hget([$$2], status)]) { msg $chan Error: Wolf not found. }  
  } 
  if ( $3 == $null ) {
    if ( $2 == $null ) { msg $chan Insufficient parameters: Type your nick and greeting. ( +greet <nick> <greeting> ) }
    if ( $2 != $null ) { msg $chan Insufficient parameters: Type in your greeting! }
    :error
    msg $chan Error: Wolf not found.
  }
}
;%channel.greeting
On 1:JOIN:#Moonhaven: { 
  if ([$hget([$nick], Greet) != $null ) { msg $chan [ $hget([ $nick ], Greet) ] }
}
;------------------------Pack
/*
On 100:TEXT:+pack*:#: {
  if ( $2-3 != $null ) && ( $hget( [ $$2 ], Pack ) != $null ) { tochan Pack changed from: $hget( [ $$2 ], Pack ) to $$3, | hadd $$2 Pack $$3 }
  elseif ( $2-3 == $null ) && ( $hget( [ $2 ], Pack ) == $null ) { tochan Pack set: $$3 | hadd $$2 Pack $$2 }
  elseif ( $2 == $null ) { tochan Insufficient parameters: please specify wolf and wolfpack. }
  elseif ( $3 == $null ) { tochan Insufficient parameters: Please specify a wolfpack. }
  elsif 
  :error
  tochan Wolf not found in directory, please add with +wolf.
}
*/
On 1000:TEXT:+pack*:#: {
  if ( $3 != $null ) { 
    if ( $hget([ $3 ], Status )) {
      if ( $hget([ $2 ], Pack )) { 
        hadd $2 Pack $3-4
      msg $chan $2's has been booted from the [ $hget([ $2 ], Pack ) ] Pack and put in the $3 Wolfpack, with default rank packmate. Type .info to view it. }
      if (!$hget([ $2 ], Pack )) { 
        hadd $2 Pack $3-4 
      msg $chan $2's has entered the $3 Wolfpack with default rank packmate. Type .info to view it. }
    }
    if (!$hget([ $2 ], Status)) { msg $chan Error: Wolf not found. | /halt }
    if (!$hget([ $3 ], Status)) { 
      var %pack = $3
      hmake %pack 15
      hadd %pack Status exists
      hadd %pack Alpha --
      hadd %pack Beta  
      hadd %pack Elder  
      hadd %pack Gaurdian  
      hadd %pack Gamma  
      hadd %pack Sentinal  
      hadd %pack Hunter/Scout  
      hadd %pack Packmate  
      hadd %pack Pup  
      hadd %pack Omega  
      hadd %pack Honoredguest  
      hadd %pack Assessment  
      hadd %pack Pledge  
      msg $chan A new pack has been created. The %pack Wolfpack.
    }
  }
  if ( $3 == $null ) { 
    if ( $2 == $null ) { /msg $chan Insufficient parameters: Type the nickname and the character's pack. ( +desc <nick> <pack name> ) }
    if ( $2 != $null ) { /msg $chan Insufficient parameters: Type in the pack name. }
  }
}

On *:TEXT:?pack*:#: { tochan +pack: Used for setting a wolf's pack. Format: ( +pack <wolf> <pack> ) }
;------------------------List Members
On *:TEXT:.list*:[%channel.SB.OOC]: {
  if ($2) {
    $hfind 
  }
}
;------------------------Rank
On 100:TEXT:+rank*:#: {
  if ( $3 != $null ) { 
    if ($hget([ $2 ], * )) { hadd $2 rank $$3- | msg $chan $2's rank has been set. Type .info to view it. }
    if (!$hget([ $2 ], * )) { msg $chan Error: Wolf not found. }
  }
  if ( $3 == $null ) { 
    if ( $2 == $null ) { /msg $chan Insufficient parameters: Type the nickname and the character's rank. ( +desc <nick> <rank> ) }
    if ( $2 != $null ) { /msg $chan Insufficient parameters: Type in the rank. ( Alpha : Beta : Elder : Gaurdian : Gamma : Sentinal : Hunter/Scout : Packmate : Pup : Omega ) }
  }
}
;
;------------------------Info
On *:TEXT:.Info:#: {

}
;Skylax Blacktail, Packmate of Sweetbreeze:(Hunger: 10) (Energy: 20) (Health: 10) (Rests: 0) (Exp: 32)
;------------------------Name



The script you said you'd work on would be very much appreciated but not required, Russel. Heh, I used to think this roleplay was stupid, now it opened me up to a new hobby. Thanks for your help guys. : D
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 16/02/07 03:51 AM

The method of saving your hash table information is to use the /hsave command (and /hload to load it up next time)

These are well documented in the help file, and noting that the format is similar to that of an ini file, I would like to recommend that you read up on those commands, as they have a -i switch, which makes the information stored compatable with the ini file format.

Sorry I didn't get back to you sooner on this, but I had some problems with my phone line, which affected my internet, as I use a DSL connection.

I'm glad to see that you put a lot of effort into this, and your posts have answered a few questions that I was going to post...now to incorporate that information with what I already had.
Posted By: Riamus2

Re: 3 large questions. Please help. (Dialogs) - 16/02/07 02:33 PM

I don't have time to go through it all right now, but if you use /hsave, then use /hload, it will load it exactly as it was before.

Assuming you have data in a hash table called Table:

/hsave Table table.hsh
/hfree Table
/hmake Table 10
/hload Table table.hsh

... then you'll have the exact same table as you had originally.

As for hash tables, remember that it's formatted as ITEM = DATA. That means that you'd want to do like you suggested and do nick.name, nick.hist, etc. for your items, OR use multiple hash tables...

Table: Name
Item: Nick
Data: Nick's Name

Table: Hist
Item: Nick
Data: Nick's Hist

etc.

Having multiple tables will help to make using them much easier. And if you're just getting info on a specific person, you can use $hget instead of $hfind.

$hget(Name,nick)
$hget(Hist,nick)

Etc.
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 18/02/07 04:50 AM

....so you're saying that I can run my script, and when I use hsave to save all my stuff:

[Nick]
Desc = (chardesc)
Name = (charname)
[Nick2]
Desc2 = (chardesc2)
Name2 = (charname2)

...ect

I can then close the window, and when I open it again and use hload to load the exact same thing. Multiple tables? If I cant do it with just those commands, how can I make it so it does. I might need around 30 of these little group things, hash tables, and I REALLY don't want to alter the script I've made.


Posted By: DJ_Sol

Re: 3 large questions. Please help. (Dialogs) - 18/02/07 07:47 AM

To answer your question, YES. But!!
Thats how an ini file is saved. The way you have it layed out.

A hash table works with 3 pieces of information. The table name first. What you call the data you are saving and the data. Look at it as:

a hash table has slots to save data in. You name each slot what you want so you can pull up the information later. Say I save the time someone joins a room. I could name the table j#Channel. I would name the slot after the nickname who joined and make the data the time. So now I have a table named j $+ $chan and I can easily see what time $nick joined.

on *:join:#:/hadd j $+ $chan $nick $asctime(HH:nnoo)

Now if I want to retrieve the info I use $hget. $hget(j $+ $chan,$nick) would return the time $nick joined $chan.

So for your layout, you have two pieces of information per nickname. You don't want to create a new hash table for each name. They use up your RAM. Instead I personally would save your information under the nickname and seperate the two pieces of info by a space so you can use $gettok to retrieve it.

Table named TEST.
/hadd test $nick (chardesc) (charname)
This saves (chardesc) (charname) under the $nick line of the test hash table.
$hget(test,$nick) == (chardesc) (charname)
$gettok($hget(test,$nick),1,32) == (chardesc)
$gettok($hget(text,$nick),2,32) == (charname)

I h ope this helps you plan your hash table better. smile
Posted By: Riamus2

Re: 3 large questions. Please help. (Dialogs) - 18/02/07 10:31 PM

You can save a hash table in an ini format, but that's really not necessary since you're working with it in mIRC and so it doesn't matter how it's saved. I would just save each table whenever you change the table and then load all tables when you start mIRC (on START).
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 18/02/07 10:42 PM

Cool. So I will have to re-script it, though not all of it...So how would easily be able to replace each piece of information? some of them are a few sentences long while others are only a few numbers. Whats the easiest way to be able to overwrite each piece of data:
(charname) (chardesc) ----> (charname) (chardesc2)
Would have to set the the number of words (parameters) for each peice? Geez, this is getting complicated. -_-
Posted By: RusselB

Re: 3 large questions. Please help. (Dialogs) - 19/02/07 12:18 AM

When you store the data for a hash table item, if the item already exists, then the data for that item is overwritten by the newest entry.
Eg: /hadd Table Name Description stores the description for the specified name in the Table
/hadd Table Name Description2 will overwrite the first Description with the second description
/hadd Table Name Description3 will overwrite the 2nd Description with the 3rd Description.

If any of the descriptions match the previous description, then you won't notice a change, although the information will have changed.

Note that Table and Name (in my above examples) are case-insensitive
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 19/02/07 02:05 AM

Yes, I read all that in the help file, though I don't think thats what he means. I have some ideas for this, since I'm having trouble understanding some of the approaches you guys have mentioned.
Idea 1:
I re-script it so that It creates an item for each piece of information, prefixed with the nickname of that user. Then I use $hfind with a wildcard of some sort to find it and that's how I'll use it.
Idea 2:
I leave most of the script as it is, making a separate file for each user/nick because of the hash tables, I really don't know how I'd do this but it's more of a last resort. smirk
Idea 3:
I leave nearly all of the current script as it is, and follow Riamus's idea, saving the file after the file is modified. I think this would be the shortest once I figure it out.
Idea 4:
Modify it to have tokens, which I'll have to read about and understand first.

Hmm. I'm going to try the 3rd first, since I'm closest. I might have over 30 tables that could have as many as 15 items each. I appreciate all your help and advice. Thanks.
Posted By: Riamus2

Re: 3 large questions. Please help. (Dialogs) - 19/02/07 02:11 PM

You can have multiple tokens in a hash table's data if you want. I think that's what you're talking about in your previous example. Then, you'd just use $gettok or /tokenize to help you access the correct token.

As for your first idea, you shouldn't need $hfind unless you're searching the DATA for information and you don't know the nick. As long as you know the nick, you can easily use $hget to get the data and it's faster.

For the second idea, I would not suggest editing the files manually unless you're sure you are formatting them properly or else the /hload may fail and you could have problems.

For the third idea, it won't be a problem having multiple tables. I'm running almost 200 tables right now at all times. You just need to keep track of them. You *can* get it all into a single table, but that will require a little more work and you'd probably want to have your ITEM names include what would normally be the table name.
Posted By: Skylax

Re: 3 large questions. Please help. (Dialogs) - 09/04/07 10:59 PM

Ok ive started up on it again. Went to loading the script and scripting the load sequence since that one of the most important parts. I believe it's scripted fine,
Code:
on *:START:{
  if ($isfile($scriptdir $+ Stats.hsh) == $true) {
    hmake Beaststats
    hload Beaststats Stats.hsh
  }
}

but i get this error message...
* /hload: unable to open 'C:\Downloads\Zephyr\Bot\mIRC\Wolves.hsh'

I used to be able to fix that by changing the path so that there were no spaces, but i guess it doesn't work anymore?
Posted By: Riamus2

Re: 3 large questions. Please help. (Dialogs) - 09/04/07 11:24 PM

Code:
on *:START:{
  if ($isfile($scriptdir\Stats.hsh) == $true) {
    hmake Beaststats
    hload Beaststats $qt($scriptdir\Stats.hsh)
  }
}


You weren't loading from the $scriptdir. Also, there's no need for $+ after $scriptdir/$mircdir/$inidir/$logdir. And the $qt will allow you to have spaces if you want them.

I would recommend putting a value in when creating the table, however. Typically the value is 10% of what you expect the hash table's size to be. So if you expect it to have 1000 items, you'd use:

hmake BeastStats 100

This will help to improve performance (at least slightly).
© 2021 mIRC Discussion Forums