Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
4 registered members (NewbieZorro, Grant, TipmyPip, AndrewAMD), 13,346 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
execute() and str_cat are returning errors #176155
01/03/08 06:40
01/03/08 06:40
Joined: Jun 2004
Posts: 12
cweth Offline OP
Newbie
cweth  Offline OP
Newbie

Joined: Jun 2004
Posts: 12
i am trying to make the bmap property of my panel be something different depending on the number at index[0] of an array. So i'm trying to create the string
bmap = item4500_bmap;
and make it execute inside of the panel definition.

Code:
 
var itemMerchSlot1[13] = [6200, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0];


string executeTestString = "bmap = item";
string item_num;
str_for_num(item_num,itemMerchSlot1[0]);
str_cat(executeTestString, item_num);
str_cat(executeTestString, "_bmap;");


PANEL merch_slot1_pan
{
pos_x = 200;
pos_y = 200;
layer = 2;
execute(executeTestString);
digits (30, 35, 2, _a4font, 1, slot2_var[1]);
on_click = slot_click_func;
flags = refresh, d3d;
}



the errors i get are...


< str_for_num(item_num,itemMerchSlot1[0]);>
merchant.wdl 9:0 Error(29): Keyword unknown str_for_num

< str_cat(executeTestString, item_num);>
merchant.wdl 10:0 Error(29): Keyword unknown str_cat

< str_cat(executeTestString, "_bmap;");>
merchant.wdl 11:0 Error(29): Keyword unknown str_cat

< execute(executeTestString);>
merchant.wdl 19:0 Error(212): Keyword unknown merch_slot1_pan execute

< }>
merchant.wdl 23:-1 Error(0): Syntax error - merch_slot1_pan

Re: execute() and str_cat are returning errors [Re: cweth] #176156
01/03/08 08:07
01/03/08 08:07
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
you have to put the str_for_num and str_cat lines in a function, else it eill indeed give you that error... that's the only thing i can think of, since i use that kind of code all the time, and it does work properly for me.
give it a try

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: execute() and str_cat are returning errors [Re: Helghast] #176157
01/04/08 01:05
01/04/08 01:05
Joined: Jun 2004
Posts: 12
cweth Offline OP
Newbie
cweth  Offline OP
Newbie

Joined: Jun 2004
Posts: 12
ok, there are no more errors being generated now; however, the panel bmap is not able to switch to the item4500_bmap

is there something wrong with the code:

merch_slot1_pan.bmap = item4500_bmap;

when item4500 is declared prior to this code, but in another file.

Last edited by cweth; 01/04/08 01:38.
Re: execute() and str_cat are returning errors [Re: cweth] #176158
01/05/08 02:31
01/05/08 02:31
Joined: Jun 2004
Posts: 12
cweth Offline OP
Newbie
cweth  Offline OP
Newbie

Joined: Jun 2004
Posts: 12
ok there's nothing wrong with the assignment statement, but the str_cat isn't generating the string properly. I'll run a test to see what string is being generated exactly.

Re: execute() and str_cat are returning errors [Re: cweth] #176159
01/05/08 02:54
01/05/08 02:54
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
I think the problem lies here:
string item_num;

if you declare it like this, item_num now is an empty string with 0 places to put characters in. This means that if you want to add text to it, the text is simply discarted because there is no place.

string item_num = "#5";

This however gives you a string with room for 5 characters. If you now put something in it (in your case, str_for_num puts something in it), the text is not discarted anymore because there is room for it. The first 5 characters of your text will now be displayed. Anything longer than 5 characters will still be cut off.

Last edited by Joozey; 01/05/08 02:55.

Click and join the 3dgs irc community!
Room: #3dgs
Re: execute() and str_cat are returning errors [Re: Joozey] #176160
01/05/08 04:15
01/05/08 04:15
Joined: Jun 2004
Posts: 12
cweth Offline OP
Newbie
cweth  Offline OP
Newbie

Joined: Jun 2004
Posts: 12
ok that was indeed the situation.
I also had to make room in the executeTestSTring string in order to have it stop truncating there as well, and then i had to use the str_cpy for the first bit of text. if i tried using the str_cat, i got a bunch of beeping, and some freezing of the system.
here's my final code.

Code:



var itemMerchSlot1[13] = [4500, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0];
string executeTestString = "#40";
string item_num = "#5";

//panel for the merchant test

PANEL merch_slot1_pan
{
pos_x = 200;
pos_y = 200;
layer = 2;
bmap = empty_slot;
digits(205, 37, item_num, _a4font, 1, itemMerchSlot1[0] );
on_click = slot_click_func;
flags = refresh, d3d, VISIBLE;
}
////////////////////////////////////////



function makeSlot1()
{
str_cpy(executeTestString, "merch_slot1_pan.bmap = item");
str_for_num(item_num, itemMerchSlot1[0]);
str_cat(executeTestString, item_num);
str_cat(executeTestString, "_bmap;");
execute(executeTestString);
}



thanks for you help both of you.

Last edited by cweth; 01/05/08 04:16.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1