combining strings

Code Snippet:

setstring player.equip.rh.id,1; this.filename = itemicon_+#s(player.equip.rh.id)+.gif;

that should set the variable this.filename as string “itemicon_1.gif” why is it failing?

this.filename is a variable, vars are read as numbers.
As for how to fix it… no clue.
Try something else.
Like another string.
Or something.

When you label a variable as this.filename, GS1 interprets this as a number. Thefore all you need to do is set a string called this.filename instead:
setstring this.filename,itemicon_#s(player.equip.rh.id).gif;

GS1 is pretty ancient so who knows what kind of hacks had to be done to get things to work…

well I got it saved in a string now with

setstring player.equip.rh.iconfile,itemicon_#v(player.equip.rh.id).gif;

unfortunately the following gives a syntax error when clicking “Test”

 showimg 414,this.guix+17,this.guiy+153,#v(player.equip.rh.iconfile);

does showimg refuse to take a string for filename?!?

uhhhhhhhhhhhhhhhhhhhhhhhhhhh
I thought showimg was index,image,x,y; where image can be anything from text to variables to whatever.

LMFAO fail! yeah thanks works great now

What you’re trying to do now is convert a string into a number, when in actual fact you still want it to be a string.
The general rule is #v is used to display numbers as strings and #s is used to display strings as strings.

ya that was a typo lol I got it working :slight_smile:

looks at keyboard

tha fuck is a typo

vars can’t hold string. wrong data type. convert the string into a number using #v i think and then you can store it.

You should have elaborate on this because it’s confusing at first. For those who don’t know there’s a function called strtofloat, so what you want to do is convert
your string by doing the following.

setstring this.aFewNumbers,123243;
this.someVar = strtofloat(#s(this.aFewNumbers));

you’d only need to use #v in cases where you want to take the strings number value and manipulate it, for example:

setstring this.numbers,32132;
setstring this.aNewNumber,#v(strtofloat(#s(this.numbers))+123);

What we’re doing here is setting a string called this.numbers, then making a new string called this.aNewNumbers and adding 123 to it from the this.numbers string.

I know this has been covered several times but information’s a hassle to dig up, especially for something so specific.

Also someone should unstick alexs scripting guide, it’s utter shit.