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 06-24-2003, 04:14 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
Question Trouble With Strlen()

im sorry i havent posted code in a while..
plz help meh X_x



if (created) {
timeout=0.05;
}
if (timeout) {
timeout=0.05;
setstring message2,This is NOT a Test;
showimg 2,@@b@#s(client.message2),screenwidth-strlen(message2)*8,screenheight-21;
changeimgvis 2,4;
}

I need it to be kinda like the little thing on GK that says you know "you avatar of govannon atmoizes Glok Lord"
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
Reply With Quote
  #2  
Old 06-24-2003, 04:20 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
1) Strlen takes a string, not the name of a string. Currently it's returning the length of 'message2'.
2) Use a this.string for temp stuff.
__________________
Reply With Quote
  #3  
Old 06-24-2003, 04:24 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
what would i use to get the length of "this is NOT a test" then?
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
Reply With Quote
  #4  
Old 06-24-2003, 04:48 AM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Use a for loop. What you need to do is get the strlen of the string's value (this is NOT a test), not just the length of the string name.
Reply With Quote
  #5  
Old 06-24-2003, 04:54 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
a for loop?

how would the script look then?
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
Reply With Quote
  #6  
Old 06-24-2003, 05:01 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
I don't know why protagonist is talking about loops. Anyway:

#s() converts string names into strings.
__________________
Reply With Quote
  #7  
Old 06-24-2003, 05:04 AM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Everybody always tells me to do for loops .


I would do something like for(i=0;i<strlen(#s(message2));i++) type thing.
Reply With Quote
  #8  
Old 06-24-2003, 05:09 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 protagonist
I would do something like for(i=0;i<strlen(#s(message2));i++) type thing.
...for what purpose?
__________________
Reply With Quote
  #9  
Old 06-24-2003, 05:11 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
X_x

strlen(#s(client.message2))

would be the length of "this is NOT a test" then?
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
Reply With Quote
  #10  
Old 06-24-2003, 05:21 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
strlen(#s(message2))
Reply With Quote
  #11  
Old 06-24-2003, 05:24 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
woo! alright i got it working now... i feel good now that stefan posted in my thread thanks for the help guys
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
Reply With Quote
  #12  
Old 06-24-2003, 05:25 AM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Quote:
Originally posted by Kaimetsu


...for what purpose?

Ugh, sorry, that would just give i the the value of the length of message2.

Quote:
Originally posted by Stefan
strlen(#s(message2))
Whoa, you are awake late.
Reply With Quote
  #13  
Old 06-24-2003, 05:32 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
Quote:
Originally posted by protagonist

Whoa, you are awake late.
yea stefan's crazy like that...



now i gotta figure out the right number to multiply it by.. X_x

and i think capital letters will screw that up
Edit : Yep... having lower case letters numbers and capital letters changes everything... now im gonna have to check the string for caps, numbers, and lowercase letters X_x
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
Reply With Quote
  #14  
Old 06-29-2003, 08:02 AM
Tseng Tseng is offline
Sublime
Tseng's Avatar
Join Date: Jan 2003
Location: California
Posts: 0
Tseng is on a distinguished road
Quote:
Originally posted by protagonist
Everybody always tells me to do for loops .


I would do something like for(i=0;i<strlen(#s(message2));i++) type thing.
Uh. Do you even know what you're talking about?

Do you even know what the guy's trying to do?

He's trying to use strlen to return a value.

Using a for loop does not help him learn to use strlen.

And the fact that everyone else tells you to do for loops has absolutely nothing to do with this situation. Sorry, just had to complain about that.

Anyway, as for your problem wonderboy, align your showimg text to the right instead of the left perhaps? Then you need not worry about strlen at all, really.
__________________
Funny Things:
Quote:
Originally posted by Stefan
I didn't ban you, I only played a little bit with my RC.
-----
Reply With Quote
  #15  
Old 06-29-2003, 09:38 AM
wonderboysp2p wonderboysp2p is offline
Registered User
wonderboysp2p's Avatar
Join Date: Sep 2002
Location: -Wonderboy
Posts: 537
wonderboysp2p is on a distinguished road
Send a message via AIM to wonderboysp2p
omg i can just Align it?????
__________________

we are the llama FORUms!!!EWQ Ce13d5423f23!! 2e1 @$6tgv3uy65!
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 05:03 AM.


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