Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-19-2003, 11:19 PM
SaijinGohan SaijinGohan is offline
Registered User
SaijinGohan's Avatar
Join Date: Jul 2001
Location: U.S.A - Ohio
Posts: 536
SaijinGohan is on a distinguished road
Send a message via AIM to SaijinGohan Send a message via MSN to SaijinGohan
Strings

Ok I have been working diligently to create a Mailbox system for the Bravo Online playerhouses. I have EVERYTHING working great. But there is one thing I have come across which I knew would be a problem. So heres what I have come up with:
Suppose I have a message 30 characters long. Now lets say graal can only hold 10 per line in a say2. I can get how many lines I need by dividing 30 by 10. I get 3. Right? Right. Now this paragraph is in a string. How am I going to get a #b after every 10 characters for every line until maxlines (3) - 1. The last part is to keep an extra #b after the last line in a message.

If this were a variable I could do it, but I do not operate well with strings. Anyone have an idea?
__________________

Job: A Legend

And you think that you have played Graal forever? Ha!
Reply With Quote
  #2  
Old 09-20-2003, 04:35 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Just loop through and insert them in before say2-ing it. I'm pretty sure that works now.
__________________
Reply With Quote
  #3  
Old 09-20-2003, 05:08 AM
Goboom Goboom is offline
Pixel Monkey
Goboom's Avatar
Join Date: Dec 2001
Location: Michigan
Posts: 1,702
Goboom is on a distinguished road
Send a message via ICQ to Goboom Send a message via AIM to Goboom Send a message via MSN to Goboom Send a message via Yahoo to Goboom
Quote:
Originally posted by Kaimetsu
Just loop through and insert them in before say2-ing it. I'm pretty sure that works now.
If he listens to you and does it this way I am going to beat him like the red-headed step child he is. I already told him to do it this way.
__________________
Reply With Quote
  #4  
Old 09-20-2003, 05:37 AM
SaijinGohan SaijinGohan is offline
Registered User
SaijinGohan's Avatar
Join Date: Jul 2001
Location: U.S.A - Ohio
Posts: 536
SaijinGohan is on a distinguished road
Send a message via AIM to SaijinGohan Send a message via MSN to SaijinGohan
so I gotta work with the strings before hand.


so

NPC Code:

setstring thiso.umessage,blahblahblahblah;
this.chars = strlen(thiso.umessage);
this.loops = int(this.chars/10);
for (a=0;a<this.loops;a++) {
//insert #b stuff here?
}



I think this is how it should go but the problem is getting the #b into the string. I've been looking around and trying several different things but I can only think of setting a new string for every 10 chars. Inefficient I think.
__________________

Job: A Legend

And you think that you have played Graal forever? Ha!
Reply With Quote
  #5  
Old 09-20-2003, 07:54 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
all in one string? use #e(startindex,length,string) for the previous part of the string being examined, and another for the end, then setstring string,#s(partstr1) #b #s(partstr2)

Ah, the power of strings...


[Edit] Note: my syntax is probably wrong
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #6  
Old 09-20-2003, 08:00 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
v3 provides a few new options for this kind of thing, but currently #e is probably your best bet.
__________________
Reply With Quote
  #7  
Old 09-20-2003, 08:24 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
couldn't he use wraptext?

or am I missing something.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #8  
Old 09-20-2003, 08:57 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by adam
am I missing something.
Yes.
__________________
Reply With Quote
  #9  
Old 09-20-2003, 05:08 PM
SaijinGohan SaijinGohan is offline
Registered User
SaijinGohan's Avatar
Join Date: Jul 2001
Location: U.S.A - Ohio
Posts: 536
SaijinGohan is on a distinguished road
Send a message via AIM to SaijinGohan Send a message via MSN to SaijinGohan
Ok so I'll just #e the token and add #b where needed. Thx!
__________________

Job: A Legend

And you think that you have played Graal forever? Ha!
Reply With Quote
  #10  
Old 09-20-2003, 06:54 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by Kaimetsu


Yes.
Why isn't

NPC Code:

// NPC made by Rogue Shadow

if (playertouchsme) {
wraptext 25,,#c;
setstring temp,;
for (i=0;i<tokenscount;i++)setstring temp,#s(temp)#t(i)#b;
say2 #s(temp)#b;
}



What he is looking for? This way it won't break up words?
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #11  
Old 09-20-2003, 08:47 PM
SaijinGohan SaijinGohan is offline
Registered User
SaijinGohan's Avatar
Join Date: Jul 2001
Location: U.S.A - Ohio
Posts: 536
SaijinGohan is on a distinguished road
Send a message via AIM to SaijinGohan Send a message via MSN to SaijinGohan
Wow thats working but its not breaking it up. That #b causes every word to be on a new line. I dunno if its something faulty withe code or what but perhaps because I am running the script serverside? Its a class.
__________________

Job: A Legend

And you think that you have played Graal forever? Ha!
Reply With Quote
  #12  
Old 09-20-2003, 09:38 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by SaijinGohan
Wow thats working but its not breaking it up. That #b causes every word to be on a new line. I dunno if its something faulty withe code or what but perhaps because I am running the script serverside? Its a class.
what is causing every word to be on a new lline? Show some code?
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #13  
Old 09-20-2003, 10:18 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
he copy and pasted, that's bad
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #14  
Old 09-21-2003, 08:25 PM
SaijinGohan SaijinGohan is offline
Registered User
SaijinGohan's Avatar
Join Date: Jul 2001
Location: U.S.A - Ohio
Posts: 536
SaijinGohan is on a distinguished road
Send a message via AIM to SaijinGohan Send a message via MSN to SaijinGohan
Well since my other post disappeared. -.-

NPC Code:
for (i=0;i<tokenscount;i++)setstring temp,#s(temp)#t(i)#b;



That #b is causing each word to be on a new line. :/ I don't think the wraptext is working. Maybe because it's serverside or does that not matter with wraptext?
__________________

Job: A Legend

And you think that you have played Graal forever? Ha!
Reply With Quote
  #15  
Old 09-21-2003, 08:31 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Maybe there would be an easier way if we knew how this script was made. Maybe you should try to use string lists in some sort of way...
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:13 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.