home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


Some CubeScript questions

by Papriko on 01/12/2011 18:19, 21 messages, last message: 03/06/2011 18:42, 3692 views, last view: 04/28/2024 17:14

Well, my questions are simple:
If I create a list, lets say
x = [1 2 3 4 5]
how do I find certain values in it, how do I add new and how to remove them? If it helps: for now I am going to use only numbers.

What I also wanted to know: is there a way to let a script "watch" the chat and only react on certain keywords? If yes how? And can I/it also determine who said it (local message via echo, actual chat, teamćhat, server broadcast, etc...)?

I already thank everybody in advance for answering!

Go to first 20 messagesGo to previous 20 messages    Board Index   

#2: ..

by Papriko on 01/13/2011 17:36

Yep, works perfectly, thanks. I am even understanding what\'s done there.
Now I can do a little more again with my scripts. I was planing something where I need a list as \"mastervalue\" to handle a bunch of others...

reply to this message

#3: i think...

by |ice|sub-zero|L on 01/15/2011 05:36

it may be possible if you make a small server mod which reacts to certain commands, say someone decided to use a "vulgar" word, it can say "mrblank said a vulgar word, and as punishment he is to muted for a full hour"

however as for cubescript, i don't think so unless you made yourself a "bot" in a way. (look in quadropolis.us for the "auto sorry script" that makes you say sorry when you frag a teamate)

CS is pretty powerful, i just don't know if that is possible unless you either make a server mod or are in the server at the time.

reply to this message

#4: ..

by Papriko on 01/15/2011 17:01

Yes, I saw the auto-sorry-script before and directly downloaded it. Sadly it is not listening to the chat or something like that. It is just permanently comparing your score with the total kills you made or something like that.

reply to this message

#5: ..

by srbs on 01/18/2011 23:25

fyi papriko, you can use:
(listdel <list> <list of items to remove>)

reply to this message

#7: ..

by Papriko on 01/26/2011 17:52

Okay, new question: does SB only have lists, or are arrays supported too?

reply to this message

#8: Re: ..

by Razgriz on 01/26/2011 21:23, refers to #7

is there much of a difference between the two? >_>

reply to this message

#9: Re: ..

by srbs on 01/26/2011 23:31, refers to #8

Razgriz: omg yes there is.
Papriko: No arrays, cubescript only has lists.

reply to this message

#10: ..

by Papriko on 01/27/2011 19:07

I had another idea to the arrays: For example if I wanted a 5*5 "array", could I take 5 lists where each has 5 objects and stick those in some kind of master-list? Example:

listA = [1 2 3 4 5]
listB = [5 4 3 2 1]
listC = [6 6 6 6 6]
listD = [0 1 0 1 0]
listE = [9 8 7 6 5]
Masterlist = [listA listB listC listD listE]

reply to this message

#11: Re: ..

by Razgriz on 01/27/2011 21:05, refers to #10

masterlist = (concat $listA $listB ..) ?

reply to this message

#12: ..

by Papriko on 01/27/2011 22:11

Naw, I mean it so:
echo Masterlist
listA listB listC listD listE

By your code do I get this:
echo Masterlist
1 2 3 4 5 5 4 3 2 ...

So I could nest the looplist command for example. Inside the looplist for the master one, is another looplist command which runs over listA to listE, that was the plan.

reply to this message

#13: Re: ..

by srbs on 01/28/2011 04:26, refers to #12

So, if you want to do that, what is your question?
(fyi, yes you can do that)

reply to this message

#14: sandbox

by Hirato Kirata on 01/28/2011 13:01

I did write up some stuff for cubescript lists in sandbox's wiki; you may find it useful

http://sandboxgamemaker.com/wiki/index.php?title=Cubescript#Lists

reply to this message

#15: Re: sandbox

by Razgriz on 01/28/2011 15:17, refers to #14

maybe we should refrain from the fact that "some" parts of this are outdated or do not apply in sauer? i did spot a couple of them.

reply to this message

#16: ..

by Papriko on 01/28/2011 17:08

@ srbs: My question was if that, what I said in my last post, is actually possible. I wanted to run a looplist-command inside a looplist-command, but in order to do that I need some lists inside the list. Question now: CAN I stack them in each like that?

reply to this message

#17: Re: ..

by srbs on 01/28/2011 19:01, refers to #16

@Papriko: yup
looplist i $masterlist [
looplist j (getalias $i) [
echo $j
]
]

@Hirato: Yeah, either prettylist has changed significantly in sandbox, or you have no idea what it does.

reply to this message

#18: Re: ..

by SheeEttin on 01/28/2011 19:30, refers to #16

Yes, I think so. Something like:

loop i (listlen Masterlist) [looplist (at Masterlist i)]

...where looplist is your function.

You could also do it recursively, but you'd need something to tell whether something was a list-element or a data-element.

reply to this message

#19: Re: ..

by SheeEttin on 01/28/2011 19:33, refers to #18

Hah wow. 29-minute ninja. (My excuse: the dog wanted its walk.)
I'll also take this opportunity to correct a mistake I made: that last "i" should be "$i".

Also, Razgriz: It's a wiki, you're free to correct it. :P

reply to this message

#20: Re: ..

by Razgriz on 01/29/2011 11:10

@SheeEtin: not much point in correcting a wiki of a game i don't play, regardless of its activity state :P

@Papriko: what srbs said.

forgot to post this last night, heh

reply to this message

#21: Severs on a mac

by seb1010 on 02/25/2011 15:33

How to create a server on mac? I saw how one makes on Windows but I cannot how make on mac.

reply to this message

#22: Re: Severs on a mac

by |ice|sub-zero|L on 03/06/2011 18:42, refers to #21

two things: 1. this is a thread for cubescript, not making servers. (and there are a million of them, just check older posts) and if you can't get any service here, go to the IRC chat: webchat.quakenet.org get a nick name, and then in the channel put #sauerbraten

2. there are examples everywhere in the docs, in the server-init.cfg, ect ect. just look around.

reply to this message

Go to first 20 messagesGo to previous 20 messages    Board Index   


Unvalidated accounts can only reply to the 'Permanent Threads' section!


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
53868905 visitors requested 71644088 pages
page created in 0.021 seconds using 10 queries
hosted by Boost Digital